循环活动
parent
79852857ee
commit
cf5bd2e6be
|
|
@ -1,6 +1,5 @@
|
||||||
package com.ljsd.jieling.logic.activity;
|
package com.ljsd.jieling.logic.activity;
|
||||||
|
|
||||||
import com.ljsd.GameApplication;
|
|
||||||
import com.ljsd.jieling.jbean.ActivityMission;
|
import com.ljsd.jieling.jbean.ActivityMission;
|
||||||
import com.ljsd.jieling.jbean.ActivityProgressInfo;
|
import com.ljsd.jieling.jbean.ActivityProgressInfo;
|
||||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||||
|
|
@ -14,7 +13,11 @@ import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
|
||||||
import com.ljsd.jieling.logic.store.newRechargeInfo.bean.AbstractWelfareBag;
|
import com.ljsd.jieling.logic.store.newRechargeInfo.bean.AbstractWelfareBag;
|
||||||
import com.ljsd.jieling.logic.store.newRechargeInfo.rechargeHandler.RechargeHandler;
|
import com.ljsd.jieling.logic.store.newRechargeInfo.rechargeHandler.RechargeHandler;
|
||||||
import com.ljsd.jieling.network.session.ISession;
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
import config.*;
|
import com.ljsd.jieling.util.ToolsUtil;
|
||||||
|
import config.SGlobalActivity;
|
||||||
|
import config.SGoodsConfig;
|
||||||
|
import config.SRechargeCommodityNewConfig;
|
||||||
|
import config.SThemeActivityShop;
|
||||||
import manager.STableManager;
|
import manager.STableManager;
|
||||||
import rpc.protocols.CommonProto;
|
import rpc.protocols.CommonProto;
|
||||||
import util.TimeUtils;
|
import util.TimeUtils;
|
||||||
|
|
@ -49,6 +52,7 @@ public class ContinuousGiftActivity extends AbstractActivity {
|
||||||
// 初始化阶段奖励
|
// 初始化阶段奖励
|
||||||
ActivityLogic.getInstance().initOtherMission(mission, new ArrayList<>());
|
ActivityLogic.getInstance().initOtherMission(mission, new ArrayList<>());
|
||||||
user.getActivityManager().getActivityMissionMap().put(id, mission);
|
user.getActivityManager().getActivityMissionMap().put(id, mission);
|
||||||
|
LOGGER.info("连续礼包活动初始化..."+id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -74,7 +78,7 @@ public class ContinuousGiftActivity extends AbstractActivity {
|
||||||
* @param giftId
|
* @param giftId
|
||||||
* @param missionMap
|
* @param missionMap
|
||||||
*/
|
*/
|
||||||
private void giftHandle(User user, int giftId, int giftNum, int type){
|
public void giftHandle(User user, int giftId, int giftNum, int type){
|
||||||
if (giftId < 0 || giftNum <= 0){
|
if (giftId < 0 || giftNum <= 0){
|
||||||
// 非礼包处理
|
// 非礼包处理
|
||||||
return;
|
return;
|
||||||
|
|
@ -87,6 +91,7 @@ public class ContinuousGiftActivity extends AbstractActivity {
|
||||||
Collection<SThemeActivityShop> themeShops = SThemeActivityShop.themeMap.getOrDefault(id, new HashMap<>(0)).values();
|
Collection<SThemeActivityShop> themeShops = SThemeActivityShop.themeMap.getOrDefault(id, new HashMap<>(0)).values();
|
||||||
|
|
||||||
for (SThemeActivityShop theme : themeShops) {
|
for (SThemeActivityShop theme : themeShops) {
|
||||||
|
LOGGER.info("连续礼包活动日志,acid:{},uid:{},giftid:{},num:{},themeid:{},themegiftid:{},themetype:{}",id,user.getId(),giftId,giftNum,theme.getId(),theme.getGoodId(),theme.getGoodType());
|
||||||
if (theme.getGoodId() == giftId && theme.getGoodType() == type){
|
if (theme.getGoodId() == giftId && theme.getGoodType() == type){
|
||||||
// 记录礼包购买次数
|
// 记录礼包购买次数
|
||||||
ActivityProgressInfo current = missionMap.getOrDefault(theme.getId(),new ActivityProgressInfo());
|
ActivityProgressInfo current = missionMap.getOrDefault(theme.getId(),new ActivityProgressInfo());
|
||||||
|
|
@ -94,8 +99,8 @@ public class ContinuousGiftActivity extends AbstractActivity {
|
||||||
// 当前礼包状态处理
|
// 当前礼包状态处理
|
||||||
if (checkBuyGiftLimit(user,theme.getId(),current.getProgrss())){
|
if (checkBuyGiftLimit(user,theme.getId(),current.getProgrss())){
|
||||||
current.setState(8);
|
current.setState(8);
|
||||||
missionMap.put(theme.getId(),current);
|
|
||||||
}
|
}
|
||||||
|
missionMap.put(theme.getId(),current);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -171,16 +176,18 @@ public class ContinuousGiftActivity extends AbstractActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<CommonProto.ActivityInfo.MissionInfo> getAllMissInfo(User user,ActivityMission activityMission, Set<Integer> filter) {
|
public List<CommonProto.ActivityInfo.MissionInfo> getAllMissInfo(User user,ActivityMission activityMission, Set<Integer> filter) {
|
||||||
long now = TimeUtils.now();
|
|
||||||
long start = getSrartTime();
|
|
||||||
long end = getEndTime();
|
|
||||||
// 验证活动是否开启
|
|
||||||
if (now < start || now > end){
|
|
||||||
return new ArrayList<>();
|
|
||||||
}
|
|
||||||
if (activityMission == null){
|
if (activityMission == null){
|
||||||
|
LOGGER.error("活动不存在数据库中,id:{},uid:{}",id,user.getId());
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
SGlobalActivity activity = SGlobalActivity.getsGlobalActivityMap().get(id);
|
||||||
|
if (activity == null){
|
||||||
|
LOGGER.error("活动不存在数据表中,id:{}",id);
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
long now = TimeUtils.now();
|
||||||
|
long createTime = user.getPlayerInfoManager().getCreateTime();
|
||||||
|
long start = ToolsUtil.getTimeLong(activity.getStartTimeLong(),activity.getEndTimeLong(),activity.getTime(),createTime,1, activity.getCycleMinute());
|
||||||
// 更新记录天数
|
// 更新记录天数
|
||||||
activityMission.setV(TimeUtils.getSoFarWentDays(start, now)+1);
|
activityMission.setV(TimeUtils.getSoFarWentDays(start, now)+1);
|
||||||
// 库里存储的活动档位信息
|
// 库里存储的活动档位信息
|
||||||
|
|
@ -239,53 +246,13 @@ public class ContinuousGiftActivity extends AbstractActivity {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 开始时间
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public long getSrartTime(){
|
|
||||||
long startTime = 0;
|
|
||||||
SGlobalActivity activity = SGlobalActivity.getsGlobalActivityMap().get(id);
|
|
||||||
// 绝对时间
|
|
||||||
if (activity.getTime() == ActivityType.OPEN_TYPE_TIME){
|
|
||||||
startTime = activity.getStartTimeLong();
|
|
||||||
}
|
|
||||||
// 开服时间
|
|
||||||
else if (activity.getTime() == ActivityType.OPEN_TYPE_SERVER) {
|
|
||||||
String openTime = GameApplication.serverConfig.getOpenTime();
|
|
||||||
long timeLong2 = TimeUtils.stringToTimeLong2(openTime);
|
|
||||||
startTime = timeLong2 + activity.getStartTimeLong() * 1000;
|
|
||||||
}
|
|
||||||
return startTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 结束时间
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public long getEndTime(){
|
|
||||||
long endTime = 0;
|
|
||||||
SGlobalActivity activity = SGlobalActivity.getsGlobalActivityMap().get(id);
|
|
||||||
// 绝对时间
|
|
||||||
if (activity.getTime() == ActivityType.OPEN_TYPE_TIME){
|
|
||||||
endTime = activity.getEndTimeLong();
|
|
||||||
}
|
|
||||||
// 开服时间
|
|
||||||
else if (activity.getTime() == ActivityType.OPEN_TYPE_SERVER) {
|
|
||||||
String openTime = GameApplication.serverConfig.getOpenTime();
|
|
||||||
long timeLong2 = TimeUtils.stringToTimeLong2(openTime);
|
|
||||||
endTime = timeLong2 + activity.getEndTimeLong() * 1000;
|
|
||||||
}
|
|
||||||
return endTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 验证前置礼包购买状态
|
* 验证前置礼包购买状态
|
||||||
* @param user
|
* @param user
|
||||||
* @param boxId
|
* @param boxId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private boolean checkBuyAgo(User user, int boxId){
|
public boolean checkBuyAgo(User user, int boxId){
|
||||||
// 获取消息
|
// 获取消息
|
||||||
Map<Integer, ActivityProgressInfo> missionMap = user.getActivityManager().getActivityMissionMap().get(id).getActivityMissionMap();
|
Map<Integer, ActivityProgressInfo> missionMap = user.getActivityManager().getActivityMissionMap().get(id).getActivityMissionMap();
|
||||||
SThemeActivityShop themes = STableManager.getConfig(SThemeActivityShop.class).get(boxId);
|
SThemeActivityShop themes = STableManager.getConfig(SThemeActivityShop.class).get(boxId);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package com.ljsd.jieling.logic.activity;
|
package com.ljsd.jieling.logic.activity;
|
||||||
|
|
||||||
import com.ljsd.GameApplication;
|
|
||||||
import com.ljsd.jieling.globals.Global;
|
import com.ljsd.jieling.globals.Global;
|
||||||
import com.ljsd.jieling.jbean.ActivityMission;
|
import com.ljsd.jieling.jbean.ActivityMission;
|
||||||
import com.ljsd.jieling.jbean.ActivityProgressInfo;
|
import com.ljsd.jieling.jbean.ActivityProgressInfo;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue