Merge branch 'master' of http://60.1.1.230/backend/jieling_server
commit
abe5e76f64
|
@ -18,6 +18,7 @@ import com.ljsd.jieling.util.MessageUtil;
|
|||
import config.SChallengeConfig;
|
||||
import config.SErrorCodeEerverConfig;
|
||||
import config.SGlobalSystemConfig;
|
||||
import config.SMainLevelConfig;
|
||||
import manager.STableManager;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -305,7 +306,7 @@ public class HandlerLogicThread extends Thread{
|
|||
int type = sGlobalSystemConfig.getOpenRules()[0];
|
||||
int condition = sGlobalSystemConfig.getOpenRules()[1];
|
||||
if (type ==1){
|
||||
if (mainLevelManager.getFightId()<condition) {
|
||||
if (!SMainLevelConfig.biggerThanFight(mainLevelManager.getFightId(),condition)) {
|
||||
return true;
|
||||
}
|
||||
}else if(type == 2){
|
||||
|
|
|
@ -143,7 +143,7 @@ public class GMRequestHandler extends BaseHandler{
|
|||
}
|
||||
case GlobalGm.ADOPT_FIGHT_BY_VALUE:
|
||||
int fightId = cUser.getMainLevelManager().getFightId();
|
||||
if(fightId>prarm1){
|
||||
if(SMainLevelConfig.biggerThanFight(fightId,prarm1)){
|
||||
break;
|
||||
}
|
||||
SMainLevelConfig sMainLevelConfigMain = SMainLevelConfig.config.get(prarm1);
|
||||
|
@ -159,7 +159,7 @@ public class GMRequestHandler extends BaseHandler{
|
|||
}
|
||||
ItemUtil.userLevelUp(cUser,exp);
|
||||
}
|
||||
while (fightId<prarm1){
|
||||
while (!SMainLevelConfig.biggerThanFight(fightId,prarm1)){
|
||||
SMainLevelConfig sMainLevelConfig = SMainLevelConfig.config.get(fightId);
|
||||
if(sMainLevelConfig.getNextLevel() != -1){
|
||||
MapLogic.getInstance().openNextMainLevel(cUser,fightId);
|
||||
|
|
|
@ -144,7 +144,7 @@ public class MapLogic {
|
|||
MessageUtil.sendErrorResponse(iSession, 0, messageType.getNumber(), "需要等级:" + openRule[0][1]);
|
||||
return;
|
||||
}
|
||||
if(user.getMainLevelManager().getFightId()<openRule[0][0]){
|
||||
if(!SMainLevelConfig.biggerThanFight(user.getMainLevelManager().getFightId(),openRule[0][0])){
|
||||
MessageUtil.sendErrorResponse(iSession, 0, messageType.getNumber(), "需要通关:" + openRule[0][0]);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.ljsd.jieling.logic.dao.ActivityProgressInfo;
|
|||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import config.SMainLevelConfig;
|
||||
|
||||
class ChapterRewardActivity extends AbstractActivity {
|
||||
|
||||
|
@ -16,6 +17,8 @@ class ChapterRewardActivity extends AbstractActivity {
|
|||
boolean takeRewardsProcess(ISession session, SActivityRewardConfig sActivityRewardConfig, ActivityProgressInfo activityProgressInfo) throws Exception {
|
||||
int[][] values = sActivityRewardConfig.getValues();
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
return user.getMainLevelManager().getFightId()>=values[0][0];
|
||||
int fightId = user.getMainLevelManager().getFightId();
|
||||
int targetFightId = values[0][0];
|
||||
return SMainLevelConfig.biggerThanFight(fightId,targetFightId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,8 @@ import com.ljsd.jieling.logic.dao.ActivityProgressInfo;
|
|||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import config.SMainLevelConfig;
|
||||
|
||||
class GrowthFundActivity extends AbstractActivity {
|
||||
|
||||
public GrowthFundActivity(int id) {
|
||||
|
@ -24,7 +26,7 @@ class GrowthFundActivity extends AbstractActivity {
|
|||
return false;
|
||||
}
|
||||
}else if(type == 15){
|
||||
return user.getMainLevelManager().getFightId()>value;
|
||||
return SMainLevelConfig.biggerThanFight(user.getMainLevelManager().getFightId(),value);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -570,8 +570,16 @@ public class HeroLogic {
|
|||
//校验消耗
|
||||
boolean result = ItemUtil.itemCost(user, consumeMap,BIReason.UP_HERO_LEVEL_CONSUME,hero.getTemplateId());
|
||||
if(!result){
|
||||
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.UP_HERO_LEVEL_RESPONSE_VALUE,"道具不足");
|
||||
return;
|
||||
int heroLevel = hero.getLevel();
|
||||
for(;oldLevel<targetLevel;oldLevel++){
|
||||
SHeroLevlConfig sHeroLevlConfig = SHeroLevlConfig.getsCHero().get(oldLevel);
|
||||
if (!ItemUtil.itemCost(user, sHeroLevlConfig.getConsume(),BIReason.UP_HERO_LEVEL_CONSUME,hero.getTemplateId())){
|
||||
break;
|
||||
}
|
||||
heroLevel++;
|
||||
}
|
||||
targetLevel = heroLevel;
|
||||
|
||||
}
|
||||
if(!isBreak){
|
||||
hero.setLevel( user,targetLevel);
|
||||
|
|
|
@ -38,11 +38,25 @@ public class SMainLevelConfig implements BaseConfig {
|
|||
|
||||
private int difficulty;
|
||||
|
||||
private int virtureId; //虚拟id,关卡是自增的。
|
||||
|
||||
public static Map<Integer, SMainLevelConfig> config;
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
config = STableManager.getConfig(SMainLevelConfig.class);
|
||||
Map<Integer, SMainLevelConfig> configTmp = STableManager.getConfig(SMainLevelConfig.class);
|
||||
for(SMainLevelConfig sMainLevelConfig : configTmp.values()){
|
||||
int id = sMainLevelConfig.getId();
|
||||
sMainLevelConfig.setVirtureId(10_000_000*(id%10) + id);
|
||||
}
|
||||
config=configTmp;
|
||||
}
|
||||
|
||||
|
||||
public static boolean biggerThanFight(int soureFight,int targetFight){
|
||||
SMainLevelConfig mineLevelConfig = SMainLevelConfig.config.get(soureFight);
|
||||
SMainLevelConfig otherLevelConfig = SMainLevelConfig.config.get(targetFight);
|
||||
return mineLevelConfig.getVirtureId()>=otherLevelConfig.getVirtureId();
|
||||
}
|
||||
|
||||
|
||||
|
@ -99,4 +113,12 @@ public class SMainLevelConfig implements BaseConfig {
|
|||
public int getDifficulty() {
|
||||
return difficulty;
|
||||
}
|
||||
|
||||
public int getVirtureId() {
|
||||
return virtureId;
|
||||
}
|
||||
|
||||
public void setVirtureId(int virtureId) {
|
||||
this.virtureId = virtureId;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue