Merge branch 'master_test_gn' of http://60.1.1.230/backend/jieling_server into master_test_gn
commit
308f406daa
|
@ -34,8 +34,10 @@ import com.ljsd.jieling.logic.dao.*;
|
||||||
import com.ljsd.jieling.logic.dao.root.User;
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
import com.ljsd.jieling.logic.fight.*;
|
import com.ljsd.jieling.logic.fight.*;
|
||||||
import com.ljsd.jieling.logic.fight.result.FightResult;
|
import com.ljsd.jieling.logic.fight.result.FightResult;
|
||||||
|
import com.ljsd.jieling.logic.hardStage.HardStageLogic;
|
||||||
import com.ljsd.jieling.logic.hero.HeroAttributeEnum;
|
import com.ljsd.jieling.logic.hero.HeroAttributeEnum;
|
||||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||||
|
import com.ljsd.jieling.logic.hero.HongMengAttributeEnum;
|
||||||
import com.ljsd.jieling.logic.item.ItemLogic;
|
import com.ljsd.jieling.logic.item.ItemLogic;
|
||||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||||
import com.ljsd.jieling.logic.player.PlayerLogic;
|
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||||
|
@ -112,6 +114,7 @@ public class MapLogic {
|
||||||
public AbstractMap getMap(int mapTypeId) throws Exception {
|
public AbstractMap getMap(int mapTypeId) throws Exception {
|
||||||
return MapEnum.getToAbstractMap(mapTypeId);
|
return MapEnum.getToAbstractMap(mapTypeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AbstractMap getMap(User user) throws Exception {
|
public AbstractMap getMap(User user) throws Exception {
|
||||||
int curMapType = user.getMapManager().getCurMapType();
|
int curMapType = user.getMapManager().getCurMapType();
|
||||||
if (curMapType == 0) {
|
if (curMapType == 0) {
|
||||||
|
@ -361,7 +364,6 @@ public class MapLogic {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param teamId
|
* @param teamId
|
||||||
* @param uid
|
* @param uid
|
||||||
* @param user
|
* @param user
|
||||||
|
@ -730,6 +732,7 @@ public class MapLogic {
|
||||||
LOGGER.info("the uid+{},the lastXy={}", uid, lastXY);
|
LOGGER.info("the uid+{},the lastXy={}", uid, lastXY);
|
||||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), mapUpdateResponse.build(), true);
|
MessageUtil.sendMessage(session, 1, messageType.getNumber(), mapUpdateResponse.build(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Set<Integer> getOpenCells(int mapId, List<Integer> cells) {
|
private Set<Integer> getOpenCells(int mapId, List<Integer> cells) {
|
||||||
int square = 3;//范围是3
|
int square = 3;//范围是3
|
||||||
Set<Integer> openCells = new HashSet<>();
|
Set<Integer> openCells = new HashSet<>();
|
||||||
|
@ -1273,9 +1276,9 @@ public class MapLogic {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 快速战斗
|
* 快速战斗
|
||||||
*
|
* <p>
|
||||||
// * @param session
|
* // * @param session
|
||||||
// * @param messageType
|
* // * @param messageType
|
||||||
*/
|
*/
|
||||||
// public void fastFight(ISession session, MessageTypeProto.MessageType messageType) throws Exception {
|
// public void fastFight(ISession session, MessageTypeProto.MessageType messageType) throws Exception {
|
||||||
// int uid = session.getUid();
|
// int uid = session.getUid();
|
||||||
|
@ -1707,8 +1710,6 @@ public class MapLogic {
|
||||||
// }
|
// }
|
||||||
// MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightEndResponse.build(), true);
|
// MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightEndResponse.build(), true);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
public void initMapMission(MapManager mapManager) {
|
public void initMapMission(MapManager mapManager) {
|
||||||
int mapId = mapManager.getCurMapId();
|
int mapId = mapManager.getCurMapId();
|
||||||
if (mapManager.getCopyMissionProgresById(mapId) != null) {
|
if (mapManager.getCopyMissionProgresById(mapId) != null) {
|
||||||
|
@ -2058,7 +2059,6 @@ public class MapLogic {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取所有关卡信息
|
* 获取所有关卡信息
|
||||||
*
|
*
|
||||||
|
@ -2077,8 +2077,6 @@ public class MapLogic {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新关卡战斗
|
* 新关卡战斗
|
||||||
*/
|
*/
|
||||||
|
@ -2092,8 +2090,7 @@ public class MapLogic {
|
||||||
if (mineFightId != fightId) {
|
if (mineFightId != fightId) {
|
||||||
LOGGER.info("startMainLevelFight==> uid={},fightId={}, levelDifficulty is not allow ", uid, fightId);
|
LOGGER.info("startMainLevelFight==> uid={},fightId={}, levelDifficulty is not allow ", uid, fightId);
|
||||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||||
}
|
} else if (mainLevelManager.getState() != 1) {
|
||||||
else if (mainLevelManager.getState()!=1){
|
|
||||||
// 动态匹配最新的表数据
|
// 动态匹配最新的表数据
|
||||||
if (sMainLevelConfig != null && sMainLevelConfig.getNextLevel() != -1 && user.getPlayerInfoManager().getLevel() >= sMainLevelConfig.getLevelLimit()) {
|
if (sMainLevelConfig != null && sMainLevelConfig.getNextLevel() != -1 && user.getPlayerInfoManager().getLevel() >= sMainLevelConfig.getLevelLimit()) {
|
||||||
mainLevelManager.setState(1);
|
mainLevelManager.setState(1);
|
||||||
|
@ -2102,6 +2099,11 @@ public class MapLogic {
|
||||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
boolean isOpenRule = CheckFigthLevelOpen(user, sMainLevelConfig.getOpenRule());
|
||||||
|
if (!isOpenRule) {
|
||||||
|
LOGGER.info("startMainLevelFight==> uid={},fightId={}, levelDifficulty is not allow ", uid, fightId);
|
||||||
|
throw new ErrorCodeException(ErrorCode.HANDLE_FAILED);
|
||||||
|
}
|
||||||
|
|
||||||
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
||||||
if (teamPosHeroInfos == null || teamPosHeroInfos.size() == 0) {
|
if (teamPosHeroInfos == null || teamPosHeroInfos.size() == 0) {
|
||||||
|
@ -2123,6 +2125,85 @@ public class MapLogic {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检测附加关卡解锁条件
|
||||||
|
* 0:无限制
|
||||||
|
* 1:山河星数(3-20后)
|
||||||
|
* 2:心魔层数(3-10后)
|
||||||
|
* 3:鸿蒙阵等级(6-15后)
|
||||||
|
* 4:指定星级(运算星级)装备数量(初始可用)
|
||||||
|
* 5:英雄总好感度等级(5-10后)
|
||||||
|
* 7:达到指定英雄等级及数量
|
||||||
|
*
|
||||||
|
* @param user
|
||||||
|
* @param openRule
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
private boolean CheckFigthLevelOpen(User user, int[][] openRule) throws Exception {
|
||||||
|
boolean isOpen = true;
|
||||||
|
for (int[] ints : openRule) {
|
||||||
|
int type = ints[0];
|
||||||
|
if (type == 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
switch (type) {
|
||||||
|
case 1: {
|
||||||
|
if (HardStageLogic.getHardStageStarsSum(user) < ints[1]) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 2: {
|
||||||
|
if (user.getMapManager().getLastMonsterAttack() - 1 < ints[1]) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 3: {
|
||||||
|
HongMengAddAttribute hongMengAddAttribute = user.getHeroManager().getResonanceAddition().get(HongMengAttributeEnum.LEVEL);
|
||||||
|
if (hongMengAddAttribute == null || hongMengAddAttribute.value < ints[1]) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 4: {
|
||||||
|
int num = 0;
|
||||||
|
Map<Integer, SEquipConfig> equipConfig = STableManager.getConfig(SEquipConfig.class);
|
||||||
|
for (Map.Entry<Integer, Long> entry : user.getItemManager().getEquipBookMap().entrySet()) {
|
||||||
|
if (equipConfig.get(entry.getKey()).getStar() >= ints[1]) {
|
||||||
|
num++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (num < ints[2]) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 5: {
|
||||||
|
if (user.getHeroManager().GetAllLikableLv() < ints[1]) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 7: {
|
||||||
|
int num = 0;
|
||||||
|
for (Map.Entry<String, Hero> stringHeroEntry : user.getHeroManager().getHeroMap().entrySet()) {
|
||||||
|
if (stringHeroEntry.getValue().getOriginalLevel()>= ints[1]) {
|
||||||
|
num++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (num < ints[2]) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return isOpen;
|
||||||
|
}
|
||||||
|
|
||||||
public void endMainLevelFight(ISession session, String frames, int fightId, MessageTypeProto.MessageType messageType) throws Exception {
|
public void endMainLevelFight(ISession session, String frames, int fightId, MessageTypeProto.MessageType messageType) throws Exception {
|
||||||
int uid = session.getUid();
|
int uid = session.getUid();
|
||||||
User user = UserManager.getUser(uid);
|
User user = UserManager.getUser(uid);
|
||||||
|
@ -2219,7 +2300,6 @@ public class MapLogic {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 兽潮开始战斗
|
* 兽潮开始战斗
|
||||||
*
|
*
|
||||||
|
@ -2343,8 +2423,6 @@ public class MapLogic {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void gmCrossFight(int uid, int arrayMapId) throws Exception {
|
public void gmCrossFight(int uid, int arrayMapId) throws Exception {
|
||||||
User user = UserManager.getUser(uid);
|
User user = UserManager.getUser(uid);
|
||||||
if (user == null || user.getMapManager() == null) {
|
if (user == null || user.getMapManager() == null) {
|
||||||
|
@ -2383,7 +2461,6 @@ public class MapLogic {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void clearNormalMonster(User user) throws Exception {
|
public void clearNormalMonster(User user) throws Exception {
|
||||||
LOGGER.info("删除当前地图小怪!!");
|
LOGGER.info("删除当前地图小怪!!");
|
||||||
Map<Integer, MapPointConfig> configMap = MapPointConfig.scMapEventMap;
|
Map<Integer, MapPointConfig> configMap = MapPointConfig.scMapEventMap;
|
||||||
|
@ -2403,8 +2480,10 @@ public class MapLogic {
|
||||||
int[] x = Arrays.stream(destoryCell.toArray(new Integer[destoryCell.size()])).mapToInt(Integer::valueOf).toArray();
|
int[] x = Arrays.stream(destoryCell.toArray(new Integer[destoryCell.size()])).mapToInt(Integer::valueOf).toArray();
|
||||||
BehaviorUtil.destoryPoints(user, x);
|
BehaviorUtil.destoryPoints(user, x);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 爬塔使用Buff
|
* 爬塔使用Buff
|
||||||
|
*
|
||||||
* @param session
|
* @param session
|
||||||
* @param messageType
|
* @param messageType
|
||||||
*/
|
*/
|
||||||
|
@ -2531,6 +2610,7 @@ public class MapLogic {
|
||||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), FbStarRewardResponse.build(), true);
|
MessageUtil.sendMessage(session, 1, messageType.getNumber(), FbStarRewardResponse.build(), true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void recordDifficultMap(ISession session, int fbId, int difficultyId, MessageTypeProto.MessageType messageType) throws Exception {
|
public void recordDifficultMap(ISession session, int fbId, int difficultyId, MessageTypeProto.MessageType messageType) throws Exception {
|
||||||
MapManager mapManager = UserManager.getUser(session.getUid()).getMapManager();
|
MapManager mapManager = UserManager.getUser(session.getUid()).getMapManager();
|
||||||
|
|
||||||
|
@ -2543,6 +2623,7 @@ public class MapLogic {
|
||||||
}
|
}
|
||||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), null, true);
|
MessageUtil.sendMessage(session, 1, messageType.getNumber(), null, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//GM调用
|
//GM调用
|
||||||
public void setTower(int uid, int towerNumber) throws Exception {
|
public void setTower(int uid, int towerNumber) throws Exception {
|
||||||
UserManager.getUser(uid).getMapManager().setTrialFloor(towerNumber);
|
UserManager.getUser(uid).getMapManager().setTrialFloor(towerNumber);
|
||||||
|
@ -2550,6 +2631,7 @@ public class MapLogic {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 领取试炼小怪奖励
|
* 领取试炼小怪奖励
|
||||||
|
*
|
||||||
* @param session
|
* @param session
|
||||||
* @param
|
* @param
|
||||||
* @param messageType
|
* @param messageType
|
||||||
|
@ -2576,6 +2658,7 @@ public class MapLogic {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 使用回春散
|
* 使用回春散
|
||||||
|
*
|
||||||
* @param session
|
* @param session
|
||||||
* @param heroId
|
* @param heroId
|
||||||
* @param messageType
|
* @param messageType
|
||||||
|
@ -2629,6 +2712,7 @@ public class MapLogic {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取无尽副本英雄信息
|
* 获取无尽副本英雄信息
|
||||||
|
*
|
||||||
* @param session
|
* @param session
|
||||||
* @param messageType
|
* @param messageType
|
||||||
*/
|
*/
|
||||||
|
@ -2700,6 +2784,7 @@ public class MapLogic {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 无尽副本复位
|
* 无尽副本复位
|
||||||
|
*
|
||||||
* @param session
|
* @param session
|
||||||
* @param messageType
|
* @param messageType
|
||||||
*/
|
*/
|
||||||
|
@ -2727,6 +2812,7 @@ public class MapLogic {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 无尽副本设置标记
|
* 无尽副本设置标记
|
||||||
|
*
|
||||||
* @param session
|
* @param session
|
||||||
* @param cellId
|
* @param cellId
|
||||||
* @param content
|
* @param content
|
||||||
|
@ -2764,6 +2850,7 @@ public class MapLogic {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 刷新获取行动力
|
* 刷新获取行动力
|
||||||
|
*
|
||||||
* @param session
|
* @param session
|
||||||
* @param messageType
|
* @param messageType
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
|
@ -2776,6 +2863,7 @@ public class MapLogic {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取出图统计数据
|
* 获取出图统计数据
|
||||||
|
*
|
||||||
* @param session
|
* @param session
|
||||||
* @param messageType
|
* @param messageType
|
||||||
*/
|
*/
|
||||||
|
@ -2792,6 +2880,7 @@ public class MapLogic {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 无尽副本复活消耗行动力
|
* 无尽副本复活消耗行动力
|
||||||
|
*
|
||||||
* @param user
|
* @param user
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
|
@ -2819,6 +2908,7 @@ public class MapLogic {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 清理无尽副本道具
|
* 清理无尽副本道具
|
||||||
|
*
|
||||||
* @param uid
|
* @param uid
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
|
@ -2828,6 +2918,7 @@ public class MapLogic {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 无尽副本小地图信息
|
* 无尽副本小地图信息
|
||||||
|
*
|
||||||
* @param session
|
* @param session
|
||||||
* @param messageType
|
* @param messageType
|
||||||
*/
|
*/
|
||||||
|
@ -2902,8 +2993,10 @@ public class MapLogic {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 无尽副本赛季更换,用户信息清除
|
* 无尽副本赛季更换,用户信息清除
|
||||||
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public void resetEndlessInfo() throws Exception {
|
public void resetEndlessInfo() throws Exception {
|
||||||
|
@ -2915,8 +3008,10 @@ public class MapLogic {
|
||||||
clearEndLessDrop(entry.getValue().getUid());
|
clearEndLessDrop(entry.getValue().getUid());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 无尽副本赛季更换,用户信息清除
|
* 无尽副本赛季更换,用户信息清除
|
||||||
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public void resetTrialInfo() throws Exception {
|
public void resetTrialInfo() throws Exception {
|
||||||
|
@ -2935,6 +3030,7 @@ public class MapLogic {
|
||||||
// resetMapInfo(user,false);
|
// resetMapInfo(user,false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void trialClear(ISession session) throws Exception {
|
public void trialClear(ISession session) throws Exception {
|
||||||
User user = UserManager.getUser(session.getUid());
|
User user = UserManager.getUser(session.getUid());
|
||||||
MapManager mapManager = user.getMapManager();
|
MapManager mapManager = user.getMapManager();
|
||||||
|
@ -2994,6 +3090,7 @@ public class MapLogic {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置无尽副本是否跳过战斗
|
* 设置无尽副本是否跳过战斗
|
||||||
|
*
|
||||||
* @param session
|
* @param session
|
||||||
* @param type
|
* @param type
|
||||||
* @param messageType
|
* @param messageType
|
||||||
|
@ -3089,7 +3186,6 @@ public class MapLogic {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PVEFightEvent pveFightEvent = new PVEFightEvent(user.getId(), TeamEnum.FORMATION_NORMAL.getTeamId(), 1000, "", GameFightType.DailyChallenge, sDailyChallengeConfig.getMonsterId(), 3);
|
PVEFightEvent pveFightEvent = new PVEFightEvent(user.getId(), TeamEnum.FORMATION_NORMAL.getTeamId(), 1000, "", GameFightType.DailyChallenge, sDailyChallengeConfig.getMonsterId(), 3);
|
||||||
FightResult fightResult = FightDispatcher.dispatcher(pveFightEvent);
|
FightResult fightResult = FightDispatcher.dispatcher(pveFightEvent);
|
||||||
CommonProto.FightData fightData = CommonProto.FightData.newBuilder()
|
CommonProto.FightData fightData = CommonProto.FightData.newBuilder()
|
||||||
|
@ -3137,6 +3233,7 @@ public class MapLogic {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 试炼副本保存阵容
|
* 试炼副本保存阵容
|
||||||
|
*
|
||||||
* @param session
|
* @param session
|
||||||
* @param heroes
|
* @param heroes
|
||||||
* @param messageType
|
* @param messageType
|
||||||
|
@ -3200,6 +3297,7 @@ public class MapLogic {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取宝箱
|
* 获取宝箱
|
||||||
|
*
|
||||||
* @param session
|
* @param session
|
||||||
* @param messageType
|
* @param messageType
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
|
@ -3226,6 +3324,7 @@ public class MapLogic {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 内部调用,根据不同层数进行获取宝箱
|
* 内部调用,根据不同层数进行获取宝箱
|
||||||
|
*
|
||||||
* @param boxPosition
|
* @param boxPosition
|
||||||
* @param boxReward
|
* @param boxReward
|
||||||
* @param user
|
* @param user
|
||||||
|
@ -3322,6 +3421,7 @@ public class MapLogic {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 小游戏更新操作
|
* 小游戏更新操作
|
||||||
|
*
|
||||||
* @param session
|
* @param session
|
||||||
* @param index
|
* @param index
|
||||||
* @param messageType
|
* @param messageType
|
||||||
|
@ -3373,6 +3473,7 @@ public class MapLogic {
|
||||||
groupId = levelDifficult.getMonsterId()[position];
|
groupId = levelDifficult.getMonsterId()[position];
|
||||||
return groupId;
|
return groupId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getDifficultReward(int rewardId, int level, int mapId) {
|
public int getDifficultReward(int rewardId, int level, int mapId) {
|
||||||
Map<Integer, Map<Integer, Integer>> mapDifficult = SEndlessDifficulty.mapDifficult;
|
Map<Integer, Map<Integer, Integer>> mapDifficult = SEndlessDifficulty.mapDifficult;
|
||||||
Map<Integer, Integer> levelMap = mapDifficult.get(mapId);
|
Map<Integer, Integer> levelMap = mapDifficult.get(mapId);
|
||||||
|
@ -3396,6 +3497,7 @@ public class MapLogic {
|
||||||
|
|
||||||
return rewardId;
|
return rewardId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getAllEndlessTreasureInfo(ISession session, MessageTypeProto.MessageType messageType) throws Exception {
|
public void getAllEndlessTreasureInfo(ISession session, MessageTypeProto.MessageType messageType) throws Exception {
|
||||||
int uid = session.getUid();
|
int uid = session.getUid();
|
||||||
User user = UserManager.getUser(uid);
|
User user = UserManager.getUser(uid);
|
||||||
|
@ -3409,6 +3511,7 @@ public class MapLogic {
|
||||||
|
|
||||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), response.build(), true);
|
MessageUtil.sendMessage(session, 1, messageType.getNumber(), response.build(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MapInfoProto.EndlessTreasureInfoResponse.Builder getEndlessResponseBuilder(EndlessTreasureReward worldTreasureReward) {
|
public MapInfoProto.EndlessTreasureInfoResponse.Builder getEndlessResponseBuilder(EndlessTreasureReward worldTreasureReward) {
|
||||||
MapInfoProto.EndlessTreasureInfoResponse.Builder response = MapInfoProto.EndlessTreasureInfoResponse.newBuilder();
|
MapInfoProto.EndlessTreasureInfoResponse.Builder response = MapInfoProto.EndlessTreasureInfoResponse.newBuilder();
|
||||||
// if(worldTreasureReward.getFirstStartTime()!=0&&worldTreasureReward.getFirstStartTime()<=TimeUtils.nowInt()&&worldTreasureReward.getCreateTime()>TimeUtils.now()/1000){
|
// if(worldTreasureReward.getFirstStartTime()!=0&&worldTreasureReward.getFirstStartTime()<=TimeUtils.nowInt()&&worldTreasureReward.getCreateTime()>TimeUtils.now()/1000){
|
||||||
|
|
|
@ -11,7 +11,7 @@ import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hj
|
* @author hj
|
||||||
* gm,扶持功能
|
* 公会boss层数 命令:guildboss 角色id 层数id
|
||||||
*/
|
*/
|
||||||
public class Cmd_guildboss extends GmRoleAbstract {
|
public class Cmd_guildboss extends GmRoleAbstract {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -16,10 +16,7 @@ import com.ljsd.jieling.logic.activity.UserLevelEventHandler;
|
||||||
import com.ljsd.jieling.logic.activity.activityLogic.WeekCardLogic;
|
import com.ljsd.jieling.logic.activity.activityLogic.WeekCardLogic;
|
||||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||||
import com.ljsd.jieling.logic.activity.event.SuperBoxEvent;
|
import com.ljsd.jieling.logic.activity.event.SuperBoxEvent;
|
||||||
import com.ljsd.jieling.logic.activity.eventhandler.ActivityStateChangeHandler;
|
import com.ljsd.jieling.logic.activity.eventhandler.*;
|
||||||
import com.ljsd.jieling.logic.activity.eventhandler.BuyGoodsDirectHandler;
|
|
||||||
import com.ljsd.jieling.logic.activity.eventhandler.GuildForceChangeEventHandler;
|
|
||||||
import com.ljsd.jieling.logic.activity.eventhandler.ShanHeSheJiTuEventHandler;
|
|
||||||
import com.ljsd.jieling.logic.activity.fourChallenge.FourChallengeLogic;
|
import com.ljsd.jieling.logic.activity.fourChallenge.FourChallengeLogic;
|
||||||
import com.ljsd.jieling.logic.arena.ArenaLogic;
|
import com.ljsd.jieling.logic.arena.ArenaLogic;
|
||||||
import com.ljsd.jieling.logic.championship.ChampionshipLogic;
|
import com.ljsd.jieling.logic.championship.ChampionshipLogic;
|
||||||
|
@ -297,6 +294,7 @@ public class GlobalDataManaager implements IManager {
|
||||||
new ActivityStateChangeHandler();
|
new ActivityStateChangeHandler();
|
||||||
new GuildForceChangeEventHandler();
|
new GuildForceChangeEventHandler();
|
||||||
new ShanHeSheJiTuEventHandler();
|
new ShanHeSheJiTuEventHandler();
|
||||||
|
new SummonTreasureHandler();
|
||||||
ChampionshipLogic.minuteCheck(true);
|
ChampionshipLogic.minuteCheck(true);
|
||||||
GuildFightLogic.minuteCheckForCarFight();
|
GuildFightLogic.minuteCheckForCarFight();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -680,8 +680,9 @@ public class ActivityLogic implements IEventHandler{
|
||||||
}
|
}
|
||||||
} else if (openRuleType == 3) {
|
} else if (openRuleType == 3) {
|
||||||
state = ActivityType.UNOPEN_STATE;
|
state = ActivityType.UNOPEN_STATE;
|
||||||
|
} else if (openRuleType == 4) {
|
||||||
|
state = ActivityType.UNOPEN_STATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
@ -943,12 +944,12 @@ public class ActivityLogic implements IEventHandler{
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getBlessActivityId(User user){
|
private int getBlessActivityId(User user){
|
||||||
Map<Integer, ActivityMission> activityMissionMap = user.getActivityManager().getActivityMissionMap();
|
// Map<Integer, ActivityMission> activityMissionMap = user.getActivityManager().getActivityMissionMap();
|
||||||
for(Integer activityId:activityMissionMap.keySet()){
|
// for(Integer activityId:activityMissionMap.keySet()){
|
||||||
if(SGlobalActivity.getsGlobalActivityMap().get(activityId).getType()==ActivityType.BLESSACTIVITY){
|
// if(SGlobalActivity.getsGlobalActivityMap().get(activityId).getType()==ActivityType.BLESSACTIVITY){
|
||||||
return activityId;
|
// return activityId;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -26,7 +26,8 @@ public interface ActivityType {
|
||||||
int RechargeTotal = 5; //首充
|
int RechargeTotal = 5; //首充
|
||||||
// int RechargeTotal = 5; //累计充值
|
// int RechargeTotal = 5; //累计充值
|
||||||
int GrowthFund = 6; //成长基金
|
int GrowthFund = 6; //成长基金
|
||||||
int BLESSACTIVITY = 7;//云梦祈福
|
// int BLESSACTIVITY = 7;//云梦祈福(跟策划对过,活动已删除)
|
||||||
|
int SUMMON_TREASURE = 7;//招募秘宝
|
||||||
int TREASURE = 8; //青龙秘宝(孙龙的宝藏)
|
int TREASURE = 8; //青龙秘宝(孙龙的宝藏)
|
||||||
int LUCKYCAT = 9;//招財貓
|
int LUCKYCAT = 9;//招財貓
|
||||||
int SERVERHAPPY = 10; //七日狂欢
|
int SERVERHAPPY = 10; //七日狂欢
|
||||||
|
|
|
@ -14,7 +14,7 @@ public enum ActivityTypeEnum {
|
||||||
FIRSTRECHARGE(ActivityType.RechargeTotal, RechargeTotalActivity::new),
|
FIRSTRECHARGE(ActivityType.RechargeTotal, RechargeTotalActivity::new),
|
||||||
// RECHARGETOTAL(ActivityType.RechargeTotal, RechargeTotalActivity::new),
|
// RECHARGETOTAL(ActivityType.RechargeTotal, RechargeTotalActivity::new),
|
||||||
GROWTHFUND(ActivityType.GrowthFund, GrowthFundActivity::new),
|
GROWTHFUND(ActivityType.GrowthFund, GrowthFundActivity::new),
|
||||||
BLESSACTIVITY(ActivityType.BLESSACTIVITY, BlessActivity::new),
|
// BLESSACTIVITY(ActivityType.BLESSACTIVITY, BlessActivity::new),
|
||||||
TREASUREACTIVITY(ActivityType.TREASURE, TreasureActivity::new),
|
TREASUREACTIVITY(ActivityType.TREASURE, TreasureActivity::new),
|
||||||
LUCKYCAT(ActivityType.LUCKYCAT, LuckyCatActivity::new),
|
LUCKYCAT(ActivityType.LUCKYCAT, LuckyCatActivity::new),
|
||||||
SERVERHAPPY(ActivityType.SERVERHAPPY, DefaultEmptyActivity::new),
|
SERVERHAPPY(ActivityType.SERVERHAPPY, DefaultEmptyActivity::new),
|
||||||
|
@ -94,6 +94,7 @@ public enum ActivityTypeEnum {
|
||||||
TRANSFORMATION_DRAW_CARD(ActivityType.TRANSFORMATION_DRAW_CARD,DefaultEmptyActivity::new),//方寸寻宝
|
TRANSFORMATION_DRAW_CARD(ActivityType.TRANSFORMATION_DRAW_CARD,DefaultEmptyActivity::new),//方寸寻宝
|
||||||
CONTINUOUS_GIFT_NEW(ActivityType.CONTINUOUS_GIFT_NEW,ContinuousGiftActivity::new),//新连续礼包
|
CONTINUOUS_GIFT_NEW(ActivityType.CONTINUOUS_GIFT_NEW,ContinuousGiftActivity::new),//新连续礼包
|
||||||
ARENA_RANK_EXPERIMENT(ActivityType.ARENA_RANK_EXPERIMENT,ArenaRankActivity::new),//竞技试炼
|
ARENA_RANK_EXPERIMENT(ActivityType.ARENA_RANK_EXPERIMENT,ArenaRankActivity::new),//竞技试炼
|
||||||
|
SUMMON_TREASURE(ActivityType.SUMMON_TREASURE,SummonTreasureActivity::new),//招募秘宝
|
||||||
;
|
;
|
||||||
|
|
||||||
private int type;
|
private int type;
|
||||||
|
|
|
@ -0,0 +1,163 @@
|
||||||
|
package com.ljsd.jieling.logic.activity;
|
||||||
|
|
||||||
|
import com.ljsd.jieling.exception.ErrorCode;
|
||||||
|
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||||
|
import com.ljsd.jieling.globals.BIReason;
|
||||||
|
import com.ljsd.jieling.jbean.ActivityMission;
|
||||||
|
import com.ljsd.jieling.jbean.ActivityProgressInfo;
|
||||||
|
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||||
|
import com.ljsd.jieling.logic.activity.event.*;
|
||||||
|
import com.ljsd.jieling.logic.dao.UserManager;
|
||||||
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
|
import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
|
||||||
|
import com.ljsd.jieling.logic.store.newRechargeInfo.PushRechargeType;
|
||||||
|
import com.ljsd.jieling.logic.store.newRechargeInfo.bean.ReceiveWelfareBag;
|
||||||
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
|
import com.ljsd.jieling.util.ItemUtil;
|
||||||
|
import com.ljsd.jieling.util.MessageUtil;
|
||||||
|
import config.*;
|
||||||
|
import manager.STableManager;
|
||||||
|
import rpc.protocols.CommonProto;
|
||||||
|
import rpc.protocols.PlayerInfoProto;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
class SummonTreasureActivity extends AbstractActivity {
|
||||||
|
|
||||||
|
public SummonTreasureActivity(int id) {
|
||||||
|
super(id);
|
||||||
|
Poster.getPoster().listenEvent(this, SummonTreasureActivityEvent.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initActivity(User user) throws Exception {
|
||||||
|
ActivityMission mission = new ActivityMission();
|
||||||
|
// 初始化阶段奖励
|
||||||
|
ActivityLogic.getInstance().initOtherMission(mission, new ArrayList<>());
|
||||||
|
user.getActivityManager().getActivityMissionMap().put(id, mission);
|
||||||
|
LOGGER.info("招募秘宝初始化..."+id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(IEvent event) throws Exception {
|
||||||
|
if (!(event instanceof SummonTreasureActivityEvent)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
SummonTreasureActivityEvent event1 = (SummonTreasureActivityEvent) event;
|
||||||
|
//动态控制购买数量
|
||||||
|
User user = UserManager.getUser(event1.getUid());
|
||||||
|
// 客户端推送
|
||||||
|
ActivityMission mission = user.getActivityManager().getActivityMissionMap().get(id);
|
||||||
|
if (mission != null){
|
||||||
|
Poster.getPoster().dispatchEvent(new ActivityStateChangeEvent(user.getId(),id,mission.getActivityState()));
|
||||||
|
// 推送客户端数据
|
||||||
|
ISession session = OnlineUserManager.getSessionByUid(user.getId());
|
||||||
|
mission.setV(user.getPlayerInfoManager().getGetFiveStarHeroNum());
|
||||||
|
sendActivityProgress(session, mission, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean takeReward(ISession session, int missionId) throws Exception {
|
||||||
|
User user = UserManager.getUser(session.getUid());
|
||||||
|
//checkAndUpdate cfg
|
||||||
|
SSummonTreasure treasure = STableManager.getConfig(SSummonTreasure.class).get(missionId);
|
||||||
|
if (treasure == null || treasure.getGrade() != id) {
|
||||||
|
throw new ErrorCodeException(ErrorCode.CFG_NULL,"功能不存在:"+missionId);
|
||||||
|
}
|
||||||
|
// acitvityinfo check
|
||||||
|
ActivityMission mission = user.getActivityManager().getActivityMissionMap().get(id);
|
||||||
|
if (mission == null){
|
||||||
|
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE,"数据错误");
|
||||||
|
}
|
||||||
|
if (mission.getActivityState() != ActivityType.OPEN_STATE) {
|
||||||
|
throw new ErrorCodeException(ErrorCode.ACTIVITY_NOT_OPEN,"活动未开启");
|
||||||
|
}
|
||||||
|
ActivityProgressInfo progressInfo = mission.getActivityMissionMap().get(missionId);
|
||||||
|
if (progressInfo != null && progressInfo.getState() == ActivityType.FINISH_TAKED) {
|
||||||
|
throw new ErrorCodeException(ErrorCode.newDefineCode("活动奖励已经领取"));
|
||||||
|
}
|
||||||
|
// 验证领取条件值
|
||||||
|
if (!takeRewardsProcess(session,treasure)) {
|
||||||
|
LOGGER.error("the uid={} the missionId={},the missionProgress={},the require is={} ", session.getUid(), treasure.getId(), user.getPlayerInfoManager().getGetFiveStarHeroNum(), treasure.getCount());
|
||||||
|
throw new ErrorCodeException(ErrorCode.newDefineCode("未达到领取条件"));
|
||||||
|
}
|
||||||
|
|
||||||
|
ArrayList<int[][]> reward = new ArrayList<>();
|
||||||
|
// 是否购买礼包
|
||||||
|
if (isBuyGift(user)){
|
||||||
|
// 宝藏奖励
|
||||||
|
reward.add(treasure.getTreasureReward());
|
||||||
|
// 普通奖励
|
||||||
|
if (progressInfo == null){
|
||||||
|
reward.add(treasure.getReward());
|
||||||
|
}
|
||||||
|
checkAndSetProgress(mission,missionId,ActivityType.FINISH_TAKED);
|
||||||
|
}else {
|
||||||
|
if (progressInfo != null){
|
||||||
|
throw new ErrorCodeException(ErrorCode.newDefineCode("普通奖励已经领取"));
|
||||||
|
}
|
||||||
|
// 普通奖励
|
||||||
|
reward.add(treasure.getReward());
|
||||||
|
checkAndSetProgress(mission,missionId,ActivityType.HAD_TAKED);
|
||||||
|
}
|
||||||
|
// reward
|
||||||
|
CommonProto.Drop.Builder drop = ItemUtil.drop(user, reward, BIReason.TAKE_ACTIVITY_REWARD);
|
||||||
|
PlayerInfoProto.TakeActivityRewardResponse build = PlayerInfoProto.TakeActivityRewardResponse.newBuilder().setDrop(drop).build();
|
||||||
|
MessageUtil.sendMessage(session, 1, rewardResponseValue, build, true);
|
||||||
|
// 状态推送
|
||||||
|
sendActivityProgress(session, mission, null);
|
||||||
|
// 打点上报
|
||||||
|
reportTakeActivityReward(user,reward,missionId);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否购买礼包
|
||||||
|
* @param user
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
private boolean isBuyGift(User user){
|
||||||
|
int[] ints = Optional.ofNullable(SGlobalActivity.getsGlobalActivityMap().get(id)).map(SGlobalActivity::getCanBuyRechargeId).orElse(null);
|
||||||
|
if (ints == null){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
for (int anInt : ints) {
|
||||||
|
ReceiveWelfareBag bag = (ReceiveWelfareBag) Optional.ofNullable(user.getPlayerInfoManager().getNewRechargeInfo().getReceiveMap())
|
||||||
|
.map(v -> v.get(anInt)).orElse(null);
|
||||||
|
// 礼包为null,礼包可买,礼包未买
|
||||||
|
if (bag == null || !bag.isBought()){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checkActivityMissionFinishAndTake(int uid, int activityId, ActivityMission activityMission) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证奖励是否可以领取
|
||||||
|
* @param session
|
||||||
|
* @param treasure
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
boolean takeRewardsProcess(ISession session, SSummonTreasure treasure) throws Exception {
|
||||||
|
User user = UserManager.getUser(session.getUid());
|
||||||
|
return user.getPlayerInfoManager().getGetFiveStarHeroNum() >= treasure.getCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 领奖后更新奖励进度
|
||||||
|
*/
|
||||||
|
public void checkAndSetProgress(ActivityMission activityMission, int missionId, int state) {
|
||||||
|
ActivityProgressInfo progressInfo = new ActivityProgressInfo();
|
||||||
|
progressInfo.setState(state);
|
||||||
|
activityMission.getActivityMissionMap().put(missionId, progressInfo);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.ljsd.jieling.logic.activity.event;
|
||||||
|
|
||||||
|
public class SummonTreasureActivityEvent implements IEvent{
|
||||||
|
private int uid;
|
||||||
|
|
||||||
|
public SummonTreasureActivityEvent(int uid) {
|
||||||
|
this.uid = uid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getUid() {
|
||||||
|
return uid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUid(int uid) {
|
||||||
|
this.uid = uid;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
package com.ljsd.jieling.logic.activity.event;
|
||||||
|
|
||||||
|
public class SummonTreasureEvent implements IEvent{
|
||||||
|
private int uid;
|
||||||
|
private int star;
|
||||||
|
private int num;
|
||||||
|
|
||||||
|
public SummonTreasureEvent(int uid, int star, int num) {
|
||||||
|
this.uid = uid;
|
||||||
|
this.star = star;
|
||||||
|
this.num = num;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getUid() {
|
||||||
|
return uid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUid(int uid) {
|
||||||
|
this.uid = uid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getStar() {
|
||||||
|
return star;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStar(int star) {
|
||||||
|
this.star = star;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getNum() {
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNum(int num) {
|
||||||
|
this.num = num;
|
||||||
|
}
|
||||||
|
}
|
|
@ -11,10 +11,13 @@ import com.ljsd.jieling.logic.dao.root.User;
|
||||||
import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
|
import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
|
||||||
import com.ljsd.jieling.util.ToolsUtil;
|
import com.ljsd.jieling.util.ToolsUtil;
|
||||||
import config.SGlobalActivity;
|
import config.SGlobalActivity;
|
||||||
|
import config.SSummonTreasure;
|
||||||
|
|
||||||
|
import javax.naming.spi.ObjectFactory;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class ActivityStateChangeHandler implements IEventHandler {
|
public class ActivityStateChangeHandler implements IEventHandler {
|
||||||
public ActivityStateChangeHandler() {
|
public ActivityStateChangeHandler() {
|
||||||
|
@ -39,6 +42,33 @@ public class ActivityStateChangeHandler implements IEventHandler {
|
||||||
ActivityLogic.getInstance().checkNeedOpenStore(user,shopId,startTime,endTime);
|
ActivityLogic.getInstance().checkNeedOpenStore(user,shopId,startTime,endTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 活动开启类型4
|
||||||
|
List<SSummonTreasure> treasureList = SSummonTreasure.getTreasureMap().get(activityId);
|
||||||
|
// 招募基金活动
|
||||||
|
if (treasureList != null && !treasureList.isEmpty()){
|
||||||
|
List<SGlobalActivity> sGlobalActivities = SGlobalActivity.sGlobalActivityMapByOpenRules.getOrDefault(4, new ArrayList<>());
|
||||||
|
int getFiveStarHeroNum = user.getPlayerInfoManager().getGetFiveStarHeroNum();
|
||||||
|
List<SGlobalActivity> activities = sGlobalActivities.stream().filter(s -> s.getOpenRules()[1] == activityId).collect(Collectors.toList());
|
||||||
|
boolean result = true;
|
||||||
|
for (SGlobalActivity activity : activities) {
|
||||||
|
for (SSummonTreasure treasure : treasureList) {
|
||||||
|
// 条件未满足
|
||||||
|
if (treasure.getCount() > getFiveStarHeroNum){
|
||||||
|
result = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (result){
|
||||||
|
ActivityMission mission = user.getActivityManager().getActivityMissionMap().get(activity.getId());
|
||||||
|
AbstractActivity abstractActivity = ActivityTypeEnum.getActicityType(activity.getId());
|
||||||
|
if(mission != null && mission.getActivityState() == ActivityType.UNOPEN_STATE && abstractActivity != null){
|
||||||
|
//修改活动状态,推送给前端
|
||||||
|
abstractActivity.setOpenState(user,ActivityType.OPEN_STATE);
|
||||||
|
ActivityLogic.getInstance().sendActivityInfo(user,activity.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}else if(state == ActivityType.FINISH_STATE){
|
}else if(state == ActivityType.FINISH_STATE){
|
||||||
List<SGlobalActivity> sGlobalActivities = SGlobalActivity.sGlobalActivityMapByOpenRules.getOrDefault(3, new ArrayList<>(0));
|
List<SGlobalActivity> sGlobalActivities = SGlobalActivity.sGlobalActivityMapByOpenRules.getOrDefault(3, new ArrayList<>(0));
|
||||||
sGlobalActivities.stream().filter(s->s.getOpenRules()[1] == activityId).forEach(s->{
|
sGlobalActivities.stream().filter(s->s.getOpenRules()[1] == activityId).forEach(s->{
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.ljsd.jieling.logic.activity.eventhandler;
|
||||||
|
|
||||||
|
import com.ljsd.jieling.logic.activity.IEventHandler;
|
||||||
|
import com.ljsd.jieling.logic.activity.event.IEvent;
|
||||||
|
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||||
|
import com.ljsd.jieling.logic.activity.event.SummonTreasureActivityEvent;
|
||||||
|
import com.ljsd.jieling.logic.activity.event.SummonTreasureEvent;
|
||||||
|
import com.ljsd.jieling.logic.dao.UserManager;
|
||||||
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
|
|
||||||
|
public class SummonTreasureHandler implements IEventHandler {
|
||||||
|
public SummonTreasureHandler() {
|
||||||
|
Poster.getPoster().listenEvent(this, SummonTreasureEvent.class);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onEvent(IEvent event) throws Exception {
|
||||||
|
if( ! (event instanceof SummonTreasureEvent) ){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
SummonTreasureEvent event1 = (SummonTreasureEvent) event;
|
||||||
|
User user = UserManager.getUser(event1.getUid());
|
||||||
|
if (event1.getStar() == 5){
|
||||||
|
user.getPlayerInfoManager().setGetFiveStarHeroNum(user.getPlayerInfoManager().getGetFiveStarHeroNum()+event1.getNum());
|
||||||
|
Poster.getPoster().dispatchEvent(new SummonTreasureActivityEvent(user.getId()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -40,7 +40,7 @@ public class GuildMyInfo extends MongoBase {
|
||||||
|
|
||||||
private int joinTime;//加入公会时间
|
private int joinTime;//加入公会时间
|
||||||
//公会副本
|
//公会副本
|
||||||
private int guildChallengeDamage;
|
private long guildChallengeDamage;
|
||||||
private int lastMonsterId;
|
private int lastMonsterId;
|
||||||
//已经使用过刷新的boss
|
//已经使用过刷新的boss
|
||||||
private Set<Integer> refreshedBoss = new HashSet<>();
|
private Set<Integer> refreshedBoss = new HashSet<>();
|
||||||
|
@ -300,11 +300,11 @@ public class GuildMyInfo extends MongoBase {
|
||||||
updateString("joinTime",joinTime);
|
updateString("joinTime",joinTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getGuildChallengeDamage() {
|
public long getGuildChallengeDamage() {
|
||||||
return guildChallengeDamage;
|
return guildChallengeDamage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGuildChallengeDamage(int guildChallengeDamage) {
|
public void setGuildChallengeDamage(long guildChallengeDamage) {
|
||||||
this.guildChallengeDamage = guildChallengeDamage;
|
this.guildChallengeDamage = guildChallengeDamage;
|
||||||
updateString("guildChallengeDamage",guildChallengeDamage);
|
updateString("guildChallengeDamage",guildChallengeDamage);
|
||||||
|
|
||||||
|
|
|
@ -196,10 +196,22 @@ public class PlayerManager extends MongoBase {
|
||||||
private long weekCardTimeFirst;//本周第一次看到周卡的时间
|
private long weekCardTimeFirst;//本周第一次看到周卡的时间
|
||||||
private int weekCardTimeFirstLevel;//本周第一次看到周卡时人物等级
|
private int weekCardTimeFirstLevel;//本周第一次看到周卡时人物等级
|
||||||
|
|
||||||
|
//玩家抽取到的五星次数,目前只应用于招募基金使用
|
||||||
|
private int getFiveStarHeroNum;
|
||||||
|
|
||||||
public PlayerManager(){
|
public PlayerManager(){
|
||||||
this.setRootCollection(User._COLLECTION_NAME);
|
this.setRootCollection(User._COLLECTION_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getGetFiveStarHeroNum() {
|
||||||
|
return getFiveStarHeroNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGetFiveStarHeroNum(int getFiveStarHeroNum) {
|
||||||
|
this.getFiveStarHeroNum = getFiveStarHeroNum;
|
||||||
|
updateString("getFiveStarHeroNum", getFiveStarHeroNum);
|
||||||
|
}
|
||||||
|
|
||||||
public int getTreasureLevel() {
|
public int getTreasureLevel() {
|
||||||
return treasureLevel;
|
return treasureLevel;
|
||||||
}
|
}
|
||||||
|
|
|
@ -205,7 +205,7 @@ public class GuildChallengeLogic {
|
||||||
}
|
}
|
||||||
FightResult fightResult = FightDispatcher.dispatcher(pveFightEvent);
|
FightResult fightResult = FightDispatcher.dispatcher(pveFightEvent);
|
||||||
fightData = fightResult.getFightData();
|
fightData = fightResult.getFightData();
|
||||||
int damageInt = (int)fightResult.getDuration();
|
long damageInt = fightResult.getDuration();
|
||||||
|
|
||||||
if(fightResult.getResult()==1) {
|
if(fightResult.getResult()==1) {
|
||||||
if(guildInfo.getBossHpRemain()!=-1){
|
if(guildInfo.getBossHpRemain()!=-1){
|
||||||
|
@ -356,9 +356,6 @@ public class GuildChallengeLogic {
|
||||||
}
|
}
|
||||||
indication.setIsKill(kill);
|
indication.setIsKill(kill);
|
||||||
//伤害排行
|
//伤害排行
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Family.GuildChallengeResponse.Builder response = Family.GuildChallengeResponse.newBuilder();
|
Family.GuildChallengeResponse.Builder response = Family.GuildChallengeResponse.newBuilder();
|
||||||
|
|
||||||
response.setDrop(drop);
|
response.setDrop(drop);
|
||||||
|
@ -374,7 +371,7 @@ public class GuildChallengeLogic {
|
||||||
|
|
||||||
response.setKill(kill);
|
response.setKill(kill);
|
||||||
|
|
||||||
response.setDamage((int)damage);
|
response.setDamage(damage);
|
||||||
|
|
||||||
PlayerLogic.getInstance().checkAndUpdate(user,config.getPrivilege()[0],1);
|
PlayerLogic.getInstance().checkAndUpdate(user,config.getPrivilege()[0],1);
|
||||||
|
|
||||||
|
|
|
@ -506,6 +506,15 @@ public class BuyGoodsNewLogic {
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (bag.getType() == RechargeType.receive.getType()){
|
||||||
|
for (String[] strings : bag.getCondition()) {
|
||||||
|
if (strings[0].equals("9")){
|
||||||
|
if(!judgeOpen(strings,user)){
|
||||||
|
bag.setOpen(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
if(bag.getType() == RechargeType.push.getType() && !bag.isOpen()){
|
if(bag.getType() == RechargeType.push.getType() && !bag.isOpen()){
|
||||||
user.getPlayerInfoManager().getNewRechargeInfo().removePush(bag.getModId());
|
user.getPlayerInfoManager().getNewRechargeInfo().removePush(bag.getModId());
|
||||||
|
@ -635,6 +644,17 @@ public class BuyGoodsNewLogic {
|
||||||
return user.getPlayerInfoManager().getMonthCard().get(Global.LMONTHCARDID) != null;
|
return user.getPlayerInfoManager().getMonthCard().get(Global.LMONTHCARDID) != null;
|
||||||
}else if(con[0].equals("7")){
|
}else if(con[0].equals("7")){
|
||||||
return true;
|
return true;
|
||||||
|
}else if (con[0].equals("9")){
|
||||||
|
SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.getConfigById(Integer.parseInt(con[1]));
|
||||||
|
if (config == null){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
RechargeHandler rechargeHandler = getRechargeHandler(config.getOtype());
|
||||||
|
AbstractWelfareBag bag = rechargeHandler.getRechargeMap(user).get(config.getId());
|
||||||
|
if (bag == null){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return bag.buyAgo();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,6 +90,10 @@ public class AbstractWelfareBag extends MongoBase{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean buyAgo(){
|
||||||
|
return buyTimes >= getLimit();
|
||||||
|
}
|
||||||
|
|
||||||
public boolean checkBuy() {
|
public boolean checkBuy() {
|
||||||
if(!open){
|
if(!open){
|
||||||
LOGGER.error("礼包:{}未开启",modId);
|
LOGGER.error("礼包:{}未开启",modId);
|
||||||
|
|
|
@ -74,6 +74,11 @@ public class ReceiveWelfareBag extends AbstractWelfareBag {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean buyAgo(){
|
||||||
|
return bought;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void refresh(){
|
public void refresh(){
|
||||||
super.refresh();
|
super.refresh();
|
||||||
|
|
|
@ -1388,6 +1388,7 @@ public class ItemUtil {
|
||||||
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||||
int[] heroStar = SItem.getsItemMap().get(cardId).getHeroStar();
|
int[] heroStar = SItem.getsItemMap().get(cardId).getHeroStar();
|
||||||
Hero hero = new Hero(user.getId(),heroStar[0],heroStar[1]);
|
Hero hero = new Hero(user.getId(),heroStar[0],heroStar[1]);
|
||||||
|
Poster.getPoster().dispatchEvent(new SummonTreasureEvent(user.getId(),hero.getStar(),1));
|
||||||
heroManager.addHero(hero);
|
heroManager.addHero(hero);
|
||||||
// 鸿蒙阵推送
|
// 鸿蒙阵推送
|
||||||
HeroLogic.getInstance().addOrUpdateHongmeng(OnlineUserManager.getSessionByUid(user.getId()));
|
HeroLogic.getInstance().addOrUpdateHongmeng(OnlineUserManager.getSessionByUid(user.getId()));
|
||||||
|
|
|
@ -15,6 +15,8 @@ public class SMainLevelConfig implements BaseConfig {
|
||||||
|
|
||||||
private int levelLimit;
|
private int levelLimit;
|
||||||
|
|
||||||
|
private int[][] openRule;//附加关卡解锁条件
|
||||||
|
|
||||||
private int monsterGroup;
|
private int monsterGroup;
|
||||||
|
|
||||||
private int[] reward;
|
private int[] reward;
|
||||||
|
@ -31,6 +33,7 @@ public class SMainLevelConfig implements BaseConfig {
|
||||||
|
|
||||||
private int[][] invasionBossReward;
|
private int[][] invasionBossReward;
|
||||||
|
|
||||||
|
|
||||||
private int invasionBossTime;
|
private int invasionBossTime;
|
||||||
|
|
||||||
private int invasionBossRefresh;
|
private int invasionBossRefresh;
|
||||||
|
@ -143,4 +146,8 @@ public class SMainLevelConfig implements BaseConfig {
|
||||||
public int getPlotId() {
|
public int getPlotId() {
|
||||||
return storyId;
|
return storyId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int[][] getOpenRule() {
|
||||||
|
return openRule;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,72 @@
|
||||||
|
package config;
|
||||||
|
|
||||||
|
import manager.STableManager;
|
||||||
|
import manager.Table;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Table(name ="SummonTreasure")
|
||||||
|
public class SSummonTreasure implements BaseConfig {
|
||||||
|
|
||||||
|
private int id;
|
||||||
|
|
||||||
|
private int level;
|
||||||
|
|
||||||
|
private int grade;
|
||||||
|
|
||||||
|
private int count;
|
||||||
|
|
||||||
|
private int[][] reward;
|
||||||
|
|
||||||
|
private int[][] treasureReward;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* key:活动id, value:对象列表
|
||||||
|
*/
|
||||||
|
private static Map<Integer, List<SSummonTreasure>> treasureMap = new HashMap<>();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init() throws Exception {
|
||||||
|
Map<Integer, SSummonTreasure> config = STableManager.getConfig(SSummonTreasure.class);
|
||||||
|
HashMap<Integer, List<SSummonTreasure>> map = new HashMap<>();
|
||||||
|
config.values().forEach(v->{
|
||||||
|
List<SSummonTreasure> treasures = map.getOrDefault(v.getGrade(), new ArrayList<SSummonTreasure>());
|
||||||
|
treasures.add(v);
|
||||||
|
map.put(v.getGrade(),treasures);
|
||||||
|
});
|
||||||
|
treasureMap = map;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Map<Integer, List<SSummonTreasure>> getTreasureMap() {
|
||||||
|
return treasureMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLevel() {
|
||||||
|
return level;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getGrade() {
|
||||||
|
return grade;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCount() {
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[][] getReward() {
|
||||||
|
return reward;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[][] getTreasureReward() {
|
||||||
|
return treasureReward;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue