增加新的推送礼包
parent
8c39e341c9
commit
957975cee1
|
@ -35,6 +35,7 @@ import com.ljsd.jieling.logic.player.PlayerLogic;
|
|||
import com.ljsd.jieling.logic.question.QuestionLogic;
|
||||
import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
|
||||
import com.ljsd.jieling.logic.store.StoreLogic;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.PushRechargeType;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.bean.ReceiveWelfareBag;
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
|
@ -90,9 +91,14 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
|||
user.getUserMissionManager().onGameEvent(user, GameEvent.ONE_MISSION_TYPE_CONSUME,MissionType.LOGIN_TIMES,0,lastLoginTime);
|
||||
}
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.EVERY_DAY_UPDATE,MissionType.LOGIN_TIMES,0);
|
||||
// 开服时间戳
|
||||
long openTime = TimeUtils.stringToTimeLong2(GameApplication.serverConfig.getOpenTime());
|
||||
long now = TimeUtils.now();
|
||||
//推送礼包
|
||||
long haveTime = now - openTime;
|
||||
int nowDay = (int)(haveTime/TimeUtils.ONE_DAY) + 1;
|
||||
BuyGoodsNewLogic.openPush(iSession, user, PushRechargeType.OPEN_DAY.getType(),nowDay);
|
||||
playerInfoManager.setLoginTime(now);
|
||||
|
||||
List<CommonProto.NewPlayerGuidePoint> list = new ArrayList<>();
|
||||
Map<Integer, Integer> guidePoints = playerInfoManager.getGuidePoints();
|
||||
for(Map.Entry<Integer,Integer> guideItem : guidePoints.entrySet()){
|
||||
|
@ -195,8 +201,6 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
|||
List<CommonProto.PracticeSkillInfo> practiceSkillInfos = getPracticeSkillInfos(heroManager);
|
||||
List<CommonProto.FaBaoSoulInfo> faBaoSoulInfos = getFaBaoSoulInfos(heroManager);
|
||||
|
||||
// 开服时间戳
|
||||
long openTime = TimeUtils.stringToTimeLong2(GameApplication.serverConfig.getOpenTime());
|
||||
PlayerInfoProto.GetPlayerInfoResponse getPlayerInfoResponse = PlayerInfoProto.GetPlayerInfoResponse.newBuilder()
|
||||
.setPlayer(player)
|
||||
.addAllNewPlayerGuidePoint(list)
|
||||
|
|
|
@ -41,6 +41,7 @@ import com.ljsd.jieling.logic.ridingSward.RidingSwardLogic;
|
|||
import com.ljsd.jieling.logic.sevenworld.SevenWorldLogic;
|
||||
import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
|
||||
import com.ljsd.jieling.logic.store.StoreLogic;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.PushRechargeType;
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
import com.ljsd.jieling.netty.cocdex.Tea;
|
||||
import com.ljsd.jieling.network.server.ProtocolsManager;
|
||||
|
@ -505,6 +506,9 @@ public class GlobalDataManaager implements IManager {
|
|||
user.getPlayerInfoManager().setDayOfOnlineTime(0);
|
||||
//刷新登录任务
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.ONE_MISSION_TYPE_CONSUME,MissionType.LOGIN_TIMES,0,user.getPlayerInfoManager().getLoginTime());
|
||||
//刷新推送礼包
|
||||
int nowDay = GameApplication.serverConfig.getServerOpenDay(TimeUtils.now());
|
||||
BuyGoodsNewLogic.openPush(session, user, PushRechargeType.OPEN_DAY.getType(),nowDay);
|
||||
flag = true;
|
||||
}
|
||||
user.getPlayerInfoManager().setLoginTime(TimeUtils.now());
|
||||
|
|
|
@ -58,4 +58,12 @@ public class OnlineUserManager {
|
|||
}
|
||||
return tokenMap.containsKey(token);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有的在线玩家数据
|
||||
* @return
|
||||
*/
|
||||
public static Map<Integer, ISession> getAllOnlineUids(){
|
||||
return sessionMap;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
package com.ljsd.jieling.logic.dao;
|
||||
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.common.mogodb.MongoBase;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.annotation.Transient;
|
||||
import org.springframework.data.mongodb.core.mapping.Document;
|
||||
import org.springframework.data.mongodb.core.mapping.Field;
|
||||
import util.TimeUtils;
|
||||
|
||||
@Document( collection = "server_config")
|
||||
public class ServerConfig extends MongoBase {
|
||||
|
@ -85,4 +87,25 @@ public class ServerConfig extends MongoBase {
|
|||
public void setRestartTime(String restartTime) {
|
||||
this.restartTime = restartTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取服务器的开服时间戳
|
||||
* @return
|
||||
*/
|
||||
public long getServerOpenTimeLong(){
|
||||
long openTime = TimeUtils.stringToTimeLong2(GameApplication.serverConfig.getOpenTime());
|
||||
return openTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取服务器当前是开服第几天
|
||||
* @param now
|
||||
* @return
|
||||
*/
|
||||
public int getServerOpenDay(long now){
|
||||
long openTime = this.getServerOpenTimeLong();
|
||||
long haveTime = now - openTime;
|
||||
int nowDay = (int)(haveTime/TimeUtils.ONE_DAY) + 1;
|
||||
return nowDay;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1024,7 +1024,8 @@ public class BuyGoodsNewLogic {
|
|||
if(type == PushRechargeType.FABAO_ZHOAHUAN.getType() ||
|
||||
type == PushRechargeType.XUNAXIAN_ZHOAHUAN.getType() ||
|
||||
type == PushRechargeType.XIANDOU_ZHOAHUAN.getType() ||
|
||||
type == PushRechargeType.QIANNENG_UP.getType()){
|
||||
type == PushRechargeType.QIANNENG_UP.getType()||
|
||||
type == PushRechargeType.OPEN_DAY.getType()){
|
||||
int[] bagIds = judgePushConditionMulti(user,con,true);
|
||||
// todo DayPushNum和AllPuthNum可以放到redis里操作
|
||||
if (statistics >0 && info.getDayPushNum(pushId)>= statistics && count > 0 && info.getAllPuthNum(pushId)>= count){
|
||||
|
@ -1169,6 +1170,16 @@ public class BuyGoodsNewLogic {
|
|||
break;
|
||||
case 19://潜能(触发了直接返回礼包,由外面判断)
|
||||
break;
|
||||
case 20://开服天数礼包(开服指定天数登录自动触发)
|
||||
int day = condition[1];
|
||||
String openTime = GameApplication.serverConfig.getOpenTime();
|
||||
long openTimeLong = TimeUtils.stringToTimeLong2(openTime);
|
||||
long haveTime = System.currentTimeMillis() - openTimeLong;
|
||||
int nowDay = (int)(haveTime/TimeUtils.ONE_DAY) + 1;
|
||||
if(nowDay != day){
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
default:break;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -43,6 +43,8 @@ public enum PushRechargeType {
|
|||
XUNAXIAN_ZHOAHUAN(17),
|
||||
XIANDOU_ZHOAHUAN(18),
|
||||
QIANNENG_UP(19),
|
||||
//开服天数
|
||||
OPEN_DAY(20),
|
||||
;
|
||||
|
||||
private int type;
|
||||
|
|
Loading…
Reference in New Issue