精英怪

back_recharge
wangyuan 2019-06-20 11:13:55 +08:00
parent eb2c08c614
commit 5b1e55b61e
6 changed files with 80 additions and 19 deletions

View File

@ -35,6 +35,11 @@ public enum FunctionIdEnum {
DailyMission(20),
WorkShopTech(101),
WorkShopCreateEquip(102),
WorkShopCreateProtectEquip(103),
WorkShopRebuildEquip(104),
;
private int functionId;

View File

@ -4,6 +4,7 @@ import com.ljsd.GameApplication;
import com.ljsd.jieling.config.SGlobalSystemConfig;
import com.ljsd.jieling.globals.Global;
import com.ljsd.jieling.handler.BaseHandler;
import com.ljsd.jieling.logic.GlobalDataManaager;
import com.ljsd.jieling.logic.OnlineUserManager;
import com.ljsd.jieling.logic.dao.LevelDifficulty;
import com.ljsd.jieling.logic.dao.UserManager;
@ -162,14 +163,31 @@ public class HandlerLogicThread extends Thread{
return false;
}
break;
case MessageTypeProto.MessageType.WORKSHOP_FOUNDATION_REQUEST_VALUE: // 锻造
case MessageTypeProto.MessageType.WORKSHOP_EQUIP_CREATE_REQUEST_VALUE:
case MessageTypeProto.MessageType.WORKSHOP_EQUIP_CREATE_RESPONSE_VALUE:
case MessageTypeProto.MessageType.WORKSHOP_LEVELUP_RESPONSE_VALUE: // 升级
sGlobalSystemConfig = SGlobalSystemConfig.getsGlobalSystemConfigByFunctionId(FunctionIdEnum.WorkShop);
if (checkOpen(user,sGlobalSystemConfig)) {
return false;
}
break;
case MessageTypeProto.MessageType.WORKSHOP_FOUNDATION_REQUEST_VALUE: // 基础锻造
case MessageTypeProto.MessageType.WORKSHOP_EQUIP_CREATE_REQUEST_VALUE: //武器打造 防具打造 特殊处理 业务逻辑自己处理
sGlobalSystemConfig = SGlobalSystemConfig.getsGlobalSystemConfigByFunctionId(FunctionIdEnum.WorkShop);
if (checkOpen(user,sGlobalSystemConfig)) {
return false;
}
break;
case MessageTypeProto.MessageType.WORKSHOP_TECHNOLOGY_LEVEL_REQUEST_VALUE: // 科技树
sGlobalSystemConfig = SGlobalSystemConfig.getsGlobalSystemConfigByFunctionId(FunctionIdEnum.WorkShopTech);
if (checkOpen(user,sGlobalSystemConfig)) {
return false;
}
break;
case MessageTypeProto.MessageType.WORKSHOP_REBUILD_REQUEST_VALUE: //武器重铸
sGlobalSystemConfig = SGlobalSystemConfig.getsGlobalSystemConfigByFunctionId(FunctionIdEnum.WorkShopRebuildEquip);
if (checkOpen(user,sGlobalSystemConfig)) {
return false;
}
break;
case MessageTypeProto.MessageType.COOK_FOOD_REQUEST_VALUE:
sGlobalSystemConfig = SGlobalSystemConfig.getsGlobalSystemConfigByFunctionId(FunctionIdEnum.Foods);
if (checkOpen(user,sGlobalSystemConfig)) {
@ -196,7 +214,10 @@ public class HandlerLogicThread extends Thread{
return true;
}
private boolean checkOpen(User user, SGlobalSystemConfig sGlobalSystemConfig) {
public static boolean checkOpen(User user, SGlobalSystemConfig sGlobalSystemConfig) {
if(!GlobalDataManaager.getInstance().checkIsOpen(sGlobalSystemConfig.getId())){
return false;
}
int level = user.getPlayerInfoManager().getLevel();
int workShopLevel = user.getWorkShopController().getWorkShopLevel();
Map<Integer, LevelDifficulty> levelDifficultyInfosMap = user.getLevelDifficultyManager().getLevelDifficultyInfosMap();

View File

@ -77,6 +77,7 @@ public class GetPlayerInfoHandler extends BaseHandler{
RoomInfo roomInfo = user.getRoomInfo();
MapManager mapManager = user.getMapManager();
CommonProto.Player player = CBean2Proto.getPlayer(userId, user.getPlayerInfoManager(), user.getPlayerInfoManager().getMapId(), user.getMapManager().getCurMapId(),user.getMapManager(),roomInfo);
CommonProto.SuddenlyBossInfo suddenlyBossInfo = CommonProto.SuddenlyBossInfo.newBuilder().setSuddBossId(mapManager.getSuddenlyBoss()).setEndTime(mapManager.getSuddenlyBossEndTime()).setFindMapId(mapManager.getFindSuddenlyBossMapId()).build();
RechargeInfo rechargeInfo = playerInfoManager.getRechargeInfo();
PlayerInfoProto.GetPlayerInfoResponse getPlayerInfoResponse
= PlayerInfoProto.GetPlayerInfoResponse.newBuilder()
@ -85,8 +86,7 @@ public class GetPlayerInfoHandler extends BaseHandler{
.addAllPrivilege(privilegeList)
.addAllGiftGoodsInfo(BuyGoodsLogic.getGoodsBagInfo(userId))
.addAllBuyGoodsId(rechargeInfo.getBuyGoodsTimes().keySet())
.setSuddBossId(mapManager.getSuddenlyBoss())
.setEndTime(mapManager.getSuddenlyBossEndTime())
.setSuddenlyBossInfo(suddenlyBossInfo)
.build();
try {
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GET_PLAYERINFO_RESPONSE_VALUE, getPlayerInfoResponse, true);

View File

@ -51,6 +51,10 @@ public class GlobalDataManaager {
private PlayerInfoProto.GetFunctionOfTimeResponse getFunctionOfTimeResponse = PlayerInfoProto.GetFunctionOfTimeResponse.newBuilder().build();
public boolean checkIsOpen(int id) {
return openTimeOfFuntionCache.containsKey(id);
}
public void checkSystemFunctioIsOpen() throws Exception {
long now = TimeUtils.now();
Map<Integer, SGlobalSystemConfig> sGlobalSystemConfigMap = SGlobalSystemConfig.getsGlobalSystemConfigMap();

View File

@ -185,9 +185,13 @@ public class HeroLogic {
}
int[][] dropHeroAndItem = new int[length][];
int randCount = 0;
Map<Integer, Integer> totalCount = heroManager.getTotalCount();
if (totalCount.containsKey(type)) {
randCount = totalCount.get(type);
Map<Integer, Integer> totalCountMap = heroManager.getTotalCount();
if (totalCountMap.containsKey(type)) {
randCount = totalCountMap.get(type);
}
int totalCount = 0;
for(Integer count : totalCountMap.values()){
totalCount+=count;
}
int j=0;
for(int i=0;i<perCount;i++){
@ -197,7 +201,8 @@ public class HeroLogic {
pooId = getPooId(sLotterySetting, pooId);
}
LOGGER.info("the uid={},the type={},the poolId={}",uid,type,pooId);
int[] reward = randomHeroByPoolId(pooId);
totalCount++;
int[] reward = randomHeroByPoolId(pooId,totalCount,user.getPlayerInfoManager().getLevel());
if(reward!=null){
dropHeroAndItem[j++] = reward;
}
@ -273,8 +278,8 @@ public class HeroLogic {
public int[] randomHeroByPoolId(int poolId){
List<SLotteryRewardConfig> sLotteryRewardConfigListByPoolId = SLotteryRewardConfig.getSLotteryRewardConfigListByPoolId(poolId);
public int[] randomHeroByPoolId(int poolId,int randomCount,int userLevel){
List<SLotteryRewardConfig> sLotteryRewardConfigListByPoolId = getMineSLotteryRewardConfig(poolId,randomCount,userLevel);
int totalCountByPoolId = SLotteryRewardConfig.getTotalCountByPoolId(poolId);
int randCount = MathUtils.randomInt(totalCountByPoolId) + 1;
int weight =0;
@ -283,11 +288,36 @@ public class HeroLogic {
if(weight>=randCount){
return sLotteryRewardConfig.getReward();
}
}
return null;
}
private List<SLotteryRewardConfig> getMineSLotteryRewardConfig(int poolId,int randomCount,int userLevel){
List<SLotteryRewardConfig> sLotteryRewardConfigs = new ArrayList<>();
List<SLotteryRewardConfig> sLotteryRewardConfigListByPoolId = SLotteryRewardConfig.getSLotteryRewardConfigListByPoolId(poolId);
for(SLotteryRewardConfig sLotteryRewardConfig : sLotteryRewardConfigListByPoolId ){
int[] openRules = sLotteryRewardConfig.getOpenRules();
boolean canAdd = true;
if(openRules!=null&&openRules.length>0){
int openType = openRules[0];
int openValue = openRules[1];
switch (openType){
case 1:
canAdd = randomCount>openValue;
break;
case 2:
canAdd = userLevel > openValue;
break;
}
}
if(canAdd){
sLotteryRewardConfigs.add(sLotteryRewardConfig);
}
}
return sLotteryRewardConfigs;
}
public void getAllTeamPosInfo(ISession session) throws Exception {
User user = UserManager.getUser(session.getUid());
List<CommonProto.TeamPosInfo> teamPosInfoList = new ArrayList<>();

View File

@ -1,7 +1,9 @@
package com.ljsd.jieling.logic.item;
import com.ljsd.jieling.config.*;
import com.ljsd.jieling.core.FunctionIdEnum;
import com.ljsd.jieling.core.GlobalsDef;
import com.ljsd.jieling.core.HandlerLogicThread;
import com.ljsd.jieling.globals.BIReason;
import com.ljsd.jieling.logic.dao.*;
import com.ljsd.jieling.logic.dao.root.User;
@ -300,11 +302,6 @@ public class WorkShopLogic {
finalMaterial.put(materialId,nums*sWorkShopFoundationConfig.getNum());
ItemUtil.addItem(user,finalMaterial,null, BIReason.WORKSHOP_CREATEMATERIAL);
//熟练度提升
int type = sWorkShopFoundationConfig.getType();
int addExp = sWorkShopFoundationConfig.getExp()*nums;
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.WORKSHOP_FOUNDATION_RESPONSE_VALUE,null,true);
}
@ -312,6 +309,11 @@ public class WorkShopLogic {
public void createEquipByUser(ISession session,int equipTid, List<Integer> runneIdsList,int nums) throws Exception {
int uid=session.getUid();
User user = UserManager.getUser(uid);
SGlobalSystemConfig sGlobalSystemConfig = SGlobalSystemConfig.getsGlobalSystemConfigByFunctionId(FunctionIdEnum.Adventure);
if (HandlerLogicThread.checkOpen(user,sGlobalSystemConfig)) {
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.WORKSHOP_FOUNDATION_RESPONSE_VALUE,"未开");
return;
}
SWorkShopEquipmentConfig sWorkShopEquipmentConfig = SWorkShopEquipmentConfig.getsWorkShopEquipmentConfigMap().get(equipTid);
if(sWorkShopEquipmentConfig == null){
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.WORKSHOP_FOUNDATION_RESPONSE_VALUE,"equipTid not exists");
@ -355,7 +357,6 @@ public class WorkShopLogic {
CommonProto.Drop.Builder dropBuilder = CommonProto.Drop.newBuilder();
//熟练度提升
int type = sWorkShopEquipmentConfig.getType();
int addExp = sWorkShopEquipmentConfig.getExp()*nums;
int workShopLevel = user.getWorkShopController().getWorkShopLevel();
if(type == GlobalsDef.WORK_SHOP_TYPE){
while (nums-->0){