back_recharge
zhangshanxue 2019-09-10 00:01:38 +08:00
commit f8ab3f7967
19 changed files with 6266 additions and 2107 deletions

View File

@ -5,6 +5,9 @@ package com.ljsd.battle.actor;
import com.ljsd.battle.BattleRequest;
import com.ljsd.battle.room.SceneManager;
import com.ljsd.battle.statics.AnalysisEventType;
import com.ljsd.battle.statics.AnalysisSourceData;
import com.ljsd.battle.statics.MessageBoxUtils;
import com.ljsd.jieling.config.SChallengeMapConfig;
import com.ljsd.jieling.util.CellUtil;
@ -47,6 +50,7 @@ public abstract class Creature extends SceneActor{
public void costMineral(int mineral) {
this.mineral -= mineral;
MessageBoxUtils.onGameEvent(AnalysisEventType.DIGGER_NUMS,getScene(),new AnalysisSourceData(this.getId(),-1,mineral));
}
public void tick(){
@ -55,6 +59,7 @@ public abstract class Creature extends SceneActor{
public void addMineral(int mineral) {
this.mineral += mineral;
MessageBoxUtils.onGameEvent(AnalysisEventType.DIGGER_NUMS,getScene(),new AnalysisSourceData(this.getId(),1,this.mineral));
}
public void exec(int tyep, Object parm){

View File

@ -122,6 +122,16 @@ public class Scene implements Runnable{
private List<String> cacheMsg = new ArrayList<>(2);
private int quickEnd = -1; //快速结束时间
private int quickPlayId = 0;//快速结束玩家uid
private Set<Integer> possibaleQuickUids = new HashSet<>();
public void addQuickPossibalePlays(int quickPlayId){
possibaleQuickUids.add(quickPlayId);
}
public void monsterReflush(){
Iterator<Map.Entry<Integer, Integer>> iterator = monsterRecoryMap.entrySet().iterator();
@ -149,6 +159,31 @@ public class Scene implements Runnable{
}
public void checkNeedRestartQuickEnd(){
if(possibaleQuickUids.isEmpty()){
return;
}
int[] settleTime = SBloodyBattleSetting.sBloodyBattleSetting.getSettleTime();
int endTick = settleTime[1]*20 + tick;
if(endTick>SceneManager.bloodyMap.getEndRound()){
return;
}
for( Integer possibaleQuickUid : possibaleQuickUids){
if(quickPlayId!=0 || quickPlayId == possibaleQuickUid){
continue;
}
SceneActor sceneActor = sceneActorMap.get(possibaleQuickUid);
Creature creature = (Creature)sceneActor;
if(creature.getMineral()>settleTime[0]){
startQuickTime(possibaleQuickUid,endTick);
break;
}
}
possibaleQuickUids.clear();
}
public void tick() throws InterruptedException {
Iterator<Map.Entry<Integer, SceneActor>> iterator = sceneActorMap.entrySet().iterator();
while (iterator.hasNext()){
@ -161,6 +196,7 @@ public class Scene implements Runnable{
for(Integer removeId : builder.getRemoveActorIdList()){
sceneActorMap.remove(removeId);
}
checkNeedRestartQuickEnd();
for(SceneActor sceneActor : sceneActorMap.values()){
if(sceneActor.getType() != ActorType.Npc){
if(willUpdateActors.contains(sceneActor.getId())){
@ -235,7 +271,11 @@ public class Scene implements Runnable{
if(isEnd){
break;
}
tick++;
if(checkIsEnd()){
break;
}
sysTick();
tick();
if(tick/20 == 1 && tick%20==0){
@ -248,6 +288,14 @@ public class Scene implements Runnable{
}
public boolean checkIsEnd(){
if(tick> SceneManager.bloodyMap.getEndRound() || (quickEnd!=-1 && tick>quickEnd)){
gameEnd();
return true;
}
return false;
}
public void startAllRunning(){
for(SceneActor sceneActor : sceneActorMap.values()){
if(sceneActor.getType()== ActorType.Player){
@ -459,4 +507,24 @@ public class Scene implements Runnable{
public void addCahceBroadMsg(String msg){
cacheMsg.add(msg);
}
public int getQuickEnd() {
return quickEnd;
}
public int getQuickPlayId() {
return quickPlayId;
}
public void startQuickTime(int quickPlayId,int quickEnd){
this.quickPlayId = quickPlayId;
this.quickEnd = quickEnd;
addCahceBroadMsg("进入游戏狂欢时刻,剩余" + (quickEnd-tick)/20 + "秒");
}
public void clearQuickTime(){
this.quickEnd = -1;
this.quickPlayId = 0;
}
}

View File

@ -7,6 +7,7 @@ import com.ljsd.battle.vo.UserBloodySnpInfo;
import com.ljsd.battle.actor.*;
import com.ljsd.battle.vo.FamilyHeroInfo;
import com.ljsd.battle.vo.HeroAttributeEnum;
import com.ljsd.jieling.config.SBloodyBattleSetting;
import com.ljsd.jieling.protocols.CommonProto;
import com.ljsd.jieling.protocols.RoomProto;
@ -93,6 +94,13 @@ public class BeanToProto {
Integer value = item.getValue();
builder.addPosMineral(CommonProto.PosMineral.newBuilder().setPos(key).setNums(value).build());
}
long endTime = SBloodyBattleSetting.sBloodyBattleSetting.getBattleTime();
if(scene.getQuickEnd()!=-1){
long startTime = scene.getStartTime();
endTime = startTime + scene.getQuickEnd()*50;
}
int remainTime = SBloodyBattleSetting.sBloodyBattleSetting.getBattleTime() - (int)((System.currentTimeMillis() - scene.getStartTime()) / 1000);
builder.setRemainTime(remainTime);
builder.addAllBarrierPoint(SceneManager.bloodyMap.getBarrierPoints());
return builder.build();
}

View File

@ -10,6 +10,8 @@ public class BloodyMap {
private int round;
private int endRound;
public BloodyMap(int mapId) {
this.mapId = mapId;
}
@ -35,4 +37,12 @@ public class BloodyMap {
public void setRound(int round) {
this.round = round;
}
public int getEndRound() {
return endRound;
}
public void setEndRound(int endRound) {
this.endRound = endRound;
}
}

View File

@ -107,6 +107,7 @@ public class SceneManager {
}
bloodyMapTmp.setRound(max*20);
bloodyMapTmp.setEndRound(SBloodyBattleSetting.sBloodyBattleSetting.getBattleTime()*20);
bloodyMap = bloodyMapTmp;
calPossiblePoss();

View File

@ -3,6 +3,7 @@ package com.ljsd.battle.statics;
public enum AnalysisEventType {
BATTLE,
DIGGER,
DIGGER_NUMS,
}

View File

@ -19,6 +19,7 @@ public class MessageBoxUtils {
//更新统计数据 数据汇总聚合
analysisEventTypeIntegerMap.put(AnalysisEventType.BATTLE,new BattleAnalysisProcessor());
analysisEventTypeIntegerMap.put(AnalysisEventType.DIGGER,new DiggerAnalysisProcessor());
analysisEventTypeIntegerMap.put(AnalysisEventType.DIGGER_NUMS,new MineralNumsAnalysisProcessor());
}
public static void init(){

View File

@ -0,0 +1,22 @@
package com.ljsd.battle.statics;
import com.ljsd.battle.actor.Scene;
import com.ljsd.jieling.config.SBloodyBattleSetting;
public class MineralNumsAnalysisProcessor implements AnalysisProcessor{
@Override
public void process(Scene scene, AnalysisSourceData analysisSourceData) {
int targetId = analysisSourceData.getTargetId();
int caster = analysisSourceData.getCaster();
int value = analysisSourceData.getValue();
int[] settleTime = SBloodyBattleSetting.sBloodyBattleSetting.getSettleTime();
int quickPlayId = scene.getQuickPlayId();
if(quickPlayId == targetId && caster == -1 && value<settleTime[0]){
scene.clearQuickTime();
}
if(quickPlayId != targetId && caster == 1 && value >= settleTime[0]){
scene.addQuickPossibalePlays(targetId);
}
}
}

View File

@ -12,6 +12,7 @@ import com.ljsd.jieling.handler.map.MapLogic;
import com.ljsd.jieling.logic.GlobalDataManaager;
import com.ljsd.jieling.logic.STableManager;
import com.ljsd.jieling.logic.activity.ActivityLogic;
import com.ljsd.jieling.logic.dao.GuilidManager;
import com.ljsd.jieling.logic.dao.MailingSystemManager;
import com.ljsd.jieling.logic.fight.CheckFight;
import com.ljsd.jieling.logic.hero.HeroLogic;
@ -86,7 +87,7 @@ public class GameApplication {
//http线程池初始化
// HttpPool.init();
GuilidManager.init();
STableManager.initialize("com.ljsd.jieling.config");
//mongo异步数据处理线程
MongoDataHandlerTask.init(configurableApplicationContext);

View File

@ -1282,10 +1282,13 @@ public class MapLogic {
}
List<TeamPosHeroInfo> team = user.getTeamPosManager().getTeamPosForHero().get(teamId);
for (TeamPosHeroInfo teamPosHeroInfo : team) {
if(mapManager.getHeroAllAttributeMap().get(teamPosHeroInfo.getHeroId()).get(HeroAttributeEnum.Hp.getPropertyId())<checkResult[teamPosHeroInfo.getPosition()+1]){
continue;
Map<Integer, Integer> heroAttr = mapManager.getHeroAllAttributeMap().get(teamPosHeroInfo.getHeroId());
if(heroAttr!=null){
if(heroAttr.get(HeroAttributeEnum.Hp.getPropertyId())<checkResult[teamPosHeroInfo.getPosition()+1]){
continue;
}
mapManager.updateHeroOneAttribute(teamPosHeroInfo.getHeroId(), HeroAttributeEnum.CurHP.getPropertyId(), checkResult[teamPosHeroInfo.getPosition()+1]);
}
mapManager.updateHeroOneAttribute(teamPosHeroInfo.getHeroId(), HeroAttributeEnum.CurHP.getPropertyId(), checkResult[teamPosHeroInfo.getPosition()+1]);
}
if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4&&teamId==401){
for (int i = 0 ; i <team.size();i++) {
@ -1293,7 +1296,11 @@ public class MapLogic {
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);
if(mapManager.getHeroAllAttributeMap().get(hero.getId()).get(HeroAttributeEnum.CurHP.getPropertyId())==0){
Map<Integer, Integer> currAttrMap = mapManager.getHeroAllAttributeMap().get(hero.getId());
if(currAttrMap==null){
continue;
}
if(currAttrMap.get(HeroAttributeEnum.CurHP.getPropertyId())==0){
mapManager.removeOneHeroAttribute(hero.getId());
}else{
mapManager.updateHeroOneAttribute(team.get(i).getHeroId(), HeroAttributeEnum.CurHP.getPropertyId(), checkResult[i+2]);
@ -1543,7 +1550,11 @@ public class MapLogic {
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);
if(mapManager.getHeroAllAttributeMap().get(hero.getId()).get(HeroAttributeEnum.CurHP.getPropertyId())==0){
Map<Integer, Integer> currAttrMap = mapManager.getHeroAllAttributeMap().get(hero.getId());
if(currAttrMap==null){
continue;
}
if(currAttrMap.get(HeroAttributeEnum.CurHP.getPropertyId())==0){
mapManager.removeOneHeroAttribute(hero.getId());
}else{
mapManager.updateHeroOneAttribute(team.get(i).getHeroId(), HeroAttributeEnum.CurHP.getPropertyId(), checkResult[i+2]);

View File

@ -209,7 +209,6 @@ public class GlobalDataManaager {
DataManagerDistributor.init();
initServerIsLanEnviornment(configurableApplicationContext);
StoreLogic.checkGlobalStore(true);
GuilidManager.init();
new RPCServerTask(configurableApplicationContext).start();
new RPCGmServerTask(configurableApplicationContext).start();
} catch (Exception e) {

View File

@ -58,8 +58,9 @@ public class BloodLogic {
HeroManager heroManager = user.getHeroManager();
TeamPosManager teamPosManager = user.getTeamPosManager();
List<TeamPosHeroInfo> teamPosHeroInfos = teamPosManager.getTeamPosForHero().get(teamId);
if(teamPosHeroInfos==null){
if(teamPosHeroInfos==null||teamPosHeroInfos.size()<1){
teamPosHeroInfos = teamPosManager.getTeamPosForHero().get(1);
teamId = 1;
}
Iterator<TeamPosHeroInfo> it = teamPosHeroInfos.iterator();
Map<String, FamilyHeroInfo> heroAllAttribute = new HashMap<>();

View File

@ -123,8 +123,8 @@ public class EquipManager extends MongoBase {
if(especialEquip ==null){
return;
}
updateString("especialEquipMap."+equipId+".star",especialEquip.getStar()+1);
especialEquip.setStar(especialEquip.getStar()+1);
especialEquipMap.put(equipId,especialEquip);
updateString("especialEquipMap."+equipId+".star",especialEquip.getStar()+1);
}
}

View File

@ -483,7 +483,7 @@ public class GuildFightLogic {
public static void getFamilyFightRoundInfo(ISession session, MessageTypeProto.MessageType messageType) throws Exception {
RedisUtil redisUtil = RedisUtil.getInstence();
int enemyFamily = getEnemyFamily(UserManager.getUser(session.getUid()).getPlayerInfoManager().getGuildId());
Integer attackCount = redisUtil.getMapEntry(RedisKey.FAMILY_FIGHT_ATTACK_COUNT,"",session.getId(),Integer.class);
Integer attackCount = redisUtil.getMapEntry(RedisKey.FAMILY_FIGHT_ATTACK_COUNT,"",String.valueOf(session.getUid()),Integer.class);
if(attackCount==null){
attackCount = 0;
}
@ -663,7 +663,7 @@ public class GuildFightLogic {
//战绩结算
int getExp = 0;
Double rank = redisUtil.getZSetScore(RedisKey.FAMILY_FIGHT_RANK, "", str);
// rank+=7000;
rank+=7000;
for(Map.Entry<Integer, SGuildScoreConfig> entry:sGuildScoreConfigMap.entrySet()){
if(rank<entry.getValue().getScoreMin()||rank>entry.getValue().getScoreMax()){
continue;
@ -848,24 +848,37 @@ public class GuildFightLogic {
timeRound = sGuildSetting.getPrepareTime();
if(status==0){
LOGGER.info("阶段变为布防");
Map<Integer, GuildInfo> guildInfoMap = GuilidManager.guildInfoMap;
if(guildInfoMap!=null&&guildInfoMap.size()>0){
for(Map.Entry<Integer, GuildInfo> entry:guildInfoMap.entrySet()){
int build = 0;
Map<Integer, Set<Integer>> members = entry.getValue().getMembers();
for(Map.Entry<Integer, Set<Integer>> member:members.entrySet()){
for(Integer uid:member.getValue()){
entry.getValue().updateDefendInfo(uid,build%3+1);
build=build%3+1;
}
}
}
}
status = 1;
}
}else if(flagTimeRound(sGuildSetting.getMatchTime(),hour,minute)){
timeRound = sGuildSetting.getMatchTime();
if(status==1){
if(status!=2){
status = 2;
LOGGER.info("阶段变为匹配");
startMatching = true;
}
startMatching = true;
}else if(flagTimeRound(sGuildSetting.getBattleTime(),hour,minute)){
timeRound = sGuildSetting.getBattleTime();
if(status == 2){
if(status != 3){
status = 3;
LOGGER.info("阶段变为进攻");
}
}else if(flagTimeRound(sGuildSetting.getSettleTime(),hour,minute)){
timeRound = sGuildSetting.getSettleTime();
if(status==3){
if(status!=4){
accountFamilyFightResult();
MongoUtil.getLjsdMongoTemplate().lastUpdate();
status = 4;

View File

@ -374,6 +374,11 @@ public class HeroLogic {
for(Map.Entry<Integer, List<TeamPosHeroInfo>> item :teamPosForHero.entrySet()){
int teamId = item.getKey();
List<TeamPosHeroInfo> teamPosHeroInfoList = item.getValue();
if(teamId==501){
if(teamPosHeroInfoList==null|teamPosHeroInfoList.size()<1){
teamPosHeroInfoList = teamPosForHero.get(1);
}
}
List<TeamPosForPokenInfo> teamPosForPokenInfos = teamPosForPoken.get(teamId);
if(null == teamPosForPokenInfos){
teamPosForPokenInfos = new ArrayList<>(1);
@ -1368,9 +1373,16 @@ public class HeroLogic {
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.EQUIP_WEAR_RESPONSE.getNumber(),"法宝智能穿戴一个");
}else{
int[] equipTalismanaUnlock = SGameSetting.getGameSetting().getEquipTalismanaUnlock();
if(user.getPlayerInfoManager().getLevel()<equipTalismanaUnlock[0]||hero.getLevel()<equipTalismanaUnlock[1]){
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.EQUIP_WEAR_RESPONSE.getNumber(),"玩家等级或妖灵师等级不够,无法装备!");
return;
if(equipTalismanaUnlock[0]==1){
if(user.getPlayerInfoManager().getLevel()<equipTalismanaUnlock[0]){
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.EQUIP_WEAR_RESPONSE.getNumber(),"玩家等级不够,无法装备!");
return;
}
}else{
if(hero.getStar()<equipTalismanaUnlock[1]){
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.EQUIP_WEAR_RESPONSE.getNumber(),"妖灵师等级不够,无法装备!");
return;
}
}
hero.updateEspecial(equipIds.get(0));
}