Merge branch 'master_test_gn' of http://60.1.1.230/backend/jieling_server into master_test_gn
commit
407b087763
|
@ -1,6 +1,7 @@
|
|||
package com.ljsd.jieling.handler;
|
||||
|
||||
import com.google.protobuf.GeneratedMessage;
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
|
@ -11,8 +12,11 @@ import org.springframework.stereotype.Component;
|
|||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.HeroInfoProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @Author hj
|
||||
|
@ -38,9 +42,16 @@ public class GetWishDrawCardInfoHandler extends BaseHandler<HeroInfoProto.choice
|
|||
if (proto != null && proto.getInfoListCount() > 0){
|
||||
HeroLogic.getInstance().updateWishDrawCardInfo(user,proto.getInfoListList());
|
||||
}
|
||||
|
||||
// 返回
|
||||
// 心愿信息
|
||||
List<CommonProto.wishDrawCardInfo> wishCard = CBean2Proto.getWishCard(user);
|
||||
return HeroInfoProto.choiceWishHeroResponse.newBuilder().addAllInfoList(wishCard).build();
|
||||
// 开服时间
|
||||
int openTime = HeroLogic.getInstance().getServerOpenTimeByWishCard();
|
||||
Set<Integer> heroList = new HashSet<>();
|
||||
if (openTime > 0){
|
||||
heroList = HeroLogic.getInstance().getWishOpenHeroList(user);
|
||||
}
|
||||
// 更新的英雄列表
|
||||
return HeroInfoProto.choiceWishHeroResponse.newBuilder()
|
||||
.addAllInfoList(wishCard).setServerOpenTime(openTime).addAllHeroList(heroList).build();
|
||||
}
|
||||
}
|
|
@ -106,10 +106,12 @@ public enum ReportEventEnum {
|
|||
START_DEMON_INVASION(72,"start_demon_invasion",CommonEventHandler.getInstance(),new String[]{"stage_id_travel","boss_ids","combat_results"}),
|
||||
// 通过逍遥游
|
||||
COMPLETE_TRAVEL(73,"complete_travel",CommonEventHandler.getInstance(),new String[]{"stage_id_travel"}),
|
||||
// 新将来袭
|
||||
// 踏碎凌霄
|
||||
TA_SUI_LING_XIAO(74,"tasuilingxiao_boss",CommonEventHandler.getInstance(),new String[]{"boss_id","damage_num","reward_nums_list"}),
|
||||
//山河社稷图
|
||||
HARD_STAGE(75 ,"Sunvo_figure",CommonEventHandler.getInstance(),new String[]{"Sunvo_figure_type","Sunvo_figure_id","combat_results","get_star"}),
|
||||
//心愿抽卡活动
|
||||
CHOICE_DRAW_CARD(76 ,"wish_summon",CommonEventHandler.getInstance(),new String[]{"hero_id","summon_type","cost_item_id","cost_amount","hero_id_quality_list"}),
|
||||
|
||||
VIP_LEVEL_UP(100,"", new VipLevelUpEventHandler(),new String[]{""});
|
||||
|
||||
|
|
|
@ -8,11 +8,14 @@ import com.ljsd.jieling.db.redis.RedisUtil;
|
|||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.globals.GlobalItemType;
|
||||
import com.ljsd.jieling.handler.activity.BlessInfoConfig;
|
||||
import com.ljsd.jieling.jbean.ActivityManager;
|
||||
import com.ljsd.jieling.jbean.ActivityMission;
|
||||
import com.ljsd.jieling.jbean.ActivityProgressInfo;
|
||||
import com.ljsd.jieling.jbean.LuckWheelMission;
|
||||
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.*;
|
||||
import com.ljsd.jieling.logic.dao.PlayerManager;
|
||||
|
@ -1553,12 +1556,15 @@ public class ActivityLogic implements IEventHandler{
|
|||
throw new ErrorCodeException(ErrorCode.REFRESH_WHEL_TIME_NOT, "抽奖次数不足");
|
||||
}
|
||||
CommonProto.Drop.Builder drop = null;
|
||||
|
||||
int[] markReward = new int[]{0,0};
|
||||
int[][] markRewards = new int[num][];
|
||||
// 单抽
|
||||
if (num == 1){
|
||||
// 验证免费特权
|
||||
boolean check = PlayerLogic.getInstance().checkAndUpdate(user, setting.getFreeTimes(), num);
|
||||
if (check){
|
||||
drop = getDrawReward(user, activityId, num);
|
||||
drop = getDrawReward(user, activityId, num, markRewards);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1571,7 +1577,8 @@ public class ActivityLogic implements IEventHandler{
|
|||
boolean itemCost = ItemUtil.itemCost(user, cost, BIReason.CHOICE_DRAW_CARD, 0);
|
||||
// 道具抽奖
|
||||
if (itemCost){
|
||||
drop = getDrawReward(user, activityId, num);
|
||||
drop = getDrawReward(user, activityId, num, markRewards);
|
||||
markReward = new int[]{item[0][0],item[0][1]};
|
||||
}
|
||||
// 妖晶抽奖
|
||||
else {
|
||||
|
@ -1587,24 +1594,48 @@ public class ActivityLogic implements IEventHandler{
|
|||
if (!itemCost2){
|
||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||
}
|
||||
|
||||
markReward = new int[]{item[1][0],item[1][1]};
|
||||
//特权次数消耗
|
||||
PlayerLogic.getInstance().checkAndUpdate(user, setting.getDiamondMaxTimes(), num);
|
||||
drop = getDrawReward(user, activityId, num);
|
||||
drop = getDrawReward(user, activityId, num, markRewards);
|
||||
}
|
||||
}
|
||||
|
||||
// 特权消耗
|
||||
PlayerLogic.getInstance().checkAndUpdate(user, setting.getMaxTimes(), num);
|
||||
|
||||
// 事件分发
|
||||
Poster.getPoster().dispatchEvent(new ChoiceDrawCardEvent(user.getId(),activityId,num));
|
||||
|
||||
// 数数上报
|
||||
int choiceRewardId = user.getActivityManager().getActivityMissionMap().get(activityId).getChoiceRewardId();
|
||||
List<String> list = rewardArrayToList(markRewards);
|
||||
ReportUtil.onReportEvent(user, ReportEventEnum.CHOICE_DRAW_CARD.getType(), choiceRewardId, num, markReward[0], markReward[1], list);
|
||||
// 返回奖励信息
|
||||
build.setDrop(drop);
|
||||
MessageUtil.sendMessage(user.getId(),1, MessageTypeProto.MessageType.choiceDrawCardResponse_VALUE,build.build(),true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 奖励数组转list
|
||||
* @param markRewards
|
||||
* @return
|
||||
*/
|
||||
public List<String> rewardArrayToList(int[][] markRewards){
|
||||
List<String> result = new ArrayList<>(markRewards.length);
|
||||
for (int[] random : markRewards) {
|
||||
if (random == null) {
|
||||
continue;
|
||||
}
|
||||
SItem item = SItem.getsItemMap().get(random[0]);
|
||||
if (item == null) {
|
||||
result.add(random[0] +"-id错误"+random[1]);
|
||||
} else if(item.getItemType()== GlobalItemType.CARD) {
|
||||
result.add(random[0] + "-" + item.getQuantity());
|
||||
}else{
|
||||
result.add(random[0] + "#" + random[1]);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 心愿 获取奖励
|
||||
* @param user
|
||||
|
@ -1613,9 +1644,7 @@ public class ActivityLogic implements IEventHandler{
|
|||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
private CommonProto.Drop.Builder getDrawReward(User user,int activityId,int num) throws Exception {
|
||||
// 奖励信息
|
||||
int[][] reward = new int[num][];
|
||||
private CommonProto.Drop.Builder getDrawReward(User user,int activityId,int num,int[][] reward) throws Exception {
|
||||
// 活动信息
|
||||
ActivityMission mission = user.getActivityManager().getActivityMissionMap().get(activityId);
|
||||
// 累计得抽奖次数
|
||||
|
|
|
@ -89,6 +89,11 @@ public class HeroManager extends MongoBase {
|
|||
*/
|
||||
private Map<Integer, Map<Integer,Integer>> wishCountByStar = new HashMap<>();
|
||||
|
||||
/**
|
||||
* 心愿可以选择的英雄列表
|
||||
*/
|
||||
private Set<Integer> wishOpenHeroList = new HashSet<>();
|
||||
|
||||
public Map<Integer, Integer> getRandomCountByType() {
|
||||
return randomCountByType;
|
||||
}
|
||||
|
@ -439,5 +444,19 @@ public class HeroManager extends MongoBase {
|
|||
this.beautyBagCardInfoMap.put(key,val);
|
||||
updateString("beautyBagCardInfoMap", beautyBagCardInfoMap);
|
||||
}
|
||||
|
||||
public Set<Integer> getWishOpenHeroList() {
|
||||
return wishOpenHeroList;
|
||||
}
|
||||
|
||||
public void setWishOpenHeroList(Set<Integer> wishOpenHeroList) {
|
||||
this.wishOpenHeroList = wishOpenHeroList;
|
||||
updateString("wishOpenHeroList", wishOpenHeroList);
|
||||
}
|
||||
|
||||
public void addWishOpenHeroList(int heroTid) {
|
||||
wishOpenHeroList.add(heroTid);
|
||||
updateString("wishOpenHeroList", wishOpenHeroList);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.ljsd.jieling.logic.hero;
|
||||
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.fight.FamilyHeroInfo;
|
||||
import com.ljsd.jieling.chat.logic.ChatLogic;
|
||||
import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig;
|
||||
|
@ -601,6 +602,53 @@ public class HeroLogic{
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取可以加入
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
public Set<Integer> getWishOpenHeroList(User user){
|
||||
// 开服时间戳
|
||||
long openTime = TimeUtils.stringToTimeLong2(GameApplication.serverConfig.getOpenTime());
|
||||
// 当前时间戳
|
||||
long now = TimeUtils.now();
|
||||
// 差值
|
||||
long time = now - openTime;
|
||||
// set,存储最新的英雄列表
|
||||
HashSet<Integer> set = new HashSet<>();
|
||||
// 全部的英雄列表
|
||||
Map<Integer, SCHero> heroMap = SCHero.getsCHero();
|
||||
// 满足条件的放入set
|
||||
heroMap.values().stream().filter(v->v.getJoinWishDay() > 0 && time >= v.getJoinWishDay()*TimeUtils.DAY).forEach(v->set.add(v.getId()));
|
||||
// set, 返回给客户端,最新的set
|
||||
HashSet<Integer> result = new HashSet<>();
|
||||
// 目前存储的全部set
|
||||
Set<Integer> heroList = user.getHeroManager().getWishOpenHeroList();
|
||||
// 之前没有记录的为新开放,需要返回给客户端
|
||||
set.stream().filter(v->!heroList.contains(v)).forEach(result::add);
|
||||
// 更新玩家数据库
|
||||
user.getHeroManager().setWishOpenHeroList(set);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 从抽卡获取服务器开服时间
|
||||
* @return
|
||||
*/
|
||||
public int getServerOpenTimeByWishCard(){
|
||||
// 开服时间
|
||||
long openTime = TimeUtils.stringToTimeLong2(GameApplication.serverConfig.getOpenTime());
|
||||
// 根据格式获取时间戳 例子 :20210720
|
||||
int value = SSpecialConfig.getIntegerValue(SSpecialConfig.Data_Of_Unlock_All_Wish_Hero);
|
||||
long time = TimeUtils.stringToTimeLong(String.valueOf(value), "yyyyMMdd");
|
||||
// 规定时间之前开服的返回0
|
||||
if (openTime <= time){
|
||||
return 0;
|
||||
}else {
|
||||
return (int) (openTime/1000);
|
||||
}
|
||||
}
|
||||
|
||||
private void changeRandomItem(User user,int activityId,int[][] random){
|
||||
ActivityMission activityMission = user.getActivityManager().getActivityMissionMap().get(activityId);
|
||||
if(activityMission==null||activityMission.getActivityMissionMap().get(0)==null){
|
||||
|
|
|
@ -62,6 +62,8 @@ public class SCHero implements BaseConfig{
|
|||
|
||||
private int weight;
|
||||
|
||||
private int joinWishDay;
|
||||
|
||||
private Map<Integer,Integer> secondaryFactorMap;
|
||||
|
||||
private Map<Integer, List<Integer>> skillListByStar;
|
||||
|
@ -354,4 +356,8 @@ public class SCHero implements BaseConfig{
|
|||
public int getWeight() {
|
||||
return weight;
|
||||
}
|
||||
|
||||
public int getJoinWishDay() {
|
||||
return joinWishDay;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,6 +109,7 @@ public class SSpecialConfig implements BaseConfig {
|
|||
public static final String NUMOFCHOOSEREDSIGN ="NumOfChooseRedSign";//乾坤宝盒选择心愿红色魂印数量
|
||||
|
||||
public static final String LING_LONG_COST = "LingLongCost";//玲珑宝镜消耗道具ID
|
||||
public static final String Data_Of_Unlock_All_Wish_Hero = "DataOfUnlockAllWishHero";//在这个日期前开服的服务器默认解锁所有卡池内神将作为心愿,不走hero表加入心愿时长的判断
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
|
|
Loading…
Reference in New Issue