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

lvxinran 2021-06-08 01:12:13 +08:00
commit 59c22520f3
12 changed files with 114 additions and 59 deletions

View File

@ -177,13 +177,15 @@ public class GMRequestHandler extends BaseHandler{
int exp = 0;
Map<Integer, SPlayerLevelConfig> sPlayerLevelConfigMap = SPlayerLevelConfig.getsPlayerLevelConfigMap();
for (Map.Entry<Integer, SPlayerLevelConfig> entry :sPlayerLevelConfigMap.entrySet()){
int leve = entry.getKey();
SPlayerLevelConfig value = entry.getValue();
if (prarm1 > leve){
exp += value.getExp();
// key
int keyLevel = entry.getKey();
// 当前等级
int nowLevel = cUser.getPlayerInfoManager().getLevel();
if (prarm1 > keyLevel && keyLevel >= nowLevel){
exp += entry.getValue().getExp();
}
}
ItemUtil.userLevelUp(cUser,exp);
ItemUtil.userLevelUp(cUser,exp-cUser.getPlayerInfoManager().getExp());
break;
case GlobalGm.ADOPT_ALL_DIFFICULTY:
while (true){

View File

@ -42,12 +42,7 @@ public class GetArenaRecordHandler extends BaseHandler {
if(result!=null && !result.isEmpty()){
List<CommonProto.ArenaRecordInfo> arenaRecordInfos = new ArrayList<>();
List<ArenaRecord> arenaRecordList = new ArrayList<>(result.values());
Collections.sort(arenaRecordList, new Comparator<ArenaRecord>() {
@Override
public int compare(ArenaRecord o1, ArenaRecord o2) {
return Integer.compare(o1.getCreateTime(), o2.getCreateTime());
}
});
Collections.sort(arenaRecordList, Comparator.comparingInt(ArenaRecord::getCreateTime));
int size = arenaRecordList.size();
if(size>10){
String[] removeMapKeys = new String[size - 10];
@ -70,6 +65,7 @@ public class GetArenaRecordHandler extends BaseHandler {
.setHead(playerInfoManager.getHead())
.setTotalForce(attackForce)
.setScore( RedisUtil.getInstence().getZSetScore(RedisKey.ARENA_RANK,Integer.toString(curSeason), Integer.toString(attackId)).intValue())
.setPracticeLevel(attackUser.getHeroManager().getPracticeLevel())
.build();
arenaRecordInfos.add(CommonProto.ArenaRecordInfo.newBuilder()

View File

@ -150,7 +150,8 @@ public class GetCarChallengeListHandler extends BaseHandler {
.setUserName(challenegeUser.getPlayerInfoManager().getNickName())
.setScore(item.getScore().intValue())
.setForce(HeroLogic.getInstance().calTeamTotalForce(challenegeUser,GlobalsDef.CAR_DELAY_TEAM,false))
.setRank(rank);
.setRank(rank)
.setPracticeLevel(challenegeUser.getHeroManager().getPracticeLevel());
for (TeamPosHeroInfo heroInfo:challenegeUser.getTeamPosManager().getTeamPosForHero().get(GlobalsDef.CAR_DELAY_TEAM)) {
Hero hero = challenegeUser.getHeroManager().getHero(heroInfo.getHeroId());
builder1.addTeamInfo(CBean2Proto.getSimpleTeamInfoByHero(user, hero,heroInfo.getPosition()));

View File

@ -1583,6 +1583,9 @@ public class ActivityLogic implements IEventHandler{
// 特权消耗
PlayerLogic.getInstance().checkAndUpdate(user, setting.getMaxTimes(), num);
if(drop.getHeroList().size()>1){
Poster.getPoster().dispatchEvent(new HeroFiveStarGetEvent(user.getId(),5,drop.getHeroList().size()));
}
// 事件分发
Poster.getPoster().dispatchEvent(new ChoiceDrawCardEvent(user.getId(),activityId,num));
@ -1618,7 +1621,7 @@ public class ActivityLogic implements IEventHandler{
// 根据玩家选取得up奖励id获取详细信息
int[] incs = up.get(upRewardId);
// 讲up奖励id得权重加入到整个卡池权重中
weight.put(weight.size(),incs[2]);
weight.put(weight.size()+1,incs[2]);
// 计算总权重
int totalWeight = weight.values().stream().mapToInt(Integer::intValue).sum();

View File

@ -42,7 +42,10 @@ public class HongBaoAlgorithm {
* @param max
* @return
*/
static long xRandom(long min, long max) {
static long xRandom(long min, long max) {
if(min == max){
return 0;
}
return sqrt(nextLong(sqr(max - min)));
}

View File

@ -38,6 +38,7 @@ public class CarDealyRank extends AbstractRank{
.setUserSkin(everyUser.getPlayerInfoManager().getUserSkin())
.setUserTitle(everyUser.getPlayerInfoManager().getUserTitle())
.setUserMount(everyUser.getPlayerInfoManager().getUserMount())
.setPracticeLevel(everyUser.getHeroManager().getPracticeLevel())
.build();
builder.addRanks(everyRank);
}

View File

@ -238,7 +238,6 @@ public class BuyGoodsNewLogic {
// Poster.getPoster().dispatchEvent(new NewWelfareEvent(user, NewWelfareTypeEnum.RECHARGE_BUY.getType(),goodsId));
MongoUtil.getLjsdMongoTemplate().lastUpdate();
sendGiftGoodsWithoutJudge(uid);
onChargeSuccess(user,price,0,orderId,cfgType);//充值成功上报
Map<Integer, Integer> mapReward = ItemUtil.arrayToMap(dropByBag);
if(price>0){
MessageUtil.sendIndicationMessage(session,1,
@ -251,6 +250,7 @@ public class BuyGoodsNewLogic {
user.getPlayerInfoManager().getLastDeviceId()==null?
"DEFAULT_DEVICE":user.getPlayerInfoManager().getLastDeviceId());
}
onChargeSuccess(user,price,0,orderId,cfgType);//充值成功上报
return resultRes;
}
@ -346,7 +346,7 @@ public class BuyGoodsNewLogic {
ISession session = OnlineUserManager.getSessionByUid(user.getId());
int type = config.getType();
CommonProto.Drop.Builder drop = null;
if(dropArray!=null && dropArray.length>1){
if(dropArray!=null && dropArray.length>=1){
drop = ItemUtil.drop(user,dropArray, BIReason.DIRECT_BUY);
}
@ -460,14 +460,10 @@ public class BuyGoodsNewLogic {
}
if(bag.getType() == RechargeType.timeLimit.getType()){
//活动类型特殊处理
//todo 其他的也要改 直接读表里的 不读数据库里的
String onSaleRule = configById.getOnSaleRule();
int[] condition = null;
if(!onSaleRule.contains("|")){
condition = StringUtil.parseFiledInt(onSaleRule);
if(condition[0]==3){
if(ActivityLogic.checkActivityOpen(user,condition[1])){
long[] time = ActivityLogic.getStartAndEndTime(user,condition[1]);
for(String[] s : configById.getCondition()){
if(s[0].equals("3")){
if(ActivityLogic.checkActivityOpen(user,Integer.parseInt(s[1]))){
long[] time = ActivityLogic.getStartAndEndTime(user,Integer.parseInt(s[1]));
bag.setStartTime(time[0]);
bag.setEndTime(time[1]);
bag.setOpen(true);

View File

@ -28,7 +28,6 @@ public class AbstractWelfareBag extends MongoBase{
private long refreshTime;
private int[] privilege;
private int timeType;
private String[][] condition;
private boolean isUserBuyRefresh;
public AbstractWelfareBag(User user,SRechargeCommodityNewConfig config){
@ -41,6 +40,7 @@ public class AbstractWelfareBag extends MongoBase{
setContinueDays(config.getContiueDays());
setPrivilege(config.getOpenPrivilege());
if(!config.getOnSaleRule().equals("")){
String[][] condition;
String[] s = config.getOnSaleRule().split("\\|");
condition = new String[s.length][3];
int i = 0;
@ -56,7 +56,6 @@ public class AbstractWelfareBag extends MongoBase{
}
i++;
}
setCondition(condition);
}
}
@ -74,7 +73,6 @@ public class AbstractWelfareBag extends MongoBase{
this.refreshTime = refreshTime;
this.privilege = privilege;
this.timeType = timeType;
this.condition = condition;
this.isUserBuyRefresh = isUserBuyRefresh;
this.setMongoKey(mongoKey);
this.setRootId(rootId);
@ -126,6 +124,9 @@ public class AbstractWelfareBag extends MongoBase{
*
*/
public void refresh(){
if(!isOpen()){
setRefreshTime(TimeUtils.getTodayZero());
}
if(getTimeType() == 7){//每周刷新
setStartTime(TimeUtils.getCurWeekdayStartTime(1,0));
setRefreshTime(TimeUtils.getCurWeekdayStartTime(1,0) + TimeUtils.WEEK);
@ -170,12 +171,7 @@ public class AbstractWelfareBag extends MongoBase{
updateString("open",open);
}
public String[][] getCondition() { return condition; }
public void setCondition(String[][] condition) {
this.condition = condition;
updateString("condition",condition);
}
public String[][] getCondition() { return SRechargeCommodityNewConfig.getConditon(modId); }
public long getStartTime() { return startTime; }

View File

@ -10,6 +10,7 @@ import config.SRechargeCommodityNewConfig;
import util.TimeUtils;
import java.util.List;
import java.util.concurrent.TimeUnit;
/**
* ()
@ -28,6 +29,9 @@ public class TimeLimitWelfareBag extends AbstractWelfareBag {
}
}
}
if(getDailyUpdate() > 0){
setRefreshTime(TimeUtils.getBeginOfDay(getStartTime())+ getDailyUpdate() * TimeUtils.DAY);
}
}
public TimeLimitWelfareBag(int modId, int type, long startTime, long endTime, int limit, int dailyUpdate, int continueDays, boolean open, long lastBuyTime, int buyTimes, long refreshTime, int[] privilege, int timeType, String[][] condition, boolean isUserBuyRefresh,String mongoKey,int rootId) {

View File

@ -693,15 +693,16 @@ public class CBean2Proto {
outTime = (int)((System.currentTimeMillis() - user.getPlayerInfoManager().getLoginTime())/1000);
}
return Family.FamilyApply.newBuilder()
.setRoleUid(user.getId())
.setName(user.getPlayerInfoManager().getNickName())
.setLevel(user.getPlayerInfoManager().getLevel())
.setForeces(user.getPlayerInfoManager().getMaxForce())
.setOutTime(outTime)
.setFrame(user.getPlayerInfoManager().getHeadFrame())
.setRoleUid(user.getId())
.setName(user.getPlayerInfoManager().getNickName())
.setLevel(user.getPlayerInfoManager().getLevel())
.setForeces(user.getPlayerInfoManager().getMaxForce())
.setOutTime(outTime)
.setFrame(user.getPlayerInfoManager().getHeadFrame())
.setTime(applyTime)
.setHead(user.getPlayerInfoManager().getHead())
.build();
.setPracticeLevel(user.getHeroManager().getPracticeLevel())
.build();
}

View File

@ -839,21 +839,35 @@ public class ItemUtil {
// 负值验证
return;
}
int maxExp = SPlayerLevelConfig.getsPlayerLevelConfigMap().get(SPlayerLevelConfig.getsPlayerLevelConfigMap().size()).getExp();
if (playerInfoManager.getExp() >= maxExp) {
// 等级配置表
Map<Integer, SPlayerLevelConfig> levelConfigMap = SPlayerLevelConfig.getsPlayerLevelConfigMap();
SPlayerLevelConfig maxLevel = levelConfigMap.get(levelConfigMap.size());
// 等级验证
if (playerInfoManager.getLevel() >= maxLevel.getPlayerLv()) {
return;
}
long curExp = MathUtils.setBetweenWithMax(playerInfoManager.getExp() + addExp, 0L, maxExp);
// 从1级升到满级需要得经验
long totalExp = levelConfigMap.values().stream().mapToLong(SPlayerLevelConfig::getExp).sum();
// 最高等级得经验是多余得,需要减去
totalExp -= maxLevel.getExp();
// 获取最大经验
long exp = playerInfoManager.getExp() + addExp;
if (exp > totalExp){
exp = totalExp - playerInfoManager.getExp();
}
int oldLevel = playerInfoManager.getLevel();
// 当前等级表配置
SPlayerLevelConfig sPlayerLevelConfig = SPlayerLevelConfig.getsPlayerLevelConfigMap().get(oldLevel);
int levelUpExp;
if (sPlayerLevelConfig == null) {
levelUpExp = maxExp;
} else {
levelUpExp = sPlayerLevelConfig.getExp();
throw new ErrorCodeException("服务器表配置错误");
}
while (curExp >= levelUpExp && curExp <= maxExp) {
int levelUpExp = sPlayerLevelConfig.getExp();
// 循环,直到经验不足继续升级或者等级最高
while (exp >= levelUpExp && playerInfoManager.getLevel() < maxLevel.getPlayerLv()) {
// 玩家等级2级发送道具改名卡
if(playerInfoManager.getLevel()==2&&playerInfoManager.getNickName().equals(String.valueOf(playerInfoManager.getRootId()))){
//TODO 走表
String title = SErrorCodeEerverConfig.getI18NMessage("change_playername_title");
@ -866,25 +880,32 @@ public class ItemUtil {
MailLogic.getInstance().sendMail(user.getId(), title, content, mailReward, nowTime, Global.MAIL_EFFECTIVE_TIME);
}
if (sPlayerLevelConfig == null) {
levelUpExp = Integer.MAX_VALUE;
} else {
if (curExp >= sPlayerLevelConfig.getExp()) {
curExp = curExp - sPlayerLevelConfig.getExp();
Poster.getPoster().dispatchEvent(new UserLevelEvent(user.getId(),playerInfoManager.getLevel()+1));
playerInfoManager.setLevel(playerInfoManager.getLevel()+1);
sPlayerLevelConfig = SPlayerLevelConfig.getsPlayerLevelConfigMap().get(playerInfoManager.getLevel());
levelUpExp = sPlayerLevelConfig.getExp();
}
// 升一级减去一次经验
exp -= sPlayerLevelConfig.getExp();
// 等级更新
playerInfoManager.setLevel(playerInfoManager.getLevel()+1);
// 升级事务处理
Poster.getPoster().dispatchEvent(new UserLevelEvent(user.getId(),playerInfoManager.getLevel()));
// 获取下一级得经验
sPlayerLevelConfig = SPlayerLevelConfig.getsPlayerLevelConfigMap().get(playerInfoManager.getLevel());
if (sPlayerLevelConfig == null){
break;
}
levelUpExp = sPlayerLevelConfig.getExp();
// 玩家升级报送
Repot37EventUtil.onKtEvent(user, Repot37EventUtil.Report37EventType.ROLE_LEVEUP_EVENT);
}
playerInfoManager.setExp(curExp);
// 更新经验
playerInfoManager.setExp((int) exp);
// 玩家升级, 埋点推送和任务处理
if (playerInfoManager.getLevel() > oldLevel) {
ReportUtil.onReportEvent(user, ReportEventEnum.LEVEL_UP.getType(),oldLevel,playerInfoManager.getLevel()-oldLevel,playerInfoManager.getLevel());
user.getUserMissionManager().onGameEvent(user, GameEvent.USER_LEVELUP,oldLevel+1,playerInfoManager.getLevel());
}
// 在线玩家消息推送
ISession sessionByUid = OnlineUserManager.getSessionByUid(user.getId());
if(sessionByUid!=null){
PlayerInfoProto.UpdateUserExpIndicaiton build = PlayerInfoProto.UpdateUserExpIndicaiton.newBuilder().setExp((int)playerInfoManager.getExp()).setLevel(playerInfoManager.getLevel()).build();

View File

@ -57,6 +57,8 @@ public class SRechargeCommodityNewConfig implements BaseConfig {
private int[] forbid;
private String[][] condition;
public static Map<Integer,SRechargeCommodityNewConfig> configMap;
public static Map<String,SRechargeCommodityNewConfig> sdkconfigMap;
@ -68,6 +70,7 @@ public class SRechargeCommodityNewConfig implements BaseConfig {
Map<String,SRechargeCommodityNewConfig> tempSdkConfigMap = new HashMap<>();
Map<Integer, List<Integer>> tempConfigTypeMap = new HashMap<>();
for(SRechargeCommodityNewConfig newConfig : config.values()){
newConfig.setCondition(initConditon(newConfig));
tempConfigMap.put(newConfig.getId(),newConfig);
tempSdkConfigMap.put(newConfig.getRechargeId(),newConfig);
tempSdkConfigMap.put(newConfig.getRechargeId2(),newConfig);
@ -87,6 +90,26 @@ public class SRechargeCommodityNewConfig implements BaseConfig {
}
}
public static String[][] getConditon(int id){
return configMap.get(id).getCondition();
}
public String[][] initConditon(SRechargeCommodityNewConfig config){
String[] s = config.getOnSaleRule().split("\\|");
condition = new String[s.length][3];
int i = 0;
for (String s0 : s) {
String[] s1 = s0.split("#");
condition[i][0] = s1[0];
condition[i][1] = s1[1];
if(s1.length > 2){
condition[i][2] = s1[2];
}
i++;
}
return condition;
}
public static SRechargeCommodityNewConfig getConfigById(int id){
return configMap.get(id);
}
@ -150,4 +173,12 @@ public class SRechargeCommodityNewConfig implements BaseConfig {
public String getRechargeId6() {
return rechargeId6;
}
public String[][] getCondition() {
return condition;
}
public void setCondition(String[][] condition) {
this.condition = condition;
}
}