Merge branch 'master' of http://60.1.1.230/backend/jieling_server
commit
34bcd18e8d
|
|
@ -1,3 +1,3 @@
|
|||
RewardGroupID Info IsUpset RewardItem RewardMaxNum Loop
|
||||
int string int mut,int#int,1 int int
|
||||
1 钻石招募卡池1 2 1#2#3#4#5#6#7#8#9#10#11#12#13#14#15#16#17#18#19#20#21#22#23#24#25#26#27#28#29#30#31#32#33#34#35#36#37#38#39#40#41#42#43#44#45#46#47#48#49#50#51#52#53#54#55#56 1 0
|
||||
Id IsUpset RewardItem RewardMaxNum Loop
|
||||
int int mut,int#int,1 int int
|
||||
1 2 1#2#3#4#5#6#7#8#9#10#11#12#13#14#15#16#17#18#19#20#21#22#23#24#25#26#27#28#29#30#31#32#33#34#35#36#37#38#39#40#41#42#43#44#45#46#47#48#49#50#51#52#53#54#55#56 1 0
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
Id ItemId Chance GrowChance RandomMin RandomMax
|
||||
id itemId Chance GrowChance RandomMin RandomMax
|
||||
int int int int int int
|
||||
1 10001 100 0 1 1
|
||||
2 10002 100 0 1 1
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ public class SCHeroRankUpConfig implements BaseConfig{
|
|||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
scHeroRankUpConfigMap = STableManager.getConfig(SCHeroRankUpConfig.class);
|
||||
// scHeroRankUpConfigMap = STableManager.getConfig(SCHeroRankUpConfig.class);
|
||||
}
|
||||
|
||||
public static Map<Integer, SCHeroRankUpConfig> getScHeroRankUpConfigMap() {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ public class SRewardGroup implements BaseConfig {
|
|||
* 3按照组内道具概率,依次抽取
|
||||
*/
|
||||
private int isUpset; // 掉落type
|
||||
private int[] rewardGroupID;
|
||||
private int[] rewardItem;
|
||||
private int rewardMaxNum; // 道具数
|
||||
/**
|
||||
* 如果抽取规则选3 ,则需要设置循环轮数
|
||||
|
|
@ -41,8 +41,8 @@ public class SRewardGroup implements BaseConfig {
|
|||
return isUpset;
|
||||
}
|
||||
|
||||
public int[] getRewardGroupID() {
|
||||
return rewardGroupID;
|
||||
public int[] getRewardItem() {
|
||||
return rewardItem;
|
||||
}
|
||||
|
||||
public int getRewardMaxNum() {
|
||||
|
|
|
|||
|
|
@ -2,4 +2,5 @@ package com.ljsd.jieling.globals;
|
|||
|
||||
public interface GlobalGm {
|
||||
int ADD_ITEM = 0;//添加道具
|
||||
int ADD_CARD = 1; //添加卡牌
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,37 +39,22 @@ public class DrawHeroHandler extends BaseHandler {
|
|||
CommonProto.Hero hero1 = CommonProto.Hero.newBuilder()
|
||||
.setId("aaa")
|
||||
.setHeroId(1)
|
||||
.setAttack(2)
|
||||
.setStar(2)
|
||||
.setLevel(1)
|
||||
.setHp(1000)
|
||||
.setMDefence(2000)
|
||||
.setPDefence(3000)
|
||||
.setSpeed(4000)
|
||||
.build();
|
||||
|
||||
CommonProto.Hero hero2 = CommonProto.Hero.newBuilder()
|
||||
.setId("bbb")
|
||||
.setHeroId(2)
|
||||
.setAttack(2)
|
||||
.setStar(2)
|
||||
.setLevel(1)
|
||||
.setHp(1000)
|
||||
.setMDefence(2000)
|
||||
.setPDefence(3000)
|
||||
.setSpeed(4000)
|
||||
.build();
|
||||
|
||||
CommonProto.Hero hero3 = CommonProto.Hero.newBuilder()
|
||||
.setId("ccc")
|
||||
.setHeroId(3)
|
||||
.setAttack(2)
|
||||
.setStar(2)
|
||||
.setLevel(1)
|
||||
.setHp(1000)
|
||||
.setMDefence(2000)
|
||||
.setPDefence(3000)
|
||||
.setSpeed(4000)
|
||||
.build();
|
||||
|
||||
heroList.add(hero1);
|
||||
|
|
|
|||
|
|
@ -2,20 +2,17 @@ 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.CommonProto;
|
||||
import com.ljsd.jieling.protocols.GMCommandProto;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
|
|
@ -30,7 +27,7 @@ public class GMRequestHandler extends BaseHandler{
|
|||
@Override
|
||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
byte[] message = netData.parseClientProtoNetData();
|
||||
GMCommandProto.GMCommand gmCommand = GMCommandProto.GMCommand.parseFrom(message);
|
||||
CommonProto.GMCommand gmCommand = CommonProto.GMCommand.parseFrom(message);
|
||||
String command = gmCommand.getCommand();
|
||||
if (!command.contains("#") || command.split("#").length < 3) {
|
||||
LOGGER.error("wrong command :" + command);
|
||||
|
|
@ -38,15 +35,30 @@ public class GMRequestHandler extends BaseHandler{
|
|||
}
|
||||
String[] commandArray = command.split("#");
|
||||
int uid = Integer.parseInt(commandArray[0]);
|
||||
int gmCommandType = Integer.parseInt(commandArray[1]);// type 0:添加道具
|
||||
int gmCommandType = Integer.parseInt(commandArray[1]);// type 0:添加道具 1:卡牌
|
||||
int prarm1 = 0, prarm2 = 0;
|
||||
User cUser = UserManager.getUser(uid);
|
||||
switch (gmCommandType){
|
||||
case GlobalGm.ADD_ITEM:
|
||||
giveItem(cUser,prarm1,prarm2);
|
||||
break;
|
||||
case GlobalGm.ADD_CARD:
|
||||
giveHero(cUser,prarm1,prarm2);
|
||||
break;
|
||||
}
|
||||
try {
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GM_RESPONSE_VALUE, null, true);
|
||||
LOGGER.info("back to client!");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void giveHero(User cUser, int cardId, int cardNum) throws Exception {
|
||||
CommonProto.Drop.Builder dropBuilder = CommonProto.Drop.newBuilder();
|
||||
Map<Integer,Integer> cardMap = new ConcurrentHashMap<>();
|
||||
cardMap.put(cardId,cardNum);
|
||||
ItemUtil.addCard(cUser,cardMap,dropBuilder);
|
||||
}
|
||||
|
||||
private void giveItem(User cUser,int itemId,int itemNum) throws Exception {
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ public class ItemUtil {
|
|||
}
|
||||
|
||||
private static void selectDrop(SRewardGroup sRewardGroup,Map<Integer, Integer> itemMap, Map<Integer, Integer> cardMap) {
|
||||
int[] rewardItem = sRewardGroup.getRewardGroupID();
|
||||
int[] rewardItem = sRewardGroup.getRewardItem();
|
||||
StringBuilder rewardStr = new StringBuilder();
|
||||
StringBuilder weight = new StringBuilder();
|
||||
for (int dropId :rewardItem){
|
||||
|
|
@ -133,6 +133,9 @@ public class ItemUtil {
|
|||
ItemManager itemManager = user.getItemManager();
|
||||
for (Map.Entry<Integer, Integer> entry : itemMap.entrySet()) {
|
||||
SItem sItem = SItem.getsItemMap().get(entry.getKey());
|
||||
if (sItem == null){
|
||||
continue;
|
||||
}
|
||||
Item item = itemManager.getItem(entry.getKey());
|
||||
if (item == null){
|
||||
item = itemManager.newItem(entry.getKey(), entry.getValue());
|
||||
|
|
@ -191,6 +194,7 @@ public class ItemUtil {
|
|||
addCard(user, entry.getKey(),heroList);
|
||||
}
|
||||
}
|
||||
dropBuilder.addAllHero(heroList);
|
||||
}
|
||||
|
||||
public static void addCard(User user,int cardId,List<CommonProto.Hero> heroList) throws Exception {
|
||||
|
|
@ -200,7 +204,13 @@ public class ItemUtil {
|
|||
heroList.add(CBean2Proto.getHero(hero));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 消耗道具
|
||||
* @param user
|
||||
* @param costItems
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static boolean itemCost(User user,int[][] costItems) throws Exception {
|
||||
|
||||
Map<Integer, Integer> itemMap = new HashMap<>();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#server info
|
||||
server.id = 10180
|
||||
server.id = 10212
|
||||
server.openTime = 20190101000101
|
||||
server.num = 1
|
||||
|
||||
|
|
@ -30,7 +30,7 @@ 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/jieling_msy
|
||||
spring.data.mongodb.uri = mongodb://60.1.1.14:27017/jieling_10212
|
||||
mongodb.options.maxWaitTime = 120000
|
||||
mongodb.options.connectTimeout = 1000
|
||||
mongodb.options.socketTimeout = 0
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ package network.client;
|
|||
|
||||
import com.google.protobuf.*;
|
||||
import com.ljsd.jieling.netty.cocdex.Tea;
|
||||
import com.ljsd.jieling.protocols.GMCommandProto;
|
||||
import com.ljsd.jieling.protocols.CommonProto;
|
||||
import com.ljsd.jieling.protocols.HeroInfoProto;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import com.ljsd.jieling.protocols.PlayerInfoProto;
|
||||
|
|
@ -44,6 +44,7 @@ public class NettyClient {
|
|||
handler.sendRequest_jieling(makeFinalMessage(gameMessage, MessageTypeProto.MessageType.LOGIN_REQUEST_VALUE));
|
||||
handler.sendRequest_jieling(makeFinalMessage(getHero(), MessageTypeProto.MessageType.GET_HEROINFO_REQUEST_VALUE));
|
||||
handler.sendRequest_jieling(makeFinalMessage(getRandomHero(), MessageTypeProto.MessageType.HERO_RAND_REQQUEST_VALUE));
|
||||
handler.sendRequest_jieling(makeFinalMessage(gmRequest(), MessageTypeProto.MessageType.GM_REQUEST_VALUE));
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -69,8 +70,8 @@ public class NettyClient {
|
|||
return finalData;
|
||||
}
|
||||
|
||||
public static GMCommandProto.GMCommand gmRequest(){
|
||||
return GMCommandProto.GMCommand.newBuilder().setCommand("10000001#0#1#100").build();
|
||||
public static CommonProto.GMCommand gmRequest(){
|
||||
return CommonProto.GMCommand.newBuilder().setCommand("10000001#0#1#100").build();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue