Merge branch 'master' of 60.1.1.230:backend/jieling_server
commit
b02f07e874
|
@ -19,8 +19,7 @@ public class MathUtils {
|
|||
|
||||
|
||||
public static void main(String[] args){
|
||||
String i = "0|00|111";
|
||||
String[] split = i.split("|", 1);
|
||||
System.out.println(forceToDouble(1231321));
|
||||
}
|
||||
public static int randomForStrArray(String [] rateArray) {
|
||||
return randomStrArray(rateArray, -1);
|
||||
|
@ -326,6 +325,9 @@ public class MathUtils {
|
|||
}
|
||||
return result;
|
||||
}
|
||||
public static double forceToDouble(double force){
|
||||
return force/Math.pow(10,8);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -710,7 +710,7 @@ local effectList = {
|
|||
local brand = Buff.Create(caster, BuffName.Brand, f3, "weak")
|
||||
brand.exDmg = f2
|
||||
brand.coverFunc = function (oldBuff)
|
||||
brand.exDmg = brand.exDmg + oldBuff.exDmg
|
||||
brand.exDmg = brand.exDmg + (oldBuff.exDmg or 0)
|
||||
end
|
||||
local trigger = function(atkRole, damagingFunc, damageType)
|
||||
BattleUtil.RandomAction(f1, function ()
|
||||
|
@ -875,11 +875,11 @@ local effectList = {
|
|||
brand.isDeBuff = true
|
||||
brand.coverFunc = function (oldBuff)
|
||||
if i2 == 0 or oldBuff.layer < i2 then
|
||||
brand.exDmg = brand.exDmg + oldBuff.exDmg
|
||||
brand.exHeal = brand.exHeal + oldBuff.exHeal
|
||||
brand.exDmg = brand.exDmg + (oldBuff.exDmg or 0)
|
||||
brand.exHeal = brand.exHeal + (oldBuff.exHeal or 0)
|
||||
else
|
||||
brand.exDmg = oldBuff.exDmg
|
||||
brand.exHeal = oldBuff.exHeal
|
||||
brand.exDmg = (oldBuff.exDmg or 0)
|
||||
brand.exHeal = (oldBuff.exHeal or 0)
|
||||
end
|
||||
end
|
||||
local trigger = function(atkRole, damagingFunc, damageType)
|
||||
|
|
|
@ -10,6 +10,9 @@ import com.ljsd.jieling.kefu.GmGlobleAbstract;
|
|||
import com.ljsd.jieling.kefu.GmInterface;
|
||||
import com.ljsd.jieling.kefu.GmRoleAbstract;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.activity.event.UserForceChangeEvent;
|
||||
import com.ljsd.jieling.logic.activity.eventhandler.UserForceUpEventHandler;
|
||||
import com.ljsd.jieling.logic.dao.RechargeInfo;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
|
@ -98,7 +101,15 @@ public class GmService implements RPCRequestGMIFace.Iface {
|
|||
sendIds.add(uid);
|
||||
}
|
||||
|
||||
} else{
|
||||
} else if(cmd.contains("mainfightrank")){
|
||||
Poster.getPoster().listenEvent(new UserForceUpEventHandler(), UserForceChangeEvent.class);
|
||||
Set<ZSetOperations.TypedTuple<String>> rankInfo = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.MAIN_LEVEL_RANK, "", 0, -1);
|
||||
for (ZSetOperations.TypedTuple<String> item : rankInfo) {
|
||||
String value = item.getValue();
|
||||
int uid = Integer.parseInt(value);
|
||||
sendIds.add(uid);
|
||||
}
|
||||
}else{
|
||||
String[] ids = parameters[0].split("#");
|
||||
for (String id : ids) {
|
||||
sendIds.add(Integer.valueOf(id));
|
||||
|
|
|
@ -145,7 +145,8 @@ public enum ErrorCode implements IErrorCode {
|
|||
EXIST_NAME(111,"此名已存在"),
|
||||
ANNOUNCE_SIZE(112,"公会宣言长度不符"),
|
||||
ALREADY_LIKE(113,"今天已经给他点过赞了"),
|
||||
RED_PACKAGE_NOT(114,"该红包已不存在")
|
||||
RED_PACKAGE_NOT(114,"该红包已不存在"),
|
||||
NO_FRIEND_APPLY(115,"暂无可添加好友")
|
||||
|
||||
|
||||
;
|
||||
|
|
|
@ -97,6 +97,9 @@ public class UpSoulEquipQuiickHandler extends BaseHandler<HeroInfoProto.UpQuickS
|
|||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.UP_SOUL_EQUIP_RESPONSE_VALUE, builder.build(), true);
|
||||
if(oldLevel!=leve && soulEquip.getLevel()>= SSpecialConfig.getIntegerValue(SSpecialConfig.lamp_rankup_equipsign_content_parm)){
|
||||
SItem sItem = SItem.getsItemMap().get(soulEquip.getEquipId());
|
||||
if(sItem.getQuantity()<5){
|
||||
return;
|
||||
}
|
||||
String message = SErrorCodeEerverConfig.getI18NMessage("lamp_rankup_equipsign_content", new Object[]{user.getPlayerInfoManager().getNickName(), sItem.getName(),soulEquip.getLevel()});
|
||||
ChatLogic.getInstance().sendSysChatMessage(message, Global.DILIGENT,sItem.getId(),0,0,0,0,0);
|
||||
}
|
||||
|
|
|
@ -2122,7 +2122,7 @@ public class MapLogic {
|
|||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightEndResponse.build(), true);
|
||||
// String rankKey = RedisKey.getKey(RedisKey.MAINLEVEL_RANK, "", false);
|
||||
// RedisUtil.getInstence().zsetAddOne(rankKey, String.valueOf(user.getId()), sMainLevelConfig.getVirtureId());
|
||||
RankContext.getRankEnum(RankEnum.MAIN_LEVEL_RANK.getType()).addRank(uid,"",sMainLevelConfig.getVirtureId());
|
||||
RankContext.getRankEnum(RankEnum.MAIN_LEVEL_RANK.getType()).addRank(uid,"",sMainLevelConfig.getVirtureId(),user.getPlayerInfoManager().getMaxForce());
|
||||
}
|
||||
|
||||
// public void getMainLevelRankInfo(ISession session) throws Exception {
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
package com.ljsd.jieling.kefu;
|
||||
|
||||
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.activity.event.UserForceChangeEvent;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
|
||||
public class Cmd_mainfightrank extends GmRoleAbstract{
|
||||
|
||||
@Override
|
||||
public boolean exec(String[] args) throws Exception {
|
||||
User user = getUser();
|
||||
Poster.getPoster().dispatchEvent(new UserForceChangeEvent(user.getId(),user.getPlayerInfoManager().getMaxForce()));
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.ljsd.jieling.kefu;
|
||||
|
||||
import com.ljsd.jieling.handler.map.MapLogic;
|
||||
|
||||
public class Cmd_viewmem extends GmAbstract{
|
||||
@Override
|
||||
public boolean exec(String[] args) throws Exception {
|
||||
LOGGER.info("the season is={}",MapLogic.getInstance());
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package com.ljsd.jieling.logic.activity.eventhandler;
|
||||
|
||||
import com.ljsd.jieling.logic.activity.IEventHandler;
|
||||
import com.ljsd.jieling.logic.activity.event.IEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.UserForceChangeEvent;
|
||||
import com.ljsd.jieling.logic.rank.RankContext;
|
||||
import com.ljsd.jieling.logic.rank.RankEnum;
|
||||
|
||||
/**
|
||||
* @author lvxinran
|
||||
* @date 2020/3/14
|
||||
* @discribe
|
||||
*/
|
||||
public class UserForceUpEventHandler implements IEventHandler {
|
||||
@Override
|
||||
public void onEvent(IEvent event) throws Exception {
|
||||
if(!(event instanceof UserForceChangeEvent))
|
||||
return;
|
||||
UserForceChangeEvent forceChangeEvent = (UserForceChangeEvent)event;
|
||||
double scoreById = RankContext.getRankEnum(RankEnum.MAIN_LEVEL_RANK.getType()).getScoreById(forceChangeEvent.getUid(), "");
|
||||
if(scoreById<=0){
|
||||
return;
|
||||
}
|
||||
RankContext.getRankEnum(RankEnum.MAIN_LEVEL_RANK.getType()).addRank(forceChangeEvent.getUid(),"",Double.valueOf(scoreById).intValue(),forceChangeEvent.getForce());
|
||||
}
|
||||
}
|
|
@ -144,7 +144,11 @@ public class ExpeditionLogic {
|
|||
}
|
||||
}
|
||||
//移除已经删除的hero
|
||||
Set<String> removeId = heroHP.keySet().stream().filter(k -> !heroMap.keySet().contains(k)).collect(Collectors.toSet());
|
||||
Set<String> removeId = heroHP.keySet().stream().filter(k -> {
|
||||
if(!heroMap.keySet().contains(k))
|
||||
return true;
|
||||
return heroMap.get(k).getLevel()<20;
|
||||
}).collect(Collectors.toSet());
|
||||
removeId.forEach(heroHP::remove);
|
||||
Set<CommonProto.ExpeditionSimpleHeroInfo> heroInfoSet = new HashSet<>();
|
||||
for (Map.Entry<String, Double> entry : heroHP.entrySet()) {
|
||||
|
@ -214,7 +218,7 @@ public class ExpeditionLogic {
|
|||
}
|
||||
int minFoce = sExpeditionSetting.getMatchForce()[0];
|
||||
int manFoce = sExpeditionSetting.getMatchForce()[1];
|
||||
int standerFoce = (int) (user.getPlayerInfoManager().getMaxForce() * (minFoce / 10000f) + nodeInfo.getLay() / size * (manFoce - minFoce));
|
||||
int standerFoce = (int) (user.getPlayerInfoManager().getMaxForce() * ((minFoce / 10000f) + ((float) nodeInfo.getLay()) / size * ((float) (manFoce - minFoce)/10000f)));
|
||||
float randomForce = (standerFoce * ((sExpeditionSetting.getMatchForceRange()[0] + (int) (Math.random() * (sExpeditionSetting.getMatchForceRange()[1] - sExpeditionSetting.getMatchForceRange()[0]))) / 10000f));
|
||||
|
||||
if(nodeInfo.getType()==NODETYPE_ADVANCE){
|
||||
|
|
|
@ -1184,8 +1184,8 @@ public class GuildFightLogic {
|
|||
continue;
|
||||
}
|
||||
ZSetOperations.TypedTuple<String> next = bossHurtRankInfo.iterator().next();
|
||||
String content = SErrorCodeEerverConfig.getI18NMessage("guildboss_daily_reward_txt",new String[]{UserManager.getUser(Integer.parseInt(next.getValue())).getPlayerInfoManager().getNickName()});
|
||||
int maxHurt =next.getScore().intValue();
|
||||
String content = SErrorCodeEerverConfig.getI18NMessage("guildboss_daily_reward_txt",new String[]{UserManager.getUser(Integer.parseInt(next.getValue())).getPlayerInfoManager().getNickName(),Integer.toString(maxHurt)});
|
||||
int[][] mineReward = new int[bossReward.length][];
|
||||
int j=0;
|
||||
for(int i=0;i<bossReward.length;i++){
|
||||
|
|
|
@ -363,6 +363,9 @@ public class FriendLogic {
|
|||
break;
|
||||
case 3://全部同意
|
||||
int nums = allApplyFriend(uid, friendManager, friends, applyFriends, maxFriends);
|
||||
if(nums==0){
|
||||
throw new ErrorCodeException(ErrorCode.NO_FRIEND_APPLY);
|
||||
}
|
||||
user.getUserMissionManager().onGameEvent(user,GameEvent.FRIEND_NUMS,nums);
|
||||
break;
|
||||
case 4://全部拒绝
|
||||
|
@ -527,11 +530,11 @@ public class FriendLogic {
|
|||
throw new ErrorCodeException(ErrorCode.FRIENDS_SEMD_YET);
|
||||
}
|
||||
friendManager.updateGiveMap(friendId,1);
|
||||
boolean check = PlayerLogic.getInstance().checkAndUpdate(user,STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getMaxEnergyGet(), 1);
|
||||
if(check){
|
||||
friendManager1.updateHaveRewardMap(uid,1);
|
||||
sendFriendStatedication(uid,friendId,2);
|
||||
}
|
||||
// boolean check = PlayerLogic.getInstance().checkAndUpdate(user,STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getMaxEnergyGet(), 1);
|
||||
// if(check){
|
||||
friendManager1.updateHaveRewardMap(uid,1);
|
||||
sendFriendStatedication(uid,friendId,2);
|
||||
// }
|
||||
times++;
|
||||
}else{ //赠送全部好友
|
||||
for (Integer friendUserId : friends) {
|
||||
|
@ -545,11 +548,11 @@ public class FriendLogic {
|
|||
continue;
|
||||
}
|
||||
friendManager.updateGiveMap(friendUserId,1);
|
||||
boolean check = PlayerLogic.getInstance().checkAndUpdate(user,STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getMaxEnergyGet(), 1);
|
||||
if(check){
|
||||
friendManager1.updateHaveRewardMap(uid,1);
|
||||
sendFriendStatedication(uid,friendUserId,2);
|
||||
}
|
||||
// boolean check = PlayerLogic.getInstance().checkAndUpdate(user,STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getMaxEnergyGet(), 1);
|
||||
// if(check){
|
||||
friendManager1.updateHaveRewardMap(uid,1);
|
||||
sendFriendStatedication(uid,friendUserId,2);
|
||||
// }
|
||||
times++;
|
||||
}
|
||||
}
|
||||
|
@ -571,7 +574,7 @@ public class FriendLogic {
|
|||
List<Integer> friends = friendManager.getFriends();
|
||||
Map<Integer, Integer> haveRewardMap = friendManager.getHaveRewardMap();
|
||||
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||
boolean check = PlayerLogic.getInstance().checkAndUpdate(user,STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getMaxEnergyGet(), 1);
|
||||
boolean check = PlayerLogic.getInstance().check(user,STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getMaxEnergyGet(), 1);
|
||||
Set<Integer> receieveFriends = new HashSet<>();
|
||||
if(!check){
|
||||
throw new ErrorCodeException(ErrorCode.FRIENDS_GET_MAX);
|
||||
|
@ -594,7 +597,6 @@ public class FriendLogic {
|
|||
takeTimes++;
|
||||
rewardStr = reward.toString();
|
||||
}else{
|
||||
int i=0;
|
||||
for (Integer friend : friends) {
|
||||
if (!haveRewardMap.containsKey(friend)) {
|
||||
continue;
|
||||
|
@ -602,13 +604,11 @@ public class FriendLogic {
|
|||
if (haveRewardMap.containsKey(friend) && haveRewardMap.get(friend) != 1) {
|
||||
continue;
|
||||
}
|
||||
if(i++>0){
|
||||
check = PlayerLogic.getInstance().checkAndUpdate(user,STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getMaxEnergyGet(), 1);
|
||||
if(!check){
|
||||
break;
|
||||
}
|
||||
|
||||
check = PlayerLogic.getInstance().checkAndUpdate(user,STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getMaxEnergyGet(), 1);
|
||||
if(!check){
|
||||
break;
|
||||
}
|
||||
playerInfoManager.updateVipPrivilage(STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getMaxEnergyGet(),1);
|
||||
friendManager.updateHaveRewardMap(friend,2);
|
||||
reward.append(SSpecialConfig.getStringValue(SSpecialConfig.Friend_Gift)).append("|");
|
||||
receieveFriends.add(friend);
|
||||
|
|
|
@ -499,6 +499,9 @@ public class ItemLogic {
|
|||
MessageUtil.sendMessage(session,1,MessageTypeProto.MessageType.UP_HERO_STAR_RESPONSE_VALUE,null,true);
|
||||
if(especialEquip.getStar()>=SSpecialConfig.getIntegerValue(SSpecialConfig.lamp_rankup_equiptalisman_content_parm)){
|
||||
SItem sItem = SItem.getsItemMap().get(especialEquip.getEquipId());
|
||||
if(sItem.getQuantity()<5){
|
||||
return;
|
||||
}
|
||||
String message = SErrorCodeEerverConfig.getI18NMessage("lamp_rankup_equiptalisman_content", new Object[]{user.getPlayerInfoManager().getNickName(), sItem.getName(),especialEquip.getStar()});
|
||||
ChatLogic.getInstance().sendSysChatMessage(message,Global.DILIGENT,sItem.getId(),0,0,0,0,0);
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ import com.ljsd.jieling.logic.activity.ActivityLogic;
|
|||
import com.ljsd.jieling.logic.activity.ActivityType;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.activity.event.UserForceChangeEvent;
|
||||
import com.ljsd.jieling.logic.activity.eventhandler.UserForceUpEventHandler;
|
||||
import com.ljsd.jieling.logic.dao.*;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.family.GuildLogic;
|
||||
|
@ -50,7 +51,10 @@ import java.util.*;
|
|||
|
||||
public class PlayerLogic {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(MailLogic.class);
|
||||
private PlayerLogic(){}
|
||||
private PlayerLogic(){
|
||||
Poster.getPoster().listenEvent(new UserForceUpEventHandler(), UserForceChangeEvent.class);
|
||||
|
||||
}
|
||||
|
||||
public static PlayerLogic getInstance(){
|
||||
return InnerClass.instance;
|
||||
|
@ -269,6 +273,13 @@ public class PlayerLogic {
|
|||
ActivityLogic.getInstance().updateActivityMissionProgress(user, ActivityType.FORCESTANDARD,teamForce);
|
||||
}
|
||||
|
||||
if(teamId == GlobalsDef.TEAM_ARENA_DEFENSE){
|
||||
//更新竞技场防御编队战力
|
||||
String key = RedisKey.getKey(RedisKey.AREDEF_TEAM_FORCE_RANK, "", false);
|
||||
RedisUtil.getInstence().zsetAddOne(key, String.valueOf(user.getId()), teamForce);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
MessageUtil.sendMessage(iSession,1, MessageTypeProto.MessageType.USER_FORCE_CHANGE_RESPONSE_VALUE,null,true);
|
||||
|
@ -745,41 +756,8 @@ public class PlayerLogic {
|
|||
user.getPlayerInfoManager().setRideLevel(rideLevel+1);
|
||||
MessageUtil.sendMessage(session,1,messageType.getNumber(),null,true);
|
||||
}
|
||||
public boolean checkAndUpdate(User user, int privilageTypeId, int updateNum){
|
||||
Map<Integer, VipInfo> vipInfo = user.getPlayerInfoManager().getVipInfo();
|
||||
if(privilageTypeId == 0){
|
||||
return true;
|
||||
}
|
||||
List<SPrivilegeTypeConfig> sPrivilegeTypeConfigs = SPrivilegeTypeConfig.privilegeByType.get(privilageTypeId);
|
||||
List<Integer> typePrivileges = new ArrayList<>();
|
||||
for(SPrivilegeTypeConfig config:sPrivilegeTypeConfigs){
|
||||
if(!vipInfo.containsKey(config.getId())){
|
||||
continue;
|
||||
}
|
||||
typePrivileges.add(config.getId());
|
||||
}
|
||||
if(typePrivileges.isEmpty()){
|
||||
return false;
|
||||
}
|
||||
for(Integer privilageId:typePrivileges){
|
||||
VipInfo info = vipInfo.get(privilageId);
|
||||
if(info.getEffectTime()!=0&&TimeUtils.now()/1000>info.getEffectTime()){
|
||||
continue;
|
||||
}
|
||||
int mCount = getMaxCountByPrivilege(user,privilageId);
|
||||
if(mCount==-1){
|
||||
return true;
|
||||
}
|
||||
if((info.getCount()+updateNum>mCount)|| (info.getEffectTime()!=0&&TimeUtils.now()/1000>info.getEffectTime())){
|
||||
continue;
|
||||
}
|
||||
user.getPlayerInfoManager().updateVipPrivilage(privilageId, updateNum);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean check(User user, int privilageTypeId, int checkNum){
|
||||
// return priviliageCheck(user,privilageTypeId,checkNum,false);
|
||||
Map<Integer, VipInfo> vipInfo = user.getPlayerInfoManager().getVipInfo();
|
||||
if(privilageTypeId == 0){
|
||||
return true;
|
||||
|
@ -811,6 +789,75 @@ public class PlayerLogic {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
public boolean checkAndUpdate(User user, int privilageTypeId, int updateNum){
|
||||
// return priviliageCheck(user,privilageTypeId,updateNum,true);
|
||||
Map<Integer, VipInfo> vipInfo = user.getPlayerInfoManager().getVipInfo();
|
||||
if(privilageTypeId == 0){
|
||||
return true;
|
||||
}
|
||||
List<SPrivilegeTypeConfig> sPrivilegeTypeConfigs = SPrivilegeTypeConfig.privilegeByType.get(privilageTypeId);
|
||||
List<Integer> typePrivileges = new ArrayList<>();
|
||||
for(SPrivilegeTypeConfig config:sPrivilegeTypeConfigs){
|
||||
if(!vipInfo.containsKey(config.getId())){
|
||||
continue;
|
||||
}
|
||||
typePrivileges.add(config.getId());
|
||||
}
|
||||
if(typePrivileges.isEmpty()){
|
||||
return false;
|
||||
}
|
||||
for(Integer privilageId:typePrivileges){
|
||||
VipInfo info = vipInfo.get(privilageId);
|
||||
if(info.getEffectTime()!=0&&TimeUtils.now()/1000>info.getEffectTime()){
|
||||
continue;
|
||||
}
|
||||
int mCount = getMaxCountByPrivilege(user,privilageId);
|
||||
if(mCount==-1){
|
||||
return true;
|
||||
}
|
||||
if((info.getCount()+updateNum>mCount)|| (info.getEffectTime()!=0&&TimeUtils.now()/1000>info.getEffectTime())){
|
||||
continue;
|
||||
}
|
||||
user.getPlayerInfoManager().updateVipPrivilage(privilageId, updateNum);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// private boolean priviliageCheck(User user, int privilageTypeId, int checkNum,boolean isUpdate){
|
||||
// Map<Integer, VipInfo> vipInfo = user.getPlayerInfoManager().getVipInfo();
|
||||
// if(privilageTypeId == 0){
|
||||
// return true;
|
||||
// }
|
||||
// List<SPrivilegeTypeConfig> sPrivilegeTypeConfigs = SPrivilegeTypeConfig.privilegeByType.get(privilageTypeId);
|
||||
// List<Integer> typePrivileges = new ArrayList<>();
|
||||
// for(SPrivilegeTypeConfig config:sPrivilegeTypeConfigs){
|
||||
// if(!vipInfo.containsKey(config.getId())){
|
||||
// continue;
|
||||
// }
|
||||
// typePrivileges.add(config.getId());
|
||||
// }
|
||||
// if(typePrivileges.isEmpty()){
|
||||
// return false;
|
||||
// }
|
||||
// for(Integer privilageId:typePrivileges){
|
||||
// VipInfo info = vipInfo.get(privilageId);
|
||||
// if(info.getEffectTime()!=0&&TimeUtils.now()/1000>info.getEffectTime()){
|
||||
// continue;
|
||||
// }
|
||||
// int mCount = getMaxCountByPrivilege(user,privilageId);
|
||||
// if(mCount==-1){
|
||||
// return true;
|
||||
// }
|
||||
// if((info.getCount()+checkNum>mCount)|| (info.getEffectTime()!=0&&TimeUtils.now()/1000>info.getEffectTime())){
|
||||
// continue;
|
||||
// }
|
||||
// if (isUpdate){
|
||||
// user.getPlayerInfoManager().updateVipPrivilage(privilageId, checkNum);
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
private int getMaxCountByPrivilege(User user,int privilegeId){
|
||||
SPrivilegeTypeConfig sPrivilegeTypeConfig = SPrivilegeTypeConfig.getsPrivilegeTypeConfigMap().get(privilegeId);
|
||||
Map<Integer, Map<Integer, Integer>> conditionMap = SPrivilegeTypeConfig.conditionMap.get(sPrivilegeTypeConfig.getUnlockType());
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.ljsd.jieling.logic.dao.UserManager;
|
|||
import com.ljsd.jieling.protocols.CommonProto;
|
||||
import com.ljsd.jieling.protocols.PlayerInfoProto;
|
||||
import org.springframework.data.redis.core.ZSetOperations;
|
||||
import util.MathUtils;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.util.*;
|
||||
|
@ -28,30 +29,31 @@ public class MainLevelRank extends AbstractRank {
|
|||
|
||||
@Override
|
||||
protected PlayerInfoProto.RankResponse.Builder getAllUserResponse(Set<ZSetOperations.TypedTuple<String>> zsetreverseRangeWithScores, int start) throws Exception {
|
||||
PlayerInfoProto.RankResponse.Builder allUserResponse = super.getAllUserResponse(zsetreverseRangeWithScores, start);
|
||||
List<CommonProto.UserRank> ranksBuilderList = allUserResponse.getRanksList();
|
||||
if(ranksBuilderList.size()<2){
|
||||
return allUserResponse;
|
||||
}
|
||||
List<CommonProto.UserRank> builders = new ArrayList<>(ranksBuilderList);
|
||||
Collections.sort(builders,(o1, o2) -> {
|
||||
if(o1.getRankInfo().getParam1()==o2.getRankInfo().getParam1()){
|
||||
if(o1.getForce()>o2.getForce() &&o1.getRankInfo().getRank()>o2.getRankInfo().getRank()){
|
||||
CommonProto.UserRank rankInfo1 = o1 ;
|
||||
o1 = o2;
|
||||
o2 = rankInfo1;
|
||||
}
|
||||
}
|
||||
return o1.getRankInfo().getRank()-o2.getRankInfo().getRank();
|
||||
});
|
||||
List<CommonProto.UserRank> buildersCopy = new ArrayList<>(ranksBuilderList.size());
|
||||
for(CommonProto.UserRank userRank : builders){
|
||||
buildersCopy.add(userRank.toBuilder().setRankInfo(userRank.toBuilder().getRankInfo().toBuilder().setRank(start).build()).build());
|
||||
start++;
|
||||
}
|
||||
PlayerInfoProto.RankResponse.Builder response = PlayerInfoProto.RankResponse.newBuilder();
|
||||
response.setMyRankInfo(allUserResponse.getMyRankInfo()).addAllRanks(buildersCopy);
|
||||
return response;
|
||||
// PlayerInfoProto.RankResponse.Builder allUserResponse = super.getAllUserResponse(zsetreverseRangeWithScores, start);
|
||||
// List<CommonProto.UserRank> ranksBuilderList = allUserResponse.getRanksList();
|
||||
// if(ranksBuilderList.size()<2){
|
||||
// return allUserResponse;
|
||||
// }
|
||||
// List<CommonProto.UserRank> builders = new ArrayList<>(ranksBuilderList);
|
||||
// Collections.sort(builders,(o1, o2) -> {
|
||||
// if(o1.getRankInfo().getParam1()==o2.getRankInfo().getParam1()){
|
||||
// if(o1.getForce()>o2.getForce() &&o1.getRankInfo().getRank()>o2.getRankInfo().getRank()){
|
||||
// CommonProto.UserRank rankInfo1 = o1 ;
|
||||
// o1 = o2;
|
||||
// o2 = rankInfo1;
|
||||
// }
|
||||
// }
|
||||
// return o1.getRankInfo().getRank()-o2.getRankInfo().getRank();
|
||||
// });
|
||||
// List<CommonProto.UserRank> buildersCopy = new ArrayList<>(ranksBuilderList.size());
|
||||
// for(CommonProto.UserRank userRank : builders){
|
||||
// buildersCopy.add(userRank.toBuilder().setRankInfo(userRank.toBuilder().getRankInfo().toBuilder().setRank(start).build()).build());
|
||||
// start++;
|
||||
// }
|
||||
// PlayerInfoProto.RankResponse.Builder response = PlayerInfoProto.RankResponse.newBuilder();
|
||||
// response.setMyRankInfo(allUserResponse.getMyRankInfo()).addAllRanks(buildersCopy);
|
||||
// return response;
|
||||
return super.getAllUserResponse(zsetreverseRangeWithScores,start);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -63,6 +65,6 @@ public class MainLevelRank extends AbstractRank {
|
|||
|
||||
@Override
|
||||
public double getScore(double... data) {
|
||||
return data[0]+ TimeUtils.getDoubleTime();
|
||||
return data[0]+ data[1]/Math.pow(10,8);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,13 +55,13 @@ public class ProtocolsManager implements ProtocolsAbstract {
|
|||
private Map<Integer, BaseHandler> handlers = new HashMap<>();
|
||||
private static ClassLoader classLoader = GameApplication.class.getClassLoader();
|
||||
public final static int HANDLER_THREAD_NUM = 50;
|
||||
public HandlerLogicThread[] handlerThreads = new HandlerLogicThread[HANDLER_THREAD_NUM];
|
||||
public static HandlerLogicThread[] handlerThreads = new HandlerLogicThread[HANDLER_THREAD_NUM];
|
||||
|
||||
private ProtocolsManager() {
|
||||
static {
|
||||
initContext();
|
||||
}
|
||||
|
||||
public void initContext() {
|
||||
private static void initContext() {
|
||||
for (int i = 0; i < HANDLER_THREAD_NUM; i++) {
|
||||
handlerThreads[i] = new HandlerLogicThread();
|
||||
handlerThreads[i].setPriority(9);//优先级最高
|
||||
|
|
|
@ -18,6 +18,7 @@ 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.family.GuildLogic;
|
||||
import com.ljsd.jieling.logic.mission.event.MissionEventDistributor;
|
||||
import com.ljsd.jieling.logic.store.StoreLogic;
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
import com.ljsd.jieling.netty.handler.GameMessageHandler;
|
||||
|
@ -224,6 +225,7 @@ public class SessionManager implements INetSession<ISession>, INetReceived<ISess
|
|||
MessageUtil.sendHeartBeat(session);
|
||||
User userInMem = UserManager.getUserInMem(session.getUid());
|
||||
if(userInMem!=null){
|
||||
MissionEventDistributor.requestStart();
|
||||
ActivityLogic.getInstance().updateActivityMissionProgress(userInMem, ActivityType.OnlineReward,0);
|
||||
try {
|
||||
StoreLogic.checkStoreRefresh(userInMem,userInMem.getStoreManager().getStoreInfoMap());
|
||||
|
@ -237,6 +239,7 @@ public class SessionManager implements INetSession<ISession>, INetReceived<ISess
|
|||
MapLogic.getInstance().endLessClear(session);
|
||||
}
|
||||
MongoUtil.getLjsdMongoTemplate().lastUpdate();
|
||||
MissionEventDistributor.requestEnd(session,true);
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("the uid={} processFlush wrong ,e={}",session.getUid(),e);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue