工坊科技树升级
parent
5a7a3f32c7
commit
04f439579e
|
@ -0,0 +1,69 @@
|
||||||
|
package com.ljsd.jieling.config;
|
||||||
|
|
||||||
|
import com.ljsd.jieling.logic.STableManager;
|
||||||
|
import com.ljsd.jieling.logic.Table;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Table(name ="WorkShopTechnology")
|
||||||
|
public class SWorkShopTechnology implements BaseConfig {
|
||||||
|
|
||||||
|
private int id;
|
||||||
|
|
||||||
|
private int techId;
|
||||||
|
|
||||||
|
private int level;
|
||||||
|
|
||||||
|
private int[][] values;
|
||||||
|
|
||||||
|
private int rankNum;
|
||||||
|
|
||||||
|
private int profession;
|
||||||
|
|
||||||
|
private int[][] limits;
|
||||||
|
|
||||||
|
private int[][] consume;
|
||||||
|
|
||||||
|
public static Map<Integer, SWorkShopTechnology> config;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init() throws Exception {
|
||||||
|
config = STableManager.getConfig(SWorkShopTechnology.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTechId() {
|
||||||
|
return techId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLevel() {
|
||||||
|
return level;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[][] getValues() {
|
||||||
|
return values;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRankNum() {
|
||||||
|
return rankNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getProfession() {
|
||||||
|
return profession;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[][] getLimits() {
|
||||||
|
return limits;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[][] getConsume() {
|
||||||
|
return consume;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -59,6 +59,7 @@ public interface BIReason {
|
||||||
int WORKSHOP_REBUILD_EQUIP_CONSUME = 1004;
|
int WORKSHOP_REBUILD_EQUIP_CONSUME = 1004;
|
||||||
int WORKSHOP_CREATEMATERIAL_CONSUME = 1005;
|
int WORKSHOP_CREATEMATERIAL_CONSUME = 1005;
|
||||||
int WORKSHOP_EQUIP_CONSUME = 1005;
|
int WORKSHOP_EQUIP_CONSUME = 1005;
|
||||||
|
int WORKSHOP_TECHNOLOGY_CONSUME = 1005;
|
||||||
int ACTIVE_BLUE_CONSUME = 1006;
|
int ACTIVE_BLUE_CONSUME = 1006;
|
||||||
int STORE_HAND_REFRESH = 1007;//手动刷新商店
|
int STORE_HAND_REFRESH = 1007;//手动刷新商店
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ public interface GlobalItemType {
|
||||||
int RUNNE = 6; //符文
|
int RUNNE = 6; //符文
|
||||||
int BLUE_IMAGE=7; // 蓝图
|
int BLUE_IMAGE=7; // 蓝图
|
||||||
int MINERAL=8; // 矿石
|
int MINERAL=8; // 矿石
|
||||||
|
int RINGTYPE=9; // 矿石
|
||||||
|
|
||||||
//物品使用类型
|
//物品使用类型
|
||||||
int NO_USE = 0 ; //不使用
|
int NO_USE = 0 ; //不使用
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.ljsd.jieling.handler.workshop;
|
||||||
|
|
||||||
|
import com.ljsd.jieling.handler.BaseHandler;
|
||||||
|
import com.ljsd.jieling.logic.item.WorkShopLogic;
|
||||||
|
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.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class WorkShopTechnologyLevelHandler extends BaseHandler {
|
||||||
|
@Override
|
||||||
|
public MessageTypeProto.MessageType getMessageCode() {
|
||||||
|
return MessageTypeProto.MessageType.WORKSHOP_TECHNOLOGY_REQUEST;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||||
|
PlayerInfoProto.WorkTechnologyLevelRequest workTechnologyLevelRequest = PlayerInfoProto.WorkTechnologyLevelRequest.parseFrom(netData.parseClientProtoNetData());
|
||||||
|
WorkShopLogic.getInstance().workShopTechnogyLevel(iSession,workTechnologyLevelRequest.getId());
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,13 +8,11 @@ import com.ljsd.jieling.logic.dao.root.User;
|
||||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||||
import com.ljsd.jieling.util.MathUtils;
|
import com.ljsd.jieling.util.MathUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class WorkShopController extends MongoBase {
|
public class WorkShopController extends MongoBase {
|
||||||
private Map<Integer, List<Integer>> openBlueStateMap;
|
private Map<Integer, List<Integer>> openBlueStateMap;
|
||||||
|
private Set<Integer> technologyIds = new HashSet<>();
|
||||||
private int workShopLevel;
|
private int workShopLevel;
|
||||||
|
|
||||||
private int workShopExp;
|
private int workShopExp;
|
||||||
|
@ -134,4 +132,7 @@ public class WorkShopController extends MongoBase {
|
||||||
return cookExp;
|
return cookExp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Set<Integer> getTechnologyIds() {
|
||||||
|
return technologyIds;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,35 @@ public class WorkShopLogic {
|
||||||
|
|
||||||
private WorkShopLogic(){}
|
private WorkShopLogic(){}
|
||||||
|
|
||||||
|
public void workShopTechnogyLevel(ISession iSession, int id) throws Exception {
|
||||||
|
int uid = iSession.getUid();
|
||||||
|
User user = UserManager.getUser(uid);
|
||||||
|
Set<Integer> technologyIds = user.getWorkShopController().getTechnologyIds();
|
||||||
|
SWorkShopTechnology sWorkShopTechnology = SWorkShopTechnology.config.get(id);
|
||||||
|
int msgId = MessageTypeProto.MessageType.WORKSHOP_TECHNOLOGY_RESPONSE_VALUE;
|
||||||
|
if(sWorkShopTechnology.getLevel() != 0){
|
||||||
|
boolean contains = technologyIds.contains(id);
|
||||||
|
if(!contains){
|
||||||
|
MessageUtil.sendErrorResponse(iSession,0,msgId,"parm is wrong");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sWorkShopTechnology = SWorkShopTechnology.config.get(id + 1);
|
||||||
|
if(sWorkShopTechnology == null){
|
||||||
|
MessageUtil.sendErrorResponse(iSession,0,msgId,"parm is wrong");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int[][] consume = sWorkShopTechnology.getConsume();
|
||||||
|
boolean enough = ItemUtil.itemCost(user, consume, BIReason.WORKSHOP_TECHNOLOGY_CONSUME, id + 1);
|
||||||
|
if(!enough){
|
||||||
|
MessageUtil.sendErrorResponse(iSession,0,msgId,"道具不足");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MessageUtil.sendMessage(iSession,1, msgId,null,true);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public static class Instance {
|
public static class Instance {
|
||||||
public final static WorkShopLogic instance = new WorkShopLogic();
|
public final static WorkShopLogic instance = new WorkShopLogic();
|
||||||
}
|
}
|
||||||
|
@ -218,6 +247,7 @@ public class WorkShopLogic {
|
||||||
CommonProto.Equip equipProto = CBean2Proto.getEquipProto(unDetermined);
|
CommonProto.Equip equipProto = CBean2Proto.getEquipProto(unDetermined);
|
||||||
builder.setUnDetermined(equipProto);
|
builder.setUnDetermined(equipProto);
|
||||||
}
|
}
|
||||||
|
builder.addAllTechnologyId(workShopController.getTechnologyIds());
|
||||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.GET_WORKSHOP_INFO_RESPONSE_VALUE,builder.build(),true);
|
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.GET_WORKSHOP_INFO_RESPONSE_VALUE,builder.build(),true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -330,6 +330,7 @@ public class ItemUtil {
|
||||||
case GlobalItemType.RUNNE:
|
case GlobalItemType.RUNNE:
|
||||||
case GlobalItemType.CARD_FRAGMENT:
|
case GlobalItemType.CARD_FRAGMENT:
|
||||||
case GlobalItemType.BLUE_IMAGE:
|
case GlobalItemType.BLUE_IMAGE:
|
||||||
|
case GlobalItemType.RINGTYPE:
|
||||||
case GlobalItemType.MINERAL:
|
case GlobalItemType.MINERAL:
|
||||||
itemType = GlobalItemType.ITEM;
|
itemType = GlobalItemType.ITEM;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue