Merge branch 'project0.95'
commit
0034193cb4
|
@ -19,8 +19,7 @@ public class MathUtils {
|
||||||
|
|
||||||
|
|
||||||
public static void main(String[] args){
|
public static void main(String[] args){
|
||||||
String i = "0|00|111";
|
System.out.println(forceToDouble(1231321));
|
||||||
String[] split = i.split("|", 1);
|
|
||||||
}
|
}
|
||||||
public static int randomForStrArray(String [] rateArray) {
|
public static int randomForStrArray(String [] rateArray) {
|
||||||
return randomStrArray(rateArray, -1);
|
return randomStrArray(rateArray, -1);
|
||||||
|
@ -326,6 +325,9 @@ public class MathUtils {
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
public static double forceToDouble(double force){
|
||||||
|
return force/Math.pow(10,8);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,9 @@ import com.ljsd.jieling.kefu.GmGlobleAbstract;
|
||||||
import com.ljsd.jieling.kefu.GmInterface;
|
import com.ljsd.jieling.kefu.GmInterface;
|
||||||
import com.ljsd.jieling.kefu.GmRoleAbstract;
|
import com.ljsd.jieling.kefu.GmRoleAbstract;
|
||||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
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.RechargeInfo;
|
||||||
import com.ljsd.jieling.logic.dao.UserManager;
|
import com.ljsd.jieling.logic.dao.UserManager;
|
||||||
import com.ljsd.jieling.logic.dao.root.User;
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
|
@ -98,7 +101,15 @@ public class GmService implements RPCRequestGMIFace.Iface {
|
||||||
sendIds.add(uid);
|
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("#");
|
String[] ids = parameters[0].split("#");
|
||||||
for (String id : ids) {
|
for (String id : ids) {
|
||||||
sendIds.add(Integer.valueOf(id));
|
sendIds.add(Integer.valueOf(id));
|
||||||
|
|
|
@ -145,7 +145,8 @@ public enum ErrorCode implements IErrorCode {
|
||||||
EXIST_NAME(111,"此名已存在"),
|
EXIST_NAME(111,"此名已存在"),
|
||||||
ANNOUNCE_SIZE(112,"公会宣言长度不符"),
|
ANNOUNCE_SIZE(112,"公会宣言长度不符"),
|
||||||
ALREADY_LIKE(113,"今天已经给他点过赞了"),
|
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);
|
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)){
|
if(oldLevel!=leve && soulEquip.getLevel()>= SSpecialConfig.getIntegerValue(SSpecialConfig.lamp_rankup_equipsign_content_parm)){
|
||||||
SItem sItem = SItem.getsItemMap().get(soulEquip.getEquipId());
|
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()});
|
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);
|
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);
|
MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightEndResponse.build(), true);
|
||||||
// String rankKey = RedisKey.getKey(RedisKey.MAINLEVEL_RANK, "", false);
|
// String rankKey = RedisKey.getKey(RedisKey.MAINLEVEL_RANK, "", false);
|
||||||
// RedisUtil.getInstence().zsetAddOne(rankKey, String.valueOf(user.getId()), sMainLevelConfig.getVirtureId());
|
// 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 {
|
// 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
|
//移除已经删除的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);
|
removeId.forEach(heroHP::remove);
|
||||||
Set<CommonProto.ExpeditionSimpleHeroInfo> heroInfoSet = new HashSet<>();
|
Set<CommonProto.ExpeditionSimpleHeroInfo> heroInfoSet = new HashSet<>();
|
||||||
for (Map.Entry<String, Double> entry : heroHP.entrySet()) {
|
for (Map.Entry<String, Double> entry : heroHP.entrySet()) {
|
||||||
|
@ -214,7 +218,7 @@ public class ExpeditionLogic {
|
||||||
}
|
}
|
||||||
int minFoce = sExpeditionSetting.getMatchForce()[0];
|
int minFoce = sExpeditionSetting.getMatchForce()[0];
|
||||||
int manFoce = sExpeditionSetting.getMatchForce()[1];
|
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));
|
float randomForce = (standerFoce * ((sExpeditionSetting.getMatchForceRange()[0] + (int) (Math.random() * (sExpeditionSetting.getMatchForceRange()[1] - sExpeditionSetting.getMatchForceRange()[0]))) / 10000f));
|
||||||
|
|
||||||
if(nodeInfo.getType()==NODETYPE_ADVANCE){
|
if(nodeInfo.getType()==NODETYPE_ADVANCE){
|
||||||
|
|
|
@ -1184,8 +1184,8 @@ public class GuildFightLogic {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ZSetOperations.TypedTuple<String> next = bossHurtRankInfo.iterator().next();
|
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();
|
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[][] mineReward = new int[bossReward.length][];
|
||||||
int j=0;
|
int j=0;
|
||||||
for(int i=0;i<bossReward.length;i++){
|
for(int i=0;i<bossReward.length;i++){
|
||||||
|
|
|
@ -363,6 +363,9 @@ public class FriendLogic {
|
||||||
break;
|
break;
|
||||||
case 3://全部同意
|
case 3://全部同意
|
||||||
int nums = allApplyFriend(uid, friendManager, friends, applyFriends, maxFriends);
|
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);
|
user.getUserMissionManager().onGameEvent(user,GameEvent.FRIEND_NUMS,nums);
|
||||||
break;
|
break;
|
||||||
case 4://全部拒绝
|
case 4://全部拒绝
|
||||||
|
@ -527,11 +530,11 @@ public class FriendLogic {
|
||||||
throw new ErrorCodeException(ErrorCode.FRIENDS_SEMD_YET);
|
throw new ErrorCodeException(ErrorCode.FRIENDS_SEMD_YET);
|
||||||
}
|
}
|
||||||
friendManager.updateGiveMap(friendId,1);
|
friendManager.updateGiveMap(friendId,1);
|
||||||
boolean check = PlayerLogic.getInstance().checkAndUpdate(user,STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getMaxEnergyGet(), 1);
|
// boolean check = PlayerLogic.getInstance().checkAndUpdate(user,STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getMaxEnergyGet(), 1);
|
||||||
if(check){
|
// if(check){
|
||||||
friendManager1.updateHaveRewardMap(uid,1);
|
friendManager1.updateHaveRewardMap(uid,1);
|
||||||
sendFriendStatedication(uid,friendId,2);
|
sendFriendStatedication(uid,friendId,2);
|
||||||
}
|
// }
|
||||||
times++;
|
times++;
|
||||||
}else{ //赠送全部好友
|
}else{ //赠送全部好友
|
||||||
for (Integer friendUserId : friends) {
|
for (Integer friendUserId : friends) {
|
||||||
|
@ -545,11 +548,11 @@ public class FriendLogic {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
friendManager.updateGiveMap(friendUserId,1);
|
friendManager.updateGiveMap(friendUserId,1);
|
||||||
boolean check = PlayerLogic.getInstance().checkAndUpdate(user,STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getMaxEnergyGet(), 1);
|
// boolean check = PlayerLogic.getInstance().checkAndUpdate(user,STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getMaxEnergyGet(), 1);
|
||||||
if(check){
|
// if(check){
|
||||||
friendManager1.updateHaveRewardMap(uid,1);
|
friendManager1.updateHaveRewardMap(uid,1);
|
||||||
sendFriendStatedication(uid,friendUserId,2);
|
sendFriendStatedication(uid,friendUserId,2);
|
||||||
}
|
// }
|
||||||
times++;
|
times++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -571,7 +574,7 @@ public class FriendLogic {
|
||||||
List<Integer> friends = friendManager.getFriends();
|
List<Integer> friends = friendManager.getFriends();
|
||||||
Map<Integer, Integer> haveRewardMap = friendManager.getHaveRewardMap();
|
Map<Integer, Integer> haveRewardMap = friendManager.getHaveRewardMap();
|
||||||
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
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<>();
|
Set<Integer> receieveFriends = new HashSet<>();
|
||||||
if(!check){
|
if(!check){
|
||||||
throw new ErrorCodeException(ErrorCode.FRIENDS_GET_MAX);
|
throw new ErrorCodeException(ErrorCode.FRIENDS_GET_MAX);
|
||||||
|
@ -594,7 +597,6 @@ public class FriendLogic {
|
||||||
takeTimes++;
|
takeTimes++;
|
||||||
rewardStr = reward.toString();
|
rewardStr = reward.toString();
|
||||||
}else{
|
}else{
|
||||||
int i=0;
|
|
||||||
for (Integer friend : friends) {
|
for (Integer friend : friends) {
|
||||||
if (!haveRewardMap.containsKey(friend)) {
|
if (!haveRewardMap.containsKey(friend)) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -602,13 +604,11 @@ public class FriendLogic {
|
||||||
if (haveRewardMap.containsKey(friend) && haveRewardMap.get(friend) != 1) {
|
if (haveRewardMap.containsKey(friend) && haveRewardMap.get(friend) != 1) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(i++>0){
|
|
||||||
check = PlayerLogic.getInstance().checkAndUpdate(user,STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getMaxEnergyGet(), 1);
|
check = PlayerLogic.getInstance().checkAndUpdate(user,STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getMaxEnergyGet(), 1);
|
||||||
if(!check){
|
if(!check){
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
playerInfoManager.updateVipPrivilage(STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getMaxEnergyGet(),1);
|
|
||||||
friendManager.updateHaveRewardMap(friend,2);
|
friendManager.updateHaveRewardMap(friend,2);
|
||||||
reward.append(SSpecialConfig.getStringValue(SSpecialConfig.Friend_Gift)).append("|");
|
reward.append(SSpecialConfig.getStringValue(SSpecialConfig.Friend_Gift)).append("|");
|
||||||
receieveFriends.add(friend);
|
receieveFriends.add(friend);
|
||||||
|
|
|
@ -499,6 +499,9 @@ public class ItemLogic {
|
||||||
MessageUtil.sendMessage(session,1,MessageTypeProto.MessageType.UP_HERO_STAR_RESPONSE_VALUE,null,true);
|
MessageUtil.sendMessage(session,1,MessageTypeProto.MessageType.UP_HERO_STAR_RESPONSE_VALUE,null,true);
|
||||||
if(especialEquip.getStar()>=SSpecialConfig.getIntegerValue(SSpecialConfig.lamp_rankup_equiptalisman_content_parm)){
|
if(especialEquip.getStar()>=SSpecialConfig.getIntegerValue(SSpecialConfig.lamp_rankup_equiptalisman_content_parm)){
|
||||||
SItem sItem = SItem.getsItemMap().get(especialEquip.getEquipId());
|
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()});
|
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);
|
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.ActivityType;
|
||||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||||
import com.ljsd.jieling.logic.activity.event.UserForceChangeEvent;
|
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.*;
|
||||||
import com.ljsd.jieling.logic.dao.root.User;
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
import com.ljsd.jieling.logic.family.GuildLogic;
|
import com.ljsd.jieling.logic.family.GuildLogic;
|
||||||
|
@ -50,7 +51,10 @@ import java.util.*;
|
||||||
|
|
||||||
public class PlayerLogic {
|
public class PlayerLogic {
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(MailLogic.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(MailLogic.class);
|
||||||
private PlayerLogic(){}
|
private PlayerLogic(){
|
||||||
|
Poster.getPoster().listenEvent(new UserForceUpEventHandler(), UserForceChangeEvent.class);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public static PlayerLogic getInstance(){
|
public static PlayerLogic getInstance(){
|
||||||
return InnerClass.instance;
|
return InnerClass.instance;
|
||||||
|
@ -269,6 +273,13 @@ public class PlayerLogic {
|
||||||
ActivityLogic.getInstance().updateActivityMissionProgress(user, ActivityType.FORCESTANDARD,teamForce);
|
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);
|
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);
|
user.getPlayerInfoManager().setRideLevel(rideLevel+1);
|
||||||
MessageUtil.sendMessage(session,1,messageType.getNumber(),null,true);
|
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){
|
public boolean check(User user, int privilageTypeId, int checkNum){
|
||||||
|
// return priviliageCheck(user,privilageTypeId,checkNum,false);
|
||||||
Map<Integer, VipInfo> vipInfo = user.getPlayerInfoManager().getVipInfo();
|
Map<Integer, VipInfo> vipInfo = user.getPlayerInfoManager().getVipInfo();
|
||||||
if(privilageTypeId == 0){
|
if(privilageTypeId == 0){
|
||||||
return true;
|
return true;
|
||||||
|
@ -811,6 +789,75 @@ public class PlayerLogic {
|
||||||
}
|
}
|
||||||
return false;
|
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){
|
private int getMaxCountByPrivilege(User user,int privilegeId){
|
||||||
SPrivilegeTypeConfig sPrivilegeTypeConfig = SPrivilegeTypeConfig.getsPrivilegeTypeConfigMap().get(privilegeId);
|
SPrivilegeTypeConfig sPrivilegeTypeConfig = SPrivilegeTypeConfig.getsPrivilegeTypeConfigMap().get(privilegeId);
|
||||||
Map<Integer, Map<Integer, Integer>> conditionMap = SPrivilegeTypeConfig.conditionMap.get(sPrivilegeTypeConfig.getUnlockType());
|
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.CommonProto;
|
||||||
import com.ljsd.jieling.protocols.PlayerInfoProto;
|
import com.ljsd.jieling.protocols.PlayerInfoProto;
|
||||||
import org.springframework.data.redis.core.ZSetOperations;
|
import org.springframework.data.redis.core.ZSetOperations;
|
||||||
|
import util.MathUtils;
|
||||||
import util.TimeUtils;
|
import util.TimeUtils;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
@ -28,30 +29,31 @@ public class MainLevelRank extends AbstractRank {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected PlayerInfoProto.RankResponse.Builder getAllUserResponse(Set<ZSetOperations.TypedTuple<String>> zsetreverseRangeWithScores, int start) throws Exception {
|
protected PlayerInfoProto.RankResponse.Builder getAllUserResponse(Set<ZSetOperations.TypedTuple<String>> zsetreverseRangeWithScores, int start) throws Exception {
|
||||||
PlayerInfoProto.RankResponse.Builder allUserResponse = super.getAllUserResponse(zsetreverseRangeWithScores, start);
|
// PlayerInfoProto.RankResponse.Builder allUserResponse = super.getAllUserResponse(zsetreverseRangeWithScores, start);
|
||||||
List<CommonProto.UserRank> ranksBuilderList = allUserResponse.getRanksList();
|
// List<CommonProto.UserRank> ranksBuilderList = allUserResponse.getRanksList();
|
||||||
if(ranksBuilderList.size()<2){
|
// if(ranksBuilderList.size()<2){
|
||||||
return allUserResponse;
|
// return allUserResponse;
|
||||||
}
|
// }
|
||||||
List<CommonProto.UserRank> builders = new ArrayList<>(ranksBuilderList);
|
// List<CommonProto.UserRank> builders = new ArrayList<>(ranksBuilderList);
|
||||||
Collections.sort(builders,(o1, o2) -> {
|
// Collections.sort(builders,(o1, o2) -> {
|
||||||
if(o1.getRankInfo().getParam1()==o2.getRankInfo().getParam1()){
|
// if(o1.getRankInfo().getParam1()==o2.getRankInfo().getParam1()){
|
||||||
if(o1.getForce()>o2.getForce() &&o1.getRankInfo().getRank()>o2.getRankInfo().getRank()){
|
// if(o1.getForce()>o2.getForce() &&o1.getRankInfo().getRank()>o2.getRankInfo().getRank()){
|
||||||
CommonProto.UserRank rankInfo1 = o1 ;
|
// CommonProto.UserRank rankInfo1 = o1 ;
|
||||||
o1 = o2;
|
// o1 = o2;
|
||||||
o2 = rankInfo1;
|
// o2 = rankInfo1;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
return o1.getRankInfo().getRank()-o2.getRankInfo().getRank();
|
// return o1.getRankInfo().getRank()-o2.getRankInfo().getRank();
|
||||||
});
|
// });
|
||||||
List<CommonProto.UserRank> buildersCopy = new ArrayList<>(ranksBuilderList.size());
|
// List<CommonProto.UserRank> buildersCopy = new ArrayList<>(ranksBuilderList.size());
|
||||||
for(CommonProto.UserRank userRank : builders){
|
// for(CommonProto.UserRank userRank : builders){
|
||||||
buildersCopy.add(userRank.toBuilder().setRankInfo(userRank.toBuilder().getRankInfo().toBuilder().setRank(start).build()).build());
|
// buildersCopy.add(userRank.toBuilder().setRankInfo(userRank.toBuilder().getRankInfo().toBuilder().setRank(start).build()).build());
|
||||||
start++;
|
// start++;
|
||||||
}
|
// }
|
||||||
PlayerInfoProto.RankResponse.Builder response = PlayerInfoProto.RankResponse.newBuilder();
|
// PlayerInfoProto.RankResponse.Builder response = PlayerInfoProto.RankResponse.newBuilder();
|
||||||
response.setMyRankInfo(allUserResponse.getMyRankInfo()).addAllRanks(buildersCopy);
|
// response.setMyRankInfo(allUserResponse.getMyRankInfo()).addAllRanks(buildersCopy);
|
||||||
return response;
|
// return response;
|
||||||
|
return super.getAllUserResponse(zsetreverseRangeWithScores,start);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -63,6 +65,6 @@ public class MainLevelRank extends AbstractRank {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getScore(double... data) {
|
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 Map<Integer, BaseHandler> handlers = new HashMap<>();
|
||||||
private static ClassLoader classLoader = GameApplication.class.getClassLoader();
|
private static ClassLoader classLoader = GameApplication.class.getClassLoader();
|
||||||
public final static int HANDLER_THREAD_NUM = 50;
|
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();
|
initContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initContext() {
|
private static void initContext() {
|
||||||
for (int i = 0; i < HANDLER_THREAD_NUM; i++) {
|
for (int i = 0; i < HANDLER_THREAD_NUM; i++) {
|
||||||
handlerThreads[i] = new HandlerLogicThread();
|
handlerThreads[i] = new HandlerLogicThread();
|
||||||
handlerThreads[i].setPriority(9);//优先级最高
|
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.UserManager;
|
||||||
import com.ljsd.jieling.logic.dao.root.User;
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
import com.ljsd.jieling.logic.family.GuildLogic;
|
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.logic.store.StoreLogic;
|
||||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||||
import com.ljsd.jieling.netty.handler.GameMessageHandler;
|
import com.ljsd.jieling.netty.handler.GameMessageHandler;
|
||||||
|
@ -224,6 +225,7 @@ public class SessionManager implements INetSession<ISession>, INetReceived<ISess
|
||||||
MessageUtil.sendHeartBeat(session);
|
MessageUtil.sendHeartBeat(session);
|
||||||
User userInMem = UserManager.getUserInMem(session.getUid());
|
User userInMem = UserManager.getUserInMem(session.getUid());
|
||||||
if(userInMem!=null){
|
if(userInMem!=null){
|
||||||
|
MissionEventDistributor.requestStart();
|
||||||
ActivityLogic.getInstance().updateActivityMissionProgress(userInMem, ActivityType.OnlineReward,0);
|
ActivityLogic.getInstance().updateActivityMissionProgress(userInMem, ActivityType.OnlineReward,0);
|
||||||
try {
|
try {
|
||||||
StoreLogic.checkStoreRefresh(userInMem,userInMem.getStoreManager().getStoreInfoMap());
|
StoreLogic.checkStoreRefresh(userInMem,userInMem.getStoreManager().getStoreInfoMap());
|
||||||
|
@ -237,6 +239,7 @@ public class SessionManager implements INetSession<ISession>, INetReceived<ISess
|
||||||
MapLogic.getInstance().endLessClear(session);
|
MapLogic.getInstance().endLessClear(session);
|
||||||
}
|
}
|
||||||
MongoUtil.getLjsdMongoTemplate().lastUpdate();
|
MongoUtil.getLjsdMongoTemplate().lastUpdate();
|
||||||
|
MissionEventDistributor.requestEnd(session,true);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("the uid={} processFlush wrong ,e={}",session.getUid(),e);
|
LOGGER.error("the uid={} processFlush wrong ,e={}",session.getUid(),e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue