Merge branch 'master_test_gn' of http://60.1.1.230/backend/jieling_server into dev_dh_fourSpirit2

duhui 2021-09-02 15:17:00 +08:00
commit 19c3a04559
19 changed files with 230 additions and 64 deletions

View File

@ -20,6 +20,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class CoreService implements RPCRequestIFace.Iface {
private static final Logger LOGGER = LoggerFactory.getLogger(CoreService.class);
@ -54,16 +56,15 @@ public class CoreService implements RPCRequestIFace.Iface {
}
@Override
public RechargeResult getRecharge(int uid) throws TException {
public RechargeResult getRecharge(int uid) {
try {
HashSet<Integer> integers = new HashSet<>();
// BuyGoodsLogic.getGoodsBagInfoFromDelive(uid,integers);
Set<Integer> list = BuyGoodsNewLogic.getGoodsBagInfoFromDelive(uid);
RechargeResult result = new RechargeResult();
result.setResultCode(1);
result.setSubNodeSet(integers);
result.setSubNodeSet(list);
return result;
}catch (Exception e){
User user = UserManager.getUserInMem(uid);
User user = UserManager.getUserInMem(uid);
RechargeResult result = new RechargeResult();
result.setResultCode(0);
if(user == null){

View File

@ -68,6 +68,7 @@ public enum FunctionIdEnum {
Four_Challenge(83,null,MessageTypeProto.MessageType.FOUR_CHALLENGE_DO_REQUEST_VALUE),
GodTree(84,null),
HongMeng(86,null),
WeekGood(9091,null),
;
private int functionType;

View File

@ -4,18 +4,19 @@ import com.ljsd.jieling.handler.BaseHandler;
import com.ljsd.jieling.logic.family.GuildLogic;
import com.ljsd.jieling.netty.cocdex.PacketNetData;
import com.ljsd.jieling.network.session.ISession;
import rpc.protocols.Family;
import rpc.protocols.MessageTypeProto;
import org.springframework.stereotype.Component;
@Component
public class FamilyRecommandHandler extends BaseHandler {
public class FamilyRecommandHandler extends BaseHandler<Family.FamilyRecommandRequest> {
@Override
public MessageTypeProto.MessageType getMessageCode() {
return MessageTypeProto.MessageType.FAMILY_RECOMEND_REQUEST;
}
@Override
public void process(ISession iSession, PacketNetData netData) throws Exception {
GuildLogic.recommendFamily(iSession);
public void processWithProto(ISession session, Family.FamilyRecommandRequest proto) throws Exception {
GuildLogic.recommendFamily(session,proto);
}
}

View File

@ -197,7 +197,9 @@ public class StartHardStageRequestHandler extends BaseHandler<PlayerInfoProto.Ha
}
}
//参与奖励
user.getUserMissionManager().onGameEvent(user, GameEvent.HARSTAGE_PARTICIPATION_REWARD,1);
if(nodeConfig.getStageType()!= 2){
user.getUserMissionManager().onGameEvent(user, GameEvent.HARSTAGE_PARTICIPATION_REWARD,1);
}
//排行榜章节
int hardStageId = SHardStage.getStageIdByChapterAndSection(user.getHardStageManager().getCurChapter(), user.getHardStageManager().getCurNode());
Poster.getPoster().dispatchEvent(new ShanHeSheJiTuStarEvent(iSession.getUid(), 1, hardStageId));

View File

@ -126,7 +126,7 @@ public class GlobalDataManaager implements IManager {
if( limitDay[0] == 2 ){
//此时是开服第几天
long day = TimeUtils.getGapDaysByTwoTime(GameApplication.serverConfig.getOpenTime(),TimeUtils.getTimeStamp2(TimeUtils.now()))+1;
if(day < limitDay[1]){
if(day <= limitDay[1]){
closeList.add(id);
continue;
}
@ -155,10 +155,10 @@ public class GlobalDataManaager implements IManager {
//开服几天后开启
if(getServerOpenTimeCompareSpecialTimeResult()){
int[]limitDay = sGlobalSystemConfig.getIfOpen();
if(limitDay.length>0 && limitDay != null){
if(limitDay.length > 0){
if( limitDay[0] == 2 ){
long day = TimeUtils.getGapDaysByTwoTime(GameApplication.serverConfig.getOpenTime(),TimeUtils.getTimeStamp2(TimeUtils.now()))+1;
if(day < limitDay[1]){
if(day <= limitDay[1]){
continue;
}
}

View File

@ -214,11 +214,13 @@ public abstract class AbstractActivity implements IActivity, IEventHandler {
User user = UserManager.getUser(session.getUid());
List<int[][]> itemArrs = new LinkedList<>();
getAllMissRewards(user, session, itemArrs);
if (itemArrs.size() == 0)
if (itemArrs.size() == 0) {
return;
}
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(id);
if (null == sGlobalActivity)
if (null == sGlobalActivity) {
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
}
String title = SErrorCodeEerverConfig.getI18NMessageNeedConvert("receive_activity_title", new Object[]{sGlobalActivity.getSesc()},new int[]{1},"#");
String content = SErrorCodeEerverConfig.getI18NMessageNeedConvert("receive_activity_txt", new Object[]{sGlobalActivity.getSesc()},new int[]{1},"#");
String mailReward = ItemUtil.getMailReward(itemArrs);
@ -308,8 +310,9 @@ public abstract class AbstractActivity implements IActivity, IEventHandler {
void onActivityEndSelfWithDealReward(User user) throws Exception {
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(id);
if (sGlobalActivity.getIsMail() == 1)
if (sGlobalActivity.getIsMail() == 1) {
onActivityEndDealReward(user);
}
onActivityEndOnMySelf(user);
}
@ -336,6 +339,15 @@ public abstract class AbstractActivity implements IActivity, IEventHandler {
}
/**
*
* @param user
* @return
*/
public Set<Integer> getCloseGoods(User user){
return new HashSet<>(1);
}
/**
* 1003747
*/

View File

@ -17,8 +17,10 @@ import config.SGlobalActivity;
import rpc.protocols.CommonProto;
import rpc.protocols.PlayerInfoProto;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
public class HeroStarActivity extends AbstractActivity {
private int heroId;
@ -132,4 +134,26 @@ public class HeroStarActivity extends AbstractActivity {
MessageUtil.sendMessage(session, 1, rewardResponseValue, build, true);
return true;
}
@Override
public Set<Integer> getCloseGoods(User user){
HashSet<Integer> set = new HashSet<>();
ActivityMission mission = user.getActivityManager().getActivityMissionMap().get(id);
if (mission == null){
return set;
}
// 活动奖励条件
List<SActivityRewardConfig> rewardConfigs = SActivityRewardConfig.getsActivityRewardConfigByActivityId(id);
for (SActivityRewardConfig rewardConfig : rewardConfigs) {
Map<Integer, ActivityProgressInfo> map = mission.getActivityMissionMap();
ActivityProgressInfo progressInfo = map.get(rewardConfig.getId());
// 页签不存在或者状态不为可领取状态
if (progressInfo == null || progressInfo.getState() != 1){
int goodsId = rewardConfig.getValues()[2][0];
set.add(goodsId);
break;
}
}
return set;
}
}

View File

@ -26,9 +26,7 @@ import rpc.protocols.CommonProto;
import rpc.protocols.PlayerInfoProto;
import util.TimeUtils;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.*;
public class MistyTripActivity extends AbstractActivity {
@ -115,5 +113,32 @@ public class MistyTripActivity extends AbstractActivity {
return false;
}
@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();
List<SActivityRewardConfig> rewardConfigs = SActivityRewardConfig.getsActivityRewardConfigByActivityId(id);
// 创角色第几天
int days = TimeUtils.getSoFarWentDays(user.getPlayerInfoManager().getCreateTime(), TimeUtils.now())+1;
for (SActivityRewardConfig config : rewardConfigs) {
// 单个页签信息
ActivityProgressInfo info = map.getOrDefault(config.getId(), null);
if (info == null){
continue;
}
int[][] values = config.getValues();
// 条件,天数和任务数量
if (days < values[0][1] || info.getProgrss() < values[0][0]){
set.add(values[1][0]);
}
}
return set;
}
}

View File

@ -58,6 +58,7 @@ class RechargeSumDayActivity extends AbstractActivity {
/**
*
*/
@Override
boolean checkValue(ISession session, SActivityRewardConfig sActivityRewardConfig, ActivityProgressInfo activityProgressInfo) throws Exception {
int[][] values = sActivityRewardConfig.getValues();
User user = UserManager.getUser(session.getUid());

View File

@ -265,4 +265,27 @@ public class SuperBoxActivity extends AbstractActivity {
return result;
}
@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, 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());
}
}
return set;
}
}

View File

@ -48,12 +48,6 @@ public class TreasureActivity extends AbstractActivity {
if(user.getPlayerInfoManager().getHadBuyTreasure() == 1){
LOGGER.info("[青龙秘宝初始化] [重置秘宝解锁状态] [uid:{}]",user.getId());
user.getPlayerInfoManager().setHadBuyTreasure(0);
int id=0;
for(SRechargeCommodityNewConfig sRechargeCommodityConfig : SRechargeCommodityNewConfig.configMap.values()){
if(sRechargeCommodityConfig.getType() == GiftGoodsType.SUN_LONG){
id=sRechargeCommodityConfig.getId();
}
}
}
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(id);

View File

@ -315,7 +315,8 @@ public class DeathPathLogic {
String key;
// 是否是跨服
Set<ZSetOperations.TypedTuple<String>> zSetReverseRangeWithScores;
if (getGroupId() > 0) {
boolean result = getGroupId() > 0;
if (result) {
key = guildRank.getCrossRedisKey();
zSetReverseRangeWithScores = RedisUtil.getInstence().getZsetreverseRangeWithScores(key, String.valueOf(i), 0, 0,false);
LOGGER.info("========================获取十绝阵内部信息,跨服:{}",uid);
@ -332,7 +333,7 @@ public class DeathPathLogic {
int guildId = Integer.parseInt(next.getValue());
GuildInfoCache crossGuild = CrossDeathPathLogic.getCrossGuild(guildId);
Integer serverId = Optional.ofNullable(CrossDeathPathLogic.getCrossGuild(guildId)).map(GuildInfoCache::getServerId).orElse(0);
String serverName = CrossDeathPathLogic.getInstance().getServerNameByDeathPath(serverId);
String serverName = result?CrossDeathPathLogic.getInstance().getServerNameByDeathPath(serverId):"";
Family.DeathPathInfo info = Family.DeathPathInfo.newBuilder().setGuildName(crossGuild.getGuildName()).setPathId(i).setGid(guildId).setServerName(serverName).build();
response.addInfos(info);
}

View File

@ -1,5 +1,6 @@
package com.ljsd.jieling.logic.family;
import com.google.common.collect.Lists;
import com.google.protobuf.GeneratedMessage;
import com.google.protobuf.Message;
import com.ljsd.GameApplication;
@ -235,10 +236,10 @@ public class GuildLogic {
* @param session
* @throws Exception
*/
public static void recommendFamily(ISession session) throws Exception {
public static void recommendFamily(ISession session,Family.FamilyRecommandRequest proto) throws Exception {
int uid = session.getUid();
User user = UserManager.getUser(uid);
int msgId = MessageTypeProto.MessageType.FAMILY_RECOMEND_RESPONSE_VALUE;
Collection<GuildInfo> guildInfos = GuilidManager.recommandGuild(user);
Family.FamilyRecommandResponse.Builder builder = Family.FamilyRecommandResponse.newBuilder();
Map<Integer, GuildApply> applyGuildInfos = GuilidManager.getApplyGuildInfos(uid, 1);
@ -255,13 +256,20 @@ public class GuildLogic {
}
}
for(GuildInfo guildInfo : guildInfos){
builder.addFamilyRecomandInfo(Family.FamilyRecomandInfo.newBuilder().
setFamilyBaseInfo(CBean2Proto.getFamilyBaseInfo(guildInfo))
.setIsApply(applyGuildInfos.containsKey(guildInfo.getId())?1:0)
.build());
int page = proto.getPage();
List<List<GuildInfo>> partition = Lists.partition(new ArrayList<>(guildInfos), 10);
// 防止超出下标
if (page <= partition.size()){
for(GuildInfo guildInfo : partition.get(page-1)){
builder.addFamilyRecomandInfo(Family.FamilyRecomandInfo.newBuilder().
setFamilyBaseInfo(CBean2Proto.getFamilyBaseInfo(guildInfo))
.setIsApply(applyGuildInfos.containsKey(guildInfo.getId())?1:0)
.build());
}
}
// 返回信息
int msgId = MessageTypeProto.MessageType.FAMILY_RECOMEND_RESPONSE_VALUE;
MessageUtil.sendMessage(session,1,msgId,builder.build(),true);
}

View File

@ -998,9 +998,10 @@ public class CombatLogic {
if(randomReward.length()!=0){
reward = reward + "|" + randomReward;
MailLogic.getInstance().sendMail(user.getId(),title,content,reward,time, Global.MAIL_EFFECTIVE_TIME);
mainLevelManager.afterTakeStateReward(true,0,time);
System.out.printf("================在线奖励升级vip发送邮件{%s},{%s}\n",mainLevelManager.getStartTime(),mainLevelManager.getLastTime());
}
}
// mainLevelManager.afterTakeStateReward(true,0,time);
myResult = true;
return this;
}

View File

@ -701,8 +701,16 @@ public class FriendLogic {
friendManager.setHaveRewardMap(new HashMap<>());
for (Map.Entry<Integer,Integer> entry: giveMap.entrySet()){
Integer friendId = entry.getKey();
LOGGER.info("friendId当前{}",friendId);
User friendUser = UserManager.getUser(friendId);
User friendUser = null;
try {
friendUser = UserManager.getUser(friendId);
}catch (Exception e){
LOGGER.info("获取好友信息报错friendId当前{}",friendId);
e.printStackTrace();
}
if (friendUser == null){
continue;
}
FriendManager friendManager1 = friendUser.getFriendManager();
Map<Integer, Integer> haveRewardMap = friendManager1.getHaveRewardMap();
if (haveRewardMap.containsKey(uid)){

View File

@ -943,6 +943,7 @@ public class ItemLogic {
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
}
progress.setProgrss(progress.getProgrss()-1);
user.getActivityManager().getActivityMissionMap().put(activityId,misson);
CommonProto.Drop.Builder drop = ItemUtil.drop(user,new int[][]{{config.getGoalItems()[0][0],config.getGoalItems()[0][1]}},BIReason.EQUIP_UPLEVEL_REWARD);
response.setResult(true);
response.setDrop(drop);

View File

@ -76,24 +76,12 @@ public class CrossArenaRank extends AbstractRank {
builder.addRanks(everyRank);
}else{
ArenaOfUser query = CrossServiceLogic.getInstance().query(Integer.valueOf(data.getValue()));
String serverName = CrossDeathPathLogic.getInstance().getServerNameByDeathPath(query.getPlayerManager().getServerId());
CommonProto.RankInfo.Builder everyRankInfo = CommonProto.RankInfo.newBuilder()
.setRank(index)
.setParam1(query.getHeroManager().getTotalForce())
.setParam2(getParam2(data.getScore()))
.setParam3(getParam3(data.getScore()));
CommonProto.UserRank.Builder everyRank = CommonProto.UserRank.newBuilder()
.setUid(query.getId())
.setUserName(query.getPlayerManager().getName())
.setLevel(query.getPlayerManager().getLevel())
.setUserTitle(query.getPlayerManager().getUserTitle())
.setUserSkin(80012)
.setUserMount(query.getPlayerManager().getUserMount())
.setRankInfo(everyRankInfo)
.setForce(query.getHeroManager().getTotalForce())
.setPracticeLevel(query.getPlayerManager().getPracticeLevel())
.setServerName(serverName)
.setSex(0);
CommonProto.UserRank.Builder everyRank = getCrossOneUserRank(query,everyRankInfo);
builder.addRanks(everyRank);
}
}

View File

@ -11,17 +11,18 @@ 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.GlobalDataManaager;
import com.ljsd.jieling.logic.OnlineUserManager;
import com.ljsd.jieling.logic.activity.AbstractActivity;
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.PlayerManager;
import com.ljsd.jieling.logic.dao.RechargeInfo;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.VipInfo;
import com.ljsd.jieling.logic.dao.*;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.expedition.ExpeditionLogic;
import com.ljsd.jieling.logic.fight.CombatLogic;
@ -622,20 +623,91 @@ public class BuyGoodsNewLogic {
giftGoodsInfoList.add(buildGoodsInfo(bag));
}
}
giftGoodsInfoList.sort(new Comparator<CommonProto.GiftGoodsInfo>() {
@Override
public int compare(CommonProto.GiftGoodsInfo o1, CommonProto.GiftGoodsInfo o2) {
if(o1.getGoodsId() > o2.getGoodsId()){
return 1;
}else if(o1.getGoodsId() < o2.getGoodsId()){
return -1;
}
return 0;
giftGoodsInfoList.sort((o1, o2) -> {
if(o1.getGoodsId() > o2.getGoodsId()){
return 1;
}else if(o1.getGoodsId() < o2.getGoodsId()){
return -1;
}
return 0;
});
return needChange;
}
public static Set<Integer> getGoodsBagInfoFromDelive(int uid) throws Exception {
User user = UserManager.getUser(uid);
Set<Integer> list = new HashSet<>();
// 礼包是否打开
NewRechargeInfo rechargeInfo = user.getPlayerInfoManager().getNewRechargeInfo();
Map<Integer, SRechargeCommodityNewConfig> configMap = SRechargeCommodityNewConfig.configMap;
// 次数,推送,永久礼包一起处理
ArrayList<AbstractWelfareBag> welfareBags = new ArrayList<>(rechargeInfo.getPerpetualMap().values());
welfareBags.addAll(rechargeInfo.getTimeLimitMap().values());
welfareBags.addAll(rechargeInfo.getReceiveMap().values());
welfareBags.addAll(rechargeInfo.getPushMap().values());
for (AbstractWelfareBag bag : welfareBags) {
if(bag.isOpen()){
if (bag.getLimit() == 0 || bag.getLimit() > bag.getBuyTimes()){
list.add(bag.getModId());
}
}
}
// 走表判断开启的礼包
Map<Integer, SGlobalActivity> activityMap = SGlobalActivity.getsGlobalActivityMap();
Map<Integer, ActivityMission> missionMap = user.getActivityManager().getActivityMissionMap();
for (Map.Entry<Integer, ActivityMission> entry : missionMap.entrySet()) {
int activityId = entry.getKey();
ActivityMission mission = entry.getValue();
// 遍历
Iterator<Integer> iterator = list.iterator();
while (iterator.hasNext()){
SRechargeCommodityNewConfig config = configMap.get(iterator.next());
// 表控制不显示
if (config.getIsShowInWeb() == 0){
iterator.remove();
continue;
}
// 未加入公会,不显示公会红包
if (user.getPlayerInfoManager().getGuildId() == 0 && config.getType() == 10){
iterator.remove();
continue;
}
for (String[] open : config.getCondition()) {
// 活动未开启的礼包
if ("3".equals(open[0])){
if (mission.getActivityState() != ActivityType.OPEN_STATE){
if (open[1].equals(String.valueOf(activityId))){
iterator.remove();
break;
}
}
}
// 功能未开启的表
if ("2".equals(open[0])){
if (!GlobalDataManaager.getInstance().checkIsOpen(Integer.parseInt(open[1]))){
iterator.remove();
break;
}
}
}
}
// 单独活动信息处理
SGlobalActivity activity = activityMap.get(activityId);
if (activity == null){
continue;
}
AbstractActivity activityType = ActivityTypeEnum.getActicityType(activityId);
if (activityType == null || list.isEmpty()){
continue;
}
list.removeAll(activityType.getCloseGoods(user));
}
return list;
}
public static CommonProto.GiftGoodsInfo buildGoodsInfo(AbstractWelfareBag bag){
CommonProto.GiftGoodsInfo.Builder builder = CommonProto.GiftGoodsInfo.newBuilder();
builder.setGoodsId(bag.getModId());
@ -726,7 +798,7 @@ public class BuyGoodsNewLogic {
}
}
private static int judgePushCondition(User user,SPackPushConfig con){
private static int judgePushCondition(User user,SPackPushConfig con){
int[] scope = con.getScopeId();
if(scope[0] == 1){//主线关卡
int mainLevel = user.getMainLevelManager().getFightId();

View File

@ -59,7 +59,7 @@ public class SRechargeCommodityNewConfig implements BaseConfig {
private String rechargeId9;
private String rechargeId10;
private int isShowInWeb;
private int[] forbid;
@ -205,4 +205,7 @@ public class SRechargeCommodityNewConfig implements BaseConfig {
this.condition = condition;
}
public int getIsShowInWeb() {
return isShowInWeb;
}
}