增加冲榜固定次数奖励活动
parent
af5ec21b4e
commit
3c206afe24
|
|
@ -411,6 +411,9 @@ public class RedisKey {
|
|||
// 补单
|
||||
public static final String ANEW_RECHARGE_ORDER = "ANEW_RECHARGE_ORDER";//补单订单
|
||||
|
||||
public static final String FANLI = "FANLI";//返利名单
|
||||
public static final String FANLI_STATUS = "FANLI_STATUS";//返利状态
|
||||
|
||||
//进程排行 合区统一
|
||||
public static Set<String> newAreaCacChe = new HashSet<>();
|
||||
|
||||
|
|
|
|||
|
|
@ -476,4 +476,6 @@ public interface BIReason {
|
|||
int YUXU_DEAL = 1359;//玉虚奖励修正
|
||||
|
||||
int PLAYER_GOD_MERIDIANS_LEVEL = 1360;//主角六道神脉升级
|
||||
|
||||
int CROSS_RANK_TIMES_REWARD = 1361;//跨服冲榜次数奖励
|
||||
}
|
||||
|
|
@ -14,6 +14,7 @@ import com.ljsd.jieling.logic.activity.ActivityLogic;
|
|||
import com.ljsd.jieling.logic.activity.ActivityTypeEnum;
|
||||
import com.ljsd.jieling.logic.activity.ChoiceDrawCardActivity;
|
||||
import com.ljsd.jieling.logic.activity.LimitRandomSpecialMonsterActivityNew;
|
||||
import com.ljsd.jieling.logic.activity.activityLogic.CrossRankActivityLogic;
|
||||
import com.ljsd.jieling.logic.activity.activityLogic.GmActivityLogic;
|
||||
import com.ljsd.jieling.logic.activity.activityLogic.GmSingleActivityLogic;
|
||||
import com.ljsd.jieling.logic.activity.crossService.CrossServiceLogic;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,52 @@
|
|||
package com.ljsd.jieling.handler.activity;
|
||||
|
||||
import com.google.protobuf.GeneratedMessage;
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.jieling.db.mongo.MongoUtil;
|
||||
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.jbean.ActivityMission;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.activity.AbstractActivity;
|
||||
import com.ljsd.jieling.logic.activity.ActivityTypeEnum;
|
||||
import com.ljsd.jieling.logic.activity.activityLogic.CrossRankActivityLogic;
|
||||
import com.ljsd.jieling.logic.activity.event.GetSheJiAwardEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.GlobalSystemControl;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.playerGod.PlayerGodLogic;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import rpc.protocols.ActivityProto;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import config.SGodSacrificeSetting;
|
||||
import manager.STableManager;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 请求领取冲榜次数奖励
|
||||
*/
|
||||
public class GetRankTimesRewardRequestHandler extends BaseHandler<PlayerInfoProto.GetRankTimesRewardRequest> {
|
||||
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
|
||||
return MessageTypeProto.MessageType.GetRankTimesRewardRequest;
|
||||
}
|
||||
|
||||
//请求领取冲榜次数奖励绑定协议
|
||||
@Override
|
||||
public void processWithProto(ISession session, PlayerInfoProto.GetRankTimesRewardRequest proto) throws Exception {
|
||||
CrossRankActivityLogic.getInstance().getCrossRankTimesReward(session,proto.getRankId(),proto.getCondition());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
package com.ljsd.jieling.handler.activity;
|
||||
|
||||
import com.google.protobuf.GeneratedMessage;
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.jieling.db.mongo.MongoUtil;
|
||||
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.jbean.ActivityMission;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.activity.AbstractActivity;
|
||||
import com.ljsd.jieling.logic.activity.ActivityTypeEnum;
|
||||
import com.ljsd.jieling.logic.activity.activityLogic.CrossRankActivityLogic;
|
||||
import com.ljsd.jieling.logic.activity.event.GetSheJiAwardEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.GlobalSystemControl;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.playerGod.PlayerGodLogic;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import rpc.protocols.ActivityProto;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import config.SGodSacrificeSetting;
|
||||
import manager.STableManager;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 请求冲榜次数奖励信息
|
||||
*/
|
||||
public class GetRankTimesStatusRequestHandler extends BaseHandler<PlayerInfoProto.GetRankTimesStatusRequest> {
|
||||
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
|
||||
return MessageTypeProto.MessageType.GetRankTimesStatusRequest;
|
||||
}
|
||||
|
||||
//请求冲榜次数奖励信息绑定协议
|
||||
@Override
|
||||
public void processWithProto(ISession session, PlayerInfoProto.GetRankTimesStatusRequest proto) throws Exception {
|
||||
CrossRankActivityLogic.getInstance().getGetRankTimesStatus(session,proto.getRankId());
|
||||
}
|
||||
}
|
||||
|
|
@ -7,6 +7,7 @@ import com.ljsd.jieling.globals.Global;
|
|||
import com.ljsd.jieling.jbean.ActivityMission;
|
||||
import com.ljsd.jieling.jbean.ActivityProgressInfo;
|
||||
import com.ljsd.jieling.logic.GlobleSystemLogic;
|
||||
import com.ljsd.jieling.logic.activity.activityLogic.CrossRankActivityLogic;
|
||||
import com.ljsd.jieling.logic.activity.event.IEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.OpenServerActivityEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
|
|
@ -226,6 +227,8 @@ public class OpenServerCompeteRankActivity extends AbstractActivity {
|
|||
}
|
||||
int scoreCompute = score + cost;
|
||||
rank.addCrossRank(user.getId(),"", scoreCompute);
|
||||
//处理固定次数奖励红点
|
||||
CrossRankActivityLogic.getInstance().dealRankTimesStatusRed(user,actId,scoreCompute,false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -266,6 +269,8 @@ public class OpenServerCompeteRankActivity extends AbstractActivity {
|
|||
}
|
||||
int scoreCompute = score + cost;
|
||||
rank.addCrossRank(user.getId(),"", scoreCompute);
|
||||
//处理固定次数奖励红点
|
||||
CrossRankActivityLogic.getInstance().dealRankTimesStatusRed(user,actId,scoreCompute,false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -439,6 +444,25 @@ public class OpenServerCompeteRankActivity extends AbstractActivity {
|
|||
return now >= rankStartTime && now < rankEndTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断某个时间是否在当期活动内
|
||||
* @param rankType
|
||||
* @param actId
|
||||
* @param time
|
||||
* @return
|
||||
*/
|
||||
public static boolean isInActivity(int rankType,int actId,long time){
|
||||
SChongRankInfo info = SChongRankInfo.getMap().getOrDefault(actId,new HashMap<>()).get(rankType);
|
||||
SGlobalActivity activity = SGlobalActivity.getsGlobalActivityMap().get(actId);
|
||||
if (info == null || activity == null){
|
||||
return false;
|
||||
}
|
||||
long startTime = ToolsUtil.getTimeLong(activity.getStartTimeLong(),activity.getEndTimeLong(),activity.getTime(),0, 1, activity.getCycleMinute());
|
||||
long rankStartTime = startTime + info.getOpenTime()*1000L;
|
||||
long rankEndTime = startTime + info.getCloseTime()*1000L;
|
||||
return time >= rankStartTime && time < rankEndTime;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取发送时间: 单位/秒
|
||||
|
|
|
|||
|
|
@ -0,0 +1,270 @@
|
|||
package com.ljsd.jieling.logic.activity.activityLogic;
|
||||
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.logic.activity.OpenServerCompeteRankActivity;
|
||||
import com.ljsd.jieling.logic.dao.PlayerManager;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.dao.vo.ChongRankTimesInfo;
|
||||
import com.ljsd.jieling.logic.rank.RankContext;
|
||||
import com.ljsd.jieling.logic.rank.RankEnum;
|
||||
import com.ljsd.jieling.logic.rank.rankImpl.AbstractRank;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import config.SChongRankInfo;
|
||||
import config.SChongRankReward;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
/**
|
||||
* 冲榜活动处理类
|
||||
*/
|
||||
public class CrossRankActivityLogic {
|
||||
|
||||
public CrossRankActivityLogic() {
|
||||
}
|
||||
|
||||
public static CrossRankActivityLogic getInstance() {
|
||||
return CrossRankActivityLogic.Instance.instance;
|
||||
}
|
||||
|
||||
public static class Instance {
|
||||
public final static CrossRankActivityLogic instance = new CrossRankActivityLogic();
|
||||
}
|
||||
|
||||
public void getGetRankTimesStatus(ISession session, int rankId) throws Exception {
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
SChongRankInfo config = SChongRankInfo.getSChongRankInfoByRankId(rankId);
|
||||
if(config == null){
|
||||
return;
|
||||
}
|
||||
int rankType = config.getRankType();
|
||||
//不是神将召唤和法宝召唤
|
||||
if(rankType!=RankEnum.CROSS_HERO_RANK.getType() && rankType!=RankEnum.CROSS_FABAO_RANK.getType()){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE, "rankType error");
|
||||
}
|
||||
int actId = config.getActivityId();
|
||||
//活动未开启,不能领取
|
||||
if(!OpenServerCompeteRankActivity.isOpen(rankType,actId)){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE, "activity not open");
|
||||
}
|
||||
//获取玩家冲榜次数奖励领取信息
|
||||
PlayerManager playerManager = user.getPlayerInfoManager();
|
||||
Map<Integer,ChongRankTimesInfo> infos = playerManager.getChongRankTimesInfoMaps();
|
||||
ChongRankTimesInfo info = null;
|
||||
if(infos.containsKey(rankId)){
|
||||
info = infos.get(rankId);
|
||||
}
|
||||
long now = System.currentTimeMillis();
|
||||
boolean update = false;
|
||||
if(info == null){
|
||||
info = new ChongRankTimesInfo();
|
||||
info.setLastRefreshTime(System.currentTimeMillis());
|
||||
update = true;
|
||||
}else{
|
||||
//判断是否同期活动,不是重置奖励信息
|
||||
if(!OpenServerCompeteRankActivity.isInActivity(rankType,actId,info.getLastRefreshTime())){
|
||||
info.setLastRefreshTime(now);
|
||||
info.clearRewardStatus();
|
||||
update = true;
|
||||
}
|
||||
}
|
||||
AbstractRank rank = RankContext.getRankEnum(rankType);
|
||||
int score = (int)rank.getCrossScoreById(user.getId(),"");
|
||||
if(score < 0){
|
||||
score = 0;
|
||||
}
|
||||
PlayerInfoProto.GetRankTimesStatusResponse.Builder builder = PlayerInfoProto.GetRankTimesStatusResponse.newBuilder();
|
||||
builder.setRankId(rankId);
|
||||
builder.setTimes(score);
|
||||
Map<Integer,Integer> rewardStatus = info.getRewardStatus();
|
||||
List<SChongRankReward> list = SChongRankReward.getSChongRankRewardList(rankId);
|
||||
if(list == null){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE, "SChongRankReward config error");
|
||||
}
|
||||
List<Integer> reList = new ArrayList<>();
|
||||
for(SChongRankReward rewardConfig : list){
|
||||
int condition = rewardConfig.getCondition();
|
||||
int status = 0;
|
||||
if(rewardStatus.containsKey(condition)){
|
||||
status = info.getRewardStatus().get(condition);
|
||||
}
|
||||
reList.add(status);
|
||||
}
|
||||
if(update){
|
||||
infos.put(rankId,info);
|
||||
playerManager.setChongRankTimesInfoMaps(infos);
|
||||
}
|
||||
builder.addAllList(reList);
|
||||
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.GetRankTimesStatusResponse_VALUE, builder.build(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取冲榜活动固定次数奖励,目前只有跨服的神将召唤和法宝召唤有固定次数奖励,其他活动只有排行奖励
|
||||
* @param session
|
||||
* @param rankId
|
||||
* @param condition
|
||||
* @throws Exception
|
||||
*/
|
||||
public void getCrossRankTimesReward(ISession session, int rankId, int condition) throws Exception {
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
SChongRankInfo config = SChongRankInfo.getSChongRankInfoByRankId(rankId);
|
||||
if(config == null){
|
||||
return;
|
||||
}
|
||||
int rankType = config.getRankType();
|
||||
//不是神将召唤和法宝召唤
|
||||
if(rankType!=RankEnum.CROSS_HERO_RANK.getType() && rankType!=RankEnum.CROSS_FABAO_RANK.getType()){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE, "rankType error");
|
||||
}
|
||||
int actId = config.getActivityId();
|
||||
//活动未开启,不能领取
|
||||
if(!OpenServerCompeteRankActivity.isOpen(rankType,actId)){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE, "activity not open");
|
||||
}
|
||||
//获取玩家冲榜次数奖励领取信息
|
||||
PlayerManager playerManager = user.getPlayerInfoManager();
|
||||
Map<Integer,ChongRankTimesInfo> infos = playerManager.getChongRankTimesInfoMaps();
|
||||
ChongRankTimesInfo info = null;
|
||||
if(infos.containsKey(rankId)){
|
||||
info = infos.get(rankId);
|
||||
}
|
||||
long now = System.currentTimeMillis();
|
||||
boolean update = false;
|
||||
if(info == null){
|
||||
info = new ChongRankTimesInfo();
|
||||
info.setLastRefreshTime(System.currentTimeMillis());
|
||||
update = true;
|
||||
}else{
|
||||
//判断是否同期活动,不是重置奖励信息
|
||||
if(!OpenServerCompeteRankActivity.isInActivity(rankType,actId,info.getLastRefreshTime())){
|
||||
info.setLastRefreshTime(now);
|
||||
info.clearRewardStatus();
|
||||
update = true;
|
||||
}
|
||||
}
|
||||
AbstractRank rank = RankContext.getRankEnum(rankType);
|
||||
int score = (int)rank.getCrossScoreById(user.getId(),"");
|
||||
if(score <0){
|
||||
score = 0;
|
||||
}
|
||||
int status = 0;
|
||||
Map<Integer,Integer> rewardStatus = info.getRewardStatus();
|
||||
if(rewardStatus.containsKey(condition)){
|
||||
status = info.getRewardStatus().get(condition);
|
||||
}
|
||||
//已领取
|
||||
if(status == 1){
|
||||
if(update){
|
||||
infos.put(rankId,info);
|
||||
playerManager.setChongRankTimesInfoMaps(infos);
|
||||
}
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE, "has reward");
|
||||
}
|
||||
//条件未满足,不能领取
|
||||
if(score < condition){
|
||||
if(update){
|
||||
infos.put(rankId,info);
|
||||
playerManager.setChongRankTimesInfoMaps(infos);
|
||||
}
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE, "condition not enough");
|
||||
}
|
||||
//领取奖励,更新状态
|
||||
rewardStatus.put(condition,1);
|
||||
info.setRewardStatus(rewardStatus);
|
||||
infos.put(rankId,info);
|
||||
playerManager.setChongRankTimesInfoMaps(infos);
|
||||
SChongRankReward rewardConfig = SChongRankReward.getSChongRankRewardByRankIdAndCondition(rankId,condition);
|
||||
if(rewardConfig == null){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE, "rewardConfig not exist");
|
||||
}
|
||||
//发送奖励
|
||||
int [][] rewards = rewardConfig.getReward();
|
||||
CommonProto.Drop.Builder builder = CommonProto.Drop.newBuilder();
|
||||
ItemUtil.drop(user,rewards,builder, BIReason.CROSS_RANK_TIMES_REWARD);
|
||||
//推送领取成功
|
||||
PlayerInfoProto.GetRankTimesRewardResponse.Builder response = PlayerInfoProto.GetRankTimesRewardResponse.newBuilder();
|
||||
response.setDrop(builder);
|
||||
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.GetRankTimesRewardResponse_VALUE, response.build(), true);
|
||||
}
|
||||
|
||||
public void dealRankTimesStatusRed(User user,int actId,int score,boolean checkActOpen){
|
||||
SChongRankInfo config = SChongRankInfo.getSChongRankInfoByActId(actId);
|
||||
if(config == null){
|
||||
return;
|
||||
}
|
||||
int rankId = config.getId();
|
||||
int rankType = config.getRankType();
|
||||
//不是神将召唤和法宝召唤
|
||||
if(rankType!=RankEnum.CROSS_HERO_RANK.getType() && rankType!=RankEnum.CROSS_FABAO_RANK.getType()){
|
||||
return;
|
||||
}
|
||||
//需要检测活动开启的时候再检测,防止重复检测,因为冲榜活动触发的时候已经检测过了
|
||||
if(checkActOpen){
|
||||
//活动未开启,不用推送
|
||||
if(!OpenServerCompeteRankActivity.isOpen(rankType,actId)){
|
||||
return;
|
||||
}
|
||||
}
|
||||
//获取玩家冲榜次数奖励领取信息
|
||||
PlayerManager playerManager = user.getPlayerInfoManager();
|
||||
Map<Integer,ChongRankTimesInfo> infos = playerManager.getChongRankTimesInfoMaps();
|
||||
ChongRankTimesInfo info = null;
|
||||
if(infos.containsKey(rankId)){
|
||||
info = infos.get(rankId);
|
||||
}
|
||||
long now = System.currentTimeMillis();
|
||||
boolean update = false;
|
||||
if(info == null){
|
||||
info = new ChongRankTimesInfo();
|
||||
info.setLastRefreshTime(System.currentTimeMillis());
|
||||
update = true;
|
||||
}else{
|
||||
//判断是否同期活动,不是重置奖励信息
|
||||
if(!OpenServerCompeteRankActivity.isInActivity(rankType,actId,info.getLastRefreshTime())){
|
||||
info.setLastRefreshTime(now);
|
||||
info.clearRewardStatus();
|
||||
update = true;
|
||||
}
|
||||
}
|
||||
AbstractRank rank = RankContext.getRankEnum(rankType);
|
||||
List<SChongRankReward> list = SChongRankReward.getSChongRankRewardList(rankId);
|
||||
if(list == null){
|
||||
return;
|
||||
}
|
||||
int canGet= 0;
|
||||
Map<Integer,Integer> rewardStatus = info.getRewardStatus();
|
||||
for(SChongRankReward rewardConfig : list){
|
||||
int condition = rewardConfig.getCondition();
|
||||
int status = 0;
|
||||
if(rewardStatus.containsKey(condition)){
|
||||
status = info.getRewardStatus().get(condition);
|
||||
}
|
||||
if(status == 0){
|
||||
//有可领取的就返回红点,并终止循环
|
||||
if(score >= condition){
|
||||
canGet = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(update){
|
||||
infos.put(rankId,info);
|
||||
playerManager.setChongRankTimesInfoMaps(infos);
|
||||
}
|
||||
if(canGet == 1){
|
||||
//推送领取成功
|
||||
MessageUtil.sendMessage(user.getId(), 1, MessageTypeProto.MessageType.GetRankTimesRedResponse_VALUE, null, true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -6,6 +6,7 @@ import com.ljsd.jieling.core.VipPrivilegeType;
|
|||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.dao.vo.ChongRankTimesInfo;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.NewRechargeInfo;
|
||||
import config.SCampTowerSetting;
|
||||
import config.SMonthcardConfig;
|
||||
|
|
@ -242,6 +243,8 @@ public class PlayerManager extends MongoBase {
|
|||
public int playerGodLevel;//主角成神阶数(1半神2神3神王)
|
||||
public Map<Integer,Integer> playerGodMeridiansLevels = new HashMap<Integer,Integer>();//主角六道神脉等级
|
||||
public int soliderRest = 0;//小兵是否修复过属性
|
||||
//按排行榜id存储的冲榜活动次数奖励信息
|
||||
private Map<Integer, ChongRankTimesInfo> chongRankTimesInfoMaps = new HashMap<>();
|
||||
|
||||
public void putDesireDraw(int type, int tempId) {
|
||||
this.desireDraw.put(type, tempId);
|
||||
|
|
@ -1643,4 +1646,31 @@ public class PlayerManager extends MongoBase {
|
|||
this.soliderRest = soliderRest;
|
||||
updateString("soliderRest", this.soliderRest);
|
||||
}
|
||||
|
||||
public Map<Integer, ChongRankTimesInfo> getChongRankTimesInfoMaps() {
|
||||
if(this.chongRankTimesInfoMaps == null){
|
||||
chongRankTimesInfoMaps = new HashMap<>();
|
||||
}
|
||||
return chongRankTimesInfoMaps;
|
||||
}
|
||||
|
||||
public void setChongRankTimesInfoMaps(Map<Integer, ChongRankTimesInfo> chongRankTimesInfoMaps) {
|
||||
chongRankTimesInfoMaps = chongRankTimesInfoMaps;
|
||||
updateString("chongRankTimesInfoMaps", this.chongRankTimesInfoMaps);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户指定排行榜的冲榜次数奖励信息
|
||||
* @param rankId
|
||||
* @return
|
||||
*/
|
||||
public ChongRankTimesInfo getChongRankTimesInfo(int rankId){
|
||||
if(this.chongRankTimesInfoMaps == null){
|
||||
chongRankTimesInfoMaps = new HashMap<>();
|
||||
}
|
||||
if(chongRankTimesInfoMaps.containsKey(rankId)){
|
||||
return chongRankTimesInfoMaps.get(rankId);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,34 @@
|
|||
package com.ljsd.jieling.logic.dao.vo;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 玩家冲榜奖励次数信息
|
||||
*/
|
||||
public class ChongRankTimesInfo {
|
||||
/** 上次活动次数奖励刷新时间*/
|
||||
private long lastRefreshTime;
|
||||
//按活动条件存储的活动奖励领取状态信息
|
||||
private Map<Integer,Integer> rewardStatus = new HashMap<>();
|
||||
|
||||
public long getLastRefreshTime() {
|
||||
return lastRefreshTime;
|
||||
}
|
||||
|
||||
public void setLastRefreshTime(long lastRefreshTime) {
|
||||
this.lastRefreshTime = lastRefreshTime;
|
||||
}
|
||||
|
||||
public Map<Integer, Integer> getRewardStatus() {
|
||||
return rewardStatus;
|
||||
}
|
||||
|
||||
public void setRewardStatus(Map<Integer, Integer> rewardStatus) {
|
||||
this.rewardStatus = rewardStatus;
|
||||
}
|
||||
|
||||
public void clearRewardStatus(){
|
||||
this.rewardStatus = new HashMap<>();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
package com.ljsd.jieling.logic.fanli;
|
||||
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||
import com.sun.jdi.IntegerType;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 返利处理类
|
||||
*/
|
||||
public class FanliLogic {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(FanliLogic.class);
|
||||
|
||||
//按用户openId存储用户删档测试充值金额用户集合,所有服务器只能给1个openId发送奖励,该数据只判断是否在返利名单内,是否发过奖励需另行查询redis
|
||||
public Map<String, Integer> fanliMembers = new HashMap<>();
|
||||
private FanliLogic(){
|
||||
}
|
||||
|
||||
static class InnerClass{
|
||||
public final static FanliLogic instance = new FanliLogic();
|
||||
}
|
||||
|
||||
public static FanliLogic getInstance(){
|
||||
return FanliLogic.InnerClass.instance;
|
||||
}
|
||||
|
||||
public void init(){
|
||||
String key = RedisKey.FANLI + RedisKey.Delimiter_colon;
|
||||
Map<String,Integer> values = RedisUtil.getInstence().getmapvaluekeyclass(key,String.class,Integer.class);
|
||||
if(values != null && values.size() > 0){
|
||||
for(String openId:values.keySet()){
|
||||
int money = values.get(openId);
|
||||
fanliMembers.put(openId,money);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户openId,查找用户删档充值金额
|
||||
* @param openId
|
||||
* @return
|
||||
*/
|
||||
public int getFanliMoney(String openId){
|
||||
if(fanliMembers.containsKey(openId)){
|
||||
return fanliMembers.get(openId);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -4220,6 +4220,7 @@ public class HeroLogic {
|
|||
totalForce += playerSkill.getFight();
|
||||
}
|
||||
}
|
||||
System.out.println("**************************总战力" + totalForce);
|
||||
// LOGGER.info("calTeamTotalForce uid={} teamId={} 总战力={} 耗时={}ms", targetUser.getId(), teamId, totalForce, TimeUtils.now() - now);
|
||||
return totalForce;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import com.ljsd.jieling.logic.dao.*;
|
|||
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.fanli.FanliLogic;
|
||||
import com.ljsd.jieling.logic.fight.CombatLogic;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.logic.mail.MailLogic;
|
||||
|
|
@ -1554,4 +1555,29 @@ public class PlayerLogic {
|
|||
return (int) TimeUtils.AfterTimeByWeek(before, TimeUtils.now());
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理用户返利
|
||||
* @param user
|
||||
*/
|
||||
public void dealFanli(User user){
|
||||
String openId = user.getPlayerInfoManager().getOpenId();
|
||||
int money = FanliLogic.getInstance().getFanliMoney(openId);
|
||||
//不是返利用户
|
||||
if(money <= 0){
|
||||
return;
|
||||
}
|
||||
String key = RedisKey.FANLI_STATUS + RedisKey.Delimiter_colon + openId;
|
||||
String status = (String)RedisUtil.getInstence().get(key);
|
||||
//状态为1说明处理过返利,不再处理
|
||||
if(status != null && !"".equals(status)){
|
||||
if("1".equals(status)){
|
||||
return;
|
||||
}
|
||||
//处理返利
|
||||
}
|
||||
//处理返利,3倍返还代金券
|
||||
int itemId = 108;
|
||||
int num = money * 3;
|
||||
// MailLogic.getInstance().sendMail();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,10 @@ public class SChongRankInfo implements BaseConfig {
|
|||
* key:活动id:key:排行榜类型:value:对象
|
||||
*/
|
||||
private static Map<Integer, Map<Integer, SChongRankInfo>> map = new HashMap<>();
|
||||
|
||||
private static Map<Integer,SChongRankInfo> configs = new HashMap<>();
|
||||
//按活动id存储的信息列表
|
||||
private static Map<Integer,SChongRankInfo> actConfigs = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
|
@ -37,6 +41,8 @@ public class SChongRankInfo implements BaseConfig {
|
|||
Map<Integer, SChongRankInfo> rankMap = map.getOrDefault(rank.getActivityId(), new HashMap<>());
|
||||
rankMap.put(rank.getRankType(),rank);
|
||||
map.put(rank.getActivityId(),rankMap);
|
||||
configs.put(rank.getId(),rank);
|
||||
actConfigs.put(rank.getActivityId(),rank);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -76,4 +82,18 @@ public class SChongRankInfo implements BaseConfig {
|
|||
public int getMailText() {
|
||||
return mailText;
|
||||
}
|
||||
|
||||
public static SChongRankInfo getSChongRankInfoByRankId(int rankId){
|
||||
if(configs.containsKey(rankId)){
|
||||
return configs.get(rankId);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static SChongRankInfo getSChongRankInfoByActId(int actId){
|
||||
if(!actConfigs.containsKey(actId)){
|
||||
return null;
|
||||
}
|
||||
return actConfigs.get(actId);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
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 ="ChongRankReward")
|
||||
public class SChongRankReward implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int chongRankInfoID;
|
||||
|
||||
private int condition;
|
||||
|
||||
private int[][] reward;
|
||||
|
||||
private static Map<Integer, Map<Integer,SChongRankReward>> map = new HashMap<>();
|
||||
private static Map<Integer, List<SChongRankReward>> listMap = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
Map<Integer, SChongRankReward> config = STableManager.getConfig(SChongRankReward.class);
|
||||
Map<Integer, Map<Integer,SChongRankReward>> _map = new HashMap<>();
|
||||
Map<Integer, List<SChongRankReward>> _listMap = new HashMap<>();
|
||||
for (SChongRankReward rank : config.values()) {
|
||||
if(_map.containsKey(rank.getChongRankInfoID())){
|
||||
_map.get(rank.getChongRankInfoID()).put(rank.getCondition(),rank);
|
||||
_listMap.get(rank.getChongRankInfoID()).add(rank);
|
||||
}else{
|
||||
Map<Integer,SChongRankReward> subMap = new HashMap<>();
|
||||
List<SChongRankReward> subList = new ArrayList<>();
|
||||
subMap.put(rank.getCondition(),rank);
|
||||
subList.add(rank);
|
||||
_map.put(rank.getChongRankInfoID(),subMap);
|
||||
_listMap.put(rank.getChongRankInfoID(),subList);
|
||||
}
|
||||
}
|
||||
map = _map;
|
||||
listMap = _listMap;
|
||||
}
|
||||
|
||||
public static Map<Integer, Map<Integer,SChongRankReward>> getMap() {
|
||||
return map;
|
||||
}
|
||||
|
||||
public static List<SChongRankReward> getSChongRankRewardList(int rankId){
|
||||
if(listMap.containsKey(rankId)){
|
||||
return listMap.get(rankId);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static SChongRankReward getSChongRankRewardByRankIdAndCondition(int rankId,int condition) {
|
||||
if(!map.containsKey(rankId)){
|
||||
return null;
|
||||
}
|
||||
Map<Integer,SChongRankReward> subMap = map.get(rankId);
|
||||
if(subMap == null){
|
||||
return null;
|
||||
}
|
||||
if(!subMap.containsKey(condition)){
|
||||
return null;
|
||||
}
|
||||
return subMap.get(condition);
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getChongRankInfoID() {
|
||||
return chongRankInfoID;
|
||||
}
|
||||
|
||||
public int getCondition() {
|
||||
return condition;
|
||||
}
|
||||
|
||||
public int[][] getReward() {
|
||||
return reward;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue