Merge branch 'master' of http://60.1.1.230/backend/jieling_server
# Conflicts: # serverlogic/src/main/java/com/ljsd/jieling/config/SCMapConfig.java # serverlogic/src/main/java/com/ljsd/jieling/config/SCMapEventsConfig.javaback_recharge
commit
3a77b42b50
|
@ -0,0 +1,24 @@
|
|||
id Event Groups
|
||||
int int mut,int#int,2
|
||||
1 101005 9#14|10#14|9#15|10#15
|
||||
2 101001 5#8|6#8|5#9|6#9
|
||||
3 101005 8#11|9#11|8#12|9#12
|
||||
4 101005 7#19|8#19|8#20
|
||||
5 101010 8#9
|
||||
6 101008 10#11
|
||||
7 101009 2#18
|
||||
8 101004 10#5|10#6
|
||||
9 101005 1#7|2#7|1#8|2#8
|
||||
10 101005 2#14|3#14|2#15|3#15
|
||||
11 101006 8#3
|
||||
12 101007 5#5
|
||||
13 101001 3#16|4#16|3#17|4#17
|
||||
14 101011 7#16
|
||||
15 101001 6#2|5#3|6#3
|
||||
16 101001 8#4|9#4|8#5|7#6|7#7
|
||||
17 101012 3#5|4#5|3#6|4#6
|
||||
18 101005 4#19|3#20
|
||||
19 101001 4#11|4#12
|
||||
20 101002 1#12|2#12|1#13|2#13|5#18|6#18|6#19
|
||||
21 101001 6#14|6#15
|
||||
22 101003 4#4
|
|
@ -0,0 +1,58 @@
|
|||
Id PiecesId PiecesCount Quality Profession ProfessionResourceId PropertyName Hp Attack PhysicalDefence MagicDefence Speed SkillId RankupConsumeMaterial
|
||||
int int int int int int int float float float float float mut,int#int,2 mut,int#int,2
|
||||
1 2001 0 0 0 1203 1 2389 164 278 0 176 10100#10|10101#20 null
|
||||
2 2002 0 0 0 1202 1 2277 155 260 0 158 10100#10|10101#20 null
|
||||
3 2003 0 0 0 1202 1 2275 159 263 0 172 10100#10|10101#20 null
|
||||
4 2004 0 0 0 1201 1 2269 183 0 277 132 10100#10|10101#20 null
|
||||
5 2005 0 0 0 1203 1 2163 173 0 258 176 10100#10|10101#20 null
|
||||
6 2006 0 0 0 1202 1 2165 174 0 261 176 10100#10|10101#20 null
|
||||
7 2007 0 0 0 1201 2 2159 169 0 262 176 10100#10|10101#20 null
|
||||
8 2008 0 0 0 1202 2 2020 206 0 222 132 10100#10|10101#20 null
|
||||
9 2009 0 0 0 1203 2 1923 198 0 212 163 10100#10|10101#20 null
|
||||
10 2010 0 0 0 1201 2 1925 200 0 208 132 10100#10|10101#20 null
|
||||
11 2011 0 0 0 1201 2 1925 199 0 203 150 10100#10|10101#20 null
|
||||
12 2012 0 0 0 1202 2 1763 251 201 0 150 10100#10|10101#20 null
|
||||
13 2013 0 0 0 1202 3 1675 239 194 0 163 10100#10|10101#20 null
|
||||
14 2014 0 0 0 1201 3 1684 235 197 0 185 10100#10|10101#20 null
|
||||
15 2015 0 0 0 1203 3 1680 237 193 0 176 10100#10|10101#20 null
|
||||
16 2016 0 0 0 1202 3 1513 293 167 0 154 10100#10|10101#20 null
|
||||
17 2017 0 0 0 1201 3 1439 278 159 0 154 10100#10|10101#20 null
|
||||
18 2018 0 0 0 1201 3 1439 278 159 0 154 10100#10|10101#20 null
|
||||
19 2019 0 0 0 1201 4 1444 281 153 0 154 10100#10|10101#20 null
|
||||
20 2020 0 0 0 1202 4 2277 159 261 0 154 10100#10|10101#20 null
|
||||
21 2021 0 0 0 1201 4 1936 131 225 0 176 10100#10|10101#20 null
|
||||
22 2022 0 0 0 1203 4 1637 168 0 178 163 10100#10|10101#20 null
|
||||
23 2023 0 0 0 1201 4 1431 200 162 0 194 10100#10|10101#20 null
|
||||
24 2024 0 0 0 1202 4 1220 239 133 0 154 10100#10|10101#20 null
|
||||
25 2025 0 0 0 1203 4 1832 143 0 222 176 10100#10|10101#20 null
|
||||
26 2026 0 0 0 1201 4 1934 136 226 0 176 10100#10|10101#20 null
|
||||
27 2027 0 0 0 1201 4 1628 173 0 175 163 10100#10|10101#20 null
|
||||
28 2028 0 0 0 1201 4 1428 209 165 0 194 10100#10|10101#20 null
|
||||
29 1000 0 0 0 1201 4 1222 235 132 0 154 10100#10|10101#20 null
|
||||
30 1000 0 0 0 1201 4 1834 149 0 224 176 10100#10|10101#20 null
|
||||
31 1000 0 0 0 1201 4 1940 131 220 0 176 10100#10|10101#20 null
|
||||
32 1000 0 0 0 1201 4 1632 165 0 177 163 10100#10|10101#20 null
|
||||
33 1000 0 0 0 1201 4 1429 205 164 0 194 10100#10|10101#20 null
|
||||
34 1000 0 0 0 1201 4 1221 242 135 0 154 10100#10|10101#20 null
|
||||
35 1000 0 0 0 1201 4 1834 147 0 225 176 10100#10|10101#20 null
|
||||
36 1000 0 0 0 1201 4 1934 136 217 0 176 10100#10|10101#20 null
|
||||
37 1000 0 0 0 1201 4 1637 170 0 179 163 10100#10|10101#20 null
|
||||
38 1000 0 0 0 1201 4 1427 201 170 0 194 10100#10|10101#20 null
|
||||
39 1000 0 0 0 1201 4 1300 235 129 0 154 10100#10|10101#20 null
|
||||
40 1000 0 0 0 1201 4 1948 147 0 219 176 10100#10|10101#20 null
|
||||
41 1000 0 0 0 1201 4 1938 135 224 0 176 10100#10|10101#20 null
|
||||
42 1000 0 0 0 1201 4 1636 174 0 179 163 10100#10|10101#20 null
|
||||
43 1000 0 0 0 1201 4 1943 132 217 0 176 10100#10|10101#20 null
|
||||
44 1000 0 0 0 1201 4 1627 166 0 181 163 10100#10|10101#20 null
|
||||
45 1000 0 0 0 1202 4 1433 209 166 0 194 10100#10|10101#20 null
|
||||
46 1000 0 0 0 1201 4 1228 241 131 0 154 10100#10|10101#20 null
|
||||
47 1000 0 0 0 1201 4 1836 146 0 226 176 10100#10|10101#20 null
|
||||
48 1000 0 0 0 1201 4 1939 141 223 0 176 10100#10|10101#20 null
|
||||
49 1000 0 0 0 1201 4 1635 175 0 173 163 10100#10|10101#20 null
|
||||
50 1000 0 0 0 1201 4 1424 208 166 0 194 10100#10|10101#20 null
|
||||
51 1000 0 0 0 1201 4 1222 234 132 0 154 10100#10|10101#20 null
|
||||
52 1000 0 0 0 1201 4 1834 140 0 220 176 10100#10|10101#20 null
|
||||
53 1000 0 0 0 1201 4 1943 135 219 0 176 10100#10|10101#20 null
|
||||
54 1000 0 0 0 1201 4 1630 169 0 176 163 10100#10|10101#20 null
|
||||
55 1000 0 0 0 1201 4 1508 205 163 0 194 10100#10|10101#20 null
|
||||
56 1000 0 0 0 1201 4 1297 242 137 0 154 10100#10|10101#20 null
|
|
@ -0,0 +1,6 @@
|
|||
Id BackpackOrNot ItemType ItemBaseType Quantity IsStacking
|
||||
int bool int int int bool
|
||||
1 false 1 1 5 false
|
||||
2 true 1 1 5 false
|
||||
3 true 1 1 5 false
|
||||
4 false 1 1 5 false
|
|
@ -0,0 +1,12 @@
|
|||
Id Info Size MoveConfused EnergyConfused OpenRule
|
||||
int string mut,int#int,1 int int string
|
||||
101 战乱荒林 20#10 1 10 null
|
||||
102 林渊深处 20#10 2 10 null
|
||||
103 三途津 20#15 2 20 null
|
||||
104 青龙门 15#20 2 20 null
|
||||
105 风见原野 20#20 2 20 null
|
||||
106 荒芜丘陵 20#10 2 20 null
|
||||
107 观澜港 20#15 2 20 null
|
||||
108 白叶渡 20#20 2 20 null
|
||||
109 荆棘流域 30#30 2 20 null
|
||||
110 中心枢纽 20#10 2 20 null
|
|
@ -0,0 +1,28 @@
|
|||
Id Style Refresh TriggerRules IsSchedule ExploreValues
|
||||
int int int int bool int
|
||||
101001 1 2 1 0 0
|
||||
101002 2 2 1 0 0
|
||||
101003 4 2 1 0 0
|
||||
101004 1 2 1 0 0
|
||||
101005 1 2 1 0 0
|
||||
101006 5 3 1 0 0
|
||||
101007 5 4 1 0 0
|
||||
101008 5 2 1 0 0
|
||||
101009 5 3 1 0 0
|
||||
101010 5 2 1 0 0
|
||||
101011 5 2 1 0 0
|
||||
101012 3 2 1 0 0
|
||||
102001 1 2 1 0 0
|
||||
102002 1 2 1 0 0
|
||||
102003 1 2 1 0 0
|
||||
102004 1 2 1 0 0
|
||||
102005 5 3 1 0 0
|
||||
102006 5 3 1 0 0
|
||||
102007 5 3 1 0 0
|
||||
102008 5 3 1 0 0
|
||||
102009 5 3 1 0 0
|
||||
102010 2 1 1 0 0
|
||||
102011 2 2 1 0 0
|
||||
102012 2 2 1 0 0
|
||||
102013 2 1 1 0 0
|
||||
102014 2 2 1 0 0
|
Binary file not shown.
|
@ -56,9 +56,10 @@ public class GameMessageHandler<T extends GameSession> extends SimpleChannelInbo
|
|||
super.channelInactive(ctx);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||
LOGGER.info("111111111111");
|
||||
LOGGER.info("receive msg ...");
|
||||
protocols.processMessage(this.session, msg);
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@ repositories {
|
|||
|
||||
dependencies {
|
||||
testCompile group: 'junit', name: 'junit', version: '4.12'
|
||||
|
||||
compile project(":netty")
|
||||
compile project(":hotfix")
|
||||
compile project(":common")
|
||||
|
@ -28,7 +27,6 @@ dependencies {
|
|||
compile("com.google.protobuf:protobuf-java:2.5.0")
|
||||
compile("com.fasterxml.jackson.core:jackson-core:2.3.1")
|
||||
compile("com.fasterxml.jackson.core:jackson-databind:2.3.3")
|
||||
compile("org.apache.poi:poi-ooxml:3.12")
|
||||
compile files("${System.properties['java.home']}/../lib/tools.jar")
|
||||
}
|
||||
|
||||
|
|
|
@ -1,67 +0,0 @@
|
|||
#server info
|
||||
server.id = 10180
|
||||
server.openTime = 20190101000101
|
||||
|
||||
|
||||
# redis config
|
||||
# Redis数据库索引(默认为0)
|
||||
spring.redis.database=0
|
||||
# Redis服务器地址
|
||||
spring.redis.host=60.1.1.14
|
||||
# Redis服务器连接端口
|
||||
spring.redis.port=6379
|
||||
# Redis服务器连接密码(默认为空)
|
||||
spring.redis.password=
|
||||
# 连接池最大连接数(使用负值表示没有限制)
|
||||
spring.redis.pool.max-active=8
|
||||
# 连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
spring.redis.pool.max-wait=-1
|
||||
# 连接池中的最大空闲连接
|
||||
spring.redis.pool.max-idle=8
|
||||
# 连接池中的最小空闲连接
|
||||
spring.redis.pool.min-idle=0
|
||||
# 连接超时时间(毫秒)
|
||||
spring.redis.timeout=0
|
||||
|
||||
spring.redis.expireTime = -1
|
||||
|
||||
|
||||
#spring.data.mongodb.uri = mongodb://mongouser:ysj#2017#ljsd@111.231.54.96:27017/ysj_wx_1
|
||||
#spring.data.mongodb2.uri = mongodb://mongouser:ysj#2017#ljsd@111.231.54.96:27017/develop_ysj_wx_1
|
||||
#mongodb2 develop
|
||||
spring.data.mongodb.uri = mongodb://60.1.1.14:27017/ysj_msy
|
||||
mongodb.options.maxWaitTime = 120000
|
||||
mongodb.options.connectTimeout = 1000
|
||||
mongodb.options.socketTimeout = 0
|
||||
mongodb.options.threadsAllowedToBlockForConnectionMultiplier = 20
|
||||
mongodb.options.connectionsPerHost = 256
|
||||
mongodb.options.minConnectionsPerHost = 5
|
||||
mongodb.options.maxConnectionIdleTime = 1000
|
||||
|
||||
|
||||
# netty config
|
||||
netty.tcpPort = 18090
|
||||
netty.chatTcpPort = 20001
|
||||
netty.logintcpPort = 18091
|
||||
netty.udpPort = 18092
|
||||
netty.udpTargetIp=127.0.0.1
|
||||
netty.udpTargetPort=10001
|
||||
netty.reconnectDelay=3000
|
||||
netty.bossThreadCount=1
|
||||
netty.workerThreadCount=10
|
||||
netty.readTimeout=32
|
||||
netty.writeTimeout=32
|
||||
netty.allTimeout=35
|
||||
|
||||
|
||||
#core
|
||||
services.core.ip=60.1.1.180
|
||||
services.core.port=7900
|
||||
services.core.area=1000
|
||||
services.core.id=1
|
||||
services.core.weight=5
|
||||
|
||||
#arena service
|
||||
services.fight.key=key_dir_checkserver_Hash
|
||||
|
||||
logging.config = conf/logback-boot.xml
|
|
@ -5,6 +5,7 @@ import com.ljsd.jieling.config.json.ServerProperties;
|
|||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.STableManager;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.netty.server.NettyGameServer;
|
||||
import com.ljsd.jieling.network.NettyProperties;
|
||||
import com.ljsd.jieling.network.NettyServerAutoConfiguration;
|
||||
|
@ -63,6 +64,8 @@ public class GameApplication {
|
|||
|
||||
STableManager.initialize("com.ljsd.jieling.config");
|
||||
|
||||
UserManager.init(configurableApplicationContext);
|
||||
|
||||
ThreadManager threadManager = new ThreadManager();
|
||||
threadManager.init(configurableApplicationContext);
|
||||
|
||||
|
|
|
@ -0,0 +1,96 @@
|
|||
package com.ljsd.jieling.config;
|
||||
|
||||
import com.ljsd.jieling.logic.STableManager;
|
||||
import com.ljsd.jieling.logic.Table;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name = "HeroConfig")
|
||||
public class SCHero implements BaseConfig{
|
||||
|
||||
public static Map<Integer, SCHero> sCHero;
|
||||
|
||||
private int id;
|
||||
|
||||
private int piecesId;
|
||||
|
||||
private int piecesCount;
|
||||
|
||||
private int quality;
|
||||
|
||||
private int profession;
|
||||
|
||||
private int maxRank;
|
||||
|
||||
private float hp;
|
||||
|
||||
private float attack;
|
||||
|
||||
private float pDefence;
|
||||
|
||||
private float mDefence;
|
||||
|
||||
private float speed;
|
||||
|
||||
private String skillList;
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
sCHero = STableManager.getConfig(SCHero.class);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static Map<Integer, SCHero> getsCHero() {
|
||||
return sCHero;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getPiecesId() {
|
||||
return piecesId;
|
||||
}
|
||||
|
||||
public int getPiecesCount() {
|
||||
return piecesCount;
|
||||
}
|
||||
|
||||
public int getQuality() {
|
||||
return quality;
|
||||
}
|
||||
|
||||
public int getProfession() {
|
||||
return profession;
|
||||
}
|
||||
|
||||
public int getMaxRank() {
|
||||
return maxRank;
|
||||
}
|
||||
|
||||
public float getHp() {
|
||||
return hp;
|
||||
}
|
||||
|
||||
public float getAttack() {
|
||||
return attack;
|
||||
}
|
||||
|
||||
public float getpDefence() {
|
||||
return pDefence;
|
||||
}
|
||||
|
||||
public float getmDefence() {
|
||||
return mDefence;
|
||||
}
|
||||
|
||||
public float getSpeed() {
|
||||
return speed;
|
||||
}
|
||||
|
||||
public String getSkillList() {
|
||||
return skillList;
|
||||
}
|
||||
}
|
|
@ -12,9 +12,9 @@ public class SCMapConfig implements BaseConfig {
|
|||
private int id;
|
||||
private String info;
|
||||
private int[] size; // 0:行 1列
|
||||
private int moveConfused; //地图消耗
|
||||
private String openRule; // 开启条件
|
||||
private int energyConfused;
|
||||
private int moveConfused; //地图上的行动力消耗
|
||||
private int energyConfused; //妖灵师精力消耗
|
||||
private String openRule; //开启条件
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
sCMapSize = STableManager.getConfig(SCMapConfig.class);
|
||||
|
@ -28,6 +28,10 @@ public class SCMapConfig implements BaseConfig {
|
|||
return info;
|
||||
}
|
||||
|
||||
public static Map<Integer, SCMapConfig> getsCMapSize() {
|
||||
return sCMapSize;
|
||||
}
|
||||
|
||||
public int[] getSize() {
|
||||
return size;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ import java.util.Map;
|
|||
public class SCMapEventsConfig implements BaseConfig{
|
||||
|
||||
public static Map<Integer, SCMapEventsConfig> scMapEventMap;
|
||||
|
||||
/**
|
||||
* 大事件id
|
||||
*/
|
||||
|
@ -26,9 +25,20 @@ public class SCMapEventsConfig implements BaseConfig{
|
|||
* 3一次性
|
||||
*/
|
||||
private int refresh;
|
||||
private int triggerRules;
|
||||
private boolean isSchedule;
|
||||
|
||||
/**
|
||||
* 事件点触发规则
|
||||
* 1边缘触发
|
||||
* 2覆盖触发
|
||||
*/
|
||||
private int triggerRules;
|
||||
/**
|
||||
* 是否记录进度
|
||||
*/
|
||||
private boolean isSchedule;
|
||||
/**
|
||||
* 探索值
|
||||
*/
|
||||
private int exploreValues;
|
||||
|
||||
@Override
|
||||
|
@ -48,6 +58,10 @@ public class SCMapEventsConfig implements BaseConfig{
|
|||
return refresh;
|
||||
}
|
||||
|
||||
public static Map<Integer, SCMapEventsConfig> getScMapEventMap() {
|
||||
return scMapEventMap;
|
||||
}
|
||||
|
||||
public int getTriggerRules() {
|
||||
return triggerRules;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
package com.ljsd.jieling.config;
|
||||
|
||||
|
||||
import com.ljsd.jieling.logic.STableManager;
|
||||
import com.ljsd.jieling.logic.Table;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name = "ItemConfig")
|
||||
public class SItem implements BaseConfig {
|
||||
public static Map<Integer, SItem> sItemMap;
|
||||
private int id;
|
||||
private boolean backpackOrNot; //是否进背包
|
||||
private int itemType;
|
||||
private int itemBaseType; //道具类型(该道具在哪个背包显示)
|
||||
private int quantity;
|
||||
private boolean isStacking;
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
sItemMap = STableManager.getConfig(SItem.class);
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public static Map<Integer, SItem> getsItemMap() {
|
||||
return sItemMap;
|
||||
}
|
||||
|
||||
public boolean isBackpackOrNot() {
|
||||
return backpackOrNot;
|
||||
}
|
||||
|
||||
public int getItemType() {
|
||||
return itemType;
|
||||
}
|
||||
|
||||
public int getItemBaseType() {
|
||||
return itemBaseType;
|
||||
}
|
||||
|
||||
public int getQuantity() {
|
||||
return quantity;
|
||||
}
|
||||
|
||||
public boolean isStacking() {
|
||||
return isStacking;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package com.ljsd.jieling.globals;
|
||||
|
||||
public interface GlobalGm {
|
||||
int ADD_ITEM = 0;//添加道具
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
package com.ljsd.jieling.handler.GameGM;
|
||||
|
||||
import com.ljsd.jieling.globals.GlobalGm;
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.dao.Item;
|
||||
import com.ljsd.jieling.logic.dao.ItemManager;
|
||||
import com.ljsd.jieling.logic.dao.User;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.GMCommandProto;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
@Component
|
||||
public class GMRequestHandler extends BaseHandler{
|
||||
private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(GMRequestHandler.class);
|
||||
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.GM_COMMAND;
|
||||
}
|
||||
@Override
|
||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
byte[] message = netData.parseClientProtoNetData();
|
||||
GMCommandProto.GMCommand gmCommand = GMCommandProto.GMCommand.parseFrom(message);
|
||||
String command = gmCommand.getCommand();
|
||||
if (!command.contains("#") || command.split("#").length < 3) {
|
||||
LOGGER.error("wrong command :" + command);
|
||||
return;
|
||||
}
|
||||
String[] commandArray = command.split("#");
|
||||
int uid = Integer.parseInt(commandArray[0]);
|
||||
int gmCommandType = Integer.parseInt(commandArray[1]);// type 0:添加道具
|
||||
int prarm1 = 0, prarm2 = 0;
|
||||
User cUser = UserManager.getUser(uid);
|
||||
switch (gmCommandType){
|
||||
case GlobalGm.ADD_ITEM:
|
||||
giveItem(cUser,prarm1,prarm2);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void giveItem(User cUser,int itemId,int itemNum) throws Exception {
|
||||
Map<Integer,Integer> itemMap = new ConcurrentHashMap<>();
|
||||
itemMap.put(itemId,itemNum);
|
||||
ItemUtil.addItem(cUser,itemMap);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package com.ljsd.jieling.handler;
|
||||
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import com.ljsd.jieling.protocols.PlayerInfoProto;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class GetAllItemHandler extends BaseHandler {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(GetAllItemHandler.class);
|
||||
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.GET_ITEMINFO_REQUEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
int userId = netData.getUserId();
|
||||
int token = netData.getToken();
|
||||
int msgId = netData.getMsgId();
|
||||
int msgIndex = netData.getIndex();
|
||||
PlayerInfoProto.PlayerInfo.GetItemInfoRequest getItemInfoRequest
|
||||
= PlayerInfoProto.PlayerInfo.GetItemInfoRequest.parseFrom(netData.parseClientProtoNetData());
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
package com.ljsd.jieling.handler;
|
||||
|
||||
import com.ljsd.jieling.logic.dao.User;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.CommonProto;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import com.ljsd.jieling.protocols.PlayerInfoProto;
|
||||
import com.ljsd.jieling.util.CBean2Proto;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class GetPlayerInfoHandler extends BaseHandler{
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(GetPlayerInfoHandler.class);
|
||||
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.GET_PLAYERINFO_REQUEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
|
||||
int userId = netData.getUserId();
|
||||
int token = netData.getToken();
|
||||
int msgId = netData.getMsgId();
|
||||
int msgIndex = netData.getIndex();
|
||||
PlayerInfoProto.PlayerInfo.GetPlayerInfoRequest getPlayerInfoRequest
|
||||
= PlayerInfoProto.PlayerInfo.GetPlayerInfoRequest.parseFrom(netData.parseClientProtoNetData());
|
||||
|
||||
LOGGER.info("processMessage->uid={},token={},msgId={},msgIndex={},messageNum={},messageStr={}",
|
||||
userId, token,msgId,msgIndex,getPlayerInfoRequest.getNum(),getPlayerInfoRequest.getStr());
|
||||
|
||||
User user = UserManager.getUserForLogin(userId);
|
||||
|
||||
CommonProto.Common.Player player = CBean2Proto.getPlayer(userId, user.getPlayerInfoManager());
|
||||
|
||||
PlayerInfoProto.PlayerInfo.GetPlayerInfoResponse getPlayerInfoResponse
|
||||
= PlayerInfoProto.PlayerInfo.GetPlayerInfoResponse.newBuilder()
|
||||
.setPlayer(player)
|
||||
.build();
|
||||
try {
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GET_PLAYERINFO_RESPONSE_VALUE, getPlayerInfoResponse, true);
|
||||
LOGGER.info("back to client!");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -32,30 +32,18 @@ public class LoginRequestHandler extends BaseHandler {
|
|||
byte[] message = netData.parseClientProtoNetData();
|
||||
PlayerInfoProto.PlayerInfo.GetPlayerInfoRequest getPlayerInfoRequest
|
||||
= PlayerInfoProto.PlayerInfo.GetPlayerInfoRequest.parseFrom(message);
|
||||
|
||||
LOGGER.info("processMessage->uid={},token={},msgId={},msgIndex={},messageNum={},messageStr={}",
|
||||
userId, token,msgId,msgIndex,getPlayerInfoRequest.getNum(),getPlayerInfoRequest.getStr());
|
||||
//TODO
|
||||
User userForLogin = UserManager.getUserForLogin(userId);
|
||||
|
||||
CommonProto.Common.Player player = CommonProto.Common.Player
|
||||
.newBuilder()
|
||||
.setUid(userId)
|
||||
.setNicknime("戒灵666")
|
||||
.setExp(1000)
|
||||
.setVipLevel(1)
|
||||
.setFamilyId("abc")
|
||||
.setHead("head_image_1")
|
||||
.setGold(100002)
|
||||
.setGem(8888)
|
||||
.setChargeGem(1000)
|
||||
.build();
|
||||
|
||||
PlayerInfoProto.PlayerInfo.GetPlayerInfoResponse getPlayerInfoResponse
|
||||
= PlayerInfoProto.PlayerInfo.GetPlayerInfoResponse.newBuilder()
|
||||
.setPlayer(player)
|
||||
PlayerInfoProto.PlayerInfo.LoginResponse loginResponse
|
||||
= PlayerInfoProto.PlayerInfo.LoginResponse.newBuilder()
|
||||
.setResultCode(0)
|
||||
.setNewToken("123456")
|
||||
.build();
|
||||
try {
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.LOGIN_RESPONSE_VALUE, getPlayerInfoResponse, true);
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.LOGIN_RESPONSE_VALUE, loginResponse, true);
|
||||
LOGGER.info("back to client!");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
|
|
@ -11,7 +11,7 @@ public class OnlineUserManager {
|
|||
public static Map<Integer, Integer> onlineUidMap = new ConcurrentHashMap<>();
|
||||
public static Map<Integer, ISession> sessionMap = new ConcurrentHashMap<>();
|
||||
|
||||
public static Map<Integer, PlayerInfoManager> onlineUserMap = new ConcurrentHashMap<>(10000);
|
||||
public static Map<Integer, PlayerManager> onlineUserMap = new ConcurrentHashMap<>(10000);
|
||||
|
||||
|
||||
public static void registUser(int uid, int serverId, ISession session) {
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
package com.ljsd.jieling.logic.dao;
|
||||
|
||||
import com.ljsd.common.mogodb.MongoBase;
|
||||
|
||||
public class Equip extends MongoBase {
|
||||
|
||||
private String id;
|
||||
|
||||
private int equipId;
|
||||
|
||||
private int level;
|
||||
|
||||
private int star;
|
||||
|
||||
public int getEquipId() {
|
||||
return equipId;
|
||||
}
|
||||
|
||||
public void setEquipId(int equipId) throws Exception {
|
||||
updateString("equipId",equipId);
|
||||
this.equipId = equipId;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public void setLevel(int level) throws Exception {
|
||||
updateString("level",level);
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public int getStar() {
|
||||
return star;
|
||||
}
|
||||
|
||||
public void setStar(int star) throws Exception {
|
||||
updateString("star",star);
|
||||
this.star = star;
|
||||
}
|
||||
}
|
|
@ -1,6 +1,9 @@
|
|||
package com.ljsd.jieling.logic.dao;
|
||||
|
||||
import com.ljsd.common.mogodb.MongoBase;
|
||||
import com.ljsd.jieling.protocols.CommonProto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Hero extends MongoBase {
|
||||
private String id;
|
||||
|
@ -25,9 +28,11 @@ public class Hero extends MongoBase {
|
|||
|
||||
private int speed;
|
||||
|
||||
private List<Skill> skillList;
|
||||
|
||||
public void setId(String id) throws Exception {
|
||||
updateString("id",id);
|
||||
private List<Equip> quipList;
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,35 +3,76 @@ package com.ljsd.jieling.logic.dao;
|
|||
import com.ljsd.common.mogodb.MongoBase;
|
||||
|
||||
public class Item extends MongoBase {
|
||||
private int templateId;
|
||||
private int overlap;
|
||||
private long haveTime;
|
||||
|
||||
private String id;
|
||||
|
||||
public void setTemplateId(int templateId) throws Exception {
|
||||
updateString("templateId",templateId);
|
||||
this.templateId = templateId;
|
||||
private int itemId;
|
||||
|
||||
private int itemNum;
|
||||
|
||||
private int itemType;
|
||||
|
||||
private int itemQuality;
|
||||
|
||||
private boolean isStacking;
|
||||
|
||||
private int endingTime;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setOverlap(int overlap) throws Exception {
|
||||
updateString("overlap",overlap);
|
||||
this.overlap = overlap;
|
||||
public int getItemId() {
|
||||
return itemId;
|
||||
}
|
||||
|
||||
public void setHaveTime(long haveTime) throws Exception {
|
||||
updateString("haveTime",haveTime);
|
||||
this.haveTime = haveTime;
|
||||
public void setItemId(int itemId) throws Exception {
|
||||
updateString("itemId", itemId);
|
||||
this.itemId = itemId;
|
||||
}
|
||||
|
||||
public int getTemplateId() {
|
||||
return templateId;
|
||||
public int getItemNum() {
|
||||
return itemNum;
|
||||
}
|
||||
|
||||
public int getOverlap() {
|
||||
return overlap;
|
||||
public void setItemNum(int itemNum) throws Exception {
|
||||
updateString("itemNum", itemNum);
|
||||
this.itemNum = itemNum;
|
||||
}
|
||||
|
||||
public long getHaveTime() {
|
||||
return haveTime;
|
||||
public int getItemType() {
|
||||
return itemType;
|
||||
}
|
||||
|
||||
public void setItemType(int itemType) throws Exception {
|
||||
updateString("itemType", itemType);
|
||||
this.itemType = itemType;
|
||||
}
|
||||
|
||||
public int getItemQuality() {
|
||||
return itemQuality;
|
||||
}
|
||||
|
||||
public void setItemQuality(int itemQuality) throws Exception {
|
||||
updateString("itemQuality", itemQuality);
|
||||
this.itemQuality = itemQuality;
|
||||
}
|
||||
|
||||
public boolean isStacking() {
|
||||
return isStacking;
|
||||
}
|
||||
|
||||
public void setStacking(boolean stacking) throws Exception {
|
||||
updateString("stacking", stacking);
|
||||
isStacking = stacking;
|
||||
}
|
||||
|
||||
public int getEndingTime() {
|
||||
return endingTime;
|
||||
}
|
||||
|
||||
public void setEndingTime(int endingTime) throws Exception {
|
||||
updateString("endingTime", endingTime);
|
||||
this.endingTime = endingTime;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.ljsd.jieling.logic.dao;
|
||||
|
||||
import com.ljsd.common.mogodb.MongoBase;
|
||||
import com.ljsd.jieling.config.SItem;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
@ -20,10 +21,10 @@ public class ItemManager extends MongoBase {
|
|||
this.itemMap = itemMap;
|
||||
}
|
||||
|
||||
public void addItem(Item item) throws Exception {
|
||||
item.init(getRoot(), getMongoKey() + ".itemMap." + item.getTemplateId());
|
||||
updateString("itemMap." + item.getTemplateId(), item);
|
||||
itemMap.put(item.getTemplateId(), item);
|
||||
public void addItem(Item item) throws Exception {
|
||||
item.init(getRoot(), getMongoKey() + ".itemMap." + item.getItemId());
|
||||
updateString("itemMap." + item.getItemId(), item);
|
||||
itemMap.put(item.getItemId(), item);
|
||||
}
|
||||
|
||||
public Item getItem(Integer key) {
|
||||
|
@ -34,4 +35,17 @@ public class ItemManager extends MongoBase {
|
|||
itemMap.remove(key);
|
||||
}
|
||||
|
||||
public Item newItem(int itemId, int itemNum) throws Exception {
|
||||
SItem sItem = SItem.getsItemMap().get(itemId);
|
||||
Item item = new Item();
|
||||
item.setItemId(itemId);
|
||||
item.setItemNum(itemNum);
|
||||
item.setItemType(sItem.getItemType());
|
||||
item.setItemQuality(sItem.getQuantity());
|
||||
int endTime = (int)(System.currentTimeMillis()/1000);
|
||||
item.setEndingTime(endTime);
|
||||
item.setStacking( sItem.isStacking());
|
||||
return item;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
package com.ljsd.jieling.logic.dao;
|
||||
|
||||
|
||||
import com.ljsd.common.mogodb.MongoBase;
|
||||
|
||||
public class PlayerInfoManager extends MongoBase {
|
||||
|
||||
private String nickName;
|
||||
|
||||
private int level;
|
||||
|
||||
private int exp;
|
||||
|
||||
public String getNickName() {
|
||||
return nickName;
|
||||
}
|
||||
|
||||
public void setNickName(String nickName) throws Exception {
|
||||
updateString("nickName", nickName);
|
||||
this.nickName = nickName;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public void setLevel(int level) throws Exception {
|
||||
updateString("level", level);
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public int getExp() {
|
||||
return exp;
|
||||
}
|
||||
|
||||
public void setExp(int exp) throws Exception {
|
||||
updateString("exp", exp);
|
||||
this.exp = exp;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,107 @@
|
|||
package com.ljsd.jieling.logic.dao;
|
||||
|
||||
|
||||
import com.ljsd.common.mogodb.MongoBase;
|
||||
|
||||
public class PlayerManager extends MongoBase {
|
||||
|
||||
private String nickName;
|
||||
|
||||
private int level;
|
||||
|
||||
private int exp;
|
||||
|
||||
private int vipLevel;
|
||||
|
||||
private String familyId;
|
||||
|
||||
private String head;
|
||||
|
||||
private long gold;
|
||||
|
||||
private int gem;
|
||||
|
||||
private int chargeGem;
|
||||
|
||||
|
||||
public String getNickName() {
|
||||
return nickName;
|
||||
}
|
||||
|
||||
public void setNickName(String nickName) throws Exception {
|
||||
updateString("nickName", nickName);
|
||||
this.nickName = nickName;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public void setLevel(int level) throws Exception {
|
||||
updateString("level", level);
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public int getExp() {
|
||||
return exp;
|
||||
}
|
||||
|
||||
public void setExp(int exp) throws Exception {
|
||||
updateString("exp", exp);
|
||||
this.exp = exp;
|
||||
}
|
||||
|
||||
public int getVipLevel() {
|
||||
return vipLevel;
|
||||
}
|
||||
|
||||
public void setVipLevel(int vipLevel) throws Exception {
|
||||
updateString("vipLevel", vipLevel);
|
||||
this.vipLevel = vipLevel;
|
||||
}
|
||||
|
||||
public String getFamilyId() {
|
||||
return familyId;
|
||||
}
|
||||
|
||||
public void setFamilyId(String familyId) throws Exception {
|
||||
updateString("familyId", familyId);
|
||||
this.familyId = familyId;
|
||||
}
|
||||
|
||||
public String getHead() {
|
||||
return head;
|
||||
}
|
||||
|
||||
public void setHead(String head) throws Exception {
|
||||
updateString("head", head);
|
||||
this.head = head;
|
||||
}
|
||||
|
||||
public long getGold() {
|
||||
return gold;
|
||||
}
|
||||
|
||||
public void setGold(long gold) throws Exception {
|
||||
updateString("gold", gold);
|
||||
this.gold = gold;
|
||||
}
|
||||
|
||||
public int getGem() {
|
||||
return gem;
|
||||
}
|
||||
|
||||
public void setGem(int gem) throws Exception {
|
||||
updateString("gem", gem);
|
||||
this.gem = gem;
|
||||
}
|
||||
|
||||
public int getChargeGem() {
|
||||
return chargeGem;
|
||||
}
|
||||
|
||||
public void setChargeGem(int chargeGem) throws Exception {
|
||||
updateString("chargeGem", chargeGem);
|
||||
this.chargeGem = chargeGem;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
package com.ljsd.jieling.logic.dao;
|
||||
|
||||
import com.ljsd.common.mogodb.MongoBase;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Skill extends MongoBase {
|
||||
|
||||
private String id;
|
||||
|
||||
private int skillId;
|
||||
|
||||
private int skillType;
|
||||
|
||||
private int level;
|
||||
|
||||
private int star;
|
||||
|
||||
|
||||
private List<Integer> effectIdList;
|
||||
|
||||
public int getSkillId() {
|
||||
return skillId;
|
||||
}
|
||||
|
||||
public void setSkillId(int skillId) throws Exception {
|
||||
updateString("skillId",skillId);
|
||||
this.skillId = skillId;
|
||||
}
|
||||
|
||||
public int getSkillType() {
|
||||
return skillType;
|
||||
}
|
||||
|
||||
public void setSkillType(int skillType) throws Exception {
|
||||
updateString("skillType",skillType);
|
||||
this.skillType = skillType;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public void setLevel(int level) throws Exception {
|
||||
updateString("level",level);
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public int getStar() {
|
||||
return star;
|
||||
}
|
||||
|
||||
public void setStar(int star) throws Exception {
|
||||
updateString("star",star);
|
||||
this.star = star;
|
||||
}
|
||||
|
||||
public List<Integer> getEffectIdList() {
|
||||
return effectIdList;
|
||||
}
|
||||
|
||||
public void setEffectIdList(List<Integer> effectIdList) {
|
||||
this.effectIdList = effectIdList;
|
||||
}
|
||||
}
|
|
@ -7,7 +7,7 @@ public class User extends MongoRoot {
|
|||
public static final String _COLLECTION_NAME = "user";
|
||||
private static LjsdMongoTemplate _myMongoDBPool;
|
||||
|
||||
private PlayerInfoManager playerInfoManager;
|
||||
private PlayerManager playerManager;
|
||||
|
||||
private ItemManager itemManager;
|
||||
|
||||
|
@ -15,16 +15,16 @@ public class User extends MongoRoot {
|
|||
|
||||
private MapManager mapManager;
|
||||
|
||||
public User(int uid,PlayerInfoManager playerInfoManager, ItemManager itemManager,
|
||||
public User(int uid, PlayerManager playerManager, ItemManager itemManager,
|
||||
HeroManager heroManager, MapManager mapManager){
|
||||
setMyMongoDBPool(_myMongoDBPool);
|
||||
setId(Integer.toString(uid));
|
||||
this.playerInfoManager = playerInfoManager;
|
||||
this.playerManager = playerManager;
|
||||
this.itemManager = itemManager;
|
||||
this.heroManager = heroManager;
|
||||
this.mapManager = mapManager;
|
||||
//綁定关系
|
||||
playerInfoManager.init(this, "playerInfoManager", false);
|
||||
playerManager.init(this, "playerManager", false);
|
||||
itemManager.init(this, "itemManager", false);
|
||||
heroManager.init(this, "heroManager", false);
|
||||
mapManager.init(this, "mapManager", false);
|
||||
|
@ -32,12 +32,12 @@ public class User extends MongoRoot {
|
|||
|
||||
public User(){
|
||||
setMyMongoDBPool(_myMongoDBPool);
|
||||
this.playerInfoManager = new PlayerInfoManager();
|
||||
this.playerManager = new PlayerManager();
|
||||
this.itemManager = new ItemManager();
|
||||
this.heroManager = new HeroManager();
|
||||
this.mapManager = new MapManager();
|
||||
//綁定关系
|
||||
playerInfoManager.init(this, "playerInfoManager", false);
|
||||
playerManager.init(this, "playerManager", false);
|
||||
itemManager.init(this, "itemManager", false);
|
||||
heroManager.init(this, "heroManager", false);
|
||||
mapManager.init(this, "mapManager", false);
|
||||
|
@ -56,12 +56,12 @@ public class User extends MongoRoot {
|
|||
return _COLLECTION_NAME;
|
||||
}
|
||||
|
||||
public PlayerInfoManager getPlayerInfoManager() {
|
||||
return playerInfoManager;
|
||||
public PlayerManager getPlayerInfoManager() {
|
||||
return playerManager;
|
||||
}
|
||||
|
||||
public void setPlayerInfoManager(PlayerInfoManager playerInfoManager) {
|
||||
this.playerInfoManager = playerInfoManager;
|
||||
public void setPlayerInfoManager(PlayerManager playerManager) {
|
||||
this.playerManager = playerManager;
|
||||
}
|
||||
|
||||
public ItemManager getItemManager() {
|
||||
|
|
|
@ -8,8 +8,11 @@ import java.util.Map;
|
|||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class UserManager {
|
||||
|
||||
private static Map<Integer, User> userMap = new ConcurrentHashMap<>();
|
||||
|
||||
public static LjsdMongoTemplate ljsdMongoTemplate;
|
||||
|
||||
public static void init(ConfigurableApplicationContext configurableApplicationContext) {
|
||||
ljsdMongoTemplate =configurableApplicationContext.getBean(LjsdMongoTemplate.class);
|
||||
User.init(ljsdMongoTemplate);
|
||||
|
@ -37,7 +40,7 @@ public class UserManager {
|
|||
}
|
||||
|
||||
private static User registerUser(int uid) throws Exception {
|
||||
User user = new User(uid,new PlayerInfoManager(),new ItemManager(),new HeroManager(),new MapManager());
|
||||
User user = new User(uid,new PlayerManager(),new ItemManager(),new HeroManager(),new MapManager());
|
||||
UserManager.addUser(user);
|
||||
ljsdMongoTemplate.save(user);
|
||||
return user;
|
||||
|
|
|
@ -45,13 +45,15 @@ public class NettyClient {
|
|||
LOGGER.info(gameMessage.toString());
|
||||
/*---------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
while (true){
|
||||
Thread.sleep(5000);
|
||||
// List<PacketNetData> result = handler.sendRequest_jieling(gameMessage);
|
||||
List<PacketNetData> result = handler.sendRequest_jieling(gameMessage);
|
||||
|
||||
List<PacketNetData> result = handler.sendHeartBeat_jieling();
|
||||
LOGGER.info("send to server...");
|
||||
}
|
||||
// while (true){
|
||||
// Thread.sleep(5000);
|
||||
// List<PacketNetData> result = handler.sendRequest_jieling(gameMessage);
|
||||
//
|
||||
//// List<PacketNetData> result = handler.sendHeartBeat_jieling();
|
||||
// LOGGER.info("send to server...");
|
||||
// }
|
||||
// ch.close();
|
||||
|
||||
// }
|
||||
|
|
|
@ -101,7 +101,7 @@ public class NettyTCPClientHandler extends SimpleChannelInboundHandler<Object> {
|
|||
byte[] packetData = new byte[messageData.length + 16];
|
||||
Tea.intToByte(packetData, 0, 10000001);
|
||||
Tea.intToByte(packetData, 4, 543242);
|
||||
Tea.intToByte(packetData, 8, 10000);
|
||||
Tea.intToByte(packetData, 8, 10600);
|
||||
Tea.intToByte(packetData, 12, 1);
|
||||
System.arraycopy(messageData, 0, packetData, 16, messageData.length);
|
||||
|
||||
|
|
|
@ -220,29 +220,32 @@ public class ProtocolsManager implements ProtocolsAbstract {
|
|||
baseHandler.execute(session, packetNetData);
|
||||
} catch (Exception e) {
|
||||
//TODO
|
||||
LOGGER.error("error : " + e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void dealHeartBeat(ISession session) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
Random random = new Random();
|
||||
int time = random.nextInt(6)+1;
|
||||
try {
|
||||
System.out.println("sleep time : "+time);
|
||||
Thread.sleep(time*1000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Thread.currentThread().setName("OOOOOOOOO");
|
||||
MessageUtil.sendHeartBeat(session);
|
||||
}
|
||||
}).start();
|
||||
// MessageUtil.sendHeartBeat(session);
|
||||
// new Thread(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
//
|
||||
// Random random = new Random();
|
||||
// int time = random.nextInt(6)+1;
|
||||
// try {
|
||||
// System.out.println("sleep time : "+time);
|
||||
// Thread.sleep(time*1000);
|
||||
// } catch (InterruptedException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
//
|
||||
// Thread.currentThread().setName("");
|
||||
// MessageUtil.sendHeartBeat(session);
|
||||
// }
|
||||
// }).start();
|
||||
//TODO
|
||||
MessageUtil.sendHeartBeat(session);
|
||||
}
|
||||
|
||||
private int checkAndRefresh(ISession session, PacketNetData packetNetData) {
|
||||
|
@ -256,9 +259,9 @@ public class ProtocolsManager implements ProtocolsAbstract {
|
|||
}else {
|
||||
|
||||
}
|
||||
if (myToken != packetNetData.getToken()){
|
||||
return 1;
|
||||
}
|
||||
// if (myToken != packetNetData.getToken()){
|
||||
// return 1;
|
||||
// }
|
||||
session.setUserLoginTime(System.currentTimeMillis()/1000);
|
||||
session.setToken(myToken);
|
||||
return 0;
|
||||
|
@ -267,7 +270,7 @@ public class ProtocolsManager implements ProtocolsAbstract {
|
|||
|
||||
@Override
|
||||
public void offLine(GameSession gameSession) {
|
||||
LOGGER.info("9999999");
|
||||
LOGGER.info("player offLine ...");
|
||||
ISession session = (ISession) gameSession;
|
||||
synchronized (session) {
|
||||
|
||||
|
|
|
@ -15,14 +15,14 @@ public class ThreadManager {
|
|||
private static final Logger LOGGER = LoggerFactory.getLogger(ThreadManager.class);
|
||||
|
||||
|
||||
private PlatConfigureTask testTask;
|
||||
private PlatConfigureTask platConfigureTask;
|
||||
|
||||
|
||||
private ScheduledThreadPoolExecutor scheduledExecutor; //管理task
|
||||
|
||||
public void init(ConfigurableApplicationContext configurableApplicationContext) {
|
||||
|
||||
testTask = configurableApplicationContext.getBean(PlatConfigureTask.class);
|
||||
platConfigureTask = configurableApplicationContext.getBean(PlatConfigureTask.class);
|
||||
|
||||
go();
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ public class ThreadManager {
|
|||
scheduledExecutor = new ScheduledThreadPoolExecutor(8, new ScheduleThreadFactory());
|
||||
|
||||
// testTask 已秒为单位 延迟10s, 间隔30s为周期执行
|
||||
scheduledExecutor.scheduleAtFixedRate(testTask, 10, 30, TimeUnit.SECONDS);
|
||||
scheduledExecutor.scheduleAtFixedRate(platConfigureTask, 10, PlatConfigureTask.SLEEP_INTEVAL_TIME, TimeUnit.SECONDS);
|
||||
|
||||
LOGGER.info("All Task running ...");
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import java.io.IOException;
|
|||
public class PlatConfigureTask implements Runnable {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(PlatConfigureTask.class);
|
||||
private int SLEEP_INTEVAL_TIME = 60 * 1000; //每1分钟检查一次
|
||||
public static int SLEEP_INTEVAL_TIME = 60 * 1000; //每1分钟检查一次
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -20,13 +20,10 @@ public class PlatConfigureTask implements Runnable {
|
|||
}
|
||||
|
||||
private void doLogic() {
|
||||
while (true){
|
||||
try {
|
||||
ConfMessage.doWork();
|
||||
TimeUtils.sleep(SLEEP_INTEVAL_TIME);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
ConfMessage.doWork();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
package com.ljsd.jieling.util;
|
||||
|
||||
import com.ljsd.jieling.logic.dao.Hero;
|
||||
import com.ljsd.jieling.logic.dao.Item;
|
||||
import com.ljsd.jieling.logic.dao.ItemManager;
|
||||
import com.ljsd.jieling.logic.dao.PlayerManager;
|
||||
import com.ljsd.jieling.protocols.CommonProto;
|
||||
|
||||
public class CBean2Proto {
|
||||
|
||||
|
||||
public static CommonProto.Common.Player getPlayer(int uid, PlayerManager playerManager) {
|
||||
CommonProto.Common.Player player = CommonProto.Common.Player
|
||||
.newBuilder()
|
||||
.setUid(uid)
|
||||
.setNickName(playerManager.getNickName())
|
||||
.setExp(playerManager.getExp())
|
||||
.setVipLevel(playerManager.getVipLevel())
|
||||
.setFamilyId(playerManager.getFamilyId())
|
||||
.setHead(playerManager.getHead())
|
||||
.setGold(playerManager.getGold())
|
||||
.setGem(playerManager.getGem())
|
||||
.setChargeGem(playerManager.getChargeGem())
|
||||
.build();
|
||||
return player;
|
||||
}
|
||||
|
||||
public static CommonProto.Common.Item getItem(Item item){
|
||||
CommonProto.Common.Item itemProto = CommonProto.Common.Item
|
||||
.newBuilder()
|
||||
.setId(item.getId())
|
||||
.setItemId(item.getItemId())
|
||||
.setItemNum(item.getItemNum())
|
||||
.setItemType(item.getItemType())
|
||||
.setItemQuality(item.getItemQuality())
|
||||
.setIsStacking(item.isStacking())
|
||||
.setEndingTime(item.getEndingTime())
|
||||
.build();
|
||||
return itemProto;
|
||||
}
|
||||
|
||||
public static CommonProto.Common.Hero getHero(Hero hero){
|
||||
CommonProto.Common.Hero heroProto = CommonProto.Common.Hero
|
||||
.newBuilder()
|
||||
|
||||
.build();
|
||||
return heroProto;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package com.ljsd.jieling.util;
|
||||
|
||||
import com.ljsd.jieling.config.SItem;
|
||||
import com.ljsd.jieling.logic.dao.Item;
|
||||
import com.ljsd.jieling.logic.dao.ItemManager;
|
||||
import com.ljsd.jieling.logic.dao.User;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class ItemUtil {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ItemUtil.class);
|
||||
|
||||
/**
|
||||
* 添加道具
|
||||
* @param user
|
||||
* @param itemMap
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void addItem(User user, Map<Integer, Integer> itemMap) throws Exception {
|
||||
ItemManager itemManager = user.getItemManager();
|
||||
for (Map.Entry<Integer, Integer> entry : itemMap.entrySet()) {
|
||||
Item item = itemManager.getItem(entry.getKey());
|
||||
if (item == null){
|
||||
item = itemManager.newItem(entry.getKey(), entry.getValue());
|
||||
}else{
|
||||
if (item.isStacking()){
|
||||
item.setItemNum(item.getItemNum() + entry.getValue());
|
||||
}
|
||||
}
|
||||
itemManager.addItem(item);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -3,4 +3,6 @@ include 'netty'
|
|||
include 'serverlogic'
|
||||
include 'hotfix'
|
||||
include 'common'
|
||||
include 'test'
|
||||
include 'test'
|
||||
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
plugins {
|
||||
id 'java'
|
||||
}
|
||||
|
||||
version 'unspecified'
|
||||
|
||||
sourceCompatibility = 1.8
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
testCompile group: 'junit', name: 'junit', version: '4.12'
|
||||
compile("org.apache.poi:poi-ooxml:3.12")
|
||||
}
|
Binary file not shown.
|
@ -0,0 +1,2 @@
|
|||
Manifest-Version: 1.0
|
||||
|
|
@ -1,10 +1,6 @@
|
|||
package com.ljsd.jieling.util;
|
||||
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
|
@ -13,7 +9,6 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
public class ExcelUtils {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ExcelUtils.class);
|
||||
private static boolean isWrite = true;
|
||||
private static String excelPath ="tmp/";
|
||||
private static String path = "C:/ljsd/jieling_conf/";
|
||||
|
@ -51,29 +46,53 @@ public class ExcelUtils {
|
|||
Object cellData;
|
||||
sheet = wb.getSheetAt(0);
|
||||
String sheetName = sheet.getSheetName();
|
||||
LOGGER.info("collection name={}", sheetName);
|
||||
int rownum = sheet.getPhysicalNumberOfRows();
|
||||
System.out.println("bulidMapInfo => collection name="+sheetName);
|
||||
int rownum = sheet.getLastRowNum();
|
||||
FileWriter fw = new FileWriter(path + sheetName + ".txt");
|
||||
PrintWriter out = new PrintWriter(fw);
|
||||
for (int i = 0; i < rownum; i++) {
|
||||
if (i == 2 || i == 3){
|
||||
if (i == 2 || i == 3 || i == 4 ||i == 5||i == 6){
|
||||
continue;
|
||||
}
|
||||
Row row1 = sheet.getRow(2);
|
||||
Row row2 = sheet.getRow(1);
|
||||
Row row4 = sheet.getRow(4);
|
||||
row = sheet.getRow(i);
|
||||
// for (Cell c :row){
|
||||
// System.out.println(c.getColumnIndex() +"==="+row.getCell(c.getColumnIndex()));
|
||||
// }
|
||||
if (row != null) {
|
||||
int colnum = row.getPhysicalNumberOfCells();
|
||||
StringBuilder info = new StringBuilder();
|
||||
for (int j = 0; j < colnum; j++) {
|
||||
if (getCellFormatValue(row1.getCell(j)).toString().isEmpty()){
|
||||
continue;
|
||||
}
|
||||
int colnum = row.getLastCellNum();
|
||||
for (int j = 1; j < colnum; j++) {
|
||||
int cellFormatValue = (int) getCellFormatValue(row1.getCell(j));
|
||||
if (cellFormatValue == 3){
|
||||
continue;
|
||||
}
|
||||
Cell cell = row.getCell(j);
|
||||
if (cell == null){
|
||||
Cell cell1 = row4.getCell(j);
|
||||
if (cell1==null){
|
||||
String in = getIn(row2.getCell(j).toString());
|
||||
if (info.length() == 0){
|
||||
info = info.append(in);
|
||||
}else{
|
||||
info.append("\t").append(in);
|
||||
}
|
||||
}else{
|
||||
cellData = getCellFormatValue(cell1);
|
||||
if (info.length() == 0){
|
||||
info = info.append(cellData);
|
||||
}else{
|
||||
info.append("\t").append(cellData);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (getCellFormatValue(row1.getCell(j)).toString().isEmpty()){
|
||||
continue;
|
||||
}
|
||||
//文件名
|
||||
cellData = getCellFormatValue(row.getCell(j));
|
||||
cellData = getCellFormatValue(cell);
|
||||
if (info.length() == 0){
|
||||
info = info.append(cellData);
|
||||
}else{
|
||||
|
@ -88,10 +107,27 @@ public class ExcelUtils {
|
|||
out.close();
|
||||
}
|
||||
|
||||
private static String getIn(String row2) {
|
||||
String str = "";
|
||||
switch (row2) {
|
||||
case "bool":
|
||||
str = "false";
|
||||
break;
|
||||
case "int":
|
||||
str = "0";
|
||||
break;
|
||||
case "string":
|
||||
break;
|
||||
default:
|
||||
str = null;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
private static void bulidMapInfo(Workbook wb) throws IOException {
|
||||
Sheet sheet = wb.getSheetAt(0);
|
||||
String sheetName = sheet.getSheetName();
|
||||
LOGGER.info("collection name={}", sheetName);
|
||||
System.out.println("bulidMapInfo => collection name="+sheetName);
|
||||
int rowNum = sheet.getPhysicalNumberOfRows();
|
||||
FileWriter fw = new FileWriter(path + sheetName + ".txt");
|
||||
PrintWriter out = new PrintWriter(fw);
|
||||
|
@ -225,6 +261,10 @@ public class ExcelUtils {
|
|||
}
|
||||
break;
|
||||
}
|
||||
case Cell.CELL_TYPE_BOOLEAN:{
|
||||
cellValue =cell.getBooleanCellValue();
|
||||
break;
|
||||
}
|
||||
case Cell.CELL_TYPE_STRING: {
|
||||
cellValue = cell.getRichStringCellValue().getString();
|
||||
break;
|
Loading…
Reference in New Issue