Merge branch 'master_prb_gn' into master_test_gn_zf
commit
793b55cbac
|
|
@ -330,8 +330,6 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
|||
Poster.getPoster().dispatchEvent(new HomeEvent(user.getId()));
|
||||
//hotfix
|
||||
Poster.getPoster().dispatchEvent(new SuperBoxEvent(user.getId(),SuperBoxEvent.default_id));
|
||||
// 超值基金,老玩家兼容
|
||||
Poster.getPoster().dispatchEvent(new SuperBoxEvent(user.getId(),SuperBoxEvent.fund_old_user));
|
||||
// 登峰造极孙悟空
|
||||
Poster.getPoster().dispatchEvent(new HeroUpStarEvent(user.getId(),10023,0));
|
||||
// 常驻活动重置
|
||||
|
|
|
|||
|
|
@ -74,9 +74,9 @@ public class HeroUpLikableRequestHandler extends BaseHandler<HeroInfoProto.HeroU
|
|||
int oldAllLikaLv=GetAllLikableLvByLikaNum(GetAllHeroLikableNum(heroManager.getHeroLikableMap()));
|
||||
heroManager.putHeroLikableMap(heroStaticId,curHeroLikableNum);
|
||||
int curAllLikaLv=GetAllLikableLvByLikaNum(GetAllHeroLikableNum(heroManager.getHeroLikableMap()));
|
||||
Map<Integer,Integer>allHeroPropAdd=GetAllHeroLikableAddPeop(curAllLikaLv);
|
||||
heroManager.putAllLikablePropAddMap(allHeroPropAdd);
|
||||
if (curAllLikaLv>oldAllLikaLv){
|
||||
Map<Integer,Integer>allHeroPropAdd=GetAllHeroLikableAddPeop(curAllLikaLv);
|
||||
heroManager.putAllLikablePropAddMap(allHeroPropAdd);
|
||||
int[][]condition= SPrivilegeTypeConfig.getsPrivilegeTypeConfigMap().get(2).getCondition();
|
||||
if (curAllLikaLv>=condition.length) {
|
||||
curAllLikaLv=condition.length-1;
|
||||
|
|
|
|||
|
|
@ -113,6 +113,8 @@ public interface ActivityType {
|
|||
|
||||
int NEW_PLAYER_SHOP = 91; // 新人商城
|
||||
int HERO_UP_STAR_ACTIVITY=94;//限时升星活动
|
||||
int fESTIVAL_LOGIN_ACTIVITY=95;//节日登录活动
|
||||
int EXPLORE_EXPECT_ACTIVITY=96;//探索达人活动
|
||||
|
||||
|
||||
int NEW_GENERAL_ATTACK = 200;//新将来袭
|
||||
|
|
|
|||
|
|
@ -80,8 +80,10 @@ 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
|
||||
// SUPERFUND128(ActivityType.SUPERFUND128,SuperFundActivity::new),//超值基金128
|
||||
// SUPERFUND328(ActivityType.SUPERFUND328,SuperFundActivity::new),//超值基金328
|
||||
SUPERFUND128(ActivityType.SUPERFUND128,SuperFundNewActivity::new),//超值基金128
|
||||
SUPERFUND328(ActivityType.SUPERFUND328,SuperFundNewActivity::new),//超值基金328
|
||||
PREPARE_FIFTEEN_ACTIVITY(ActivityType.PREPARE_FIFTEEN_ACTIVITY,DefaultEmptyActivity::new),//超值基金328
|
||||
THEME_ACTIVITY_SHOP(ActivityType.THEME_ACTIVITY_SHOP,DefaultEmptyActivity::new),
|
||||
XUN_BAO_MI_ZONG(ActivityType.XUN_BAO_MI_ZONG,XunBaoMiZongActivity::new),
|
||||
|
|
@ -101,7 +103,9 @@ public enum ActivityTypeEnum {
|
|||
NEW_PLAYER_SHOP(ActivityType.NEW_PLAYER_SHOP, NewPlayerShopActivity::new),
|
||||
NEW_DAILY_RECHARGE(ActivityType.NEW_DAILY_RECHARGE, RechargeRewardActivity::new),
|
||||
HERO_UP_STAR_ACTIVITY(ActivityType.HERO_UP_STAR_ACTIVITY,HeroUpStarActivity::new),
|
||||
DAILY_SPECIAL(ActivityType.DAILY_SPECIAL,DefaultEmptyActivity::new)//每日特惠
|
||||
DAILY_SPECIAL(ActivityType.DAILY_SPECIAL,DefaultEmptyActivity::new),//每日特惠
|
||||
fESTIVAL_LOGIN_ACTIVITY(ActivityType.fESTIVAL_LOGIN_ACTIVITY,NewEightActivity::new),//节日登录活动
|
||||
EXPLORE_EXPECT_ACTIVITY(ActivityType.EXPLORE_EXPECT_ACTIVITY,ExploreExpectActivity::new)
|
||||
;
|
||||
|
||||
private int type;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,68 @@
|
|||
package com.ljsd.jieling.logic.activity;
|
||||
|
||||
import com.ljsd.jieling.jbean.ActivityMission;
|
||||
import com.ljsd.jieling.jbean.ActivityProgressInfo;
|
||||
import com.ljsd.jieling.logic.activity.event.ExploreEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.IEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.dao.GuilidManager;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.GuildInfo;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import config.SActivityRewardConfig;
|
||||
|
||||
|
||||
public class ExploreExpectActivity extends AbstractActivity {
|
||||
|
||||
public ExploreExpectActivity(int id) {
|
||||
super(id);
|
||||
Poster.getPoster().listenEvent(this, ExploreEvent.class);
|
||||
}
|
||||
@Override
|
||||
public void onEvent(IEvent event) throws Exception {
|
||||
if (!(event instanceof ExploreEvent))
|
||||
return;
|
||||
update(UserManager.getUser(((ExploreEvent) event).getUid()), ((ExploreEvent) event).getNum());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
void updateProgress(ActivityMission activityMission, int count) {
|
||||
activityMission.setV(activityMission.getV() + count);
|
||||
}
|
||||
@Override
|
||||
public void onActivityEnd() throws Exception {
|
||||
//所有帮会探索计数清0
|
||||
//GuildInfo guildInfo = GuilidManager.guildInfoMap
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean takeRewardsProcess(ISession session, SActivityRewardConfig sActivityRewardConfig, ActivityProgressInfo activityProgressInfo) throws Exception {
|
||||
int[][] values = sActivityRewardConfig.getValues();
|
||||
//int missionProgress = activityProgressInfo.getProgrss();
|
||||
User user = UserManager.getUser(session.getUid(), true);
|
||||
int guildId = user.getPlayerInfoManager().getGuildId();
|
||||
if(guildId != 0 ){
|
||||
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(guildId);
|
||||
return guildInfo.getExploreKillMonsterNum() >= values[0][0];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* 结束回调
|
||||
*/
|
||||
@Override
|
||||
public void onActivityEndOnMySelf(User user) throws Exception {
|
||||
int guildId = user.getPlayerInfoManager().getGuildId();
|
||||
if(guildId !=0){
|
||||
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(guildId);
|
||||
if(guildInfo.getExploreKillMonsterNum()!=0){
|
||||
guildInfo.setExploreKillMonsterNum(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -5,10 +5,11 @@ import com.ljsd.jieling.logic.dao.UserManager;
|
|||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import config.SActivityRewardConfig;
|
||||
import config.SGlobalActivity;
|
||||
import util.TimeUtils;
|
||||
|
||||
/**
|
||||
* Description: 新的八日登录
|
||||
* Description: 新的八日登录 节日登录活动
|
||||
* Author: zsx
|
||||
* CreateDate: 2020/6/18 11:55
|
||||
*/
|
||||
|
|
@ -21,8 +22,15 @@ public class NewEightActivity extends AbstractActivity {
|
|||
@Override
|
||||
boolean takeRewardsProcess(ISession session, SActivityRewardConfig sActivityRewardConfig, ActivityProgressInfo activityProgressInfo) throws Exception {
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
if(TimeUtils.getOverTimeCount(user.getPlayerInfoManager().getCreateTime(),System.currentTimeMillis(),0)<sActivityRewardConfig.getValues()[0][0]-1){
|
||||
return false;
|
||||
SGlobalActivity globalActivity = SGlobalActivity.getsGlobalActivityMap().get(id);
|
||||
if (globalActivity.getTime()==1){
|
||||
if(TimeUtils.getOverTimeCount(globalActivity.getStartTimeLong(),System.currentTimeMillis(),0)<sActivityRewardConfig.getValues()[0][0]-1){
|
||||
return false;
|
||||
}
|
||||
}else if (globalActivity.getTime()==2){
|
||||
if(TimeUtils.getOverTimeCount(user.getPlayerInfoManager().getCreateTime(),System.currentTimeMillis(),0)<sActivityRewardConfig.getValues()[0][0]-1){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,255 +31,257 @@ import java.util.stream.Collectors;
|
|||
/**
|
||||
* @author hj
|
||||
* 超值基金活动
|
||||
* 2022-1-24 根据策划需求修改活动信息,本类暂时弃用,新内容请查看 SuperFundNewActivity.java
|
||||
*/
|
||||
@Deprecated
|
||||
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,event1.getGiftId());
|
||||
// 状态刷新
|
||||
updateState(user);
|
||||
// 状态推送
|
||||
sendActivityProgress(user, user.getActivityManager().getActivityMissionMap().get(id), null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 礼包处理
|
||||
* @param user
|
||||
*/
|
||||
private void updateValue(User user, int giftId) throws Exception {
|
||||
// 活动详情
|
||||
ActivityMission mission = user.getActivityManager().getActivityMissionMap().get(id);
|
||||
if (mission == null || mission.getV() == 2){
|
||||
// 活动不存在或者已经购买了
|
||||
return;
|
||||
}
|
||||
Map<Integer, Integer> monthCard = user.getPlayerInfoManager().getMonthCard();
|
||||
int monthTime = 0;
|
||||
// 普通月卡
|
||||
if (id == 78){
|
||||
monthTime = monthCard.getOrDefault(1, 0);
|
||||
}
|
||||
// 高级月卡
|
||||
if (id == 79){
|
||||
monthTime = monthCard.getOrDefault(2, 0);
|
||||
}
|
||||
|
||||
// 旧信息兼容
|
||||
ReceiveWelfareBag bagInfo = getBagInfo(user);
|
||||
|
||||
// 已激活月卡
|
||||
if (monthTime > 0 || bagInfo.isOpen()){
|
||||
mission.setV(1);
|
||||
}
|
||||
// 已购买基金
|
||||
if (giftId == id || bagInfo.isBought()){
|
||||
// 初始化基金
|
||||
mission.setV(2);
|
||||
mission.setCreatTime(TimeUtils.now());
|
||||
}
|
||||
}
|
||||
|
||||
@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 && v.getState() == 0){
|
||||
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 {
|
||||
// 活动信息
|
||||
ActivityMission mission = user.getActivityManager().getActivityMissionMap().get(id);
|
||||
if(mission == null){
|
||||
LOGGER.info("updateState 玩家id ={},activityId={}",user.getId(),id);
|
||||
return;
|
||||
}
|
||||
if (mission.getV() != 2){
|
||||
return;
|
||||
}
|
||||
// 间隔天数,购买当天算第一天,所以需要+1
|
||||
int days = TimeUtils.differentDays(mission.getCreatTime(), TimeUtils.getTodayZero())+1;
|
||||
|
||||
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.getStartTime(), TimeUtils.getTodayZero())+1;
|
||||
// 遍历
|
||||
infoMap.forEach((k,v)->{
|
||||
// 已领取得不做处理
|
||||
if (days >= k){
|
||||
v.setProgrss(1);
|
||||
v.setState(1);
|
||||
mission.getActivityMissionMap().put(k,v);
|
||||
}
|
||||
});
|
||||
mission.setV(2);
|
||||
mission.setCreatTime(bag.getStartTime());
|
||||
bag.setGetRewardTime(0);
|
||||
LOGGER.info("================超值基金老玩家兼容===============,uid:{},id:{}",user.getId(),id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reSetValue(User user) throws Exception {
|
||||
// 活动信息重置
|
||||
ActivityManager activityManager = user.getActivityManager();
|
||||
activityManager.getActivityMissionMap().remove(id);
|
||||
initActivity(user);
|
||||
// 旧信息兼容
|
||||
ReceiveWelfareBag bagInfo = getBagInfo(user);
|
||||
bagInfo.refresh();
|
||||
LOGGER.info("================超值基金礼包刷新===============,uid:{},id:{}",user.getId(),id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取活动单个页签信息
|
||||
* @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;
|
||||
// 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,event1.getGiftId());
|
||||
// // 状态刷新
|
||||
// updateState(user);
|
||||
// // 状态推送
|
||||
// sendActivityProgress(user, user.getActivityManager().getActivityMissionMap().get(id), null);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 礼包处理
|
||||
// * @param user
|
||||
// */
|
||||
// private void updateValue(User user, int giftId) throws Exception {
|
||||
// // 活动详情
|
||||
// ActivityMission mission = user.getActivityManager().getActivityMissionMap().get(id);
|
||||
// if (mission == null || mission.getV() == 2){
|
||||
// // 活动不存在或者已经购买了
|
||||
// return;
|
||||
// }
|
||||
// Map<Integer, Integer> monthCard = user.getPlayerInfoManager().getMonthCard();
|
||||
// int monthTime = 0;
|
||||
// // 普通月卡
|
||||
// if (id == 78){
|
||||
// monthTime = monthCard.getOrDefault(1, 0);
|
||||
// }
|
||||
// // 高级月卡
|
||||
// if (id == 79){
|
||||
// monthTime = monthCard.getOrDefault(2, 0);
|
||||
// }
|
||||
//
|
||||
// // 旧信息兼容
|
||||
// ReceiveWelfareBag bagInfo = getBagInfo(user);
|
||||
//
|
||||
// // 已激活月卡
|
||||
// if (monthTime > 0 || bagInfo.isOpen()){
|
||||
// mission.setV(1);
|
||||
// }
|
||||
// // 已购买基金
|
||||
// if (giftId == id || bagInfo.isBought()){
|
||||
// // 初始化基金
|
||||
// mission.setV(2);
|
||||
// mission.setCreatTime(TimeUtils.now());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @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 && v.getState() == 0){
|
||||
// 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 {
|
||||
// // 活动信息
|
||||
// ActivityMission mission = user.getActivityManager().getActivityMissionMap().get(id);
|
||||
// if(mission == null){
|
||||
// LOGGER.info("updateState 玩家id ={},activityId={}",user.getId(),id);
|
||||
// return;
|
||||
// }
|
||||
// if (mission.getV() != 2){
|
||||
// return;
|
||||
// }
|
||||
// // 间隔天数,购买当天算第一天,所以需要+1
|
||||
// int days = TimeUtils.differentDays(mission.getCreatTime(), TimeUtils.getTodayZero())+1;
|
||||
//
|
||||
// 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.getStartTime(), TimeUtils.getTodayZero())+1;
|
||||
// // 遍历
|
||||
// infoMap.forEach((k,v)->{
|
||||
// // 已领取得不做处理
|
||||
// if (days >= k){
|
||||
// v.setProgrss(1);
|
||||
// v.setState(1);
|
||||
// mission.getActivityMissionMap().put(k,v);
|
||||
// }
|
||||
// });
|
||||
// mission.setV(2);
|
||||
// mission.setCreatTime(bag.getStartTime());
|
||||
// bag.setGetRewardTime(0);
|
||||
// LOGGER.info("================超值基金老玩家兼容===============,uid:{},id:{}",user.getId(),id);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void reSetValue(User user) throws Exception {
|
||||
// // 活动信息重置
|
||||
// ActivityManager activityManager = user.getActivityManager();
|
||||
// activityManager.getActivityMissionMap().remove(id);
|
||||
// initActivity(user);
|
||||
// // 旧信息兼容
|
||||
// ReceiveWelfareBag bagInfo = getBagInfo(user);
|
||||
// bagInfo.refresh();
|
||||
// LOGGER.info("================超值基金礼包刷新===============,uid:{},id:{}",user.getId(),id);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 获取活动单个页签信息
|
||||
// * @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;
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,233 @@
|
|||
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.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.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.SGlobalActivity;
|
||||
import config.SLuxuryFund;
|
||||
import config.SSurpriseBox;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author hj
|
||||
* 超值基金活动新
|
||||
* 2022-1-24
|
||||
*/
|
||||
public class SuperFundNewActivity extends AbstractActivity {
|
||||
|
||||
SuperFundNewActivity(int id) {
|
||||
super(id);
|
||||
Poster.getPoster().listenEvent(this, SuperBoxEvent.class);
|
||||
}
|
||||
|
||||
private static int finish = 2;
|
||||
|
||||
@Override
|
||||
public void initActivity(User user) throws Exception {
|
||||
ActivityMission mission = new ActivityMission();
|
||||
// 活动信息初始化
|
||||
ActivityLogic.getInstance().initOtherMission(mission, new ArrayList<>());
|
||||
user.getActivityManager().getActivityMissionMap().put(id, mission);
|
||||
// 礼包信息初始化
|
||||
ReceiveWelfareBag info = getBagInfo(user);
|
||||
if (info != null){
|
||||
info.refresh();
|
||||
}
|
||||
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());
|
||||
// 活动数据处理
|
||||
updateValue(user,event1.getGiftId());
|
||||
// 零点刷新
|
||||
zeroRefresh(user,event1.getGiftId());
|
||||
// 状态推送
|
||||
sendActivityProgress(user, user.getActivityManager().getActivityMissionMap().get(id), null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 零点刷新
|
||||
* @param user
|
||||
* @param typeId
|
||||
* @throws Exception
|
||||
*/
|
||||
private void zeroRefresh(User user, int typeId) throws Exception {
|
||||
if (typeId != SuperBoxEvent.fund_zero_init){
|
||||
return;
|
||||
}
|
||||
ActivityMission mission = user.getActivityManager().getActivityMissionMap().get(id);
|
||||
if (mission == null){
|
||||
return;
|
||||
}
|
||||
long count = SLuxuryFund.typeMap.get(id).values().stream().count();
|
||||
long count1 = mission.getActivityMissionMap().values().stream().filter(v -> v.getState() == finish).count();
|
||||
if (count == count1){
|
||||
initActivity(user);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 礼包处理
|
||||
* @param user
|
||||
*/
|
||||
private void updateValue(User user, int giftId){
|
||||
SGlobalActivity activity = SGlobalActivity.getsGlobalActivityMap().get(id);
|
||||
// 验证礼包id
|
||||
if (activity == null || activity.getCanBuyRechargeId()[0] != giftId){
|
||||
return;
|
||||
}
|
||||
ActivityMission mission = user.getActivityManager().getActivityMissionMap().get(id);
|
||||
// 礼包是否已购买
|
||||
if (mission == null || mission.getV() == finish){
|
||||
return;
|
||||
}
|
||||
// 旧信息兼容
|
||||
ReceiveWelfareBag bagInfo = getBagInfo(user);
|
||||
// 已购买基金
|
||||
if (bagInfo != null && bagInfo.isBought()){
|
||||
// 初始化基金
|
||||
mission.setV(finish);
|
||||
mission.setCreatTime(TimeUtils.now());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CommonProto.ActivityInfo.MissionInfo> getAllMissInfo(User user,ActivityMission activityMission, Set<Integer> filter) {
|
||||
if (activityMission == null){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
// 库里存储的活动档位信息
|
||||
Map<Integer, ActivityProgressInfo> progressInfoMap = activityMission.getActivityMissionMap();
|
||||
// 返回对象
|
||||
List<CommonProto.ActivityInfo.MissionInfo> missionInfos = new ArrayList<>(progressInfoMap.size());
|
||||
// 策划表的配置
|
||||
Map<Integer, SLuxuryFund> fundMap = SLuxuryFund.typeMap.getOrDefault(id, new HashMap<>(0));
|
||||
for (Map.Entry<Integer, SLuxuryFund> entry : fundMap.entrySet()) {
|
||||
// 参数初始化
|
||||
int missionId = entry.getKey();
|
||||
int state = getState(activityMission,progressInfoMap.get(missionId),entry.getValue());
|
||||
// 封装proto并返回
|
||||
CommonProto.ActivityInfo.MissionInfo build = CommonProto.ActivityInfo.MissionInfo.newBuilder()
|
||||
.setMissionId(missionId)
|
||||
.setProgress(0)
|
||||
.setState(state)
|
||||
.build();
|
||||
missionInfos.add(build);
|
||||
}
|
||||
return missionInfos;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取状态
|
||||
* @param activityMission
|
||||
* @param progressInfo
|
||||
* @param fund
|
||||
* @return
|
||||
*/
|
||||
private int getState(ActivityMission activityMission, ActivityProgressInfo progressInfo, SLuxuryFund fund){
|
||||
int state;
|
||||
int days = TimeUtils.differentDays(activityMission.getCreatTime(), TimeUtils.getTodayZero())+1;
|
||||
if (activityMission.getV() != finish){
|
||||
state = 0;
|
||||
} else if (progressInfo != null && progressInfo.getState() == finish){
|
||||
state = 2;
|
||||
}else {
|
||||
state = days >= fund.getDay()?1:0;
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
/**
|
||||
* 领取奖励
|
||||
* @param session
|
||||
* @param missionId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@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);
|
||||
if (mission == null){
|
||||
throw new ErrorCodeException(ErrorCode.SYS_ERROR_CODE,"活动信息不存在:"+id);
|
||||
}
|
||||
Map<Integer, ActivityProgressInfo> infoMap = mission.getActivityMissionMap();
|
||||
List<int[][]> rewards = new ArrayList<>();
|
||||
Map<Integer, SLuxuryFund> fundMap = SLuxuryFund.typeMap.get(id);
|
||||
for (SLuxuryFund fund : fundMap.values()) {
|
||||
ActivityProgressInfo progressInfo = infoMap.get(fund.getId());
|
||||
int state = getState(mission, progressInfo, fund);
|
||||
if (state == 1){
|
||||
ActivityProgressInfo info = new ActivityProgressInfo();
|
||||
info.setState(finish);
|
||||
// 更新数据库
|
||||
mission.getActivityMissionMap().put(fund.getId(),info);
|
||||
rewards.add(fund.getReward());
|
||||
}
|
||||
}
|
||||
// 已领取全部奖励
|
||||
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
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
private ReceiveWelfareBag getBagInfo(User user){
|
||||
SGlobalActivity activity = SGlobalActivity.getsGlobalActivityMap().get(id);
|
||||
if (activity == null){
|
||||
LOGGER.error("活动信息不存在,活动id:{}",id);
|
||||
return null;
|
||||
}
|
||||
AbstractWelfareBag welfareBag = user.getPlayerInfoManager().getNewRechargeInfo().getReceiveMap().get(activity.getCanBuyRechargeId()[0]);
|
||||
if (welfareBag == null){
|
||||
LOGGER.info("礼包未购买,活动id:{},礼包id:{}",id,activity.getCanBuyRechargeId()[0]);
|
||||
return null;
|
||||
}
|
||||
return (ReceiveWelfareBag)welfareBag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkActivityMissionFinishAndTake(int uid, int activityId, ActivityMission activityMission) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package com.ljsd.jieling.logic.activity.event;
|
||||
|
||||
public class ExploreEvent implements IEvent {
|
||||
private int uid;
|
||||
private int num;
|
||||
|
||||
public ExploreEvent(int uid, int num) {
|
||||
this.uid = uid;
|
||||
this.num = num;
|
||||
}
|
||||
|
||||
public int getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(int uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public int getNum() {
|
||||
return num;
|
||||
}
|
||||
|
||||
public void setNum(int num) {
|
||||
this.num = num;
|
||||
}
|
||||
}
|
||||
|
|
@ -66,6 +66,8 @@ public class GuildInfo extends MongoBase {
|
|||
|
||||
private List<Integer> historyMember = new ArrayList<>();
|
||||
|
||||
private int exploreKillMonsterNum;
|
||||
|
||||
public GuildInfo() {
|
||||
setRootCollection(_COLLECTION_NAME);
|
||||
}
|
||||
|
|
@ -342,4 +344,14 @@ public class GuildInfo extends MongoBase {
|
|||
public void updateHistoryMember() {
|
||||
updateString("historyMember",historyMember);
|
||||
}
|
||||
|
||||
|
||||
public int getExploreKillMonsterNum() {
|
||||
return exploreKillMonsterNum;
|
||||
}
|
||||
|
||||
public void setExploreKillMonsterNum(int exploreKillMonsterNum) {
|
||||
updateString("exploreKillMonsterNum",exploreKillMonsterNum);
|
||||
this.exploreKillMonsterNum = exploreKillMonsterNum;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.ljsd.jieling.logic.explorerMap;
|
||||
|
||||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
import com.ljsd.jieling.db.mongo.MongoUtil;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
|
|
@ -7,11 +8,18 @@ import com.ljsd.jieling.globals.BIReason;
|
|||
import com.ljsd.jieling.globals.Global;
|
||||
import com.ljsd.jieling.logic.GlobleSystemLogic;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.activity.ActivityLogic;
|
||||
import com.ljsd.jieling.logic.activity.ActivityType;
|
||||
import com.ljsd.jieling.logic.activity.ActivityTypeEnum;
|
||||
import com.ljsd.jieling.logic.activity.crossService.CrossServiceLogic;
|
||||
import com.ljsd.jieling.logic.activity.event.ExploreEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.dao.ExplorerInfo;
|
||||
import com.ljsd.jieling.logic.dao.GuilidManager;
|
||||
import com.ljsd.jieling.logic.dao.TeamEnum;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.cross.CSPlayer;
|
||||
import com.ljsd.jieling.logic.dao.root.GuildInfo;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.logic.mail.MailLogic;
|
||||
|
|
@ -25,6 +33,7 @@ import config.SSpecialConfig;
|
|||
import manager.STableManager;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import rpc.protocols.ActivityProto;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
|
|
@ -44,7 +53,8 @@ public class ExplorerMapLogic {
|
|||
public static ExplorerMapLogic getInstance() {
|
||||
return ExplorerMapLogic.Instance.instance;
|
||||
}
|
||||
public static void sendIndication(int uid, ExplorerInfo explorerInfo, int teamId){
|
||||
|
||||
public static void sendIndication(int uid, ExplorerInfo explorerInfo, int teamId) {
|
||||
ISession sess = OnlineUserManager.sessionMap.get(uid);
|
||||
if (sess != null) {
|
||||
List<CommonProto.CommKeyVal> dropKeyValList = new ArrayList<>();
|
||||
|
|
@ -59,6 +69,7 @@ public class ExplorerMapLogic {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
//单场战斗
|
||||
public static void singleBattle(User user, ExplorerInfo explorerInfo, int teamId, int time) throws Exception {
|
||||
if (explorerInfo == null) {
|
||||
|
|
@ -73,7 +84,7 @@ public class ExplorerMapLogic {
|
|||
//怪物的初始血量
|
||||
int mapMonsterForce = exploreConfig.getMonsterForce();
|
||||
//玩家掉血
|
||||
float ratio = (float) explorerInfo.getPlayerHp() /explorerInfo.getEnemyHp() ;
|
||||
float ratio = (float) explorerInfo.getPlayerHp() / explorerInfo.getEnemyHp();
|
||||
SExploreFight exploreFightData = SExploreFight.getConfigByFightDownAndFightUp(ratio);
|
||||
if (exploreFightData == null) {
|
||||
return;
|
||||
|
|
@ -84,7 +95,7 @@ public class ExplorerMapLogic {
|
|||
//玩家掉血
|
||||
int reducePlayer = (int) (teamForce * reduceRatio);
|
||||
//怪物掉血
|
||||
ratio = (float) explorerInfo.getEnemyHp()/explorerInfo.getPlayerHp();
|
||||
ratio = (float) explorerInfo.getEnemyHp() / explorerInfo.getPlayerHp();
|
||||
exploreFightData = SExploreFight.getConfigByFightDownAndFightUp(ratio);
|
||||
if (exploreFightData == null) {
|
||||
return;
|
||||
|
|
@ -99,8 +110,8 @@ public class ExplorerMapLogic {
|
|||
//怪物赢了 保留血量 下次打
|
||||
explorerInfo.setEnemyHp(explorerInfo.getEnemyHp() - (reduceMonster));
|
||||
explorerInfo.setPlayerHp(0);
|
||||
LOGGER.info("{} 怪物赢了,怪物掉血:=》{},剩余血量-》{}", user.getId(),reduceMonster, explorerInfo.getEnemyHp());
|
||||
sendIndication(user.getId(),explorerInfo,teamId);
|
||||
LOGGER.info("{} 怪物赢了,怪物掉血:=》{},剩余血量-》{}", user.getId(), reduceMonster, explorerInfo.getEnemyHp());
|
||||
sendIndication(user.getId(), explorerInfo, teamId);
|
||||
} else {
|
||||
Map<Integer, Integer> dropMap = explorerInfo.getDropMap();
|
||||
if (dropMap == null) {
|
||||
|
|
@ -109,8 +120,37 @@ public class ExplorerMapLogic {
|
|||
Map<Integer, Integer> itemMap = ItemUtil.getItemMapByGroupId(user, exploreConfig.getReward(), 1, 0, BIReason.EXPLORE_MAP_GET);
|
||||
explorerInfo.setPlayerHp(explorerInfo.getPlayerHp() - reducePlayer);
|
||||
explorerInfo.setEnemyHp(0);
|
||||
LOGGER.info("{}玩家掉血:=》{},剩余血量-》{}", user.getId(),reducePlayer, explorerInfo.getPlayerHp());
|
||||
LOGGER.info("{}玩家掉血:=》{},剩余血量-》{}", user.getId(), reducePlayer, explorerInfo.getPlayerHp());
|
||||
LOGGER.info("玩家赢了 怪物死 怪物走复活逻辑=>{} 掉落组=>{}", explorerInfo.getEnemyReliveTime(), exploreConfig.getReward());
|
||||
//活动是否开启
|
||||
Set<Integer> openActivityIdsByType = ActivityLogic.getInstance().getOpenActivityIdsByType(user, ActivityTypeEnum.EXPLORE_EXPECT_ACTIVITY.getType(), false);
|
||||
//if (ActivityLogic.checkActivityOpen(user, ActivityType.EXPLORE_EXPECT_ACTIVITY)) {
|
||||
if(openActivityIdsByType.size()>0){
|
||||
//同个工会 死亡计数
|
||||
int guildId = user.getPlayerInfoManager().getGuildId();
|
||||
if (guildId != 0) {
|
||||
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(guildId);
|
||||
if (guildInfo != null) {
|
||||
guildInfo.setExploreKillMonsterNum(guildInfo.getExploreKillMonsterNum() + 1);
|
||||
Poster.getPoster().dispatchEvent(new ExploreEvent(user.getId(), 1));
|
||||
Set<Integer> allUid = new HashSet<>();
|
||||
allUid.addAll(guildInfo.getMembers().get(GlobalsDef.CHAIRMAN));
|
||||
if(guildInfo.getMembers().get(GlobalsDef.MEMBER)!=null){
|
||||
allUid.addAll(guildInfo.getMembers().get(GlobalsDef.MEMBER));
|
||||
}
|
||||
for (int uid : allUid) {
|
||||
ISession session = OnlineUserManager.getSessionByUid(uid);
|
||||
if (session == null) {
|
||||
continue;
|
||||
}
|
||||
ActivityProto.ExploreActivityIndication.Builder indication = ActivityProto.ExploreActivityIndication.newBuilder();
|
||||
indication.setGuildId(guildId);
|
||||
indication.setExploreKillMonsterNum(guildInfo.getExploreKillMonsterNum());
|
||||
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.ExploreActivityIndication_VALUE, indication.build(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (Map.Entry<Integer, Integer> keyVal : itemMap.entrySet()) {
|
||||
if (dropMap.containsKey(keyVal.getKey())) {
|
||||
dropMap.put(keyVal.getKey(), dropMap.get(keyVal.getKey()) + keyVal.getValue());
|
||||
|
|
@ -119,7 +159,7 @@ public class ExplorerMapLogic {
|
|||
}
|
||||
}
|
||||
explorerInfo.setDropMap(dropMap);
|
||||
sendIndication(user.getId(),explorerInfo,teamId);
|
||||
sendIndication(user.getId(), explorerInfo, teamId);
|
||||
}
|
||||
//玩家死亡 设置重生时间
|
||||
if (explorerInfo.getPlayerHp() == 0) {
|
||||
|
|
@ -129,7 +169,7 @@ public class ExplorerMapLogic {
|
|||
} else {
|
||||
explorerInfo.setPlayerReliveTime(time + reliveTime);
|
||||
}
|
||||
LOGGER.info("{}玩家死亡=》重生时间{}", user.getId(),explorerInfo.getPlayerReliveTime());
|
||||
LOGGER.info("{}玩家死亡=》重生时间{}", user.getId(), explorerInfo.getPlayerReliveTime());
|
||||
}
|
||||
//怪物死亡 设置重生时间
|
||||
if (explorerInfo.getEnemyHp() == 0) {
|
||||
|
|
@ -192,26 +232,26 @@ public class ExplorerMapLogic {
|
|||
} else {
|
||||
offlineEndTime = keyVal.getValue().getSendEndTime();
|
||||
}
|
||||
if(keyVal.getValue() == null){
|
||||
LOGGER.info("ExplorerInfo 数据为空 =>{}",user.getId());
|
||||
if (keyVal.getValue() == null) {
|
||||
LOGGER.info("ExplorerInfo 数据为空 =>{}", user.getId());
|
||||
continue;
|
||||
}
|
||||
SExplore exploreConfig = STableManager.getConfig(SExplore.class).get(keyVal.getValue().getMapId());
|
||||
if (exploreConfig == null) {
|
||||
LOGGER.info("{} SExplore 不存在的id =>{}",user.getId(),keyVal.getValue().getMapId());
|
||||
LOGGER.info("{} SExplore 不存在的id =>{}", user.getId(), keyVal.getValue().getMapId());
|
||||
continue;
|
||||
}
|
||||
int battleInterval = exploreConfig.getBattleInterval();
|
||||
if (keyVal.getValue().getBatteTime() >= offlineEndTime) {
|
||||
continue;
|
||||
}
|
||||
LOGGER.info("离线玩家队伍id",keyVal.getKey());
|
||||
LOGGER.info("离线玩家队伍id", keyVal.getKey());
|
||||
for (int i = keyVal.getValue().getBatteTime(); i <= offlineEndTime; i = i + battleInterval) {
|
||||
//复活玩家
|
||||
if (keyVal.getValue().getPlayerHp() == 0 && keyVal.getValue().getPlayerReliveTime() <= i) {
|
||||
int teamForce = HeroLogic.getInstance().calTeamTotalForce(user, keyVal.getKey(), false);
|
||||
keyVal.getValue().setPlayerHp(teamForce);
|
||||
LOGGER.info("{} 离线复活玩家: 玩家战斗时间=》{}",user.getId(),i);
|
||||
LOGGER.info("{} 离线复活玩家: 玩家战斗时间=》{}", user.getId(), i);
|
||||
}
|
||||
//复活怪物
|
||||
if (keyVal.getValue().getEnemyHp() == 0 && keyVal.getValue().getEnemyReliveTime() <= i) {
|
||||
|
|
@ -221,7 +261,7 @@ public class ExplorerMapLogic {
|
|||
}
|
||||
//怪物的初始血量
|
||||
int mapMonsterForce = exploreConfig.getMonsterForce();
|
||||
LOGGER.info("{} 离线复活怪物:",user.getId(),i);
|
||||
LOGGER.info("{} 离线复活怪物:", user.getId(), i);
|
||||
keyVal.getValue().setEnemyHp(mapMonsterForce);
|
||||
}
|
||||
singleBattle(user, keyVal.getValue(), keyVal.getKey(), i);
|
||||
|
|
@ -247,6 +287,9 @@ public class ExplorerMapLogic {
|
|||
continue;
|
||||
}
|
||||
//探索时间到期
|
||||
if(keyVal.getValue().getMapId() == 0){
|
||||
delayId.add(keyVal.getKey());
|
||||
}
|
||||
if (keyVal.getValue().getSendEndTime() < TimeUtils.nowInt()) {
|
||||
delayId.add(keyVal.getKey());
|
||||
deleteMapPlayer.add(keyVal.getValue().getMapId());
|
||||
|
|
@ -256,7 +299,7 @@ public class ExplorerMapLogic {
|
|||
int teamForce = HeroLogic.getInstance().calTeamTotalForce(user, keyVal.getKey(), false);
|
||||
keyVal.getValue().setPlayerHp(teamForce);
|
||||
LOGGER.info("复活玩家:" + uid);
|
||||
sendIndication(user.getId(),keyVal.getValue(),keyVal.getKey());
|
||||
sendIndication(user.getId(), keyVal.getValue(), keyVal.getKey());
|
||||
}
|
||||
//复活怪物
|
||||
if (keyVal.getValue().getEnemyHp() == 0 && keyVal.getValue().getEnemyReliveTime() <= TimeUtils.nowInt()) {
|
||||
|
|
@ -279,12 +322,12 @@ public class ExplorerMapLogic {
|
|||
}
|
||||
}
|
||||
//地图内到期玩家删除
|
||||
for(int mapId:deleteMapPlayer){
|
||||
for (int mapId : deleteMapPlayer) {
|
||||
int crossGroup = GlobleSystemLogic.getInstence().getCrossGroup();
|
||||
String key;
|
||||
RedisUtil redisUtil = RedisUtil.getInstence();
|
||||
if (crossGroup == -1) {
|
||||
key = RedisUtil.getInstence().getKey(RedisKey.EXPLORER_MAP_PLAYER,String.valueOf(mapId));
|
||||
key = RedisUtil.getInstence().getKey(RedisKey.EXPLORER_MAP_PLAYER, String.valueOf(mapId));
|
||||
Set<String> set = redisUtil.sGet(key);
|
||||
if (set.contains(String.valueOf(user.getId()))) {
|
||||
long remove = RedisUtil.getInstence().setRemove(key, String.valueOf(uid));
|
||||
|
|
@ -338,7 +381,6 @@ public class ExplorerMapLogic {
|
|||
indication.setExploreInfo(mapInfo);
|
||||
MessageUtil.sendIndicationMessage(sess, 1, MessageTypeProto.MessageType.ExplorerMapIndicationResponse_VALUE, indication.build(), true);
|
||||
}
|
||||
|
||||
}
|
||||
if (delayId.size() > 0) {
|
||||
user.getPlayerInfoManager().setExplorer(explorer);
|
||||
|
|
|
|||
|
|
@ -11,13 +11,15 @@ 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.ActivityMission;
|
||||
import com.ljsd.jieling.jbean.ActivityProgressInfo;
|
||||
import com.ljsd.jieling.ktbeans.ReportEventEnum;
|
||||
import com.ljsd.jieling.ktbeans.ReportUtil;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.activity.event.CommitSheJiEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.GuildForceChangeEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.activity.event.UserMainTeamForceEvent;
|
||||
import com.ljsd.jieling.logic.activity.ActivityLogic;
|
||||
import com.ljsd.jieling.logic.activity.ActivityType;
|
||||
import com.ljsd.jieling.logic.activity.ActivityTypeEnum;
|
||||
import com.ljsd.jieling.logic.activity.event.*;
|
||||
import com.ljsd.jieling.logic.dao.*;
|
||||
import com.ljsd.jieling.logic.dao.root.*;
|
||||
import com.ljsd.jieling.logic.mail.MailLogic;
|
||||
|
|
@ -967,6 +969,8 @@ public class GuildLogic {
|
|||
user.getGuildMyInfo().clearOfLevelGuild();
|
||||
addGuildLog(guildInfo.getId(),GuildDef.Log.LEVEL,user.getPlayerInfoManager().getNickName());
|
||||
MessageUtil.sendMessage(session,1,msgId,null,true);
|
||||
//探索活动个人计数重置
|
||||
exploreActivity(user,guildInfo);
|
||||
}
|
||||
|
||||
public static void sendPositionChange(int uid,int position) throws Exception {
|
||||
|
|
@ -1782,4 +1786,15 @@ public class GuildLogic {
|
|||
return map;
|
||||
}
|
||||
|
||||
private static void exploreActivity(User user,GuildInfo guildInfo){
|
||||
Set<Integer> openActivityIdsByType = ActivityLogic.getInstance().getOpenActivityIdsByType(user, ActivityTypeEnum.EXPLORE_EXPECT_ACTIVITY.getType(), false);
|
||||
if(openActivityIdsByType.size()!= 0){
|
||||
ActivityMission activityMission = user.getActivityManager().getActivityMissionMap().get(openActivityIdsByType.toArray()[0]);
|
||||
if(guildInfo!=null){
|
||||
activityMission.setV(0);
|
||||
ActivityLogic.getInstance().sendActivityInfo(user, (int)openActivityIdsByType.toArray()[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1423,7 +1423,7 @@ public class HeroLogic {
|
|||
}
|
||||
|
||||
/**
|
||||
* 妖灵师进阶 升星==进阶==觉醒
|
||||
* 妖灵师进阶 升星==进阶==觉醒==化神
|
||||
*
|
||||
* @param session
|
||||
* @param heroId
|
||||
|
|
@ -1540,8 +1540,8 @@ public class HeroLogic {
|
|||
}
|
||||
removeHeroIds.add(consume.getItemId());
|
||||
}
|
||||
// 道具
|
||||
else {
|
||||
// 万能和专属道具检测
|
||||
else if(consume.getType() == 2){
|
||||
int itemId = Integer.parseInt(consume.getItemId());
|
||||
if (!items.contains(itemId)) {
|
||||
boolean camp = upStartItemCamp(scHero.getPropertyName(), itemCamp, itemId);
|
||||
|
|
@ -1552,6 +1552,12 @@ public class HeroLogic {
|
|||
Integer num = removeItemMap.getOrDefault(itemId, 0);
|
||||
removeItemMap.put(itemId, num + 1);
|
||||
}
|
||||
//配置在格子里特殊显示道具消耗
|
||||
else{
|
||||
int itemId = Integer.parseInt(consume.getItemId());
|
||||
Integer num = removeItemMap.getOrDefault(itemId, 0);
|
||||
removeItemMap.put(itemId, num + 1);
|
||||
}
|
||||
}
|
||||
// 校验道具数量
|
||||
boolean cost = ItemUtil.checkCost(user, removeItemMap);
|
||||
|
|
@ -1608,8 +1614,16 @@ public class HeroLogic {
|
|||
addOrUpdateHongmeng(session);
|
||||
|
||||
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.UP_HERO_STAR_RESPONSE_VALUE, baseBuilder.build(), true);
|
||||
// 觉醒飘字
|
||||
if (targetHero.getStar() >= SSpecialConfig.getIntegerValue(SSpecialConfig.lamp_awaken_hero_content_parm)) {
|
||||
if (targetHero.getStar() >= SSpecialConfig.getIntegerValue(SSpecialConfig.ChangeGodHeroContentParm)) {
|
||||
int feishengNum=targetHero.getStar()-11;//计算飞升阶数
|
||||
String codeKey="hero_feisheng_broadcast_content"+feishengNum;
|
||||
//飞升飘字
|
||||
String message = SErrorCodeEerverConfig.getI18NMessageNeedConvert(codeKey,
|
||||
new Object[]{user.getPlayerInfoManager().getNameColor(), user.getPlayerInfoManager().getNickName(), scHero.getReadingName()},
|
||||
new int[]{0, 0, 1});
|
||||
ChatLogic.getInstance().sendSysChatMessage(message, Global.DILIGENT, String.valueOf(targetHero.getTemplateId()), 0, 0, 0, 0, 0);
|
||||
} else if (targetHero.getStar() >= SSpecialConfig.getIntegerValue(SSpecialConfig.lamp_awaken_hero_content_parm)) {
|
||||
// 觉醒飘字
|
||||
String message = SErrorCodeEerverConfig.getI18NMessageNeedConvert("animal_awaken_broadcast_content",
|
||||
new Object[]{user.getPlayerInfoManager().getNameColor(), user.getPlayerInfoManager().getNickName(), scHero.getReadingName()},
|
||||
new int[]{0, 0, 1});
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import manager.STableManager;
|
|||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class CowFlySkyMissionType extends AbstractMissionType {
|
||||
|
|
@ -33,9 +34,11 @@ public class CowFlySkyMissionType extends AbstractMissionType {
|
|||
public void calCumulationDataResult(User user, CumulationData.Result result, List<MissionStateChangeInfo> missionStateChangeInfos, CumulationData cumulationData) throws Exception {
|
||||
// 进行中得任务
|
||||
Set<Integer> doingMissionIds = getDoingMissionIds();
|
||||
|
||||
Collection<SArroGantFly> values = STableManager.getConfig(SArroGantFly.class).values();
|
||||
for (SArroGantFly fly : values) {
|
||||
List<SArroGantFly> flyList = SArroGantFly.getMap().get(result.subType.getMissionTypeValue());
|
||||
if (flyList == null){
|
||||
return;
|
||||
}
|
||||
for (SArroGantFly fly : flyList) {
|
||||
// 任务子id
|
||||
int id = fly.getId();
|
||||
// 不在执行中
|
||||
|
|
|
|||
|
|
@ -959,6 +959,7 @@ public class CBean2Proto {
|
|||
.setFightResult(familyContribute)
|
||||
.setPlayerIntoLevel(guildInfo.getIntoLevel())
|
||||
.setFete(guildInfo.getFete())
|
||||
.setExploreTimes(guildInfo.getExploreKillMonsterNum())
|
||||
.build();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@ package config;
|
|||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="ArroGantFly")
|
||||
|
|
@ -18,14 +21,23 @@ public class SArroGantFly implements BaseConfig {
|
|||
|
||||
private int[][] reward;
|
||||
|
||||
private static Map<Integer, List<SArroGantFly>> map = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
Map<Integer, SArroGantFly> config = STableManager.getConfig(SArroGantFly.class);
|
||||
for (SArroGantFly value : config.values()) {
|
||||
List<SArroGantFly> flyList = map.getOrDefault(value.getValues(), new ArrayList<>());
|
||||
flyList.add(value);
|
||||
map.put(value.getValues(),flyList);
|
||||
}
|
||||
}
|
||||
|
||||
public static Map<Integer, List<SArroGantFly>> getMap() {
|
||||
return map;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -192,7 +192,12 @@ public class SCHero implements BaseConfig{
|
|||
int starOrBreakId = openSkillRule[1];
|
||||
int skillId = openSkillRule[2];
|
||||
awakSkillMapTmp.get(type).computeIfAbsent(starOrBreakId, a -> {
|
||||
return new ArrayList<>(awakSkillMapTmp.get(type).getOrDefault(a - 1, new ArrayList<>()));
|
||||
int oldKey=a-1;
|
||||
///飞升技能特殊处理,为了累计之前的激活技能
|
||||
if (a==25){
|
||||
oldKey=11;
|
||||
}
|
||||
return new ArrayList<>(awakSkillMapTmp.get(type).getOrDefault(oldKey , new ArrayList<>()));
|
||||
});
|
||||
awakSkillMapTmp.get(type).get(starOrBreakId).add(skillId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ public class SLuxuryFund implements BaseConfig {
|
|||
Map<Integer, SLuxuryFund> config = STableManager.getConfig(SLuxuryFund.class);
|
||||
config.values().forEach(v->{
|
||||
Map<Integer, SLuxuryFund> fundMap = typeMap.getOrDefault(v.getType(), new HashMap<>());
|
||||
fundMap.put(v.getDay(),v);
|
||||
fundMap.put(v.getId(),v);
|
||||
typeMap.put(v.getType(),fundMap);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -126,6 +126,7 @@ public class SSpecialConfig implements BaseConfig {
|
|||
public static final String DAYS_FOR_RECHARGE_SUM = "DaysForRechargeSum";//近期累计充值金额累计时长
|
||||
public static final String DAYS_FOR_RECHARGE_SINGLE = "DaysForRechargeSingle";//近期最大单笔充值金额累计时长
|
||||
public static final String PER_CHANGING_CART_PROP = "PerChangingCartProp";//每激活一张变身卡所增加的全体属性
|
||||
public static final String ChangeGodHeroContentParm = "ChangeGodHeroContentParm";//英雄飞升星级 12以上
|
||||
public static final String EXPLORERE_LIVETIME = "ExploreReliveTime";//探索时我方阵亡后复活时长
|
||||
public static final String BUILDING_TIME_REDUCE = "BuildingTimeReduce";//浮生特权每日每次减少建筑升级时间:秒
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue