Merge branch 'master' of http://60.1.1.230/backend/jieling_server
commit
4d1ae3caf3
|
@ -8,6 +8,7 @@ version '1.0.0-SNAPSHOT'
|
||||||
sourceCompatibility = 1.8
|
sourceCompatibility = 1.8
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ version '1.0.0-SNAPSHOT'
|
||||||
sourceCompatibility = 1.8
|
sourceCompatibility = 1.8
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +17,8 @@ dependencies {
|
||||||
}
|
}
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
|
baseName = 'hotfix'
|
||||||
|
version = '1.0.0'
|
||||||
manifest{
|
manifest{
|
||||||
attributes 'Manifest-Version':'1.0'
|
attributes 'Manifest-Version':'1.0'
|
||||||
attributes 'Premain-Class':'com.ljsd.jieling.hotfix.JavaAgent'
|
attributes 'Premain-Class':'com.ljsd.jieling.hotfix.JavaAgent'
|
||||||
|
|
|
@ -8,6 +8,7 @@ version '1.0.0-SNAPSHOT'
|
||||||
sourceCompatibility = 1.8
|
sourceCompatibility = 1.8
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,4 +36,21 @@ jar {
|
||||||
manifest {
|
manifest {
|
||||||
attributes 'Main-Class': 'com.ljsd.jieling.ServerlogicApplication'
|
attributes 'Main-Class': 'com.ljsd.jieling.ServerlogicApplication'
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//依赖编译,然后打包JAR
|
||||||
|
task taskJar(type:Jar, dependsOn: compileJava) {
|
||||||
|
from 'build/classes/main'
|
||||||
|
destinationDir = file('build/libs')
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除lib中的jar
|
||||||
|
task clearJars(type:Delete){
|
||||||
|
delete 'lib'
|
||||||
|
}
|
||||||
|
|
||||||
|
task copyJars(type: Copy, dependsOn:clearJars) {
|
||||||
|
from configurations.runtime
|
||||||
|
into 'lib' // 目标位置
|
||||||
}
|
}
|
|
@ -3,11 +3,12 @@ package com.ljsd.jieling.config;
|
||||||
import com.ljsd.jieling.logic.STableManager;
|
import com.ljsd.jieling.logic.STableManager;
|
||||||
import com.ljsd.jieling.logic.Table;
|
import com.ljsd.jieling.logic.Table;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Table(name = "HeroRankupConfig")
|
@Table(name = "HeroRankupConfig")
|
||||||
public class SCHeroRankUpConfig implements BaseConfig{
|
public class SCHeroRankUpConfig implements BaseConfig{
|
||||||
public static Map<Integer,SCHeroRankUpConfig> scHeroRankUpConfigMap;
|
public static Map<Integer,Map<Integer,SCHeroRankUpConfig>> scHeroRankUpConfigByType;
|
||||||
|
|
||||||
private int id;
|
private int id;
|
||||||
|
|
||||||
|
@ -23,17 +24,28 @@ public class SCHeroRankUpConfig implements BaseConfig{
|
||||||
|
|
||||||
private int openStar;
|
private int openStar;
|
||||||
|
|
||||||
private int consumeMaterial[];
|
private int consumeMaterial[][];
|
||||||
|
|
||||||
private int[] consumeCard[];
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() throws Exception {
|
public void init() throws Exception {
|
||||||
// scHeroRankUpConfigMap = STableManager.getConfig(SCHeroRankUpConfig.class);
|
Map<Integer,Map<Integer,SCHeroRankUpConfig>> result = new HashMap<>();
|
||||||
|
Map<Integer, SCHeroRankUpConfig> config = STableManager.getConfig(SCHeroRankUpConfig.class);
|
||||||
|
for(SCHeroRankUpConfig scHeroRankUpConfig: config.values()){
|
||||||
|
int type = scHeroRankUpConfig.getType();
|
||||||
|
if(!result.containsKey(type)){
|
||||||
|
result.put(type,new HashMap<>());
|
||||||
|
}
|
||||||
|
if(type == 1){
|
||||||
|
result.get(type).put(scHeroRankUpConfig.getLimitLevel(),scHeroRankUpConfig);
|
||||||
|
}else{
|
||||||
|
result.get(type).put(scHeroRankUpConfig.getLimitStar(),scHeroRankUpConfig);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
scHeroRankUpConfigByType = result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Map<Integer, SCHeroRankUpConfig> getScHeroRankUpConfigMap() {
|
public static Map<Integer, SCHeroRankUpConfig> getScHeroRankUpConfigByType(int type) {
|
||||||
return scHeroRankUpConfigMap;
|
return scHeroRankUpConfigByType.get(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
|
@ -64,11 +76,7 @@ public class SCHeroRankUpConfig implements BaseConfig{
|
||||||
return openStar;
|
return openStar;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int[] getConsumeMaterial() {
|
public int[][] getConsumeMaterial() {
|
||||||
return consumeMaterial;
|
return consumeMaterial;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int[][] getConsumeCard() {
|
|
||||||
return consumeCard;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -256,6 +256,13 @@ public class ProtocolsManager implements ProtocolsAbstract {
|
||||||
private int checkAndRefresh(ISession session, PacketNetData packetNetData) {
|
private int checkAndRefresh(ISession session, PacketNetData packetNetData) {
|
||||||
int myToken = 0;
|
int myToken = 0;
|
||||||
if (packetNetData.getMsgId()== MessageTypeProto.MessageType.LOGIN_REQUEST_VALUE){
|
if (packetNetData.getMsgId()== MessageTypeProto.MessageType.LOGIN_REQUEST_VALUE){
|
||||||
|
|
||||||
|
if (OnlineUserManager.checkUidOnline(session.getUid())){
|
||||||
|
ISession iSession = OnlineUserManager.getSessionByUid(session.getUid());
|
||||||
|
MessageUtil.sendErrorCode(session, ErrorCode.reloginCode);
|
||||||
|
OnlineUserManager.userOffline(iSession.getUid());
|
||||||
|
iSession.close();
|
||||||
|
}
|
||||||
OnlineUserManager.userOnline(session.getUid(),session);
|
OnlineUserManager.userOnline(session.getUid(),session);
|
||||||
|
|
||||||
//TODO 更新token
|
//TODO 更新token
|
||||||
|
@ -266,12 +273,6 @@ public class ProtocolsManager implements ProtocolsAbstract {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OnlineUserManager.checkUidOnline(session.getUid())){
|
|
||||||
ISession iSession = OnlineUserManager.getSessionByUid(session.getUid());
|
|
||||||
MessageUtil.sendErrorCode(session, ErrorCode.reloginCode);
|
|
||||||
iSession.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
// if (myToken != packetNetData.getToken()){
|
// if (myToken != packetNetData.getToken()){
|
||||||
// return 1;
|
// return 1;
|
||||||
// }
|
// }
|
||||||
|
|
|
@ -1,14 +1,18 @@
|
||||||
package com.ljsd.jieling.util;
|
package com.ljsd.jieling.util;
|
||||||
|
|
||||||
import com.google.protobuf.GeneratedMessage;
|
import com.google.protobuf.GeneratedMessage;
|
||||||
|
import com.ljsd.jieling.db.redis.RedisKey;
|
||||||
import com.ljsd.jieling.logic.dao.UserManager;
|
import com.ljsd.jieling.logic.dao.UserManager;
|
||||||
import com.ljsd.jieling.netty.PackageConstant;
|
import com.ljsd.jieling.netty.PackageConstant;
|
||||||
import com.ljsd.jieling.netty.cocdex.Tea;
|
import com.ljsd.jieling.netty.cocdex.Tea;
|
||||||
import com.ljsd.jieling.network.session.ISession;
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
|
import com.ljsd.jieling.protocols.CommonProto;
|
||||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.util.Base64;
|
||||||
|
|
||||||
public class MessageUtil {
|
public class MessageUtil {
|
||||||
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(MessageUtil.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(MessageUtil.class);
|
||||||
|
@ -79,11 +83,16 @@ public class MessageUtil {
|
||||||
session.writeAndFlush(byteBuf);
|
session.writeAndFlush(byteBuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
// public static void sendErrorResponse(Msg msg, GeneratedMessage error_message, int msgId) throws Exception {
|
public static void sendErrorResponse(ISession session,int errorCode,int msgId,String errMsg) throws Exception {
|
||||||
// String protoEntity = Base64.getEncoder().encodeToString(error_message.toByteArray());
|
GeneratedMessage generatedMessage = null;
|
||||||
// BaseGlobal.redisApp.hset(RedisKey.RESPONSE, String.valueOf(msg.getUid()), String.valueOf(Math.abs(msg.getIndex())), new ProtoEntity(msgId, protoEntity), -1);
|
if(errorCode!=1 && !StringUtil.isEmpty(errMsg)){
|
||||||
// sendMessage(msg.getSession(), msg.getUid(), msg.getIndex(), 1, msgId, error_message, true);
|
generatedMessage = CommonProto.ErrorResponse.newBuilder().setErrCode(errorCode).setErrMsg(errMsg).build();
|
||||||
// }
|
}
|
||||||
|
byte[] byteBuf = wrappedBuffer(session.getUid(), session.getToken(), session.getIndex(),
|
||||||
|
errorCode,msgId, generatedMessage);
|
||||||
|
session.writeAndFlush(byteBuf);
|
||||||
|
|
||||||
|
}
|
||||||
//
|
//
|
||||||
// public static void sendResponse(Msg msg, int msgId, GeneratedMessage generatedMessage) throws Exception {
|
// public static void sendResponse(Msg msg, int msgId, GeneratedMessage generatedMessage) throws Exception {
|
||||||
// String protoEntity = Base64.getEncoder().encodeToString(generatedMessage.toByteArray());
|
// String protoEntity = Base64.getEncoder().encodeToString(generatedMessage.toByteArray());
|
||||||
|
|
Loading…
Reference in New Issue