领取副本星级奖励
parent
02e2cff56b
commit
fa7c397e5d
|
@ -0,0 +1,35 @@
|
||||||
|
package com.ljsd.jieling.config;
|
||||||
|
|
||||||
|
import com.ljsd.jieling.logic.STableManager;
|
||||||
|
import com.ljsd.jieling.logic.Table;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Table(name = "ChallengeStarBox")
|
||||||
|
public class SChallengeStarBox implements BaseConfig{
|
||||||
|
@Override
|
||||||
|
public void init() throws Exception {
|
||||||
|
sChallengeStarBoxMap = STableManager.getConfig(SChallengeStarBox.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Map<Integer, SChallengeStarBox> sChallengeStarBoxMap;
|
||||||
|
|
||||||
|
|
||||||
|
private int id;
|
||||||
|
|
||||||
|
private int starNum;
|
||||||
|
|
||||||
|
private int[][] reward;
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getStarNum() {
|
||||||
|
return starNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[][] getReward() {
|
||||||
|
return reward;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1949,4 +1949,165 @@ public class MapLogic {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 试炼副本 爬塔
|
||||||
|
*/
|
||||||
|
public void enterTowerCopy(ISession iSession, int teamId, MessageTypeProto.MessageType messageType) throws Exception {
|
||||||
|
int uid = iSession.getUid();
|
||||||
|
User user = UserManager.getUser(uid);
|
||||||
|
MapManager mapManager = user.getMapManager();
|
||||||
|
if (teamId == 0) {
|
||||||
|
LOGGER.info("enterTowerCopy() uid=>{} teamId =>{} ", uid, teamId);
|
||||||
|
MessageUtil.sendErrorResponse(iSession, 0, messageType.getNumber(), "");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 判断次数
|
||||||
|
if (mapManager.getFightCount() >= 5) {
|
||||||
|
LOGGER.info("enterTowerCopy() uid=>{} teamId =>{} ", uid, teamId);
|
||||||
|
MessageUtil.sendErrorResponse(iSession, 0, messageType.getNumber(), "");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int tower = mapManager.getTower();
|
||||||
|
Map<Integer, SCMap> scMap = SCMap.sCMap.get(tower);
|
||||||
|
if (scMap == null) {
|
||||||
|
LOGGER.info("enterTowerCopy() uid=>{} scMap == null =>{} ", uid, tower);
|
||||||
|
MessageUtil.sendErrorResponse(iSession, 0, messageType.getNumber(), "");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
SChallengeMapConfig scMapConfig = SChallengeMapConfig.integerSChallengeMapConfigMap.get(tower);
|
||||||
|
if (scMapConfig == null) {
|
||||||
|
LOGGER.info("enterTowerCopy() uid=>{} sChallengeConfig == null =>{} ", uid, tower);
|
||||||
|
MessageUtil.sendErrorResponse(iSession, 0, messageType.getNumber(), "该地图不存在");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(tower);
|
||||||
|
if (sChallengeConfig == null) {
|
||||||
|
LOGGER.info("enterTowerCopy() uid=>{} sChallengeConfig == null =>{} ", uid, tower);
|
||||||
|
MessageUtil.sendErrorResponse(iSession, 0, messageType.getNumber(), "该地图不存在");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String error = initTeamInfo(teamId, uid, user, mapManager);
|
||||||
|
if (!error.isEmpty()) {
|
||||||
|
LOGGER.info("enterTowerCopy() uid=>{} error =>{} ", uid, error);
|
||||||
|
MessageUtil.sendErrorResponse(iSession, 0, messageType.getNumber(), "");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
user.setMapManager(mapManager);
|
||||||
|
|
||||||
|
List<CommonProto.Cell> cells = new ArrayList<>(mapManager.getMapInfo().size());
|
||||||
|
for (Map.Entry<Integer, Cell> entry : mapManager.getMapInfo().entrySet()) {
|
||||||
|
cellToProto(cells, entry);
|
||||||
|
}
|
||||||
|
MapInfoProto.MapEnterResponse.Builder mapEnterResponse = MapInfoProto.MapEnterResponse.newBuilder();
|
||||||
|
|
||||||
|
for (Map.Entry<Integer, Integer> buffEntry : mapManager.getFoodBufferMap().entrySet()) {
|
||||||
|
if (buffEntry.getValue() <= 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
CommonProto.FoodBuffer foodBuffer = CBean2Proto.getFoodBuffer(buffEntry.getKey(), buffEntry.getValue());
|
||||||
|
mapEnterResponse.addFoodBuffers(foodBuffer);
|
||||||
|
}
|
||||||
|
if (mapManager.getMission() != null) {
|
||||||
|
mapEnterResponse.setMissions(getMission(mapManager.getMission()));
|
||||||
|
}
|
||||||
|
mapEnterResponse.setDieCount(mapManager.getDieCount());
|
||||||
|
mapEnterResponse.addAllMapList(cells);
|
||||||
|
mapEnterResponse.setCurXY(mapManager.getCurXY());
|
||||||
|
mapEnterResponse.addAllWakeCells(mapManager.getWalkCells() == null ? new ArrayList<>() : mapManager.getWalkCells());
|
||||||
|
if (mapManager.getTemporaryItems() != null) {
|
||||||
|
mapEnterResponse.setTemporaryItems(CBean2Proto.getDrop(mapManager.getTemporaryItems()));
|
||||||
|
}
|
||||||
|
MapMission mapMissionProgres = mapManager.getMapMissionProgres();
|
||||||
|
if (mapMissionProgres != null) {
|
||||||
|
Map<Integer, Integer> allMissionProgress = mapMissionProgres.getAllMissionProgress();
|
||||||
|
List<CommonProto.ExploreDetail> exploreDetailList = new ArrayList<>(allMissionProgress.size());
|
||||||
|
for (Map.Entry<Integer, Integer> item : allMissionProgress.entrySet()) {
|
||||||
|
exploreDetailList.add(CommonProto.ExploreDetail.newBuilder().setId(item.getKey()).setProgress(item.getValue()).build());
|
||||||
|
}
|
||||||
|
mapEnterResponse.addAllExploreDetail(exploreDetailList);
|
||||||
|
}else{
|
||||||
|
LOGGER.error("the curmap={}",mapManager.getCurMapId());
|
||||||
|
}
|
||||||
|
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
||||||
|
Map<String, Map<Integer, Integer>> heroAllAttributeMap = mapManager.getHeroAllAttributeMap();
|
||||||
|
for (TeamPosHeroInfo teamPosHeroInfo : teamPosHeroInfos) {
|
||||||
|
Map<Integer, Integer> map = heroAllAttributeMap.get(teamPosHeroInfo.getHeroId());
|
||||||
|
if (map == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
MapInfoProto.HeroInfo heroInfo = MapInfoProto.HeroInfo.newBuilder()
|
||||||
|
.setHeroId(teamPosHeroInfo.getHeroId())
|
||||||
|
.setHeroHp(map.get(HeroAttributeEnum.CurHP.getPropertyId()) == null ? 0 : map.get(HeroAttributeEnum.CurHP.getPropertyId()))
|
||||||
|
.setHeroMaxHp(map.get(HeroAttributeEnum.Hp.getPropertyId()) == null ? 0 : map.get(HeroAttributeEnum.Hp.getPropertyId()))
|
||||||
|
.build();
|
||||||
|
mapEnterResponse.addHeroInfos(heroInfo);
|
||||||
|
}
|
||||||
|
LOGGER.info("enterTowerCopy() uid=>{} mapId =>{}", uid, mapManager.getTower());
|
||||||
|
MessageUtil.sendMessage(iSession, 1, messageType.getNumber(), mapEnterResponse.build(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 召唤首领
|
||||||
|
*
|
||||||
|
* @param iSession
|
||||||
|
* @param messageType
|
||||||
|
*/
|
||||||
|
public void callChief(ISession iSession, MessageTypeProto.MessageType messageType) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用炸弹
|
||||||
|
*
|
||||||
|
* @param iSession
|
||||||
|
* @param messageType
|
||||||
|
*/
|
||||||
|
public void useBombs(ISession iSession, MessageTypeProto.MessageType messageType) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param iSession
|
||||||
|
* @param messageType
|
||||||
|
*/
|
||||||
|
public void outTowerCopy(ISession iSession, MessageTypeProto.MessageType messageType) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 领取副本星级奖励
|
||||||
|
* @param session
|
||||||
|
* @param messageType
|
||||||
|
*/
|
||||||
|
public void takeStarReward(ISession session, int id, MessageTypeProto.MessageType messageType) throws Exception {
|
||||||
|
SChallengeStarBox sChallengeStarBox = SChallengeStarBox.sChallengeStarBoxMap.get(id);
|
||||||
|
if (sChallengeStarBox == null) {
|
||||||
|
LOGGER.info("takeStarReward uid=>{}, id=>{}", session.getUid(), id);
|
||||||
|
MessageUtil.sendErrorResponse(session, 0, messageType.getNumber(), "");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int uid = session.getUid();
|
||||||
|
User user = UserManager.getUser(uid);
|
||||||
|
MapManager mapManager = user.getMapManager();
|
||||||
|
if (id <= mapManager.getStarReward()){
|
||||||
|
LOGGER.info("takeStarReward uid=>{}, id=>{} mapManager.getStarReward()=>{}", session.getUid(), id, mapManager.getStarReward());
|
||||||
|
MessageUtil.sendErrorResponse(session, 0, messageType.getNumber(), "");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Map<Integer, CrossInfo> crossInfoMap = mapManager.getCrossInfoMap();
|
||||||
|
int totalStar = 0;
|
||||||
|
for (CrossInfo crossInfo : crossInfoMap.values()) {
|
||||||
|
int star = crossInfo.getStars().size();
|
||||||
|
totalStar += star;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,6 +69,16 @@ public class MapManager extends MongoBase {
|
||||||
|
|
||||||
private int findSuddenlyBossMapId;
|
private int findSuddenlyBossMapId;
|
||||||
|
|
||||||
|
// 副本星级奖励领取进度 challengeStarBox id
|
||||||
|
private int starReward;
|
||||||
|
|
||||||
|
// 爬塔副本当前层数
|
||||||
|
private int tower;
|
||||||
|
// 爬塔副本战斗次数
|
||||||
|
private int fightCount;
|
||||||
|
// 爬塔副本重置次数
|
||||||
|
private int resetCount;
|
||||||
|
|
||||||
|
|
||||||
public MapManager() {
|
public MapManager() {
|
||||||
this.setRootCollection(User._COLLECTION_NAME);
|
this.setRootCollection(User._COLLECTION_NAME);
|
||||||
|
@ -397,4 +407,40 @@ public class MapManager extends MongoBase {
|
||||||
public int getFindSuddenlyBossMapId() {
|
public int getFindSuddenlyBossMapId() {
|
||||||
return findSuddenlyBossMapId;
|
return findSuddenlyBossMapId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getTower() {
|
||||||
|
return tower;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTower(int tower) {
|
||||||
|
updateString("tower" , tower);
|
||||||
|
this.tower = tower;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getFightCount() {
|
||||||
|
return fightCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFightCount(int fightCount) {
|
||||||
|
updateString("fightCount" , fightCount);
|
||||||
|
this.fightCount = fightCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getResetCount() {
|
||||||
|
return resetCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setResetCount(int resetCount) {
|
||||||
|
updateString("resetCount" , resetCount);
|
||||||
|
this.resetCount = resetCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getStarReward() {
|
||||||
|
return starReward;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStarReward(int starReward) {
|
||||||
|
updateString("starReward" , starReward);
|
||||||
|
this.starReward = starReward;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue