back_recharge
parent
db7dbb84c2
commit
9253e775f0
|
@ -15,5 +15,6 @@ public class ExplorerMapInfoHandler extends BaseHandler<PlayerInfoProto.Explore
|
|||
public void processWithProto(ISession session, PlayerInfoProto.ExplorerMapInfoRequest proto) throws Exception{
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package com.ljsd.jieling.handler.explorerMap;
|
||||
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
|
@ -15,6 +17,14 @@ public class ExplorerMapSendHandler extends BaseHandler<PlayerInfoProto.Explorer
|
|||
@Override
|
||||
public void processWithProto(ISession session, PlayerInfoProto.ExplorerMapSendRequest proto) throws Exception {
|
||||
|
||||
int uid = session.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
if (user == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
package com.ljsd.jieling.logic.dao;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ExplorerInfo {
|
||||
|
||||
private int MapId;
|
||||
private int sendEndTime;//派遣的截止时间
|
||||
private int playerHp;//玩家当前血量
|
||||
private int playerReliveTime;//玩家复活时间
|
||||
private int enemyHp;//敌人血量
|
||||
private int enemyReliveTime;//敌人复活时间
|
||||
|
||||
private List<Integer> dropList = new ArrayList<>();
|
||||
|
||||
public int getMapId() {
|
||||
return MapId;
|
||||
}
|
||||
|
||||
public void setMapId(int mapId) {
|
||||
MapId = mapId;
|
||||
}
|
||||
|
||||
public int getSendEndTime() {
|
||||
return sendEndTime;
|
||||
}
|
||||
|
||||
public void setSendEndTime(int sendEndTime) {
|
||||
this.sendEndTime = sendEndTime;
|
||||
}
|
||||
|
||||
public int getPlayerHp() {
|
||||
return playerHp;
|
||||
}
|
||||
|
||||
public void setPlayerHp(int playerHp) {
|
||||
if(playerHp<0){
|
||||
playerHp = 0;
|
||||
}
|
||||
this.playerHp = playerHp;
|
||||
}
|
||||
|
||||
public int getPlayerReliveTime() {
|
||||
return playerReliveTime;
|
||||
}
|
||||
|
||||
public void setPlayerReliveTime(int playerReliveTime) {
|
||||
this.playerReliveTime = playerReliveTime;
|
||||
}
|
||||
|
||||
public int getEnemyHp() {
|
||||
return enemyHp;
|
||||
}
|
||||
|
||||
public void setEnemyHp(int enemyHp) {
|
||||
if(enemyHp<0){
|
||||
enemyHp = 0;
|
||||
}
|
||||
this.enemyHp = enemyHp;
|
||||
}
|
||||
|
||||
public int getEnemyReliveTime() {
|
||||
return enemyReliveTime;
|
||||
}
|
||||
|
||||
public void setEnemyReliveTime(int enemyReliveTime) {
|
||||
this.enemyReliveTime = enemyReliveTime;
|
||||
}
|
||||
|
||||
public List<Integer> getDropList() {
|
||||
return dropList;
|
||||
}
|
||||
|
||||
public void setDropList(List<Integer> dropList) {
|
||||
this.dropList = dropList;
|
||||
}
|
||||
}
|
|
@ -198,6 +198,13 @@ public class PlayerManager extends MongoBase {
|
|||
|
||||
//玩家抽取到的五星次数,目前只应用于招募基金使用
|
||||
private int getFiveStarHeroNum;
|
||||
//探索
|
||||
private Map<Integer,ExplorerInfo> explorer = new HashMap<>();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public PlayerManager(){
|
||||
this.setRootCollection(User._COLLECTION_NAME);
|
||||
|
@ -1347,4 +1354,13 @@ public class PlayerManager extends MongoBase {
|
|||
this.weekCardTimeFirstLevel = weekCardTimeFirstLevel;
|
||||
updateString("weekCardTimeFirstLevel",weekCardTimeFirstLevel);
|
||||
}
|
||||
|
||||
public Map<Integer, ExplorerInfo> getExplorer() {
|
||||
return explorer;
|
||||
}
|
||||
|
||||
public void setExplorer(Map<Integer, ExplorerInfo> explorer) {
|
||||
this.explorer = explorer;
|
||||
updateString("explorer",explorer);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,6 +36,12 @@ public enum TeamEnum {
|
|||
FOURCHALLENGE_MONSTER_TEAM(3003,"四灵试炼-妖"),
|
||||
FOURCHALLENGE_MORALITY_TEAM(3004,"四灵试炼-道"),
|
||||
SEVEN_WORLD_TEAM(2101,"七届试炼编队",1,0),
|
||||
|
||||
EXPLORE_TEAM_ONE(2102,"探索第一编队",1,0),
|
||||
EXPLORE_TEAM_TWO(2103,"探索第二编队",1,0),
|
||||
EXPLORE_TEAM_TREE(2104,"探索第三编队",1,0),
|
||||
EXPLORE_TEAM_FOUR(2105,"探索第四编队",1,0),
|
||||
EXPLORE_TEAM_FIVE(2106,"探索第五编队",1,0),
|
||||
;
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,18 +4,23 @@ import com.ljsd.jieling.db.redis.RedisKey;
|
|||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.activity.crossService.CrossServiceLogic;
|
||||
import com.ljsd.jieling.logic.dao.ExplorerInfo;
|
||||
import com.ljsd.jieling.logic.dao.PlayerManager;
|
||||
import com.ljsd.jieling.logic.dao.TeamEnum;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.cross.CSPlayer;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import config.SArenaRobotConfig;
|
||||
import config.SExplore;
|
||||
import config.SExploreFight;
|
||||
import manager.STableManager;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import rpc.protocols.CommonProto;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
public class ExplorerMapLogic {
|
||||
|
||||
|
@ -39,22 +44,97 @@ public class ExplorerMapLogic {
|
|||
redisUtil.lSet(key2, String.valueOf(user.getId()));
|
||||
}
|
||||
|
||||
public static void battle(User user){
|
||||
Map<Integer, ExplorerInfo> explorer = user.getPlayerInfoManager().getExplorer();
|
||||
|
||||
|
||||
}
|
||||
//单场战斗
|
||||
public static void singleBattle(User user,int teamId){
|
||||
ExplorerInfo explorerInfo = user.getPlayerInfoManager().getExplorer().get(teamId);
|
||||
if(explorerInfo == null){
|
||||
return;
|
||||
}
|
||||
if(explorerInfo.getPlayerHp()!=0 && explorerInfo.getEnemyHp()!=0){
|
||||
int teamForce = HeroLogic.getInstance().calTeamTotalForce(user,teamId, false);
|
||||
SExplore exploreConfig = STableManager.getConfig(SExplore.class).get(explorerInfo.getMapId());
|
||||
if(exploreConfig == null){
|
||||
return;
|
||||
}
|
||||
//怪物的初始血量
|
||||
int mapMonsterForce = exploreConfig.getMonsterForce();
|
||||
float ratio = (float)teamForce/mapMonsterForce;
|
||||
SExploreFight exploreFightData = SExploreFight.getConfigByFightDownAndFightUp(ratio);
|
||||
if(exploreFightData == null){
|
||||
return;
|
||||
}
|
||||
//掉血比例
|
||||
float reduceRatio = exploreFightData.getLoseFight();
|
||||
//玩家掉血
|
||||
explorerInfo.setPlayerHp(explorerInfo.getPlayerHp() - (int)(explorerInfo.getPlayerHp()*reduceRatio));
|
||||
//怪物掉血
|
||||
explorerInfo.setEnemyHp(explorerInfo.getEnemyHp()- (int)(explorerInfo.getEnemyHp()*reduceRatio));
|
||||
//玩家死亡 设置重生时间
|
||||
if(explorerInfo.getPlayerHp() == 0){
|
||||
explorerInfo.setPlayerReliveTime(TimeUtils.nowInt()+300);
|
||||
}
|
||||
//怪物死亡 设置重生时间
|
||||
if(explorerInfo.getEnemyHp() == 0){
|
||||
explorerInfo.setEnemyReliveTime(TimeUtils.nowInt()+300);
|
||||
//胜利添加掉落
|
||||
List<Integer>dropList = explorerInfo.getDropList();
|
||||
if(dropList == null){
|
||||
dropList = new ArrayList<>();
|
||||
}
|
||||
dropList.add(exploreConfig.getReward());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//复活怪物 自己血量之类的
|
||||
public static void reset(){
|
||||
public static void recycleFight(){
|
||||
try{
|
||||
Set<Integer> uids = OnlineUserManager.sessionMap.keySet();
|
||||
Map<String,Integer> channelMap = new HashMap<>();
|
||||
for(int uid:uids){
|
||||
User user = UserManager.getUser(uid);
|
||||
String channel = user.getPlayerInfoManager().getChannel();
|
||||
channelMap.put(channel,channelMap.getOrDefault(channel,0)+1);
|
||||
|
||||
//探索队伍 map <id,(血量,复活时间,派遣到哪个地图里,派遣的截止时间,获得的掉落)>
|
||||
|
||||
Map<Integer,ExplorerInfo> explorer = user.getPlayerInfoManager().getExplorer();
|
||||
if(explorer == null || explorer.size() == 0){
|
||||
continue;
|
||||
}
|
||||
List<Integer> delayId = new ArrayList<>();
|
||||
for (Map.Entry<Integer, ExplorerInfo> keyVal:explorer.entrySet()){
|
||||
//到期探索
|
||||
if(keyVal.getValue().getSendEndTime()<TimeUtils.now()){
|
||||
delayId.add(keyVal.getKey());
|
||||
}
|
||||
//复活
|
||||
//复活玩家
|
||||
if(keyVal.getValue().getPlayerHp() == 0 && keyVal.getValue().getPlayerReliveTime()>= TimeUtils.nowInt()){
|
||||
int teamForce = HeroLogic.getInstance().calTeamTotalForce(user,keyVal.getKey(), false);
|
||||
keyVal.getValue().setPlayerHp(teamForce);
|
||||
//打架 TODO
|
||||
singleBattle(user,keyVal.getKey());
|
||||
}
|
||||
//复活怪物
|
||||
if(keyVal.getValue().getEnemyHp() == 0 && keyVal.getValue().getEnemyReliveTime()>= TimeUtils.nowInt()){
|
||||
SExplore exploreConfig = STableManager.getConfig(SExplore.class).get(keyVal.getValue().getMapId());
|
||||
if(exploreConfig == null){
|
||||
continue;
|
||||
}
|
||||
//怪物的初始血量
|
||||
int mapMonsterForce = exploreConfig.getMonsterForce();
|
||||
keyVal.getValue().setEnemyHp(mapMonsterForce);
|
||||
//打架 TODO
|
||||
singleBattle(user,keyVal.getKey());
|
||||
}
|
||||
}
|
||||
for(int id :delayId){
|
||||
explorer.remove(id);
|
||||
}
|
||||
//探索队伍 map <id,(派遣到哪个地图里,派遣的截止时间,玩家,复活时间)>
|
||||
//地图怪物 map<地图id,List<>()地图上所有的怪物(怪物id,刷新时间,血量)>
|
||||
|
||||
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
package config;
|
||||
|
||||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="Explore")
|
||||
public class SExplore implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int map;
|
||||
|
||||
private int level;
|
||||
|
||||
private int force;
|
||||
|
||||
private int battleInterval;
|
||||
|
||||
private int reward;
|
||||
|
||||
private int[] cost;
|
||||
|
||||
private int monsterForce;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getMap() {
|
||||
return map;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public int getForce() {
|
||||
return force;
|
||||
}
|
||||
|
||||
public int getBattleInterval() {
|
||||
return battleInterval;
|
||||
}
|
||||
|
||||
public int getReward() {
|
||||
return reward;
|
||||
}
|
||||
|
||||
public int[] getCost() {
|
||||
return cost;
|
||||
}
|
||||
|
||||
public int getMonsterForce() {
|
||||
return monsterForce;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
package config;
|
||||
|
||||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="ExploreFight")
|
||||
public class SExploreFight implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private float fightDown;
|
||||
|
||||
private float fightUp;
|
||||
|
||||
private float loseFight;
|
||||
|
||||
public static Map<Integer,SExploreFight> exploreFight;
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
Map<Integer, SExploreFight> config = STableManager.getConfig(SExploreFight.class);
|
||||
Map<Integer,SExploreFight> tempExploreFight = new HashMap<>();
|
||||
for(Map.Entry<Integer, SExploreFight> entry:config.entrySet()){
|
||||
tempExploreFight.put(entry.getKey(),entry.getValue());
|
||||
}
|
||||
exploreFight = tempExploreFight;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public float getFightDown() {
|
||||
return fightDown;
|
||||
}
|
||||
|
||||
public float getFightUp() {
|
||||
return fightUp;
|
||||
}
|
||||
|
||||
public float getLoseFight() {
|
||||
return loseFight;
|
||||
}
|
||||
|
||||
|
||||
public static Map<Integer, SExploreFight> getExploreFight() {
|
||||
return exploreFight;
|
||||
}
|
||||
|
||||
public static SExploreFight getConfigByFightDownAndFightUp(float ratio){
|
||||
for(SExploreFight data:exploreFight.values()){
|
||||
if(ratio>= data.fightDown&& data.fightUp<= ratio){
|
||||
return data;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package config;
|
||||
|
||||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="HomeLand")
|
||||
public class SHomeLand implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int type;
|
||||
|
||||
private int lvupCostPool;
|
||||
|
||||
private int[] unlockLevel;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public int getLvupCostPool() {
|
||||
return lvupCostPool;
|
||||
}
|
||||
|
||||
public int[] getUnlockLevel() {
|
||||
return unlockLevel;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
package config;
|
||||
|
||||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="HomeLandLevel")
|
||||
public class SHomeLandLevel implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int poolID;
|
||||
|
||||
private int level;
|
||||
|
||||
private int[] rule;
|
||||
|
||||
private int[][] cost;
|
||||
|
||||
private int[][] gain;
|
||||
|
||||
private int unlockArea;
|
||||
|
||||
private int[][] storage;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getPoolID() {
|
||||
return poolID;
|
||||
}
|
||||
|
||||
public int getlevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public int[] getRule() {
|
||||
return rule;
|
||||
}
|
||||
|
||||
public int[][] getCost() {
|
||||
return cost;
|
||||
}
|
||||
|
||||
public int[][] getGain() {
|
||||
return gain;
|
||||
}
|
||||
|
||||
public int getUnlockArea() {
|
||||
return unlockArea;
|
||||
}
|
||||
|
||||
public int[][] getStorage() {
|
||||
return storage;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package config;
|
||||
|
||||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="HomeLandTask")
|
||||
public class SHomeLandTask implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int type;
|
||||
|
||||
private int[][] values;
|
||||
|
||||
private int[][] reward;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public int[][] getValues() {
|
||||
return values;
|
||||
}
|
||||
|
||||
public int[][] getReward() {
|
||||
return reward;
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue