zhangshanxue 2020-06-08 11:15:49 +08:00
commit 78905f7b0b
9 changed files with 55 additions and 27 deletions

View File

@ -1328,17 +1328,17 @@ public class TimeUtils {
}
/**
*
*
* @param hour
* @param lastOrUnder truefalse
* @return
*/
public static long getLastOrUnderHour(long time,int hour,boolean lastOrUnder){
public static long getLastOrUnderHour(long time,int hour,int minute,boolean lastOrUnder){
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(time);
int i = cal.get(Calendar.HOUR_OF_DAY);
cal.set(Calendar.HOUR_OF_DAY,hour);
cal.set(Calendar.MINUTE,0);
cal.set(Calendar.MINUTE,minute);
cal.set(Calendar.SECOND,0);
cal.set(Calendar.MILLISECOND,0);
long result = cal.getTimeInMillis();

View File

@ -2589,8 +2589,10 @@ public class MapLogic {
}else{
//todo 加血逻辑
int maxHp = propertyMap.get(HeroAttributeEnum.Hp.getPropertyId());
propertyMap.put(HeroAttributeEnum.CurHP.getPropertyId(),curHp+maxHp*5000/10000);
int resultHp = Math.min(curHp+maxHp*5000/10000,maxHp);
propertyMap.put(HeroAttributeEnum.CurHP.getPropertyId(),resultHp);
trialInfo.getHeroInfo().get(heroId).setProperty(propertyMap);
mapManager.updateTrialAddHpCount(1);
mapManager.updateTrailHeroInfo(heroInfo);
}
MessageUtil.sendMessage(session,1,messageType.getNumber(),null);

View File

@ -803,6 +803,10 @@ public class MapManager extends MongoBase {
trialInfo.setQuitMapId(mapId);
updateString("trialInfo",trialInfo);
}
public void updateTrialAddHpCount(int count){
trialInfo.setAddHpCount(count+trialInfo.getAddHpCount());
updateString("trialInfo",trialInfo);
}
}

View File

@ -282,6 +282,7 @@ public class BehaviorUtil {
.setUnitSkillIds(heroSkill.substring(0,heroSkill.length()-1))
.setProperty(property.substring(0, property.length()-1))
.setPosition(teamPosHeroInfo.getPosition())
.setStar(trailHero.getStar())
.build();
heroFightInfos.add(heroFightInfo);
}

View File

@ -93,6 +93,7 @@ public class TowerMap extends AbstractMap {
if(!trialInfo.getMapInfo().isEmpty()&&mapManager.getCurMapId()==0){
mapManager.setMapInfo(trialInfo.getMapInfo());
mapManager.setCurMapId(trialInfo.getQuitMapId());
mapManager.setCurXY(trialInfo.getCurXY());
List<CommonProto.Cell> cells = new ArrayList<>(trialInfo.getMapInfo().size());
for (Map.Entry<Integer, Cell> entry : trialInfo.getMapInfo().entrySet()) {
cellToProto(cells, entry);
@ -134,6 +135,7 @@ public class TowerMap extends AbstractMap {
if(teamPosHeroInfos!=null&&teamPosHeroInfos.size()==1){
mapEnterResponse.setCurHero(teamPosHeroInfos.get(0).getHeroId());
}
mapEnterResponse.setAddHpCount(trialInfo.getAddHpCount());
}
@Override
@ -384,8 +386,8 @@ public class TowerMap extends AbstractMap {
createCell=callChief(user);
}
remainHp = checkResult[2];
BehaviorUtil.destoryApointXY(user, destoryXY);
}
BehaviorUtil.destoryApointXY(user, destoryXY);
//生成传送门,需要在删点之后
if(createCell!=null){
mapManager.addOrUpdateCell(createCell.getCellId(),createCell);

View File

@ -1289,7 +1289,7 @@ public class ActivityLogic implements IEventHandler{
}
public void getTreasureNextRefreshTime(ISession session,MessageTypeProto.MessageType messageType) throws Exception {
int dayRefreshTime=(int) (TimeUtils.getLastOrUnderHour(TimeUtils.now(), 5, false)/1000);
int dayRefreshTime=(int) (TimeUtils.getLastOrUnderHour(TimeUtils.now(), 5,0, false)/1000);
int weekRefreshTime = (int)(TimeUtils.getNextWeekendStartTime(1,5)/1000);
PlayerInfoProto.TreasureRefreshTimeResponse response = PlayerInfoProto.TreasureRefreshTimeResponse.newBuilder().setDayTime(dayRefreshTime).setWeekTime(weekRefreshTime).build();
MessageUtil.sendMessage(session,1,messageType.getNumber(),response,true);

View File

@ -367,7 +367,7 @@ public class PlayerManager extends MongoBase {
}else {
maxTime = TimeUtils.now()/1000+config.getContinueTime()[0];
}
maxTime = (int)(TimeUtils.getLastOrUnderHour(maxTime*1000,5,true)/1000);
maxTime = (int)(TimeUtils.getLastOrUnderHour(maxTime*1000,5,0,true)/1000);
newVipInfo.setEffectTime((int)maxTime);
}
this.vipInfo.put(privilageId,newVipInfo);

View File

@ -96,7 +96,7 @@ public class UserMissionManager extends MongoBase {
case TREASH_REFRESH:
int[] refreshIds =resetTreasureTaskInfo(1,missionTypeEnumListMap,treasureCumulationData);
treasureCumulationData = new CumulationData();
int dayRefreshTime=(int) (TimeUtils.getLastOrUnderHour(TimeUtils.now(), 5, false)/1000);
int dayRefreshTime=(int) (TimeUtils.getLastOrUnderHour(TimeUtils.now(), 5, 0,false)/1000);
CommonProto.RefreshTask.Builder task = treasureIndicationBuild(1, refreshIds).setRefreshTime(dayRefreshTime);
PlayerInfoProto.TreasureRefreshIndication indication1 = PlayerInfoProto.TreasureRefreshIndication.newBuilder().addTasks(task.build()).build();
MessageUtil.sendIndicationMessage(session,1, MessageTypeProto.MessageType.TREASURE_REFRESH_INDICATION_VALUE,indication1,true);

View File

@ -88,32 +88,51 @@ public class DeathPathLogic {
private void doCheck(){
//初始化字段
int[] setting = SGuildSetting.sGuildSetting.getGuildWarOpenTime();
if(guildWarOpenTime==null) {
guildWarOpenTime = new int[8];
//判断开启类型
if(setting[0]==2){
for(int i = 1;i<setting.length;i++){
guildWarOpenTime[setting[i]]= 1;
if(setting[i]!=7){
guildWarOpenTime[setting[i]+1]= -1;
}else{
guildWarOpenTime[1] = -1;
}
}
} else {
for(int i = 0 ; i<guildWarOpenTime.length;i++){
guildWarOpenTime[i] = 1;
}
}
}
if(guildWarTime==null){
guildWarTime = SGuildSetting.sGuildSetting.getGuildWarTime();
}
TimeControllerOfFunction timeControllerOfFunction = GlobalDataManaager.getInstance().getTimeControllerOfFunctionByFunctinoType(FunctionIdEnum.DeathPath);
if(timeControllerOfFunction==null){
status = -1;
return;
}
if(guildWarOpenTime==null){
guildWarOpenTime = new int[8];
int[] setting = SGuildSetting.sGuildSetting.getGuildWarOpenTime();
if(setting[0]==2){
for(int i = 1;i<setting.length;i++){
guildWarOpenTime[setting[i]]= 1;
if(setting[i]!=7){
guildWarOpenTime[setting[i]+1]= -1;
}else{
guildWarOpenTime[1] = -1;
}
}
} else {
for(int i = 0 ; i<guildWarOpenTime.length;i++){
guildWarOpenTime[i] = 1;
}
}
//第一次开启时间判断
long firstStartTime = TimeUtils.getLastOrUnderHour(timeControllerOfFunction.getStartTime(), guildWarTime[0][0], guildWarTime[0][1], false);
if(setting[0]==2&&guildWarOpenTime!=null) {
int dayOfWeek = TimeUtils.getDayOfWeek(firstStartTime);
while(guildWarOpenTime[dayOfWeek]==0){
if(dayOfWeek==0){
dayOfWeek=7;
}
firstStartTime+=firstStartTime+TimeUtils.DAY;
}
}
if(guildWarTime==null){
guildWarTime = SGuildSetting.sGuildSetting.getGuildWarTime();
if(TimeUtils.now()<firstStartTime){
status = -1;
return;
}
isOpen();
}