Merge branch 'master_prb_gn' into master_test_gn_zf
commit
426b23d23f
|
|
@ -2,7 +2,7 @@ package com.ljsd.jieling.core;
|
|||
|
||||
public interface GlobalsDef {
|
||||
String DEFAULT_NAME = "无名妖灵师";
|
||||
int VERSION_CODE=3;//后端兼容版本号
|
||||
int VERSION_CODE=4;//后端兼容版本号
|
||||
int MAP_MISSION_RETURN = -9999;
|
||||
int MAP_MISSION_FAILURE = -10000;
|
||||
|
||||
|
|
|
|||
|
|
@ -369,5 +369,9 @@ public interface BIReason {
|
|||
int WEEK_CARD_REWARD =1222;//周卡奖励
|
||||
|
||||
int FABAO_SOUL_UP_COST =1223;//法宝之魂升级消耗
|
||||
|
||||
int TRANSFORMATION_CARD_COST = 1224;//变身卡激活消耗
|
||||
|
||||
int BUY_GOOD_ITEM_COST =1225;//妖晶购买道具消耗
|
||||
int BUY_GOOD_ITEM_GET =1226;//妖晶购买道具获得
|
||||
}
|
||||
|
|
@ -168,8 +168,8 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
|||
if (playerInfoManager.getVersionCode()<2){
|
||||
calHeroHandBookData(user);
|
||||
}
|
||||
// 重置天宫商店
|
||||
if (playerInfoManager.getVersionCode()<3){
|
||||
// 重置天宫商店,2021-12-8 再次重置
|
||||
if (playerInfoManager.getVersionCode() < 4) {
|
||||
user.getStoreManager().removeStoreInfo(17);
|
||||
}
|
||||
playerInfoManager.setVersionCode(GlobalsDef.VERSION_CODE);
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ public class GetSomeActivityInfoHandler extends BaseHandler<PlayerInfoProto.GetS
|
|||
activityUpdateMap.put(activityId, activityMissionMap.get(activityId));
|
||||
});
|
||||
|
||||
List<CommonProto.ActivityInfo> activityInfos =ActivityLogic.getInstance().getActivityInfos(activityUpdateMap, user.getPlayerInfoManager().getCreateTime());
|
||||
List<CommonProto.ActivityInfo> activityInfos =ActivityLogic.getInstance().getActivityInfos(user,activityUpdateMap, user.getPlayerInfoManager().getCreateTime());
|
||||
PlayerInfoProto.GetSomeActitityInfoRespone build = PlayerInfoProto.GetSomeActitityInfoRespone.newBuilder().addAllActivityInfo(activityInfos).build();
|
||||
MessageUtil.sendMessage(iSession,1, MessageTypeProto.MessageType.GET_SOME_ACTIVITY_INFO_RESPONSE_VALUE,build);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,64 @@
|
|||
package com.ljsd.jieling.handler.goods;
|
||||
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.activity.event.SuperBoxEvent;
|
||||
import com.ljsd.jieling.logic.activity.fourChallenge.FourChallengeLogic;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import config.SGoodsConfig;
|
||||
import manager.STableManager;
|
||||
import rpc.protocols.ActivityProto;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author hj
|
||||
*/
|
||||
public class BuyGoodsToItemHandler extends BaseHandler<ActivityProto.BuyGoodsToItemRequest> {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.BuyGoodsToItemRequest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processWithProto(ISession iSession, ActivityProto.BuyGoodsToItemRequest proto) throws Exception {
|
||||
User user = UserManager.getUser(iSession.getUid());
|
||||
// 客户端参数
|
||||
int goodId = proto.getGoodId();
|
||||
int goodsNum = proto.getGoodsNum();
|
||||
if (goodsNum <= 0 || goodsNum > 999){
|
||||
throw new ErrorCodeException(ErrorCode.HERO_MAX);
|
||||
}
|
||||
// 配置表获取数据
|
||||
Map<Integer, SGoodsConfig> config = STableManager.getConfig(SGoodsConfig.class);
|
||||
SGoodsConfig goodsConfig = config.get(goodId);
|
||||
if (goodsConfig == null){
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||
}
|
||||
// 消耗道具
|
||||
boolean cost = ItemUtil.itemCost(user, new int[][]{goodsConfig.getPrice()},goodsNum,BIReason.BUY_GOOD_ITEM_COST,0);
|
||||
if (!cost){
|
||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||
}
|
||||
// 领取奖励
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, goodsConfig.getGoods(), goodsNum, BIReason.BUY_GOOD_ITEM_GET);
|
||||
// 消息发送
|
||||
Poster.getPoster().dispatchEvent(new SuperBoxEvent(user.getId(),goodId,goodsNum));
|
||||
// 返回
|
||||
ActivityProto.BuyGoodsToItemResponse build = ActivityProto.BuyGoodsToItemResponse.newBuilder().setDrop(drop).build();
|
||||
MessageUtil.sendMessage(iSession,1, MessageTypeProto.MessageType.BuyGoodsToItemResponse_VALUE,build,true);
|
||||
}
|
||||
}
|
||||
|
|
@ -370,12 +370,12 @@ public abstract class AbstractActivity implements IActivity, IEventHandler {
|
|||
takeAllReward(sessionByUid);
|
||||
}
|
||||
|
||||
List<CommonProto.ActivityInfo.MissionInfo> getAllMissInfo(ActivityMission activityMission) {
|
||||
return getAllMissInfo(activityMission, null);
|
||||
List<CommonProto.ActivityInfo.MissionInfo> getAllMissInfo(User user,ActivityMission activityMission) {
|
||||
return getAllMissInfo(user,activityMission,null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CommonProto.ActivityInfo.MissionInfo> getAllMissInfo(ActivityMission activityMission, Set<Integer> filter) {
|
||||
public List<CommonProto.ActivityInfo.MissionInfo> getAllMissInfo(User user,ActivityMission activityMission, Set<Integer> filter) {
|
||||
Map<Integer, ActivityProgressInfo> activityProgressInfoMap = activityMission.getActivityMissionMap();
|
||||
List<CommonProto.ActivityInfo.MissionInfo> missionInfos = new ArrayList<>(activityProgressInfoMap.size());
|
||||
for (Map.Entry<Integer, ActivityProgressInfo> missionProgress : activityProgressInfoMap.entrySet()) {
|
||||
|
|
@ -396,10 +396,19 @@ public abstract class AbstractActivity implements IActivity, IEventHandler {
|
|||
*/
|
||||
public void sendActivityProgress(ISession session, ActivityMission activityMission, Set<Integer> filterMissId) {
|
||||
PlayerInfoProto.ActivityUpateProgressIndication.Builder builder = PlayerInfoProto.ActivityUpateProgressIndication.newBuilder();
|
||||
builder.setActivityInfo(CommonProto.ActivityInfo.newBuilder().setValue(activityMission.getV()).addAllMission(getAllMissInfo(activityMission, filterMissId)).setActivityId(id));
|
||||
if (session != null) {
|
||||
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.ACTIVITY_UPDATE_PROGRESS_INDICATION_VALUE, builder.build(), true);
|
||||
User user = UserManager.getUserInMem(session.getUid());
|
||||
if (user != null && activityMission != null){
|
||||
List<CommonProto.ActivityInfo.MissionInfo> missInfo = getAllMissInfo(user, activityMission, filterMissId);
|
||||
CommonProto.ActivityInfo.Builder builder1 = CommonProto.ActivityInfo.newBuilder()
|
||||
.setValue(activityMission.getV())
|
||||
.addAllMission(missInfo)
|
||||
.setActivityId(id);
|
||||
builder.setActivityInfo(builder1);
|
||||
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.ACTIVITY_UPDATE_PROGRESS_INDICATION_VALUE, builder.build(), true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void sendActivityProgress(User user, ActivityMission activityMission, Set<Integer> filterMissId) {
|
||||
|
|
|
|||
|
|
@ -241,7 +241,7 @@ public class ActivityLogic implements IEventHandler{
|
|||
sendLuckWheelPool=true;
|
||||
activityUpdateMap.put(activityId, activityMissionMap.get(activityId));
|
||||
}
|
||||
List<CommonProto.ActivityInfo> activityInfos = getActivityInfos(activityUpdateMap, user1.getPlayerInfoManager().getCreateTime());
|
||||
List<CommonProto.ActivityInfo> activityInfos = getActivityInfos(user1,activityUpdateMap, user1.getPlayerInfoManager().getCreateTime());
|
||||
builder.addAllActivityInfo(activityInfos);
|
||||
|
||||
if(sendLuckWheelPool){
|
||||
|
|
@ -519,7 +519,7 @@ public class ActivityLogic implements IEventHandler{
|
|||
long createTime = user.getPlayerInfoManager().getCreateTime();
|
||||
int rewardResponseValue = MessageTypeProto.MessageType.GET_ALL_ACTIVITY_RESPONSE_VALUE;
|
||||
checkActivityOfUser(user, null);
|
||||
List<CommonProto.ActivityInfo> activityInfoList = getActivityInfos(user.getActivityManager().getActivityMissionMap(), createTime);
|
||||
List<CommonProto.ActivityInfo> activityInfoList = getActivityInfos(user,user.getActivityManager().getActivityMissionMap(), createTime);
|
||||
PlayerInfoProto.GetAllActivityResponse.Builder builder = PlayerInfoProto.GetAllActivityResponse.newBuilder();
|
||||
|
||||
builder.addAllActivityInfo(activityInfoList);
|
||||
|
|
@ -543,7 +543,7 @@ public class ActivityLogic implements IEventHandler{
|
|||
* @param createTime
|
||||
* @return
|
||||
*/
|
||||
public List<CommonProto.ActivityInfo> getActivityInfos(Map<Integer, ActivityMission> activityMissionMap, long createTime) {
|
||||
public List<CommonProto.ActivityInfo> getActivityInfos(User user,Map<Integer, ActivityMission> activityMissionMap, long createTime) {
|
||||
Map<Integer, SGlobalActivity> sGlobalActivityMap = SGlobalActivity.getsGlobalActivityMap();
|
||||
List<CommonProto.ActivityInfo> activityInfoList = new ArrayList<>(activityMissionMap.size());
|
||||
for (Map.Entry<Integer, ActivityMission> activityState : activityMissionMap.entrySet()) {
|
||||
|
|
@ -601,7 +601,7 @@ public class ActivityLogic implements IEventHandler{
|
|||
LOGGER.error(sGlobalActivity.getId()+":活动类型不存在");
|
||||
continue;
|
||||
}
|
||||
List<CommonProto.ActivityInfo.MissionInfo> missionInfos =abstractActivity.getAllMissInfo(activityMission);
|
||||
List<CommonProto.ActivityInfo.MissionInfo> missionInfos =abstractActivity.getAllMissInfo(user,activityMission);
|
||||
CommonProto.ActivityInfo build = CommonProto.ActivityInfo.newBuilder()
|
||||
.setActivityId(activityId)
|
||||
.addAllMission(missionInfos)
|
||||
|
|
@ -627,7 +627,7 @@ public class ActivityLogic implements IEventHandler{
|
|||
||ActivityType.LUCK_WHEEL_ADVANCE == SGlobalActivity.getsGlobalActivityMap().get(activityId).getType())
|
||||
sendLuckWheelPool=true;
|
||||
activityUpdateMap.put(activityId, activityMissionMap.get(activityId));
|
||||
List<CommonProto.ActivityInfo> activityInfos = getActivityInfos(activityUpdateMap, user.getPlayerInfoManager().getCreateTime());
|
||||
List<CommonProto.ActivityInfo> activityInfos = getActivityInfos(user,activityUpdateMap, user.getPlayerInfoManager().getCreateTime());
|
||||
builder.addAllActivityInfo(activityInfos);
|
||||
if(sendLuckWheelPool){
|
||||
sendLuckWheelPool(user,session);
|
||||
|
|
@ -746,6 +746,9 @@ public class ActivityLogic implements IEventHandler{
|
|||
}
|
||||
Integer activityId = item.getKey();
|
||||
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(activityId);
|
||||
if (sGlobalActivity == null){
|
||||
continue;
|
||||
}
|
||||
int targetActivityType = sGlobalActivity.getType();
|
||||
if (!activityType.contains(targetActivityType)) {
|
||||
continue;
|
||||
|
|
@ -767,7 +770,7 @@ public class ActivityLogic implements IEventHandler{
|
|||
long createTime = user.getPlayerInfoManager().getCreateTime();
|
||||
int startTime = (int) (ToolsUtil.getTimeLong(sGlobalActivity.getStartTimeLong(),sGlobalActivity.getEndTimeLong(),sGlobalActivity.getTime(),createTime, 1) / 1000);
|
||||
int endTime = (int) (ToolsUtil.getTimeLong(sGlobalActivity.getStartTimeLong(),sGlobalActivity.getEndTimeLong(),sGlobalActivity.getTime(),createTime, 2) / 1000);
|
||||
List<CommonProto.ActivityInfo.MissionInfo> missionInfos = abstractActivity.getAllMissInfo(activityMission);
|
||||
List<CommonProto.ActivityInfo.MissionInfo> missionInfos = abstractActivity.getAllMissInfo(user,activityMission);
|
||||
fBuilder.addActivityInfo(CommonProto.ActivityInfo.newBuilder().setValue(activityMission.getV()).setActivityId(activityId).addAllMission(missionInfos).setStartTime(startTime).setEndTime(endTime).setReallyOpen(activityMission.getOpenType()).build());
|
||||
fBuilder.setHadLuckTime( user.getPlayerInfoManager().getLuckWheelLimitTime());
|
||||
fBuilder.setHadAdvanceLuckTime(user.getPlayerInfoManager().getLuckAdvanceWheelLimitTime());
|
||||
|
|
@ -1461,7 +1464,7 @@ public class ActivityLogic implements IEventHandler{
|
|||
return true;
|
||||
}
|
||||
}
|
||||
LOGGER.error("未开启或者活动表已删除的活动id:{}",activityType);
|
||||
// LOGGER.info("checkActivityOpen uid={} 未开启或者活动表已删除的活动id:{}",user.getId(), activityType);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.ljsd.jieling.logic.activity;
|
||||
|
||||
@SuppressWarnings("ALL")
|
||||
public interface ActivityType {
|
||||
|
||||
int UNOPEN_STATE = -1;
|
||||
|
|
@ -99,6 +100,8 @@ public interface ActivityType {
|
|||
int SEVEN_WORLD_TREASURE = 83;//七界秘宝
|
||||
int RIDING_SWARD = 84;//御剑飞行
|
||||
int CONTINUOUS_GIFT = 85;//连续礼包
|
||||
int TRANSFORMATION_DRAW_CARD = 86;//方寸寻宝
|
||||
int CONTINUOUS_GIFT_NEW = 87;//新连续礼包
|
||||
int SPECIAL_MONSTER_RANDOM_ACTIVITY = 100;//灵兽宝阁活动
|
||||
int SPECIAL_MONSTER_GIFT_ACTIVITY = 101;//灵兽礼包
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import config.SGlobalActivity;
|
|||
import java.util.HashMap;
|
||||
import java.util.function.Function;
|
||||
|
||||
@SuppressWarnings("ALL")
|
||||
public enum ActivityTypeEnum {
|
||||
|
||||
ONLINEREWARD(ActivityType.OnlineReward, OnlineRewardActivity::new),
|
||||
|
|
@ -90,6 +91,8 @@ public enum ActivityTypeEnum {
|
|||
ITEMS_STORE_NEW(ActivityType.ITEMS_STORE_NEW,SuperBoxActivity::new),
|
||||
TRUMP_GACHA_ACTIVITY(ActivityType.TRUMP_GACHA_ACTIVITY,LimitRandomCardActivity::new),
|
||||
CONTINUOUS_GIFT(ActivityType.CONTINUOUS_GIFT,SuperBoxActivity::new),//连续礼包
|
||||
TRANSFORMATION_DRAW_CARD(ActivityType.TRANSFORMATION_DRAW_CARD,DefaultEmptyActivity::new),//方寸寻宝
|
||||
CONTINUOUS_GIFT_NEW(ActivityType.CONTINUOUS_GIFT_NEW,ContinuousGiftActivity::new),//新连续礼包
|
||||
;
|
||||
|
||||
private int type;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,373 @@
|
|||
package com.ljsd.jieling.logic.activity;
|
||||
|
||||
import com.ljsd.GameApplication;
|
||||
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.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.BuyGoodsNewLogic;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.bean.AbstractWelfareBag;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.rechargeHandler.RechargeHandler;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import config.*;
|
||||
import manager.STableManager;
|
||||
import rpc.protocols.CommonProto;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author hj
|
||||
* 新连续礼包活动
|
||||
*
|
||||
* 礼包状态:
|
||||
* 1:已解锁,可购买
|
||||
* 2:已解锁,不可买,未到购买天数
|
||||
* 3:已解锁,不可买,未购买前置礼包
|
||||
* 4:已解锁,不可买,未激活特权
|
||||
* 5:未解锁,不可见
|
||||
* 6:未解锁,可见,可预览
|
||||
* 7:未解锁,可见,不可预览
|
||||
* 8:已购买
|
||||
*/
|
||||
@SuppressWarnings("ALL")
|
||||
public class ContinuousGiftActivity extends AbstractActivity {
|
||||
|
||||
ContinuousGiftActivity(int id) {
|
||||
super(id);
|
||||
Poster.getPoster().listenEvent(this, SuperBoxEvent.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initActivity(User user) throws Exception {
|
||||
ActivityMission mission = new ActivityMission();
|
||||
// 初始化阶段奖励
|
||||
ActivityLogic.getInstance().initOtherMission(mission, new ArrayList<>());
|
||||
user.getActivityManager().getActivityMissionMap().put(id, mission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEvent(IEvent event) throws Exception {
|
||||
// 类型验证
|
||||
if (!(event instanceof SuperBoxEvent)) {
|
||||
return;
|
||||
}
|
||||
// 获取信息
|
||||
SuperBoxEvent event1 = (SuperBoxEvent) event;
|
||||
User user = UserManager.getUser(event1.getUserId());
|
||||
// 礼包处理
|
||||
giftHandle(user, event1.getGiftId(), event1.getNum());
|
||||
|
||||
// 客户端推送
|
||||
ISession session = OnlineUserManager.getSessionByUid(user.getId());
|
||||
sendActivityProgress(session, user.getActivityManager().getActivityMissionMap().get(id), null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 礼包处理
|
||||
* @param user
|
||||
* @param giftId
|
||||
* @param missionMap
|
||||
*/
|
||||
private void giftHandle(User user, int giftId, int giftNum){
|
||||
if (giftId < 0 || giftNum <= 0){
|
||||
// 非礼包处理
|
||||
return;
|
||||
}
|
||||
|
||||
ActivityMission mission = user.getActivityManager().getActivityMissionMap().get(id);
|
||||
if (mission == null){
|
||||
return;
|
||||
}
|
||||
Map<Integer, ActivityProgressInfo> missionMap = mission.getActivityMissionMap();
|
||||
Collection<SThemeActivityShop> themeShops = SThemeActivityShop.themeMap.getOrDefault(id, new HashMap<>(0)).values();
|
||||
|
||||
for (SThemeActivityShop theme : themeShops) {
|
||||
if (theme.getGoodId() == giftId){
|
||||
// 记录礼包购买次数
|
||||
ActivityProgressInfo current = missionMap.getOrDefault(theme.getId(),new ActivityProgressInfo());
|
||||
current.setProgrss(current.getProgrss() + giftNum);
|
||||
// 当前礼包状态处理
|
||||
if (checkBuyGiftLimit(user,theme.getId(),current.getProgrss())){
|
||||
current.setState(8);
|
||||
missionMap.put(theme.getId(),current);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改状态
|
||||
* 次数代码非必要不要进行修改,包含N多的嵌套if
|
||||
* 不要问我为啥写的这么恶心,因为我自己也不知怎么写出来的
|
||||
* @param user
|
||||
*/
|
||||
private int getState(User user, int missionId){
|
||||
// 活动信息是否为null
|
||||
ActivityMission mission = user.getActivityManager().getActivityMissionMap().get(id);
|
||||
int days = mission.getV();
|
||||
// 库
|
||||
ActivityProgressInfo progressInfo = Optional.ofNullable(mission.getActivityMissionMap()).map(v->v.get(missionId)).orElse(null);
|
||||
// 表
|
||||
SThemeActivityShop theme = Optional.ofNullable(SThemeActivityShop.themeMap.get(id)).map(v -> v.get(missionId)).orElse(null);
|
||||
// 返回值
|
||||
int result = 0;
|
||||
// 极为恶心的循环,包含超多的if-else
|
||||
if (theme != null){
|
||||
if (progressInfo != null && progressInfo.getState() == 8){
|
||||
// 已购买
|
||||
result = 8;
|
||||
}else {
|
||||
// 未购买, 是否解锁
|
||||
if (judgeDays(days,theme.getUnlockDay(),theme.getType())){
|
||||
// 已解锁, 可买天数
|
||||
if (judgeDays(days,theme.getBuyDay(),theme.getType())){
|
||||
// 可买, 是否购买前置礼包
|
||||
if (checkBuyAgo(user,theme.getId())){
|
||||
// 可买
|
||||
result = 1;
|
||||
}else {
|
||||
// 未购买前置
|
||||
result = 3;
|
||||
}
|
||||
}else {
|
||||
// 不可买
|
||||
result = 2;
|
||||
}
|
||||
}else {
|
||||
// 未解锁, 是否可见
|
||||
if (judgeDays(days,theme.getVisibleDay(),theme.getType())){
|
||||
// 可见, 是否可预览
|
||||
result = judgeDays(days,theme.getViewDay(),theme.getType())?6:7;
|
||||
}else {
|
||||
// 不可见
|
||||
result = 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断天数
|
||||
* @param condition
|
||||
* @param value
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
private boolean judgeDays(int value,int condition,int type){
|
||||
if (type == 2){
|
||||
return value == condition;
|
||||
}
|
||||
return value >= condition;
|
||||
}
|
||||
|
||||
@Override
|
||||
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){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
// 更新记录天数
|
||||
activityMission.setV(TimeUtils.getSoFarWentDays(start, now)+1);
|
||||
// 库里存储的活动档位信息
|
||||
Map<Integer, ActivityProgressInfo> progressInfoMap = activityMission.getActivityMissionMap();
|
||||
// 返回对象
|
||||
List<CommonProto.ActivityInfo.MissionInfo> missionInfos = new ArrayList<>(progressInfoMap.size());
|
||||
// 策划表的配置
|
||||
Map<Integer, SThemeActivityShop> themeMap = SThemeActivityShop.themeMap.getOrDefault(id,new HashMap<>());
|
||||
for (Map.Entry<Integer, SThemeActivityShop> entry : themeMap.entrySet()) {
|
||||
// 参数初始化
|
||||
int missionId = entry.getKey();
|
||||
int state = getState(user,missionId);
|
||||
if (state == 0){
|
||||
continue;
|
||||
}
|
||||
int progrss = progressInfoMap.getOrDefault(missionId, new ActivityProgressInfo()).getProgrss();
|
||||
// 封装proto并返回
|
||||
CommonProto.ActivityInfo.MissionInfo build = CommonProto.ActivityInfo.MissionInfo.newBuilder()
|
||||
.setMissionId(missionId)
|
||||
.setProgress(progrss)
|
||||
.setState(state)
|
||||
.build();
|
||||
missionInfos.add(build);
|
||||
}
|
||||
return missionInfos;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查活动是否完成或者可以领取
|
||||
* @param uid
|
||||
* @param activityId
|
||||
* @param activityMission
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean checkActivityMissionFinishAndTake(int uid, int activityId, ActivityMission activityMission) {
|
||||
Map<Integer, ActivityProgressInfo> activityProgressInfoMap = activityMission.getActivityMissionMap();
|
||||
if (activityProgressInfoMap.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 策划表的配置
|
||||
Map<Integer, SThemeActivityShop> themeMap = SThemeActivityShop.themeMap.getOrDefault(id,new HashMap<>());
|
||||
for (Map.Entry<Integer, SThemeActivityShop> entry : themeMap.entrySet()) {
|
||||
ActivityProgressInfo progressInfo = activityProgressInfoMap.get(entry.getKey());
|
||||
if (progressInfo == null || progressInfo.getState() != 8){
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
* @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 boxId
|
||||
* @return
|
||||
*/
|
||||
private boolean checkBuyAgo(User user, int boxId){
|
||||
// 获取消息
|
||||
Map<Integer, ActivityProgressInfo> missionMap = user.getActivityManager().getActivityMissionMap().get(id).getActivityMissionMap();
|
||||
SThemeActivityShop themes = STableManager.getConfig(SThemeActivityShop.class).get(boxId);
|
||||
// 非空
|
||||
if (themes == null){
|
||||
return false;
|
||||
}
|
||||
// 0表示没有前置条件
|
||||
if (themes.getLimitPackFId() == 0){
|
||||
return true;
|
||||
}
|
||||
// 前置礼包状态验证
|
||||
ActivityProgressInfo info = Optional.ofNullable(missionMap).map(v->v.get(themes.getLimitPackFId())).orElse(null);
|
||||
// info为null代表没有前置条件, state==1代表已买过
|
||||
if (info != null && info.getState() == 8){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验礼包购买次数
|
||||
* @param user
|
||||
* @param indexId
|
||||
* @return
|
||||
*/
|
||||
private boolean checkBuyGiftLimit(User user, int indexId, int count){
|
||||
Map<Integer, SThemeActivityShop> themeActivityShopMap = STableManager.getConfig(SThemeActivityShop.class);
|
||||
SThemeActivityShop shop = themeActivityShopMap.get(indexId);
|
||||
if (shop != null){
|
||||
if (shop.getGoodType() == 1){
|
||||
// 礼包不存在
|
||||
SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.getConfigById(shop.getGoodId());
|
||||
if (config == null){
|
||||
return true;
|
||||
}
|
||||
RechargeHandler rechargeHandler = BuyGoodsNewLogic.getRechargeHandler(config.getOtype());
|
||||
AbstractWelfareBag bag = rechargeHandler.getRechargeMap(user).get(shop.getGoodId());
|
||||
// 可继续购买
|
||||
if (bag != null && bag.checkBuy()){
|
||||
return false;
|
||||
}
|
||||
}else if (shop.getGoodType() == 2){
|
||||
Map<Integer, SGoodsConfig> goodsConfigMap = STableManager.getConfig(SGoodsConfig.class);
|
||||
SGoodsConfig goodsConfig = goodsConfigMap.get(shop.getGoodId());
|
||||
if (goodsConfig == null){
|
||||
return true;
|
||||
}
|
||||
// 可继续购买
|
||||
if (goodsConfig.getLimit() != 0 && goodsConfig.getLimit() < count){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取全部不能购买的礼包
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Set<Integer> getCloseGoods(User user){
|
||||
HashSet<Integer> set = new HashSet<>();
|
||||
ActivityMission mission = user.getActivityManager().getActivityMissionMap().get(id);
|
||||
if (mission == null){
|
||||
return set;
|
||||
}
|
||||
// 活动页签
|
||||
Map<Integer, ActivityProgressInfo> map = mission.getActivityMissionMap();
|
||||
Map<Integer, SThemeActivityShop> themes = SThemeActivityShop.themeMap.get(id);
|
||||
|
||||
for (Map.Entry<Integer, SThemeActivityShop> entry : themes.entrySet()) {
|
||||
int state = getState(user, entry.getKey());
|
||||
// 不可购买的礼包
|
||||
if (state != 1){
|
||||
set.add(entry.getValue().getGoodId());
|
||||
}
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -54,6 +54,6 @@ public interface IActivity {
|
|||
|
||||
void onActivityEndOnMySelf(User user) throws Exception;
|
||||
|
||||
List<CommonProto.ActivityInfo.MissionInfo> getAllMissInfo(ActivityMission activityMission, Set<Integer> filter);
|
||||
List<CommonProto.ActivityInfo.MissionInfo> getAllMissInfo(User user,ActivityMission activityMission, Set<Integer> filter);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ public class LevelExpectActivity extends ExpectRankActivity {
|
|||
|
||||
|
||||
@Override
|
||||
public List<CommonProto.ActivityInfo.MissionInfo> getAllMissInfo(ActivityMission activityMission, Set<Integer> filter) {
|
||||
public List<CommonProto.ActivityInfo.MissionInfo> getAllMissInfo(User user,ActivityMission activityMission, Set<Integer> filter) {
|
||||
Map<Integer, ActivityProgressInfo> activityProgressInfoMap = activityMission.getActivityMissionMap();
|
||||
Map<Integer, Integer> mapValues = RedisUtil.getInstence().getMapValues(RedisKey.ACTIVITY_GIFT_LIMIT, String.valueOf(id), Integer.class, Integer.class);
|
||||
List<CommonProto.ActivityInfo.MissionInfo> missionInfos = new ArrayList<>(activityProgressInfoMap.size());
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.ljsd.jieling.globals.Global;
|
|||
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.IEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.activity.event.SuperBoxEvent;
|
||||
|
|
@ -19,6 +20,7 @@ import config.SGlobalActivity;
|
|||
import config.SRechargeCommodityNewConfig;
|
||||
import config.SSurpriseBox;
|
||||
import manager.STableManager;
|
||||
import rpc.protocols.CommonProto;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.util.*;
|
||||
|
|
@ -49,17 +51,9 @@ public class SuperBoxActivity extends AbstractActivity {
|
|||
@Override
|
||||
public void initActivity(User user) throws Exception {
|
||||
ActivityMission mission = new ActivityMission();
|
||||
// 读表获取阶段奖励信息
|
||||
Map<Integer, SSurpriseBox> boxMap = SSurpriseBox.map.getOrDefault(id,new HashMap<>());
|
||||
if (boxMap.isEmpty()){
|
||||
LOGGER.error("惊喜礼盒初始化失败,活动id:"+id);
|
||||
}
|
||||
List<Integer> list = boxMap.values().stream().mapToInt(SSurpriseBox::getId).boxed().collect(Collectors.toList());
|
||||
// 初始化阶段奖励
|
||||
ActivityLogic.getInstance().initOtherMission(mission, list);
|
||||
ActivityLogic.getInstance().initOtherMission(mission, new ArrayList<>());
|
||||
user.getActivityManager().getActivityMissionMap().put(id, mission);
|
||||
// 修改状态
|
||||
updateState(user);
|
||||
LOGGER.info("惊喜礼盒初始化..."+id);
|
||||
}
|
||||
|
||||
|
|
@ -74,8 +68,10 @@ public class SuperBoxActivity extends AbstractActivity {
|
|||
User user = UserManager.getUser(event1.getUserId());
|
||||
// 礼包处理
|
||||
giftHandle(user, event1.getGiftId());
|
||||
// 状态刷新
|
||||
updateState(user);
|
||||
|
||||
// 客户端推送
|
||||
ISession session = OnlineUserManager.getSessionByUid(user.getId());
|
||||
sendActivityProgress(session, user.getActivityManager().getActivityMissionMap().get(id), null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -100,10 +96,9 @@ public class SuperBoxActivity extends AbstractActivity {
|
|||
for (SSurpriseBox box : boxes) {
|
||||
if (box.getPackId() == giftId){
|
||||
// 当前礼包状态处理
|
||||
ActivityProgressInfo current = missionMap.get(box.getId());
|
||||
if (current != null && !checkBuyGiftCount(user,giftId)){
|
||||
if (!checkBuyGiftCount(user,giftId)){
|
||||
ActivityProgressInfo current = new ActivityProgressInfo();
|
||||
current.setState(ActivityType.HAD_TAKED);
|
||||
current.setProgrss(8);
|
||||
missionMap.put(box.getId(),current);
|
||||
}
|
||||
break;
|
||||
|
|
@ -117,71 +112,123 @@ public class SuperBoxActivity extends AbstractActivity {
|
|||
* 不要问我为啥写的这么恶心,因为我自己也不知怎么写出来的
|
||||
* @param user
|
||||
*/
|
||||
private void updateState(User user){
|
||||
private int getProgress(User user,int missionId){
|
||||
// 活动信息是否为null
|
||||
ActivityMission mission = user.getActivityManager().getActivityMissionMap().get(id);
|
||||
int days = mission.getV();
|
||||
// 库
|
||||
ActivityProgressInfo progressInfo = Optional.ofNullable(mission.getActivityMissionMap()).map(v->v.get(missionId)).orElse(null);
|
||||
// 表
|
||||
SSurpriseBox box = Optional.ofNullable(SSurpriseBox.map.get(id)).map(v -> v.get(missionId)).orElse(null);
|
||||
// 返回值
|
||||
int result = 0;
|
||||
// 极为恶心的循环,包含超多的if-else
|
||||
if (box != null){
|
||||
if (progressInfo != null && progressInfo.getState() == ActivityType.HAD_TAKED){
|
||||
// 已购买
|
||||
result = 8;
|
||||
}else {
|
||||
// 未购买, 是否解锁
|
||||
if (days >= box.getUnlockDay()){
|
||||
// 已解锁, 可买天数
|
||||
if (days >= box.getBuyDay()){
|
||||
// 可买, 是否购买前置礼包
|
||||
if (checkBuyAgo(user,box.getId())){
|
||||
// 已购买前置. 是否需要特权, 是否激活特权
|
||||
result = checkRule(user,box.getRule())?1:4;
|
||||
}else {
|
||||
// 未购买前置
|
||||
result = 3;
|
||||
}
|
||||
}else {
|
||||
// 不可买
|
||||
result = 2;
|
||||
}
|
||||
}else {
|
||||
// 未解锁, 是否可见
|
||||
if (days >= box.getVisibleDay()){
|
||||
// 可见, 是否可预览
|
||||
result = days >= box.getViewDay()?6:7;
|
||||
}else {
|
||||
// 不可见
|
||||
result = 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
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;
|
||||
return new ArrayList<>();
|
||||
}
|
||||
ActivityMission mission = user.getActivityManager().getActivityMissionMap().get(id);
|
||||
if (mission == null){
|
||||
return;
|
||||
if (activityMission == null){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
// 计算过去了几天
|
||||
int days = TimeUtils.getSoFarWentDays(start, now)+1;
|
||||
mission.setV(days);
|
||||
// mission 单个礼包
|
||||
Map<Integer, ActivityProgressInfo> missionMap = mission.getActivityMissionMap();
|
||||
Map<Integer, SSurpriseBox> boxMap = SSurpriseBox.map.get(id);
|
||||
// 极为恶心的循环,包含超多的if-else
|
||||
for (Map.Entry<Integer, ActivityProgressInfo> entry : missionMap.entrySet()) {
|
||||
int k = entry.getKey();
|
||||
ActivityProgressInfo v = entry.getValue();
|
||||
int progrss = v.getProgrss();
|
||||
// 是否已购买
|
||||
if (progrss == 8){
|
||||
// 已购买
|
||||
// 更新记录天数
|
||||
activityMission.setV(TimeUtils.getSoFarWentDays(start, now)+1);
|
||||
// 库里存储的活动档位信息
|
||||
Map<Integer, ActivityProgressInfo> progressInfoMap = activityMission.getActivityMissionMap();
|
||||
// 返回对象
|
||||
List<CommonProto.ActivityInfo.MissionInfo> missionInfos = new ArrayList<>(progressInfoMap.size());
|
||||
// 策划表的配置
|
||||
Map<Integer, SSurpriseBox> boxMap = SSurpriseBox.map.getOrDefault(id,new HashMap<>());
|
||||
for (Map.Entry<Integer, SSurpriseBox> entry : boxMap.entrySet()) {
|
||||
// 参数初始化
|
||||
int missionId = entry.getKey();
|
||||
int progress = getProgress(user,missionId);
|
||||
if (progress == 0){
|
||||
continue;
|
||||
}
|
||||
int state = progress==8?1:0;
|
||||
// 封装proto并返回
|
||||
CommonProto.ActivityInfo.MissionInfo build = CommonProto.ActivityInfo.MissionInfo.newBuilder()
|
||||
.setMissionId(missionId)
|
||||
.setProgress(progress)
|
||||
.setState(state)
|
||||
.build();
|
||||
missionInfos.add(build);
|
||||
}
|
||||
return missionInfos;
|
||||
}
|
||||
|
||||
SSurpriseBox box = boxMap.get(k);
|
||||
// 未购买, 是否解锁
|
||||
if (days >= box.getUnlockDay()){
|
||||
// 已解锁, 可买天数
|
||||
if (days >= box.getBuyDay()){
|
||||
// 可买, 是否购买前置礼包
|
||||
if (checkBuyAgo(user,box.getId())){
|
||||
// 已购买前置. 是否需要特权, 是否激活特权
|
||||
progrss = checkRule(user,box.getRule())?1:4;
|
||||
}else {
|
||||
// 未购买前置
|
||||
progrss = 3;
|
||||
}
|
||||
}else {
|
||||
// 不可买
|
||||
progrss = 2;
|
||||
}
|
||||
}else {
|
||||
// 未解锁, 是否可见
|
||||
if (days >= box.getVisibleDay()){
|
||||
// 可见, 是否可预览
|
||||
progrss = days >= box.getViewDay()?6:7;
|
||||
}else {
|
||||
// 不可见
|
||||
progrss = 5;
|
||||
}
|
||||
}
|
||||
v.setProgrss(progrss);
|
||||
mission.getActivityMissionMap().put(k,v);
|
||||
/**
|
||||
* 检查活动是否完成或者可以领取
|
||||
* @param uid
|
||||
* @param activityId
|
||||
* @param activityMission
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean checkActivityMissionFinishAndTake(int uid, int activityId, ActivityMission activityMission) {
|
||||
Map<Integer, ActivityProgressInfo> activityProgressInfoMap = activityMission.getActivityMissionMap();
|
||||
if (activityProgressInfoMap.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
LOGGER.info("========================惊喜礼盒状态刷新,uid={}",user.getId());
|
||||
// 策划表的配置
|
||||
Map<Integer, SSurpriseBox> boxMap = SSurpriseBox.map.getOrDefault(id,new HashMap<>());
|
||||
for (Map.Entry<Integer, SSurpriseBox> entry : boxMap.entrySet()) {
|
||||
ActivityProgressInfo progressInfo = activityProgressInfoMap.get(entry.getKey());
|
||||
if (progressInfo == null || progressInfo.getState() == ActivityType.WILL_TAKE){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 客户端推送
|
||||
ISession session = OnlineUserManager.getSessionByUid(user.getId());
|
||||
sendActivityProgress(session, mission, null);
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -231,20 +278,24 @@ public class SuperBoxActivity extends AbstractActivity {
|
|||
* @return
|
||||
*/
|
||||
private boolean checkBuyAgo(User user, int boxId){
|
||||
boolean result = true;
|
||||
// 获取消息
|
||||
Map<Integer, ActivityProgressInfo> missionMap = user.getActivityManager().getActivityMissionMap().get(id).getActivityMissionMap();
|
||||
SSurpriseBox box = STableManager.getConfig(SSurpriseBox.class).get(boxId);
|
||||
// 非空
|
||||
if (!missionMap.isEmpty() && box != null){
|
||||
// 前置礼包状态验证
|
||||
ActivityProgressInfo info = missionMap.get(box.getLimitPackFId());
|
||||
// info为null代表没有前置条件, state==2代表已买过
|
||||
if (info != null && info.getState() == ActivityType.WILL_TAKE){
|
||||
result = false;
|
||||
}
|
||||
if (box == null){
|
||||
return false;
|
||||
}
|
||||
return result;
|
||||
// 0表示没有前置条件
|
||||
if (box.getLimitPackFId() == 0){
|
||||
return true;
|
||||
}
|
||||
// 前置礼包状态验证
|
||||
ActivityProgressInfo info = Optional.ofNullable(missionMap).map(v->v.get(box.getLimitPackFId())).orElse(null);
|
||||
// info为null代表没有前置条件, state==1代表已买过
|
||||
if (info != null && info.getState() == ActivityType.HAD_TAKED){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -292,6 +343,11 @@ public class SuperBoxActivity extends AbstractActivity {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取全部不能购买的礼包
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Set<Integer> getCloseGoods(User user){
|
||||
HashSet<Integer> set = new HashSet<>();
|
||||
|
|
@ -302,14 +358,12 @@ public class SuperBoxActivity extends AbstractActivity {
|
|||
// 活动页签
|
||||
Map<Integer, ActivityProgressInfo> map = mission.getActivityMissionMap();
|
||||
Map<Integer, SSurpriseBox> boxMap = SSurpriseBox.map.get(id);
|
||||
// 活动奖励条件
|
||||
for (Map.Entry<Integer, ActivityProgressInfo> entry2 : map.entrySet()) {
|
||||
if (entry2.getValue().getProgrss() != 1){
|
||||
SSurpriseBox box = boxMap.getOrDefault(entry2.getKey(), null);
|
||||
if (box == null){
|
||||
continue;
|
||||
}
|
||||
set.add(box.getPackId());
|
||||
|
||||
for (Map.Entry<Integer, SSurpriseBox> entry : boxMap.entrySet()) {
|
||||
int progress = getProgress(user, entry.getKey());
|
||||
// 不可购买的礼包
|
||||
if (progress != 1 || progress == 0){
|
||||
set.add(entry.getValue().getPackId());
|
||||
}
|
||||
}
|
||||
return set;
|
||||
|
|
|
|||
|
|
@ -22,11 +22,26 @@ public class SuperBoxEvent implements IEvent {
|
|||
public static int fund_old_user = -3;
|
||||
|
||||
private int userId;
|
||||
private int giftId = default_id;//礼包id
|
||||
/**
|
||||
* 礼包id
|
||||
*/
|
||||
private int giftId = default_id;
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private int num;
|
||||
|
||||
|
||||
public SuperBoxEvent(int userId, int giftId) {
|
||||
this.userId = userId;
|
||||
this.giftId = giftId;
|
||||
this.num = 1;
|
||||
}
|
||||
|
||||
public SuperBoxEvent(int userId, int giftId, int num) {
|
||||
this.userId = userId;
|
||||
this.giftId = giftId;
|
||||
this.num = num;
|
||||
}
|
||||
|
||||
public int getUserId() {
|
||||
|
|
@ -45,4 +60,11 @@ public class SuperBoxEvent implements IEvent {
|
|||
this.giftId = giftId;
|
||||
}
|
||||
|
||||
public int getNum() {
|
||||
return num;
|
||||
}
|
||||
|
||||
public void setNum(int num) {
|
||||
this.num = num;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,10 +42,7 @@ import rpc.protocols.PlayerInfoProto;
|
|||
import util.StringUtil;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author lvxinran
|
||||
|
|
@ -373,6 +370,7 @@ public class FourChallengeLogic {
|
|||
if (status[i] == 0){ continue; }
|
||||
user.getPlayerInfoManager().addFourChallengeRemainTimes(i, campOpenDay);
|
||||
}
|
||||
LOGGER.info("四灵试炼层数刷新,首次开启,玩家:{},层数:{}", user.getId(), Arrays.toString(user.getPlayerInfoManager().getFourChallengeRemainTimes()));
|
||||
user.getPlayerInfoManager().setOpenFourChallenge(true);
|
||||
// 推送四灵试炼信息
|
||||
ISession session = OnlineUserManager.getSessionByUid(user.getId());
|
||||
|
|
@ -399,6 +397,7 @@ public class FourChallengeLogic {
|
|||
if (status[i] == 0){ continue; }
|
||||
user.getPlayerInfoManager().addFourChallengeRemainTimes(i, campOpenDay*num);
|
||||
}
|
||||
LOGGER.info("四灵试炼层数刷新,每日登录,玩家:{},层数:{}", user.getId(), Arrays.toString(user.getPlayerInfoManager().getFourChallengeRemainTimes()));
|
||||
user.getPlayerInfoManager().setOpenFourChallenge(true);
|
||||
// 推送四灵试炼信息
|
||||
ISession session = OnlineUserManager.getSessionByUid(user.getId());
|
||||
|
|
|
|||
|
|
@ -9,10 +9,7 @@ import com.ljsd.jieling.logic.hero.HongMengAttributeEnum;
|
|||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.util.KeyGenUtils;
|
||||
import com.ljsd.jieling.util.UUIDEnum;
|
||||
import config.SCHero;
|
||||
import config.SCHeroRankUpConfig;
|
||||
import config.SEndlessHeroProp;
|
||||
import config.SEquipConfig;
|
||||
import config.*;
|
||||
import manager.STableManager;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
|
@ -104,7 +101,7 @@ public class Hero extends MongoBase implements Comparable<Hero>,Cloneable {
|
|||
}
|
||||
|
||||
/**
|
||||
* 初始化英雄
|
||||
* 初始化英雄,不入英雄背包
|
||||
* @param uid
|
||||
* @param heroTid
|
||||
* @param level
|
||||
|
|
@ -124,6 +121,7 @@ public class Hero extends MongoBase implements Comparable<Hero>,Cloneable {
|
|||
this.speed = hero.speed;
|
||||
this.especialEquipLevel = hero.especialEquipLevel;
|
||||
this.createType = 1;
|
||||
this.godSoulLv = Optional.ofNullable(STableManager.getConfig(SRobotProperty.class).get(level)).map(SRobotProperty::getSpirits).orElse(0);
|
||||
// 这个参数需要到外边处理
|
||||
this.jewelInfo = new HashSet<>(hero.getJewelInfo());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ public class BattleNode extends AbstractExpedition {
|
|||
Map<Integer,Long> longAttribute = new HashMap<>();
|
||||
robotHeroAttribute.forEach((k,v)->longAttribute.put(k,(long)v));
|
||||
force+=HeroLogic.getInstance().calForce(longAttribute);
|
||||
heroAllAttribute.put(id.toString(), new FamilyHeroInfo(id, property.getId(), property.getStar(), longAttribute,innerPosition++,0));
|
||||
heroAllAttribute.put(id.toString(), new FamilyHeroInfo(id, property.getId(), property.getStar(), longAttribute,innerPosition++,property.getSpirits()));
|
||||
}
|
||||
|
||||
fightInfo.setForce(force);
|
||||
|
|
|
|||
|
|
@ -186,22 +186,10 @@ public class ExpeditionLogic {
|
|||
if (newlay != nodeInfo1.getLay() && nodeInfo1.getLay() != oldlay) {
|
||||
return;
|
||||
}
|
||||
// if(passNode!=nodeInfo1.getSortId()&& !nextNodeId.contains(nodeInfo1.getSortId())){
|
||||
// return;
|
||||
// }
|
||||
|
||||
int state = nodeInfo1.getLay() == oldlay ? (nodeInfo1.getSortId() == passNode ? ExpeditionLogic.NODESTATE_PASS : ExpeditionLogic.NODESTATE_OVER_PASS) : nextNodeId.contains(nodeInfo1.getSortId())?ExpeditionLogic.NODESTATE_NOT_PASS:ExpeditionLogic.NODESTATE_CLOSE;
|
||||
nodeInfo1.setState(state);
|
||||
|
||||
// if(nodeInfo1.getType()==ExpeditionLogic.NODETYPE_SHOP&&newlay==nodeInfo1.getLay()){
|
||||
// try {
|
||||
// //更新商店
|
||||
// StoreLogic.initOneStore(user, 56);
|
||||
// }catch (Exception e){
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
|
||||
//最后的奖励节点 前端显示跳转入口用
|
||||
if( nodeInfo1.getLay() == oldlay&&nodeInfo1.getType()==ExpeditionLogic.NODETYPE_REWARD){
|
||||
if(user.getExpeditionManager().getExpeditionLeve()<=2){
|
||||
|
|
@ -442,6 +430,7 @@ public class ExpeditionLogic {
|
|||
builder1.setStar(familyHeroInfo.getStar());
|
||||
builder1.setRemainHp(heroHP.get(s));
|
||||
builder1.setPosition(familyHeroInfo.getPosition());
|
||||
builder1.setGodSoulLv(familyHeroInfo.getGodSoulLv());
|
||||
builders.add(builder1.build());
|
||||
});
|
||||
builder.addAllHero(builders);
|
||||
|
|
@ -606,9 +595,9 @@ public class ExpeditionLogic {
|
|||
throw new ErrorCodeException(ErrorCode.CFG_NULL,"英雄表id不存在:"+heroTid);
|
||||
}
|
||||
// 最高等级
|
||||
level = level>scHero.getMaxLevel()?scHero.getMaxLevel():level;
|
||||
level = Math.min(level, scHero.getMaxLevel());
|
||||
// 最低20级
|
||||
level = level<20?20:level;
|
||||
level = Math.max(level, 20);
|
||||
//创建新的英雄
|
||||
Hero newHero = new Hero(hero,user.getId(),heroTid,level);
|
||||
// 魂宝灵宝,魂印需要走表
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ public class SpecialNode extends AbstractExpedition {
|
|||
int force = HeroLogic.getInstance().calForce(longAttribute);
|
||||
fightInfo.setForce(force);
|
||||
//试炼节点 放到第二个位置上
|
||||
heroAllAttribute.put(Integer.toString(heroId), new FamilyHeroInfo(heroId,level,robot.getStar(),longAttribute,2,0));
|
||||
heroAllAttribute.put(Integer.toString(heroId), new FamilyHeroInfo(heroId,level,robot.getStar(),longAttribute,2,robot.getGodSoulLev()));
|
||||
fightInfo.updateHeroSkill(String.valueOf(heroId),skills.substring(0,skills.length()-1));
|
||||
// 获取灵兽信息
|
||||
SRobotProperty property = STableManager.getConfig(SRobotProperty.class).get(level);
|
||||
|
|
|
|||
|
|
@ -642,6 +642,7 @@ public class FightUtil {
|
|||
robotInfo.setRobotHeroAttribute(HeroLogic.getInstance().calRobotHeroAttribute(property));
|
||||
robotInfo.setSkill(SRobotSkill.getSkill(heroTid));
|
||||
robotInfo.setPassiveSkill(SRobotSkill.getPassiveSkill(heroTid, property.getSkillPool() - 1));
|
||||
robotInfo.setGodSoulLev(property.getSpirits());
|
||||
return robotInfo;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,15 @@ public class RobotInfo {
|
|||
private Map<Integer, Integer> robotHeroAttribute;
|
||||
private String skill;
|
||||
private String passiveSkill;
|
||||
private int godSoulLev;
|
||||
|
||||
public int getGodSoulLev() {
|
||||
return godSoulLev;
|
||||
}
|
||||
|
||||
public void setGodSoulLev(int godSoulLev) {
|
||||
this.godSoulLev = godSoulLev;
|
||||
}
|
||||
|
||||
public int getHeroTid() {
|
||||
return heroTid;
|
||||
|
|
|
|||
|
|
@ -1727,41 +1727,34 @@ public class HeroLogic {
|
|||
|
||||
/**
|
||||
* 根据英雄等级计算出starBreaklId
|
||||
*
|
||||
* @param heroTid
|
||||
* @param heroLevel
|
||||
* @return
|
||||
*/
|
||||
public int calRobotStarBreakByLevel(int heroTid, int heroLevel) {
|
||||
// 获取进阶属性
|
||||
// 获取原始星级
|
||||
int star = SCHero.getsCHero().get(heroTid).getStar();
|
||||
Map<Integer, SCHeroRankUpConfig> byStar = STableManager.getFigureConfig(HeroStaticConfig.class).getScHeroRankUpConfigByShow(GlobalsDef.UP_STAR_TYPE, star);
|
||||
if (byStar != null) {
|
||||
// 换个对象,尽量不要修改原值
|
||||
List<SCHeroRankUpConfig> rankUpConfigs = new ArrayList<>(byStar.values());
|
||||
// 聚合::根据openlevel倒序,输出list
|
||||
List<SCHeroRankUpConfig> collect = rankUpConfigs.stream().sorted(Comparator.comparing(SCHeroRankUpConfig::getOpenLevel).reversed()).collect(Collectors.toList());
|
||||
for (SCHeroRankUpConfig scHeroRankUpConfig : collect) {
|
||||
if (heroLevel == scHeroRankUpConfig.getOpenLevel()) {
|
||||
if (scHeroRankUpConfig.getOpenStar() > 10) {
|
||||
continue;
|
||||
}
|
||||
return scHeroRankUpConfig.getId();
|
||||
} else if (heroLevel > scHeroRankUpConfig.getOpenLevel()) {
|
||||
if (scHeroRankUpConfig.getOpenStar() > 10) {
|
||||
continue;
|
||||
}
|
||||
return scHeroRankUpConfig.getId() + 1;
|
||||
// 根据等级计算星级
|
||||
int heroStar = calRobotStarByLevel(heroTid,heroLevel);
|
||||
// 突破,根据初始星级获取不同分区
|
||||
Map<Integer, SCHeroRankUpConfig> configByShow = STableManager.getFigureConfig(HeroStaticConfig.class).getScHeroRankUpConfigByShow(GlobalsDef.UP_STAR_TYPE, star);
|
||||
int starBreakId = 0;
|
||||
if (configByShow != null) {
|
||||
// openLevel 正序
|
||||
List<SCHeroRankUpConfig> collect = configByShow.values().stream().sorted(Comparator.comparing(SCHeroRankUpConfig::getOpenLevel)).collect(Collectors.toList());
|
||||
for (SCHeroRankUpConfig rank : collect) {
|
||||
if (heroStar == rank.getOpenStar()){
|
||||
starBreakId = rank.getId();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return starBreakId;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据英雄等级计算出BreaklId
|
||||
*
|
||||
* @param heroTid
|
||||
* @param heroLevel
|
||||
* @return
|
||||
|
|
@ -1769,18 +1762,20 @@ public class HeroLogic {
|
|||
public int calRobotBreakByLevel(int heroTid, int heroLevel) {
|
||||
// 初始等级
|
||||
int star = SCHero.getsCHero().get(heroTid).getStar();
|
||||
Map<Integer, SCHeroRankUpConfig> byBreak = STableManager.getFigureConfig(HeroStaticConfig.class).getScHeroRankUpConfigByShow(GlobalsDef.BREAK_TYPE, star);
|
||||
if (byBreak != null) {
|
||||
List<SCHeroRankUpConfig> rankUpConfigs = new ArrayList<>(byBreak.values());
|
||||
// 聚合:根据openlevel倒叙排序,输出成list
|
||||
List<SCHeroRankUpConfig> collect = rankUpConfigs.stream().sorted(Comparator.comparing(SCHeroRankUpConfig::getOpenLevel).reversed()).collect(Collectors.toList());
|
||||
for (SCHeroRankUpConfig scHeroRankUpConfig : collect) {
|
||||
if (heroLevel > scHeroRankUpConfig.getLimitLevel()) {
|
||||
return scHeroRankUpConfig.getId();
|
||||
// 突破,根据初始星级获取不同分区
|
||||
Map<Integer, SCHeroRankUpConfig> configByShow = STableManager.getFigureConfig(HeroStaticConfig.class).getScHeroRankUpConfigByShow(GlobalsDef.BREAK_TYPE, star);
|
||||
int breakId = 0;
|
||||
if (configByShow != null) {
|
||||
// openLevel 正序排列
|
||||
List<SCHeroRankUpConfig> collect = configByShow.values().stream().sorted(Comparator.comparing(SCHeroRankUpConfig::getOpenLevel)).collect(Collectors.toList());
|
||||
for (SCHeroRankUpConfig rank : collect) {
|
||||
if (heroLevel <= rank.getLimitLevel()){
|
||||
break;
|
||||
}
|
||||
breakId = rank.getId();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return breakId;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1794,40 +1789,70 @@ public class HeroLogic {
|
|||
SCHero scHero = SCHero.getsCHero().get(heroTid);
|
||||
// 英雄初始星级
|
||||
int star = scHero.getStar();
|
||||
|
||||
// 进阶,根据初始星级获取不同分区,先进行进阶验证,再进行突破验证
|
||||
Map<Integer, SCHeroRankUpConfig> byStar = STableManager.getFigureConfig(HeroStaticConfig.class).getScHeroRankUpConfigByShow(GlobalsDef.UP_STAR_TYPE, star);
|
||||
if (byStar != null) {
|
||||
// 换个对象,尽量不要修改原值
|
||||
List<SCHeroRankUpConfig> rankUpStar = new ArrayList<>(byStar.values());
|
||||
// 聚合::根据openlevel倒序,输出list
|
||||
List<SCHeroRankUpConfig> collect = rankUpStar.stream().sorted(Comparator.comparing(SCHeroRankUpConfig::getOpenLevel).reversed()).collect(Collectors.toList());
|
||||
for (SCHeroRankUpConfig val : collect) {
|
||||
if (heroLevel > val.getOpenLevel()) {
|
||||
// 计算星级需要+1操作
|
||||
int result = val.getOpenStar() + 1;
|
||||
// 机器人生成星级,最高10星
|
||||
return result > 10 ? 10 : result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 突破,根据初始星级获取不同分区
|
||||
Map<Integer, SCHeroRankUpConfig> byBreak = STableManager.getFigureConfig(HeroStaticConfig.class).getScHeroRankUpConfigByShow(GlobalsDef.BREAK_TYPE, star);
|
||||
if (byBreak != null) {
|
||||
List<SCHeroRankUpConfig> rankUpBreak = new ArrayList<>(byBreak.values());
|
||||
// 聚合:根据openlevel倒叙排序,输出成list
|
||||
List<SCHeroRankUpConfig> collect = rankUpBreak.stream().sorted(Comparator.comparing(SCHeroRankUpConfig::getOpenLevel).reversed()).collect(Collectors.toList());
|
||||
for (SCHeroRankUpConfig val : collect) {
|
||||
if (heroLevel > val.getLimitLevel()) {
|
||||
return val.getOpenStar() > 10 ? 10 : val.getOpenStar();
|
||||
Map<Integer, SCHeroRankUpConfig> configByShow = STableManager.getFigureConfig(HeroStaticConfig.class).getScHeroRankUpConfigByShow(GlobalsDef.UP_STAR_TYPE, star);
|
||||
if (configByShow != null) {
|
||||
// openLevel 正序排列
|
||||
List<SCHeroRankUpConfig> collect = configByShow.values().stream().sorted(Comparator.comparing(SCHeroRankUpConfig::getOpenLevel)).collect(Collectors.toList());
|
||||
// 遍历
|
||||
for (int i = collect.size() - 1; i >= 0; i--) {
|
||||
SCHeroRankUpConfig rank = collect.get(i);
|
||||
if (heroLevel >= rank.getOpenLevel() && i == collect.size()-1){
|
||||
star = rank.getOpenStar();
|
||||
break;
|
||||
}
|
||||
if (heroLevel > rank.getOpenLevel()){
|
||||
star = rank.getOpenStar()+1;
|
||||
break;
|
||||
}
|
||||
if (i == 0 && heroLevel <= rank.getOpenLevel() && heroLevel > 100){
|
||||
star = rank.getOpenStar();
|
||||
break;
|
||||
}
|
||||
if (heroLevel >= 81 && heroLevel <= 100){
|
||||
star = 5;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return star;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据等级计算机器人的星级,突破等级,星级突破等级
|
||||
* @param heroLevel
|
||||
* @param type
|
||||
* @param star
|
||||
* @return
|
||||
*/
|
||||
private int calRobotIdByLevel(int heroLevel, int type, int star){
|
||||
// 突破,根据初始星级获取不同分区
|
||||
Map<Integer, SCHeroRankUpConfig> configByShow = STableManager.getFigureConfig(HeroStaticConfig.class).getScHeroRankUpConfigByShow(type, star);
|
||||
if (configByShow != null) {
|
||||
List<SCHeroRankUpConfig> configs = new ArrayList<>(configByShow.values());
|
||||
// 聚合:根据openlevel倒叙排序,输出成list
|
||||
List<SCHeroRankUpConfig> collect = configs.stream().sorted(Comparator.comparing(SCHeroRankUpConfig::getOpenLevel).reversed()).collect(Collectors.toList());
|
||||
for (int i = 0; i < collect.size(); i++) {
|
||||
SCHeroRankUpConfig rank = collect.get(i);
|
||||
|
||||
// 等级卡在突破阶段,返回下层星级
|
||||
if (heroLevel == rank.getOpenLevel()) {
|
||||
return rank.getId();
|
||||
}
|
||||
// 最高星级
|
||||
else if (heroLevel > rank.getOpenLevel() && i==0){
|
||||
return rank.getId();
|
||||
}
|
||||
// 等级超过突破阶段,返回上层等级
|
||||
else if (heroLevel > rank.getOpenLevel()){
|
||||
return collect.get(i-1).getId();
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
private Map<Integer, Object> getParaRate(SCHero scHero, int heroStar, int heroLevel, int heroBreakId) {
|
||||
Map<Integer, Object> result = new HashMap<>(2);
|
||||
Object rankupPara = null;
|
||||
|
|
@ -5688,15 +5713,13 @@ public class HeroLogic {
|
|||
*/
|
||||
public int getAverageLevel(User user, int averageNum) throws ErrorCodeException {
|
||||
HeroManager heroManager = user.getHeroManager();
|
||||
|
||||
int num = heroManager.getHeroMap().size() > averageNum ? averageNum : heroManager.getHeroMap().size();
|
||||
|
||||
// 获取平均数量
|
||||
int num = Math.min(heroManager.getHeroMap().size(), averageNum);
|
||||
// 获取玩家全部英雄
|
||||
Collection<Hero> values = heroManager.getHeroMap().values();
|
||||
List<Hero> heroes = new ArrayList<>(values);
|
||||
|
||||
// 玩家英雄背包按等级排
|
||||
Collections.sort(heroes);
|
||||
List<Hero> heroes = heroManager.getHeroMap().values().stream()
|
||||
.sorted(Comparator.comparing(v -> v.getLevel(heroManager), Comparator.reverseOrder()))
|
||||
.collect(Collectors.toList())
|
||||
.subList(0, num);
|
||||
// 等级相加
|
||||
int count = 0;
|
||||
for (int i = 0; i < num; i++) {
|
||||
|
|
|
|||
|
|
@ -98,6 +98,23 @@ public class ItemUtil {
|
|||
return dropBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取道具
|
||||
* @param user
|
||||
* @param itemArr
|
||||
* @param count
|
||||
* @param reason
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static CommonProto.Drop.Builder drop(User user, int[][] itemArr, float count, int reason) throws Exception {
|
||||
CommonProto.Drop.Builder dropBuilder = CommonProto.Drop.newBuilder();
|
||||
ItemMap itemObj = new ItemMap();
|
||||
selectItemArr(itemArr,itemObj,count);
|
||||
mapToAdd(user,itemObj,dropBuilder,reason);
|
||||
return dropBuilder;
|
||||
}
|
||||
|
||||
|
||||
//注:此方法只用于会超过int最大值的掉落,不会超过最大值的用上面方法
|
||||
public static CommonProto.Drop.Builder drop(User user, long[][] itemArr,int reason) throws Exception {
|
||||
|
|
@ -198,8 +215,8 @@ public class ItemUtil {
|
|||
*
|
||||
* @param user
|
||||
* @param dropGroupIds
|
||||
* @param dropRatio
|
||||
* @param isMapping 是否地图探索掉落,1:是
|
||||
* @param dropRatio 计算几次
|
||||
* @param isMapping 是否地图探索掉落,1:是(暂时不用)
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
|
|
@ -367,6 +384,12 @@ public class ItemUtil {
|
|||
}
|
||||
}
|
||||
|
||||
private static void selectItemArr(int[][] itemArr,ItemMap itemObj,float count) throws ErrorCodeException{
|
||||
for (int[] items : itemArr){
|
||||
getMap(items[0],items[1],itemObj,count);
|
||||
}
|
||||
}
|
||||
|
||||
private static void selectLongItemArr(long[][] itemArr,ItemMap itemObj) throws ErrorCodeException{
|
||||
for (long[] items : itemArr){
|
||||
getMap((int)items[0],items[1],itemObj,1);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,43 @@
|
|||
package config;
|
||||
|
||||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="GoodsConfig")
|
||||
public class SGoodsConfig implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int[][] goods;
|
||||
|
||||
private int[] price;
|
||||
|
||||
private int limit;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int[][] getGoods() {
|
||||
return goods;
|
||||
}
|
||||
|
||||
public int[] getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public int getLimit() {
|
||||
return limit;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -17,6 +17,8 @@ public class SRobotProperty implements BaseConfig {
|
|||
private int skillPool;
|
||||
|
||||
private int[][] animal;
|
||||
|
||||
private int spirits;
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
|
@ -43,4 +45,8 @@ public class SRobotProperty implements BaseConfig {
|
|||
public int[][] getAnimal() {
|
||||
return animal;
|
||||
}
|
||||
|
||||
public int getSpirits() {
|
||||
return spirits;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
package config;
|
||||
|
||||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="ThemeActivityShop")
|
||||
public class SThemeActivityShop implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int activityId;
|
||||
|
||||
private int type;
|
||||
|
||||
private int goodType;
|
||||
|
||||
private int goodId;
|
||||
|
||||
private int unlockDay;
|
||||
|
||||
private int visibleDay;
|
||||
|
||||
private int viewDay;
|
||||
|
||||
private int buyDay;
|
||||
|
||||
private int limitPackFId;
|
||||
|
||||
private int limitPackBId;
|
||||
|
||||
/**
|
||||
* key: 活动id value: <key: 索引id, value:对象>
|
||||
*/
|
||||
public static Map<Integer, Map<Integer,SThemeActivityShop>> themeMap = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
Map<Integer, SThemeActivityShop> config = STableManager.getConfig(SThemeActivityShop.class);
|
||||
config.values().forEach(v->{
|
||||
Map<Integer, SThemeActivityShop> themeActivityShopMap = themeMap.getOrDefault(v.getActivityId(), new HashMap<>());
|
||||
themeActivityShopMap.put(v.getId(),v);
|
||||
themeMap.put(v.getActivityId(),themeActivityShopMap);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getActivityId() {
|
||||
return activityId;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public int getGoodType() {
|
||||
return goodType;
|
||||
}
|
||||
|
||||
public int getGoodId() {
|
||||
return goodId;
|
||||
}
|
||||
|
||||
public int getUnlockDay() {
|
||||
return unlockDay;
|
||||
}
|
||||
|
||||
public int getVisibleDay() {
|
||||
return visibleDay;
|
||||
}
|
||||
|
||||
public int getViewDay() {
|
||||
return viewDay;
|
||||
}
|
||||
|
||||
public int getBuyDay() {
|
||||
return buyDay;
|
||||
}
|
||||
|
||||
public int getLimitPackFId() {
|
||||
return limitPackFId;
|
||||
}
|
||||
|
||||
public int getLimitPackBId() {
|
||||
return limitPackBId;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue