Merge branch 'dh_dev_fund' into master_test_gn
commit
708cc0b718
|
@ -225,7 +225,9 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
|||
ReportUtil.onReportEvent(user, ReportEventEnum.APP_LOGIN.getType());
|
||||
try {
|
||||
//hotfix
|
||||
Poster.getPoster().dispatchEvent(new SuperBoxEvent(user.getId(),-1));
|
||||
Poster.getPoster().dispatchEvent(new SuperBoxEvent(user.getId(),SuperBoxEvent.default_id));
|
||||
// 超值基金,老玩家兼容
|
||||
Poster.getPoster().dispatchEvent(new SuperBoxEvent(user.getId(),SuperBoxEvent.fund_old_user));
|
||||
user.getUserMissionManager().onGameEvent(user,GameEvent.DAILY_TASK_TYPE,0,user);
|
||||
MessageUtil.sendIndicationMessage(iSession, 1, MessageTypeProto.MessageType.WorldLevelIndication_VALUE, PlayerInfoProto.WorldLevelIndication.newBuilder().setWorldLeve(GlobleSystemLogic.getGloableWorldLeveCache()).build(), true);
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GET_PLAYERINFO_RESPONSE_VALUE, getPlayerInfoResponse, true);
|
||||
|
|
|
@ -14,8 +14,8 @@ public class Cmd_fightrecord extends GmAbstract {
|
|||
@Override
|
||||
public String exec2(String[] args){
|
||||
// 获取玩家战报系统
|
||||
String sign = Optional.ofNullable(args[0]).orElse("");
|
||||
String content = Optional.ofNullable(args[1]).orElse("");
|
||||
String sign = args.length>0 ? args[0]:"";
|
||||
String content = args.length>1 ? args[1]:"";
|
||||
String result = "";
|
||||
if (sign.equals("delete")){
|
||||
FightRecordLogic.getInstance().delete();
|
||||
|
|
|
@ -382,8 +382,8 @@ public class GlobalDataManaager implements IManager {
|
|||
// 道具刷新
|
||||
BuyGoodsNewLogic.refreshWelfareState(user);
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.LOGIN_GAME,0);
|
||||
// 惊喜礼盒,事件推送
|
||||
Poster.getPoster().dispatchEvent(new SuperBoxEvent(user.getId(),-1));
|
||||
// 惊喜礼盒,超值基金,零点逻辑(可以同用一个状态)
|
||||
Poster.getPoster().dispatchEvent(new SuperBoxEvent(user.getId(),SuperBoxEvent.fund_zero_init));
|
||||
// 心愿格子信息刷新
|
||||
HeroLogic.getInstance().resetWishDrawCardInfoMap(user);
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ public abstract class AbstractActivity implements IActivity, IEventHandler {
|
|||
@Override
|
||||
public void update(User user, int count) {
|
||||
ActivityMission activityMission = user.getActivityManager().getActivityMissionMap().get(id);
|
||||
if( null == activityMission){
|
||||
if(null == activityMission){
|
||||
return;
|
||||
}
|
||||
updateProgressWithUser(user, activityMission, count);
|
||||
|
@ -114,6 +114,32 @@ public abstract class AbstractActivity implements IActivity, IEventHandler {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查活动是否完成或者可以领取
|
||||
* @param uid
|
||||
* @param activityId
|
||||
* @param activityMission
|
||||
* @return
|
||||
*/
|
||||
public boolean checkActivityMissionFinishAndTake(int uid,int activityId,ActivityMission activityMission) {
|
||||
Map<Integer, ActivityProgressInfo> activityProgressInfoMap = activityMission.getActivityMissionMap();
|
||||
if (activityProgressInfoMap.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
for (Map.Entry<Integer, ActivityProgressInfo> item : activityProgressInfoMap.entrySet()) {
|
||||
ActivityProgressInfo activityProgressInfo = item.getValue();
|
||||
int missionStatus = activityProgressInfo.getState();
|
||||
if (missionStatus == ActivityType.WILL_TAKE) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(activityId);
|
||||
if(sGlobalActivity.getResetGrade()==0){
|
||||
activityMission.setActivityState(ActivityType.FINISH_STATE);
|
||||
Poster.getPoster().dispatchEvent(new ActivityStateChangeEvent(uid,activityId,ActivityType.FINISH_STATE));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 领奖默认方法 走统一奖励配置表
|
||||
|
@ -151,7 +177,7 @@ public abstract class AbstractActivity implements IActivity, IEventHandler {
|
|||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, reward, BIReason.TAKE_ACTIVITY_REWARD);
|
||||
checkAndSetProgress(activityMission, activityProgressInfo, missionId);
|
||||
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(id);
|
||||
if (null != sGlobalActivity && ActivityLogic.getInstance().checkActivityMissionFinishAndTaked(session.getUid(),id, activityMission) && sGlobalActivity.getResetGrade() == 1) {
|
||||
if (null != sGlobalActivity && checkActivityMissionFinishAndTake(session.getUid(),id, activityMission) && sGlobalActivity.getResetGrade() == 1) {
|
||||
reSetValue(user);
|
||||
if(sGlobalActivity.getType() != ActivityType.OnlineReward) {
|
||||
ActivityMission newmiss = user.getActivityManager().getActivityMissionMap().get(id);
|
||||
|
@ -162,7 +188,6 @@ public abstract class AbstractActivity implements IActivity, IEventHandler {
|
|||
sendActivityProgress(session, activityMission, Collections.singleton(missionId));
|
||||
}
|
||||
}
|
||||
// KtEventUtils.onKtEvent(user, ParamEventBean.UserActivityEvent, id, missionId);
|
||||
reportTakeActivityReward(user,reward,missionId);
|
||||
PlayerInfoProto.TakeActivityRewardResponse build = PlayerInfoProto.TakeActivityRewardResponse.newBuilder().setDrop(drop).build();
|
||||
MessageUtil.sendMessage(session, 1, rewardResponseValue, build, true);
|
||||
|
@ -175,6 +200,12 @@ public abstract class AbstractActivity implements IActivity, IEventHandler {
|
|||
ReportUtil.onReportEvent(user, ReportEventEnum.COMPLETE_ACTIVITY.getType(),String.valueOf(id),String.valueOf(missionId),itemId,itemNum,new Date());
|
||||
}
|
||||
|
||||
protected void reportTakeActivityReward(User user, List<int[][]> reward, int missionId) throws Exception {
|
||||
for (int[][] inits : reward) {
|
||||
reportTakeActivityReward(user,inits,missionId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 领取所有活动奖励 有的活动是重置类型 迭代处理
|
||||
*/
|
||||
|
@ -346,6 +377,13 @@ public abstract class AbstractActivity implements IActivity, IEventHandler {
|
|||
}
|
||||
}
|
||||
|
||||
public void sendActivityProgress(User user, ActivityMission activityMission, Set<Integer> filterMissId) {
|
||||
ISession session = OnlineUserManager.sessionMap.get(user.getId());
|
||||
if (session != null){
|
||||
sendActivityProgress(session,activityMission,filterMissId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void setOpenState(User user,int openState){
|
||||
ActivityMission activityMission = user.getActivityManager().getActivityMissionMap().get(id);
|
||||
|
|
|
@ -288,6 +288,7 @@ public class ActivityLogic implements IEventHandler{
|
|||
activityMission.setOpenType(1);
|
||||
activityMission.setV(0);
|
||||
activityMission.setActivityState(ActivityType.OPEN_STATE);
|
||||
activityMission.setCreatTime(TimeUtils.now());
|
||||
}
|
||||
|
||||
public LuckWheelMission getLuckWheel(ActivityManager activityManager, int type) {
|
||||
|
@ -741,36 +742,12 @@ public class ActivityLogic implements IEventHandler{
|
|||
if (activityMission.getActivityState() != ActivityType.OPEN_STATE) {
|
||||
continue;
|
||||
}
|
||||
checkActivityMissionFinishAndTaked(user.getId(),item.getKey(), activityMission);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean checkActivityMissionFinishAndTaked(int uid,int activityId, ActivityMission activityMission) {
|
||||
Map<Integer, ActivityProgressInfo> activityProgressInfoMap = activityMission.getActivityMissionMap();
|
||||
for (Map.Entry<Integer, ActivityProgressInfo> item : activityProgressInfoMap.entrySet()) {
|
||||
ActivityProgressInfo activityProgressInfo = item.getValue();
|
||||
int missionStatus = activityProgressInfo.getState();
|
||||
if (missionStatus == ActivityType.WILL_TAKE) {
|
||||
return false;
|
||||
}
|
||||
if (SGlobalActivity.getsGlobalActivityMap().get(activityId).getType() == ActivityType.TREASURE) {
|
||||
if (missionStatus == ActivityType.HAD_TAKED) {
|
||||
return false;
|
||||
AbstractActivity activityType = ActivityTypeEnum.getActicityType(item.getKey());
|
||||
if (activityType != null){
|
||||
activityType.checkActivityMissionFinishAndTake(user.getId(),item.getKey(), activityMission);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (activityProgressInfoMap.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(activityId);
|
||||
if(sGlobalActivity.getResetGrade()==0){
|
||||
activityMission.setActivityState(ActivityType.FINISH_STATE);
|
||||
Poster.getPoster().dispatchEvent(new ActivityStateChangeEvent(uid,activityId,ActivityType.FINISH_STATE));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public int getInitActivityMissionProgress(int activityId) {
|
||||
int defalutProgress = 0;
|
||||
|
|
|
@ -100,4 +100,7 @@ public interface ActivityType {
|
|||
int SUPER_DISCOUNT_SKIN = 73;//特惠神装
|
||||
int HERO_STAR = 500;
|
||||
|
||||
int SUPERFUND128 = 78;//超值基金128
|
||||
int SUPERFUND328 = 79;//超值基金328
|
||||
|
||||
}
|
||||
|
|
|
@ -77,7 +77,8 @@ public enum ActivityTypeEnum {
|
|||
HERO_STAR(ActivityType.HERO_STAR,HeroStarActivity::new),
|
||||
SUPER_DISCOUNT_SKIN(ActivityType.SUPER_DISCOUNT_SKIN,SuperBoxActivity::new),
|
||||
MISTYTRIP(ActivityType.MISTY_TRIP,MistyTripActivity::new),
|
||||
|
||||
SUPERFUND128(ActivityType.SUPERFUND128,SuperFundActivity::new),//超值基金128
|
||||
SUPERFUND328(ActivityType.SUPERFUND328,SuperFundActivity::new),//超值基金328
|
||||
;
|
||||
private int type;
|
||||
private Function<Integer, AbstractActivity> toActivityFunction;
|
||||
|
|
|
@ -60,6 +60,7 @@ public class LuckyGetActivity extends AbstractActivity{
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean takeReward(ISession session, int missionId) throws Exception {
|
||||
if(missionId!=-1){
|
||||
return super.takeReward(session, missionId);
|
||||
|
|
|
@ -79,7 +79,7 @@ public class SuperBoxActivity extends AbstractActivity {
|
|||
* @param missionMap
|
||||
*/
|
||||
private void giftHandle(User user, int giftId){
|
||||
if (giftId == -1){
|
||||
if (giftId < 0){
|
||||
// 非礼包处理
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,262 @@
|
|||
package com.ljsd.jieling.logic.activity;
|
||||
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.globals.Global;
|
||||
import com.ljsd.jieling.jbean.ActivityManager;
|
||||
import com.ljsd.jieling.jbean.ActivityMission;
|
||||
import com.ljsd.jieling.jbean.ActivityProgressInfo;
|
||||
import com.ljsd.jieling.logic.activity.event.IEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.activity.event.SuperBoxEvent;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.NewRechargeInfo;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.bean.AbstractWelfareBag;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.bean.ReceiveWelfareBag;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import config.SLuxuryFund;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.security.Key;
|
||||
import java.time.Year;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author hj
|
||||
* 超值基金活动
|
||||
*/
|
||||
public class SuperFundActivity extends AbstractActivity {
|
||||
|
||||
SuperFundActivity(int id) {
|
||||
super(id);
|
||||
Poster.getPoster().listenEvent(this, SuperBoxEvent.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initActivity(User user) {
|
||||
ActivityMission mission = new ActivityMission();
|
||||
// 读表获取阶段奖励信息
|
||||
Map<Integer, SLuxuryFund> fundMap = SLuxuryFund.typeMap.getOrDefault(id, new HashMap<>());
|
||||
// 初始化阶段奖励
|
||||
ActivityLogic.getInstance().initOtherMission(mission, new ArrayList<>(fundMap.keySet()));
|
||||
user.getActivityManager().getActivityMissionMap().put(id, mission);
|
||||
LOGGER.info("超值基金初始化...{}",id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEvent(IEvent event) throws Exception {
|
||||
// 类型验证
|
||||
if (!(event instanceof SuperBoxEvent)) {
|
||||
return;
|
||||
}
|
||||
// 获取信息
|
||||
SuperBoxEvent event1 = (SuperBoxEvent) event;
|
||||
User user = UserManager.getUser(event1.getUserId());
|
||||
// 老玩家兼容
|
||||
compatibleOldUser(user,event1.getGiftId());
|
||||
// 状态初始化
|
||||
initState(user,event1.getGiftId());
|
||||
// 礼包处理
|
||||
updateValue(user);
|
||||
// 状态刷新
|
||||
updateState(user);
|
||||
// 状态推送
|
||||
sendActivityProgress(user, user.getActivityManager().getActivityMissionMap().get(id), null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 礼包处理
|
||||
* @param user
|
||||
*/
|
||||
private void updateValue(User user) throws Exception {
|
||||
// 活动详情
|
||||
ActivityMission mission = user.getActivityManager().getActivityMissionMap().get(id);
|
||||
if (mission == null || mission.getV() == 2){
|
||||
// 活动不存在或者已经购买了
|
||||
return;
|
||||
}
|
||||
// 获取活动信息
|
||||
ReceiveWelfareBag bag = getBagInfo(user);
|
||||
// 已购买月卡
|
||||
if (bag.isOpen()){
|
||||
mission.setV(1);
|
||||
}
|
||||
// 已购买基金
|
||||
if (bag.isBought()){
|
||||
mission.setV(2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean takeReward(ISession session, int missionId) throws Exception {
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
// activity check
|
||||
ActivityMission mission = user.getActivityManager().getActivityMissionMap().get(id);
|
||||
Map<Integer, ActivityProgressInfo> infoMap =getMissionMap(mission);
|
||||
// 处理状态
|
||||
updateState(user);
|
||||
// 获取奖励
|
||||
Map<Integer, SLuxuryFund> fundMap = SLuxuryFund.typeMap.get(id);
|
||||
List<int[][]> rewards = new ArrayList<>();
|
||||
infoMap.forEach((k,v)->{
|
||||
// 可以领取得奖励
|
||||
if (v.getProgrss() == 1){
|
||||
SLuxuryFund fund = fundMap.get(k);
|
||||
rewards.add(fund.getReward());
|
||||
// 修改状态
|
||||
v.setState(1);
|
||||
mission.getActivityMissionMap().put(k,v);
|
||||
}
|
||||
});
|
||||
// 已领取全部奖励
|
||||
if (rewards.isEmpty()){
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("活动奖励已经领取"));
|
||||
}
|
||||
// reward
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, rewards, BIReason.TAKE_ACTIVITY_REWARD);
|
||||
PlayerInfoProto.TakeActivityRewardResponse build = PlayerInfoProto.TakeActivityRewardResponse.newBuilder().setDrop(drop).build();
|
||||
MessageUtil.sendMessage(session, 1, rewardResponseValue, build, true);
|
||||
// 状态推送
|
||||
sendActivityProgress(session, mission, null);
|
||||
// 打点上报
|
||||
reportTakeActivityReward(user,rewards,missionId);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改详细奖励状态
|
||||
* @param user
|
||||
* @throws ErrorCodeException
|
||||
*/
|
||||
private void updateState(User user) throws Exception {
|
||||
// 获取礼包信息
|
||||
AbstractWelfareBag bag = getBagInfo(user);
|
||||
if (bag.getLastBuyTime() == 0){
|
||||
return;
|
||||
}
|
||||
// 间隔天数,购买当天算第一天,所以需要+1
|
||||
int days = TimeUtils.differentDays(bag.getLastBuyTime(), TimeUtils.getTodayZero())+1;
|
||||
// 活动信息
|
||||
ActivityMission mission = user.getActivityManager().getActivityMissionMap().get(id);
|
||||
Map<Integer, ActivityProgressInfo> infoMap = getMissionMap(mission);
|
||||
// 遍历
|
||||
infoMap.forEach((k,v)->{
|
||||
// 已领取得不做处理
|
||||
if (v.getState() == 0){
|
||||
// 满足天数修改状态
|
||||
if (days >= k){
|
||||
v.setProgrss(1);
|
||||
}
|
||||
// 入库
|
||||
mission.getActivityMissionMap().put(k,v);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化状态
|
||||
* @param user
|
||||
* @param gId
|
||||
* @throws ErrorCodeException
|
||||
*/
|
||||
private void initState(User user,int gId) throws Exception {
|
||||
if (gId != SuperBoxEvent.fund_zero_init){
|
||||
// 不是零点得逻辑
|
||||
return;
|
||||
}
|
||||
// 活动信息
|
||||
ActivityMission mission = user.getActivityManager().getActivityMissionMap().get(id);
|
||||
Map<Integer, ActivityProgressInfo> infoMap = getMissionMap(mission);
|
||||
// 获取已经领取得状态
|
||||
long count = infoMap.values().stream().filter(v -> v.getState() == 1).count();
|
||||
// 全部领取得话
|
||||
if (count == infoMap.size()){
|
||||
// 重置活动信息
|
||||
reSetValue(user);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 老玩家兼容
|
||||
* @param user
|
||||
* @param gId
|
||||
* @throws ErrorCodeException
|
||||
*/
|
||||
private void compatibleOldUser(User user,int gId) throws Exception {
|
||||
if (gId != SuperBoxEvent.fund_old_user){
|
||||
// 不是老玩家兼容逻辑
|
||||
return;
|
||||
}
|
||||
// 获取礼包信息
|
||||
ReceiveWelfareBag bag = getBagInfo(user);
|
||||
if (bag.getGetRewardTime() == 0){
|
||||
// 未领取过
|
||||
return;
|
||||
}
|
||||
// 活动信息
|
||||
ActivityMission mission = user.getActivityManager().getActivityMissionMap().get(id);
|
||||
Map<Integer, ActivityProgressInfo> infoMap = getMissionMap(mission);
|
||||
// 领取得天数
|
||||
int days = TimeUtils.differentDays(bag.getGetRewardTime(), TimeUtils.getTodayZero())+1;
|
||||
// 遍历
|
||||
infoMap.forEach((k,v)->{
|
||||
// 已领取得不做处理
|
||||
if (k >= days){
|
||||
v.setState(1);
|
||||
mission.getActivityMissionMap().put(k,v);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reSetValue(User user) throws Exception {
|
||||
// 活动信息重置
|
||||
ActivityManager activityManager = user.getActivityManager();
|
||||
activityManager.getActivityMissionMap().remove(id);
|
||||
initActivity(user);
|
||||
// 礼包信息重置
|
||||
ReceiveWelfareBag bagInfo = getBagInfo(user);
|
||||
bagInfo.refresh();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取活动单个页签信息
|
||||
* @param mission
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
private Map<Integer, ActivityProgressInfo> getMissionMap(ActivityMission mission) throws Exception{
|
||||
Map<Integer, ActivityProgressInfo> infoMap = Optional.ofNullable(mission).map(ActivityMission::getActivityMissionMap).orElse(new HashMap<>());
|
||||
if (infoMap.isEmpty()){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE,"超值基金活动数据错误:"+id);
|
||||
}
|
||||
return infoMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取礼包信息
|
||||
* @param user
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
private ReceiveWelfareBag getBagInfo(User user) throws Exception{
|
||||
ReceiveWelfareBag bag = (ReceiveWelfareBag)Optional.ofNullable(user.getPlayerInfoManager().getNewRechargeInfo().getReceiveMap()).map(v -> v.get(id)).orElse(null);
|
||||
if (bag == null){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE,"超值基金礼包信息错误:"+id);
|
||||
}
|
||||
return bag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkActivityMissionFinishAndTake(int uid, int activityId, ActivityMission activityMission) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -7,6 +7,8 @@ import com.ljsd.jieling.globals.BIReason;
|
|||
import com.ljsd.jieling.jbean.ActivityMission;
|
||||
import com.ljsd.jieling.jbean.ActivityProgressInfo;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.activity.event.ActivityStateChangeEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.dao.PlayerManager;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.VipInfo;
|
||||
|
@ -52,14 +54,12 @@ public class TreasureActivity extends AbstractActivity {
|
|||
id=sRechargeCommodityConfig.getId();
|
||||
}
|
||||
}
|
||||
// user.getPlayerInfoManager().getRechargeInfo().updateBuyGoodsTimes(id,0);
|
||||
}
|
||||
|
||||
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(id);
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.TREASH_MONTH_REFRESH, sGlobalActivity.getId());
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.TREASH_WEEK_REFRESH, sGlobalActivity.getId());
|
||||
//戒灵秘宝改为青龙秘宝,只有周任务和月任务 2020.8.14
|
||||
//user.getUserMissionManager().onGameEvent(user, GameEvent.TREASH_REFRESH, sGlobalActivity.getId());
|
||||
ActivityMission activityMission = new ActivityMission();
|
||||
activityMission.setActivityState(1);
|
||||
List<Integer> levels = new ArrayList<>(STreasureSunlongConfig.levelTreasureConfigMap.get(id).keySet());
|
||||
|
@ -67,7 +67,6 @@ public class TreasureActivity extends AbstractActivity {
|
|||
levels.remove(0);
|
||||
}
|
||||
ActivityLogic.getInstance().initOtherMission(activityMission,levels);
|
||||
// long endTime = ToolsUtil.getTimeLong(sGlobalActivity.getStartTimeLong(),sGlobalActivity.getEndTimeLong(),sGlobalActivity.getTime(),user.getPlayerInfoManager().getCreateTime(), 2) - 24 * 3600 * 1000;
|
||||
user.getActivityManager().getActivityMissionMap().put(sGlobalActivity.getId(), activityMission);
|
||||
PlayerInfoProto.TreasureLevelUpIndication indication = PlayerInfoProto.TreasureLevelUpIndication.newBuilder().setLevel(user.getPlayerInfoManager().getTreasureLevel())
|
||||
.setHadBuy(user.getPlayerInfoManager().getHadBuyTreasure()).build();
|
||||
|
@ -283,4 +282,25 @@ public class TreasureActivity extends AbstractActivity {
|
|||
indication.addAllInfos(privilege);
|
||||
MessageUtil.sendIndicationMessage(sesson, 1, MessageTypeProto.MessageType.PRIVILLEGE_ADD_INDICATION_VALUE, indication.build(), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkActivityMissionFinishAndTake(int uid,int activityId,ActivityMission activityMission) {
|
||||
Map<Integer, ActivityProgressInfo> activityProgressInfoMap = activityMission.getActivityMissionMap();
|
||||
if (activityProgressInfoMap.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
for (Map.Entry<Integer, ActivityProgressInfo> item : activityProgressInfoMap.entrySet()) {
|
||||
ActivityProgressInfo activityProgressInfo = item.getValue();
|
||||
int missionStatus = activityProgressInfo.getState();
|
||||
if (missionStatus == ActivityType.WILL_TAKE || missionStatus == ActivityType.HAD_TAKED) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(activityId);
|
||||
if(sGlobalActivity.getResetGrade()==0){
|
||||
activityMission.setActivityState(ActivityType.FINISH_STATE);
|
||||
Poster.getPoster().dispatchEvent(new ActivityStateChangeEvent(uid,activityId,ActivityType.FINISH_STATE));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,8 +8,21 @@ package com.ljsd.jieling.logic.activity.event;
|
|||
*/
|
||||
public class SuperBoxEvent implements IEvent {
|
||||
|
||||
/**
|
||||
* 默认状态
|
||||
*/
|
||||
public static int default_id = -1;
|
||||
/**
|
||||
* 超值基金, 零点刷新初始化
|
||||
*/
|
||||
public static int fund_zero_init = -2;
|
||||
/**
|
||||
* 超值基金, 老玩家兼容
|
||||
*/
|
||||
public static int fund_old_user = -3;
|
||||
|
||||
private int userId;
|
||||
private int giftId = -1;//礼包id
|
||||
private int giftId = default_id;//礼包id
|
||||
|
||||
public SuperBoxEvent(int userId, int giftId) {
|
||||
this.userId = userId;
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
package com.ljsd.jieling.logic.store;
|
||||
|
||||
import ch.qos.logback.core.util.TimeUtil;
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.jieling.config.reportData.DataMessageUtils;
|
||||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
import com.ljsd.jieling.core.VipPrivilegeType;
|
||||
import com.ljsd.jieling.db.mongo.MongoUtil;
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
|
@ -44,7 +42,6 @@ import rpc.protocols.CommonProto;
|
|||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
import util.MathUtils;
|
||||
import util.StringUtil;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
@ -84,7 +81,6 @@ public class BuyGoodsNewLogic {
|
|||
user.getPlayerInfoManager().setNewRechargeInfo(info);
|
||||
}
|
||||
dailyRefresh(user);
|
||||
sendDailyMailReward(user);
|
||||
boolean needChange = false;
|
||||
List<AbstractWelfareBag> pAddList = new ArrayList<>();
|
||||
for(Map.Entry<Integer,SRechargeCommodityNewConfig> entry : SRechargeCommodityNewConfig.configMap.entrySet()){
|
||||
|
@ -179,10 +175,8 @@ public class BuyGoodsNewLogic {
|
|||
|
||||
User user = UserManager.getUser(uid);
|
||||
NewRechargeInfo info = user.getPlayerInfoManager().getNewRechargeInfo();
|
||||
AbstractWelfareBag bag = null;
|
||||
RechargeHandler rechargeHandler = getRechargeHandler(config.getOtype());
|
||||
bag = rechargeHandler.getRechargeMap(user).get(goodsId);
|
||||
String rewardStr="";
|
||||
AbstractWelfareBag bag = rechargeHandler.getRechargeMap(user).get(goodsId);
|
||||
if(bag == null || !bag.buy()){
|
||||
LOGGER.error("购买失败!bag是否为空:{}",bag == null);
|
||||
return resultRes;
|
||||
|
@ -218,9 +212,6 @@ public class BuyGoodsNewLogic {
|
|||
//活动
|
||||
user.getPlayerInfoManager().setRechargedaily(user.getPlayerInfoManager().getRechargedaily()+price);
|
||||
changeActivity(user,price,info);
|
||||
|
||||
// 惊喜礼盒,事件推送
|
||||
Poster.getPoster().dispatchEvent(new SuperBoxEvent(user.getId(),config.getId()));
|
||||
}
|
||||
if(!info.getIsFirst()){
|
||||
info.setIsFirst(true);
|
||||
|
@ -240,6 +231,9 @@ public class BuyGoodsNewLogic {
|
|||
notifyPaySuccessFul(uid,goodsId,amount != -999);
|
||||
sendGiftGoodsWithoutJudge(uid);
|
||||
openPush(session,user, PushRechargeType.point_recharge.getType(),goodsId,1);
|
||||
// 惊喜礼盒,事件推送
|
||||
Poster.getPoster().dispatchEvent(new SuperBoxEvent(user.getId(),config.getId()));
|
||||
// 更新入库
|
||||
MongoUtil.getLjsdMongoTemplate().lastUpdate();
|
||||
// 扶持订单不需要上报
|
||||
if(price>0 && !orderId.equals("support-order")){
|
||||
|
@ -791,70 +785,6 @@ public class BuyGoodsNewLogic {
|
|||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 每日礼包奖励发送
|
||||
*/
|
||||
public static void sendDailyMailReward(User user) throws Exception{
|
||||
NewRechargeInfo info = user.getPlayerInfoManager().getNewRechargeInfo();
|
||||
List<Integer> found1 = SRechargeCommodityNewConfig.getConfigListByType(GiftGoodsType.FOUND_ONE);
|
||||
List<Integer> found2 = SRechargeCommodityNewConfig.getConfigListByType(GiftGoodsType.FOUND_TWO);
|
||||
for(AbstractWelfareBag bag : info.getReceiveMap().values()){
|
||||
for(int id :found1){
|
||||
if(bag.getModId() == id && canReward((ReceiveWelfareBag) bag)){
|
||||
sendReward(user.getId(),id,(ReceiveWelfareBag) bag,GiftGoodsType.FOUND_ONE);
|
||||
}
|
||||
}
|
||||
for(int id :found2){
|
||||
if(bag.getModId() == id && canReward((ReceiveWelfareBag)bag)){
|
||||
sendReward(user.getId(),id,(ReceiveWelfareBag) bag,GiftGoodsType.FOUND_TWO);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void sendReward(int uid,int id,ReceiveWelfareBag bag,int type) throws Exception{
|
||||
int nowTime = (int)(System.currentTimeMillis()/1000);
|
||||
int getDays = 0;
|
||||
if(bag.getGetRewardTime() != 0){
|
||||
getDays = TimeUtils.differentDays(bag.getLastBuyTime() - TimeUtils.DAY,bag.getGetRewardTime());
|
||||
}else{
|
||||
bag.setGetRewardTime(TimeUtils.getTodayZero() - TimeUtils.DAY);
|
||||
}
|
||||
int canget = TimeUtils.differentDays(bag.getGetRewardTime(),System.currentTimeMillis());
|
||||
getRewards(uid,id,getDays,canget,bag.getContinueDays());
|
||||
bag.setGetRewardTime(TimeUtils.getTodayZero());
|
||||
}
|
||||
|
||||
public static boolean canReward(ReceiveWelfareBag bag){
|
||||
if(!bag.isOpen()){
|
||||
return false;
|
||||
}
|
||||
if(!bag.isBought()){
|
||||
return false;
|
||||
}
|
||||
if(TimeUtils.differentDays(bag.getGetRewardTime(),System.currentTimeMillis())<1){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void getRewards(int uid,int type,int startDay,int cDay,int continueDays) throws Exception{
|
||||
int nowTime = (int)(System.currentTimeMillis()/1000);
|
||||
for(int i = 1;i<=cDay;i++){
|
||||
SLuxuryFund fund = SLuxuryFund.getByFoundIdAndDay(type,startDay+i);
|
||||
if(fund == null){
|
||||
break;
|
||||
}
|
||||
SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.getConfigById(type);
|
||||
String reward = ItemUtil.getMailReward(fund.getreward());
|
||||
String title = SErrorCodeEerverConfig.getI18NMessage("recharge_"+config.getType()+"_daily_title");
|
||||
String content;
|
||||
content = SErrorCodeEerverConfig.getI18NMessageNeedConvert("recharge_"+config.getType()+"_daily_txt",
|
||||
new Object[]{continueDays-startDay-cDay},new int[]{0},"#");
|
||||
MailLogic.getInstance().sendMail(uid,title,content,reward,nowTime, Global.MAIL_EFFECTIVE_TIME);
|
||||
}
|
||||
}
|
||||
|
||||
private static void dailyRefresh(User user){
|
||||
NewRechargeInfo info = user.getPlayerInfoManager().getNewRechargeInfo();
|
||||
if(TimeUtils.differentDays(info.getLastRefreshTime(),System.currentTimeMillis())<1){
|
||||
|
|
|
@ -17,25 +17,21 @@ public class SLuxuryFund implements BaseConfig {
|
|||
|
||||
private int[][] reward;
|
||||
|
||||
private static Map<Integer,SLuxuryFund> sLuxuryFundByFoundAndDay;
|
||||
|
||||
|
||||
/**
|
||||
* key: type value: < key: day value: SLuxuryFund对象 >
|
||||
*/
|
||||
public static Map<Integer,Map<Integer,SLuxuryFund>> typeMap = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
Map<Integer, SLuxuryFund> config = STableManager.getConfig(SLuxuryFund.class);
|
||||
Map<Integer,SLuxuryFund> sLuxuryFundByFoundAndDayTmp = new HashMap<>();
|
||||
config.values().forEach(sLuxuryFund->{
|
||||
sLuxuryFundByFoundAndDayTmp.put(sLuxuryFund.getType()*100 + sLuxuryFund.getDay(),sLuxuryFund);
|
||||
config.values().forEach(v->{
|
||||
Map<Integer, SLuxuryFund> fundMap = typeMap.getOrDefault(v.getType(), new HashMap<>());
|
||||
fundMap.put(v.getDay(),v);
|
||||
typeMap.put(v.getType(),fundMap);
|
||||
});
|
||||
sLuxuryFundByFoundAndDay = sLuxuryFundByFoundAndDayTmp;
|
||||
}
|
||||
|
||||
public static SLuxuryFund getByFoundIdAndDay(int foundId,int day){
|
||||
return sLuxuryFundByFoundAndDay.get(foundId*100+day);
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
@ -48,9 +44,8 @@ public class SLuxuryFund implements BaseConfig {
|
|||
return day;
|
||||
}
|
||||
|
||||
public int[][] getreward() {
|
||||
public int[][] getReward() {
|
||||
return reward;
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue