Merge branch 'master' of http://60.1.1.230/backend/jieling_server
commit
befccd4e38
|
@ -1,7 +1,7 @@
|
|||
Id OpenLevel RecommendForce RecommendHeroIds MinNum BaseRewardGroup RandomRewardGroup RecommendRewardGroup
|
||||
int int int mut,int#int,1 int mut,int#int,1 mut,int#int,1 mut,int#int,2
|
||||
1 102023 1000 2#1#2 5 101 111 4#121#6#122#8#123|4#124#6#125#8#126
|
||||
2 104030 2000 2#1#2 5 102 112 4#121#6#122#8#123|4#124#6#125#8#126
|
||||
3 109026 3000 2#1#2 5 103 113 4#121#6#122#8#123|4#124#6#125#8#126
|
||||
4 102001 4000 2#1#2 5 104 114 4#121#6#122#8#123|4#124#6#125#8#126
|
||||
5 102001 5000 2#1#2 5 105 115 4#121#6#122#8#123|4#124#6#125#8#126
|
||||
Id OpenLevel MaxNum BaseRewardGroup RandomRewardGroup NumIncome LeaveBonus
|
||||
int int int mut,int#int,1 mut,int#int,1 mut,float#float,2 int
|
||||
1 10 5 101 111 1#0.2|2#0.4|3#0.6|4#0.8|5#1 8
|
||||
2 20 5 102 112 1#0.2|2#0.4|3#0.6|4#0.8|5#1 8
|
||||
3 30 5 103 113 1#0.2|2#0.4|3#0.6|4#0.8|5#1 8
|
||||
4 40 5 104 114 1#0.2|2#0.4|3#0.6|4#0.8|5#1 8
|
||||
5 50 5 105 115 1#0.2|2#0.4|3#0.6|4#0.8|5#1 8
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
Id Weight Pool
|
||||
int int int
|
||||
10001 100 1
|
||||
10002 100 1
|
||||
10003 100 1
|
||||
10004 100 1
|
||||
10005 100 2
|
|
@ -1,7 +0,0 @@
|
|||
Id ConsumeGemRatio BaseRewardRatio RandomRewardRatio PerMapMaxHour HourRewardRatio
|
||||
int mut,int#int,1 mut,float#float,2 mut,float#float,2 int mut,float#float,1
|
||||
1 0#0#50#0 0.7#0.4|0.8#0.6|0.9#0.8|1#1|1.1#1.1|1.2#1.2|1.3#1.3|1.4#1.4|1.5#1.5 0.7#0.4|0.8#0.6|0.9#0.8|1#1|1.1#1.1|1.2#1.2|1.3#1.3|1.4#1.4|1.5#1.5 8 0#0#1#0
|
||||
2 0#0#55#0 0.7#0.4|0.8#0.6|0.9#0.8|1#1|1.1#1.1|1.2#1.2|1.3#1.3|1.4#1.4|1.5#1.5 0.7#0.4|0.8#0.6|0.9#0.8|1#1|1.1#1.1|1.2#1.2|1.3#1.3|1.4#1.4|1.5#1.5 8 0#0#1#0
|
||||
3 0#0#60#0 0.7#0.4|0.8#0.6|0.9#0.8|1#1|1.1#1.1|1.2#1.2|1.3#1.3|1.4#1.4|1.5#1.5 0.7#0.4|0.8#0.6|0.9#0.8|1#1|1.1#1.1|1.2#1.2|1.3#1.3|1.4#1.4|1.5#1.5 8 0#0#1#0
|
||||
4 0#0#70#0 0.7#0.4|0.8#0.6|0.9#0.8|1#1|1.1#1.1|1.2#1.2|1.3#1.3|1.4#1.4|1.5#1.5 0.7#0.4|0.8#0.6|0.9#0.8|1#1|1.1#1.1|1.2#1.2|1.3#1.3|1.4#1.4|1.5#1.5 8 0#0#1#0
|
||||
5 0#0#80#0 0.7#0.4|0.8#0.6|0.9#0.8|1#1|1.1#1.1|1.2#1.2|1.3#1.3|1.4#1.4|1.5#1.5 0.7#0.4|0.8#0.6|0.9#0.8|1#1|1.1#1.1|1.2#1.2|1.3#1.3|1.4#1.4|1.5#1.5 8 0#0#1#0
|
|
@ -249,56 +249,56 @@ int int mut,int#int,1 int int
|
|||
3048 1 22048#21048 5 0
|
||||
3049 1 22049#21049 5 0
|
||||
3050 1 22050#21050 5 0
|
||||
4001 2 20000#20001 1 0
|
||||
4002 2 20000#20002 1 0
|
||||
4003 2 20000#20003 1 0
|
||||
4004 2 20000#20004 1 0
|
||||
4005 2 20000#20005 1 0
|
||||
4006 2 20000#20006 1 0
|
||||
4007 2 20000#20007 1 0
|
||||
4008 2 20000#20008 1 0
|
||||
4009 2 20000#20009 1 0
|
||||
4010 2 20000#20010 1 0
|
||||
4011 2 20000#20011 1 0
|
||||
4012 2 20000#20012 1 0
|
||||
4013 2 20000#20013 1 0
|
||||
4014 2 20000#20014 1 0
|
||||
4015 2 20000#20015 1 0
|
||||
4016 2 20000#20016 1 0
|
||||
4017 2 20000#20017 1 0
|
||||
4018 2 20000#20018 1 0
|
||||
4019 2 20000#20019 1 0
|
||||
4020 2 20000#20020 1 0
|
||||
4021 2 20000#20021 1 0
|
||||
4022 2 20000#20022 1 0
|
||||
4023 2 20000#20023 1 0
|
||||
4024 2 20000#20024 1 0
|
||||
4025 2 20000#20025 1 0
|
||||
4026 2 20000#20026 1 0
|
||||
4027 2 20000#20027 1 0
|
||||
4028 2 20000#20028 1 0
|
||||
4029 2 20000#20029 1 0
|
||||
4030 2 20000#20030 1 0
|
||||
4031 2 20000#20031 1 0
|
||||
4032 2 20000#20032 1 0
|
||||
4033 2 20000#20033 1 0
|
||||
4034 2 20000#20034 1 0
|
||||
4035 2 20000#20035 1 0
|
||||
4036 2 20000#20036 1 0
|
||||
4037 2 20000#20037 1 0
|
||||
4038 2 20000#20038 1 0
|
||||
4039 2 20000#20039 1 0
|
||||
4040 2 20000#20040 1 0
|
||||
4041 2 20000#20041 1 0
|
||||
4042 2 20000#20042 1 0
|
||||
4043 2 20000#20043 1 0
|
||||
4044 2 20000#20044 1 0
|
||||
4045 2 20000#20045 1 0
|
||||
4046 2 20000#20046 1 0
|
||||
4047 2 20000#20047 1 0
|
||||
4048 2 20000#20048 1 0
|
||||
4049 2 20000#20049 1 0
|
||||
4050 2 20000#20050 1 0
|
||||
4001 2 20000#20001 5 0
|
||||
4002 2 20000#20002 5 0
|
||||
4003 2 20000#20003 5 0
|
||||
4004 2 20000#20004 5 0
|
||||
4005 2 20000#20005 5 0
|
||||
4006 2 20000#20006 5 0
|
||||
4007 2 20000#20007 5 0
|
||||
4008 2 20000#20008 5 0
|
||||
4009 2 20000#20009 5 0
|
||||
4010 2 20000#20010 5 0
|
||||
4011 2 20000#20011 5 0
|
||||
4012 2 20000#20012 5 0
|
||||
4013 2 20000#20013 5 0
|
||||
4014 2 20000#20014 5 0
|
||||
4015 2 20000#20015 5 0
|
||||
4016 2 20000#20016 5 0
|
||||
4017 2 20000#20017 5 0
|
||||
4018 2 20000#20018 5 0
|
||||
4019 2 20000#20019 5 0
|
||||
4020 2 20000#20020 5 0
|
||||
4021 2 20000#20021 5 0
|
||||
4022 2 20000#20022 5 0
|
||||
4023 2 20000#20023 5 0
|
||||
4024 2 20000#20024 5 0
|
||||
4025 2 20000#20025 5 0
|
||||
4026 2 20000#20026 5 0
|
||||
4027 2 20000#20027 5 0
|
||||
4028 2 20000#20028 5 0
|
||||
4029 2 20000#20029 5 0
|
||||
4030 2 20000#20030 5 0
|
||||
4031 2 20000#20031 5 0
|
||||
4032 2 20000#20032 5 0
|
||||
4033 2 20000#20033 5 0
|
||||
4034 2 20000#20034 5 0
|
||||
4035 2 20000#20035 5 0
|
||||
4036 2 20000#20036 5 0
|
||||
4037 2 20000#20037 5 0
|
||||
4038 2 20000#20038 5 0
|
||||
4039 2 20000#20039 5 0
|
||||
4040 2 20000#20040 5 0
|
||||
4041 2 20000#20041 5 0
|
||||
4042 2 20000#20042 5 0
|
||||
4043 2 20000#20043 5 0
|
||||
4044 2 20000#20044 5 0
|
||||
4045 2 20000#20045 5 0
|
||||
4046 2 20000#20046 5 0
|
||||
4047 2 20000#20047 5 0
|
||||
4048 2 20000#20048 5 0
|
||||
4049 2 20000#20049 5 0
|
||||
4050 2 20000#20050 5 0
|
||||
10001 1 1000 1 0
|
||||
10101 1 1000#2000 2 0
|
||||
10102 1 1001#2001 2 0
|
||||
|
|
|
@ -73,7 +73,7 @@ int int int float int int
|
|||
416 3316 100 1.0 1 1
|
||||
417 3317 100 1.0 1 1
|
||||
418 3318 100 1.0 1 1
|
||||
600 3001 1 1.0 0 0
|
||||
600 3001 10200 1.0 0 0
|
||||
1000 3 100 1.0 18 22
|
||||
1001 3 100 1.0 14 17
|
||||
1002 3 100 1.0 14 17
|
||||
|
@ -380,57 +380,57 @@ int int int float int int
|
|||
10322 1002 100 1.0 0 0
|
||||
10323 1002 100 1.0 0 0
|
||||
11001 1002 900 1.0 0 0
|
||||
20000 11024 40 1.0 1 1
|
||||
20001 11024 60 1.0 1 1
|
||||
20002 11025 60 1.0 1 1
|
||||
20003 11026 60 1.0 1 1
|
||||
20004 11027 60 1.0 1 1
|
||||
20005 11028 60 1.0 1 1
|
||||
20006 11029 60 1.0 1 1
|
||||
20007 11030 60 1.0 1 1
|
||||
20008 11031 60 1.0 1 1
|
||||
20009 11032 60 1.0 1 1
|
||||
20010 11033 60 1.0 1 1
|
||||
20011 11034 60 1.0 1 1
|
||||
20012 11035 60 1.0 1 1
|
||||
20013 11036 60 1.0 1 1
|
||||
20014 11037 60 1.0 1 1
|
||||
20015 11038 60 1.0 1 1
|
||||
20016 11039 60 1.0 1 1
|
||||
20017 11040 60 1.0 1 1
|
||||
20018 11041 60 1.0 1 1
|
||||
20019 11042 60 1.0 1 1
|
||||
20020 11043 60 1.0 1 1
|
||||
20021 11044 60 1.0 1 1
|
||||
20022 11045 60 1.0 1 1
|
||||
20023 11046 60 1.0 1 1
|
||||
20024 11002 60 1.0 1 1
|
||||
20025 11003 60 1.0 1 1
|
||||
20026 11005 60 1.0 1 1
|
||||
20027 11006 60 1.0 1 1
|
||||
20028 11007 60 1.0 1 1
|
||||
20029 11009 60 1.0 1 1
|
||||
20030 11010 60 1.0 1 1
|
||||
20031 11011 60 1.0 1 1
|
||||
20032 11013 60 1.0 1 1
|
||||
20033 11019 60 1.0 1 1
|
||||
20034 11020 60 1.0 1 1
|
||||
20035 11021 60 1.0 1 1
|
||||
20036 11022 60 1.0 1 1
|
||||
20037 11002 60 1.0 1 1
|
||||
20038 11003 60 1.0 1 1
|
||||
20039 11005 60 1.0 1 1
|
||||
20040 11006 60 1.0 1 1
|
||||
20041 11007 60 1.0 1 1
|
||||
20042 11009 60 1.0 1 1
|
||||
20043 11010 60 1.0 1 1
|
||||
20044 11011 60 1.0 1 1
|
||||
20045 11013 60 1.0 1 1
|
||||
20046 11019 60 1.0 1 1
|
||||
20047 11020 60 1.0 1 1
|
||||
20048 11021 60 1.0 1 1
|
||||
20049 11022 60 1.0 1 1
|
||||
20050 11002 60 1.0 1 1
|
||||
20000 10024 40 1.0 1 1
|
||||
20001 10024 60 1.0 1 1
|
||||
20002 10025 60 1.0 1 1
|
||||
20003 10026 60 1.0 1 1
|
||||
20004 10027 60 1.0 1 1
|
||||
20005 10028 60 1.0 1 1
|
||||
20006 10029 60 1.0 1 1
|
||||
20007 10030 60 1.0 1 1
|
||||
20008 10031 60 1.0 1 1
|
||||
20009 10032 60 1.0 1 1
|
||||
20010 10033 60 1.0 1 1
|
||||
20011 10034 60 1.0 1 1
|
||||
20012 10035 60 1.0 1 1
|
||||
20013 10036 60 1.0 1 1
|
||||
20014 10037 60 1.0 1 1
|
||||
20015 10038 60 1.0 1 1
|
||||
20016 10039 60 1.0 1 1
|
||||
20017 10040 60 1.0 1 1
|
||||
20018 10041 60 1.0 1 1
|
||||
20019 10042 60 1.0 1 1
|
||||
20020 10043 60 1.0 1 1
|
||||
20021 10044 60 1.0 1 1
|
||||
20022 10045 60 1.0 1 1
|
||||
20023 10046 60 1.0 1 1
|
||||
20024 10002 60 1.0 1 1
|
||||
20025 10003 60 1.0 1 1
|
||||
20026 10005 60 1.0 1 1
|
||||
20027 10006 60 1.0 1 1
|
||||
20028 10007 60 1.0 1 1
|
||||
20029 10009 60 1.0 1 1
|
||||
20030 10010 60 1.0 1 1
|
||||
20031 10011 60 1.0 1 1
|
||||
20032 10013 60 1.0 1 1
|
||||
20033 10019 60 1.0 1 1
|
||||
20034 10020 60 1.0 1 1
|
||||
20035 10021 60 1.0 1 1
|
||||
20036 10022 60 1.0 1 1
|
||||
20037 10002 60 1.0 1 1
|
||||
20038 10003 60 1.0 1 1
|
||||
20039 10005 60 1.0 1 1
|
||||
20040 10006 60 1.0 1 1
|
||||
20041 10007 60 1.0 1 1
|
||||
20042 10009 60 1.0 1 1
|
||||
20043 10010 60 1.0 1 1
|
||||
20044 10011 60 1.0 1 1
|
||||
20045 10013 60 1.0 1 1
|
||||
20046 10019 60 1.0 1 1
|
||||
20047 10020 60 1.0 1 1
|
||||
20048 10021 60 1.0 1 1
|
||||
20049 10022 60 1.0 1 1
|
||||
20050 10002 60 1.0 1 1
|
||||
21001 14 100 1.0 130 130
|
||||
21002 14 100 1.0 150 150
|
||||
21003 14 100 1.0 170 170
|
||||
|
|
|
@ -74,8 +74,6 @@ public class GameApplication {
|
|||
|
||||
MongoUtil.getInstence().init(configurableApplicationContext);
|
||||
|
||||
CombatLogic.getInstance().checkAdventureFlush();
|
||||
|
||||
STableManager.initialize("com.ljsd.jieling.config");
|
||||
//初始化邮件
|
||||
MailingSystemManager.init(configurableApplicationContext);
|
||||
|
|
|
@ -3,49 +3,39 @@ package com.ljsd.jieling.config;
|
|||
import com.ljsd.jieling.logic.STableManager;
|
||||
import com.ljsd.jieling.logic.Table;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@Table(name ="AdventureConfig")
|
||||
public class SAdventureConfig implements BaseConfig {
|
||||
|
||||
private static Map<Integer, SAdventureConfig> sAdventureConfigMap;
|
||||
private int id;
|
||||
|
||||
private int openLevel;
|
||||
|
||||
private int recommendForce;
|
||||
|
||||
private int[] recommendHeroIds;
|
||||
|
||||
private int minNum;
|
||||
private int maxNum;
|
||||
|
||||
private int[] baseRewardGroup;
|
||||
|
||||
private int[] randomRewardGroup;
|
||||
|
||||
private int[][] recommendRewardGroup;
|
||||
private float[][] numIncome;
|
||||
|
||||
private int leaveBonus;
|
||||
|
||||
private static Map<Integer, SAdventureConfig> sAdventureConfigMap;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
sAdventureConfigMap = STableManager.getConfig(SAdventureConfig.class);
|
||||
|
||||
|
||||
sAdventureConfigMap = STableManager.getConfig(SAdventureConfig.class);
|
||||
}
|
||||
|
||||
public static SAdventureConfig getsAdventureConfigByPosition(int position) {
|
||||
return sAdventureConfigMap.get(position);
|
||||
public static SAdventureConfig getSAdventureConfigByPosition(int position){
|
||||
return sAdventureConfigMap.get(position);
|
||||
}
|
||||
|
||||
public static Map<Integer, SAdventureConfig> getsAdventureConfigMap() {
|
||||
return sAdventureConfigMap;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
@ -53,28 +43,25 @@ public class SAdventureConfig implements BaseConfig {
|
|||
return openLevel;
|
||||
}
|
||||
|
||||
public int getRecommendForce() {
|
||||
return recommendForce;
|
||||
public int getMaxNum() {
|
||||
return maxNum;
|
||||
}
|
||||
|
||||
public int[] getRecommendHeroIds() {
|
||||
return recommendHeroIds;
|
||||
}
|
||||
|
||||
public int getMinNum() {
|
||||
return minNum;
|
||||
}
|
||||
|
||||
public int[] getBaseRewardGroup() {
|
||||
public int[] getBaseRewardGroup() {
|
||||
return baseRewardGroup;
|
||||
}
|
||||
|
||||
public int[] getRandomRewardGroup() {
|
||||
public int[] getRandomRewardGroup() {
|
||||
return randomRewardGroup;
|
||||
}
|
||||
|
||||
public int[][] getRecommendRewardGroup() {
|
||||
return recommendRewardGroup;
|
||||
public float[][] getNumIncome() {
|
||||
return numIncome;
|
||||
}
|
||||
|
||||
public int getLeaveBonus() {
|
||||
return leaveBonus;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
package com.ljsd.jieling.config;
|
||||
|
||||
import com.ljsd.jieling.logic.STableManager;
|
||||
import com.ljsd.jieling.logic.Table;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="AdventurePoolConfig")
|
||||
public class SAdventurePoolConfig implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int weight;
|
||||
|
||||
private int pool;
|
||||
|
||||
private static Map<Integer, List<SAdventurePoolConfig>> sAdventurePoolConfigListMap;
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
Map<Integer, List<SAdventurePoolConfig>> sAdventurePoolConfigListMapTmp = new HashMap<>();
|
||||
Map<Integer, SAdventurePoolConfig> config = STableManager.getConfig(SAdventurePoolConfig.class);
|
||||
for(SAdventurePoolConfig sAdventurePoolConfig : config.values()){
|
||||
int pool = sAdventurePoolConfig.getPool();
|
||||
if(!sAdventurePoolConfigListMapTmp.containsKey(pool)){
|
||||
sAdventurePoolConfigListMapTmp.put(pool,new ArrayList<>());
|
||||
}
|
||||
sAdventurePoolConfigListMapTmp.get(pool).add(sAdventurePoolConfig);
|
||||
}
|
||||
sAdventurePoolConfigListMap = sAdventurePoolConfigListMapTmp;
|
||||
}
|
||||
|
||||
public static List<SAdventurePoolConfig> getsAdventurePoolConfigListByPool(int poolId) {
|
||||
return sAdventurePoolConfigListMap.get(poolId);
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getWeight() {
|
||||
return weight;
|
||||
}
|
||||
|
||||
public int getPool() {
|
||||
return pool;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
package com.ljsd.jieling.config;
|
||||
|
||||
import com.ljsd.jieling.logic.STableManager;
|
||||
import com.ljsd.jieling.logic.Table;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="AdventureSetting")
|
||||
public class SAdventureSetting implements BaseConfig {
|
||||
|
||||
private static Map<Integer, SAdventureSetting> sAdventureSettingMap;
|
||||
|
||||
private int id;
|
||||
|
||||
private int[] consumeGemRatio;
|
||||
|
||||
private float[][] baseRewardRatio;
|
||||
|
||||
private float[][] randomRewardRatio;
|
||||
|
||||
private int perMapMaxHour;
|
||||
|
||||
private float[] hourRewardRatio;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
sAdventureSettingMap = STableManager.getConfig(SAdventureSetting.class);
|
||||
}
|
||||
|
||||
public static SAdventureSetting getsAdventureSetting(int pooId) {
|
||||
return sAdventureSettingMap.get(pooId);
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int[] getConsumeGemRatio() {
|
||||
return consumeGemRatio;
|
||||
}
|
||||
|
||||
public float[][] getBaseRewardRatio() {
|
||||
return baseRewardRatio;
|
||||
}
|
||||
|
||||
public float[][] getRandomRewardRatio() {
|
||||
return randomRewardRatio;
|
||||
}
|
||||
|
||||
public int getPerMapMaxHour() {
|
||||
return perMapMaxHour;
|
||||
}
|
||||
|
||||
public float[] getHourRewardRatio() {
|
||||
return hourRewardRatio;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
package com.ljsd.jieling.handler.combat;
|
||||
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.fight.CombatLogic;
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.FightInfoProto;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Component
|
||||
public class AdventureRewardHandler extends BaseHandler {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.ADVENTURE_REWARD_REQUEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
byte[] bytes = netData.parseClientProtoNetData();
|
||||
FightInfoProto.TakeAventureRewardRequest takeAventureRewardRequest = FightInfoProto.TakeAventureRewardRequest.parseFrom(bytes);
|
||||
int position = takeAventureRewardRequest.getPosition();
|
||||
CombatLogic.getInstance().clearStation(iSession,position);
|
||||
}
|
||||
}
|
|
@ -23,7 +23,6 @@ public class AdventureStationHandler extends BaseHandler {
|
|||
FightInfoProto.AventureStationRequest aventureStationRequest = FightInfoProto.AventureStationRequest.parseFrom(bytes);
|
||||
int position = aventureStationRequest.getPosition();
|
||||
List<String> heroIdListList = aventureStationRequest.getHeroIdListList();
|
||||
int hourDuration = aventureStationRequest.getHourDuration();
|
||||
CombatLogic.getInstance().adventureStation(iSession,position,heroIdListList,hourDuration);
|
||||
CombatLogic.getInstance().adventureStation(iSession,position,heroIdListList);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -156,6 +156,11 @@ public class MapLogic {
|
|||
if (mapManager.getMission() != null) {
|
||||
mapEnterResponse.setMissions(getMission(mapManager.getMission()));
|
||||
}
|
||||
int reviveTime = (int) ((mapManager.getCanMoveTime() - TimeUtils.now()) / 1000);
|
||||
if (reviveTime > 0) {
|
||||
mapEnterResponse.setReviveTime(reviveTime);
|
||||
}
|
||||
mapEnterResponse.setDieCount(mapManager.getDieCount());
|
||||
mapEnterResponse.addAllMapList(cells);
|
||||
mapEnterResponse.setCurXY(mapManager.getCurXY());
|
||||
mapEnterResponse.addAllWakeCells(mapManager.getWalkCells() == null ? new ArrayList<>() : mapManager.getWalkCells());
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.ljsd.jieling.logic.dao;
|
||||
|
||||
import com.ljsd.common.mogodb.MongoBase;
|
||||
import com.ljsd.jieling.handler.map.TemporaryItems;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
|
||||
|
||||
|
@ -10,63 +11,35 @@ import java.util.Map;
|
|||
public class AdventureManager extends MongoBase {
|
||||
|
||||
private Map<Integer,AdventureStateInfo> adventureStateInfoMap;
|
||||
private Map<Integer,Integer> allowTimeMap;
|
||||
|
||||
private long updateTime;
|
||||
private Map<int[],Float> tempDropRatio = new HashMap<>();
|
||||
|
||||
public AdventureManager(){
|
||||
this.setRootCollection(User._COLLECTION_NAME);
|
||||
adventureStateInfoMap = new HashMap<>();
|
||||
allowTimeMap = new HashMap<>();
|
||||
}
|
||||
|
||||
public void station(AdventureStateInfo adventureStateInfo,int allowTime) throws Exception {
|
||||
public void station(AdventureStateInfo adventureStateInfo) throws Exception {
|
||||
int position = adventureStateInfo.getPosition();
|
||||
updateString("adventureStateInfoMap." + position, adventureStateInfo);
|
||||
updateString("allowTimeMap." + position, allowTime);
|
||||
adventureStateInfoMap.put(position,adventureStateInfo);
|
||||
allowTimeMap.put(position,allowTime);
|
||||
}
|
||||
|
||||
public void clearStation(int position){
|
||||
AdventureStateInfo adventureStateInfo = adventureStateInfoMap.get(position);
|
||||
if (adventureStateInfo!=null){
|
||||
removeString(getMongoKey() +".adventureStateInfoMap." + position);
|
||||
removeString(getMongoKey() +".allowTimeMap." + position);
|
||||
adventureStateInfoMap.remove(position);
|
||||
allowTimeMap.remove(position);
|
||||
}
|
||||
public Map<int[], Float> getTempDropRation() {
|
||||
return tempDropRatio;
|
||||
}
|
||||
|
||||
public void updateTemp(int dropIds[],float ratio){
|
||||
tempDropRatio.put(dropIds,ratio);
|
||||
updateString("tempDropRatio."+dropIds,ratio);
|
||||
}
|
||||
|
||||
public void clearTemp(){
|
||||
tempDropRatio.clear();
|
||||
updateString("tempDropRatio",new HashMap<>());
|
||||
}
|
||||
|
||||
public Map<Integer, AdventureStateInfo> getAdventureStateInfoMap() {
|
||||
return adventureStateInfoMap;
|
||||
}
|
||||
|
||||
public void setAdventureStateInfoMap(Map<Integer, AdventureStateInfo> adventureStateInfoMap) {
|
||||
this.adventureStateInfoMap = adventureStateInfoMap;
|
||||
}
|
||||
|
||||
public void updateAllowTime(int position,int allowTime){
|
||||
updateString("allowTimeMap." + position, allowTime);
|
||||
allowTimeMap.put(position,allowTime);
|
||||
}
|
||||
|
||||
public void setUpdateTime(long updateTime) {
|
||||
updateString("updateTime",updateTime);
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public void setAllowTimeMap(Map<Integer, Integer> allowTimeMap) {
|
||||
updateString("allowTimeMap.",allowTimeMap);
|
||||
this.allowTimeMap = allowTimeMap;
|
||||
}
|
||||
|
||||
public long getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public Map<Integer, Integer> getAllowTimeMap() {
|
||||
return allowTimeMap;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package com.ljsd.jieling.logic.dao;
|
||||
|
||||
import com.ljsd.common.mogodb.MongoBase;
|
||||
import com.ljsd.jieling.config.SAdventureSetting;
|
||||
import com.ljsd.jieling.config.SVipLevelConfig;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -11,24 +9,15 @@ public class AdventureStateInfo extends MongoBase {
|
|||
private int position;
|
||||
private List<String> heroIds;
|
||||
private int startTime;
|
||||
private int hourDuration;
|
||||
|
||||
|
||||
private int totalForce;
|
||||
private int myRecommendHeroSize;
|
||||
|
||||
public AdventureStateInfo(){
|
||||
this.setRootCollection(User._COLLECTION_NAME);
|
||||
}
|
||||
|
||||
public AdventureStateInfo(int position,List<String> heroIds, int startTime, int hourDuration,int totalForce,int myRecommendHeroSize) {
|
||||
public AdventureStateInfo(int position,List<String> heroIds, int startTime) {
|
||||
this.setRootCollection(User._COLLECTION_NAME);
|
||||
this.heroIds = heroIds;
|
||||
this.startTime = startTime;
|
||||
this.hourDuration = hourDuration;
|
||||
this.position = position;
|
||||
this.totalForce = totalForce;
|
||||
this.myRecommendHeroSize = myRecommendHeroSize;
|
||||
}
|
||||
|
||||
public List<String> getHeroIds() {
|
||||
|
@ -39,19 +28,13 @@ public class AdventureStateInfo extends MongoBase {
|
|||
return startTime;
|
||||
}
|
||||
|
||||
public int getHourDuration() {
|
||||
return hourDuration;
|
||||
}
|
||||
|
||||
public int getPosition() {
|
||||
return position;
|
||||
}
|
||||
|
||||
public int getTotalForce() {
|
||||
return totalForce;
|
||||
}
|
||||
public void setStartTime(int startTime) {
|
||||
updateString("startTime",startTime);
|
||||
this.startTime = startTime;
|
||||
|
||||
public int getMyRecommendHeroSize() {
|
||||
return myRecommendHeroSize;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,16 +1,12 @@
|
|||
package com.ljsd.jieling.logic.fight;
|
||||
|
||||
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.jieling.config.*;
|
||||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
import com.ljsd.jieling.db.mongo.MongoUtil;
|
||||
import com.ljsd.jieling.handler.map.MapManager;
|
||||
import com.ljsd.jieling.logic.dao.*;
|
||||
import com.ljsd.jieling.logic.dao.root.AdventureSeasonInfo;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.CommonProto;
|
||||
import com.ljsd.jieling.protocols.FightInfoProto;
|
||||
|
@ -24,9 +20,6 @@ import java.util.*;
|
|||
public class CombatLogic {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(CombatLogic.class);
|
||||
|
||||
private static AdventureSeasonInfo adventureSeasonInfoCache;
|
||||
private static List<CommonProto.AdventureRecommendHeroInfo> adventureRecommendHeroInfos ;
|
||||
|
||||
private CombatLogic(){}
|
||||
|
||||
|
||||
|
@ -39,101 +32,23 @@ public class CombatLogic {
|
|||
return CombatLogic.Instance.instance;
|
||||
}
|
||||
|
||||
|
||||
private void getAdventureRecommendHeroInfos( Map<Integer, Set<Integer>> recommendFinalHeroMap){
|
||||
|
||||
adventureRecommendHeroInfos = new ArrayList<>(recommendFinalHeroMap.size());
|
||||
for(Map.Entry<Integer,Set<Integer>> item : recommendFinalHeroMap.entrySet()){
|
||||
Integer key = item.getKey();
|
||||
Set<Integer> value = item.getValue();
|
||||
adventureRecommendHeroInfos.add(CommonProto.AdventureRecommendHeroInfo.newBuilder().setPositionId(key).addAllRecommenedId(value).build());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//冒险模式 加成英雄刷新
|
||||
public void checkAdventureFlush() throws Exception {
|
||||
AdventureSeasonInfo adventureSeasonInfo = MongoUtil.getInstence().getMyMongoTemplate().findById(AdventureSeasonInfo._COLLECTION_NAME, Integer.toString(GameApplication.serverId), AdventureSeasonInfo.class);
|
||||
if(adventureSeasonInfo!=null){
|
||||
if(adventureSeasonInfoCache == null || adventureSeasonInfo.getUpdateTime()!=adventureSeasonInfoCache.getUpdateTime()){
|
||||
adventureSeasonInfoCache = adventureSeasonInfo;
|
||||
getAdventureRecommendHeroInfos(adventureSeasonInfo.getRecommendFinalHeroMap());
|
||||
}
|
||||
if(TimeUtils.isSameDayWithNow(adventureSeasonInfo.getUpdateTime())){
|
||||
return;
|
||||
}
|
||||
}
|
||||
Map<Integer,Set<Integer>> recommendFinalHeroMap = new HashMap<>();
|
||||
Map<Integer, SAdventureConfig> sAdventureConfigMap = SAdventureConfig.getsAdventureConfigMap();
|
||||
for(SAdventureConfig sAdventureConfig : sAdventureConfigMap.values()){
|
||||
int[] recommendHeroIds = sAdventureConfig.getRecommendHeroIds();
|
||||
int recommendNums = recommendHeroIds[0];
|
||||
int randomPoolId = recommendHeroIds[1];
|
||||
int mustPoolId = recommendHeroIds[2];
|
||||
int leftNums = recommendNums;
|
||||
Set<Integer> recommendFinalHeroIds = new HashSet<>(recommendNums);
|
||||
recommendFinalHeroMap.put(sAdventureConfig.getId(),recommendFinalHeroIds);
|
||||
if(mustPoolId!=0){
|
||||
List<SAdventurePoolConfig> sAdventurePoolConfigs = SAdventurePoolConfig.getsAdventurePoolConfigListByPool(mustPoolId);
|
||||
for(SAdventurePoolConfig sAdventurePoolConfig : sAdventurePoolConfigs){
|
||||
recommendFinalHeroIds.add(sAdventurePoolConfig.getId());
|
||||
leftNums --;
|
||||
}
|
||||
}
|
||||
|
||||
if(leftNums>0){
|
||||
List<SAdventurePoolConfig> sAdventurePoolConfigs = SAdventurePoolConfig.getsAdventurePoolConfigListByPool(randomPoolId);
|
||||
int totalWeight = 0;
|
||||
for(SAdventurePoolConfig sAdventurePoolConfig : sAdventurePoolConfigs){
|
||||
totalWeight+=sAdventurePoolConfig.getWeight();
|
||||
}
|
||||
while (leftNums>0){
|
||||
int randomWeight = MathUtils.randomInt(totalWeight)+1;
|
||||
for(SAdventurePoolConfig sAdventurePoolConfig : sAdventurePoolConfigs){
|
||||
randomWeight-=sAdventurePoolConfig.getWeight();
|
||||
if(randomWeight<=0){
|
||||
recommendFinalHeroIds.add(sAdventurePoolConfig.getId());
|
||||
leftNums--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(adventureSeasonInfo == null){
|
||||
adventureSeasonInfo = new AdventureSeasonInfo();
|
||||
}
|
||||
adventureSeasonInfo.setRecommendFinalHeroMap(recommendFinalHeroMap);
|
||||
adventureSeasonInfo.setUpdateTime(System.currentTimeMillis());
|
||||
adventureSeasonInfoCache = adventureSeasonInfo;
|
||||
getAdventureRecommendHeroInfos(adventureSeasonInfo.getRecommendFinalHeroMap());
|
||||
MongoUtil.getInstence().getMyMongoTemplate().save(adventureSeasonInfo);
|
||||
|
||||
}
|
||||
//冒险模式
|
||||
public void getAdventureStateInfo(ISession session) throws Exception {
|
||||
int uid = session.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
flushAdventureTime(user);
|
||||
AdventureManager adventureManager = user.getAdventureManager();
|
||||
Map<Integer, AdventureStateInfo> adventureStateInfoMap = adventureManager.getAdventureStateInfoMap();
|
||||
List<CommonProto.AdventureStateInfo> result = new ArrayList<>();
|
||||
Map<Integer, Integer> allowTimeMap = adventureManager.getAllowTimeMap();
|
||||
for(Map.Entry<Integer,Integer> item : allowTimeMap.entrySet()){
|
||||
Integer position = item.getKey();
|
||||
Integer allowTime = item.getValue();
|
||||
AdventureStateInfo adventureStateInfo = adventureStateInfoMap.get(position);
|
||||
result.add(CBean2Proto.getAdventureStateInfo(adventureStateInfo,position,allowTime));
|
||||
CommonProto.Drop.Builder dropBuilder = calAdvenrureReward(user, false,0);
|
||||
for(AdventureStateInfo item : adventureStateInfoMap.values()){
|
||||
result.add(CBean2Proto.getAdventureStateInfo(item,item.getPosition()));
|
||||
}
|
||||
|
||||
FightInfoProto.GetAdventureStateInfoResponse response = FightInfoProto.GetAdventureStateInfoResponse.newBuilder().addAllAdventureStateInfoList(result).addAllAdventureRecommendHeroInfo(adventureRecommendHeroInfos).
|
||||
build();
|
||||
FightInfoProto.GetAdventureStateInfoResponse response = FightInfoProto.GetAdventureStateInfoResponse.newBuilder().addAllAdventureStateInfoList(result).setDrop(dropBuilder.build()).build();
|
||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.GET_ADVENTURE_INFO_RESPONSE_VALUE,response,true);
|
||||
|
||||
}
|
||||
|
||||
public void adventureStation(ISession session,int position,List<String> heroIds,int hourDuration) throws Exception {
|
||||
public void adventureStation(ISession session,int position,List<String> heroIds) throws Exception {
|
||||
if(heroIds == null || heroIds.isEmpty()){
|
||||
MessageUtil.sendErrorResponse(session,0, MessageTypeProto.MessageType.ADVENTURE_STATION_RESPONSE_VALUE,"");
|
||||
return;
|
||||
|
@ -141,47 +56,27 @@ public class CombatLogic {
|
|||
int uid = session.getUid();
|
||||
|
||||
User user = UserManager.getUser(uid);
|
||||
SAdventureConfig sAdventureConfig = SAdventureConfig.getsAdventureConfigByPosition(position);
|
||||
/* if(sAdventureConfig.getOpenLevel() > user.getPlayerInfoManager().getLevel()){
|
||||
SAdventureConfig sAdventureConfig = SAdventureConfig.getSAdventureConfigByPosition(position);
|
||||
if(sAdventureConfig.getOpenLevel() > user.getPlayerInfoManager().getLevel()){
|
||||
MessageUtil.sendErrorResponse(session,0, MessageTypeProto.MessageType.ADVENTURE_STATION_RESPONSE_VALUE,"等级不够");
|
||||
return;
|
||||
}*/
|
||||
|
||||
|
||||
if(sAdventureConfig.getMinNum() > heroIds.size()){
|
||||
MessageUtil.sendErrorResponse(session,0, MessageTypeProto.MessageType.ADVENTURE_STATION_RESPONSE_VALUE,"英雄数量小于规定数量");
|
||||
return;
|
||||
}
|
||||
|
||||
SAdventureSetting sAdventureSetting = SAdventureSetting.getsAdventureSetting(position);
|
||||
if(hourDuration > sAdventureSetting.getPerMapMaxHour()){
|
||||
MessageUtil.sendErrorResponse(session,0, MessageTypeProto.MessageType.ADVENTURE_STATION_RESPONSE_VALUE,"超出时长");
|
||||
|
||||
if(heroIds.size()>sAdventureConfig.getMaxNum()){
|
||||
MessageUtil.sendErrorResponse(session,0, MessageTypeProto.MessageType.ADVENTURE_STATION_RESPONSE_VALUE,"英雄数量大于规定数量");
|
||||
return;
|
||||
}
|
||||
|
||||
AdventureManager adventureManager = user.getAdventureManager();
|
||||
//检验
|
||||
Map<Integer, AdventureStateInfo> adventureStateInfoMap = adventureManager.getAdventureStateInfoMap();
|
||||
AdventureStateInfo adventureStateInfo = adventureManager.getAdventureStateInfoMap().get(position);
|
||||
if(adventureStateInfo!=null){
|
||||
MessageUtil.sendErrorResponse(session,0, MessageTypeProto.MessageType.ADVENTURE_STATION_RESPONSE_VALUE,"已驻扎");
|
||||
return;
|
||||
}
|
||||
|
||||
int allowTime =0;
|
||||
if(!adventureManager.getAllowTimeMap().containsKey(position)){
|
||||
int vipLevel = user.getPlayerInfoManager().getVipLevel();
|
||||
allowTime = SVipLevelConfig.getsVipLevelConfigMap().get(vipLevel).getPrivilegeMap().get(1) -hourDuration;
|
||||
}else{
|
||||
Integer remainAllowTime = adventureManager.getAllowTimeMap().get(position);
|
||||
allowTime = remainAllowTime - hourDuration;
|
||||
}
|
||||
if(allowTime<0){
|
||||
MessageUtil.sendErrorResponse(session,0, MessageTypeProto.MessageType.ADVENTURE_STATION_RESPONSE_VALUE,"超过时间");
|
||||
return;
|
||||
}
|
||||
|
||||
for(AdventureStateInfo adventureStateInfoTmp:adventureStateInfoMap.values()){
|
||||
int positionTmp = adventureStateInfoTmp.getPosition();
|
||||
if(position == positionTmp){
|
||||
continue;
|
||||
}
|
||||
List<String> heroIds1 = adventureStateInfoTmp.getHeroIds();
|
||||
for(String useHeroId : heroIds1){
|
||||
if(heroIds.contains(useHeroId)){
|
||||
|
@ -191,117 +86,76 @@ public class CombatLogic {
|
|||
}
|
||||
}
|
||||
}
|
||||
HeroManager heroManager = user.getHeroManager();
|
||||
int myRecommendHeroSize=0;
|
||||
int totalForce=0;
|
||||
Set<Integer> recommendHeroSets =adventureSeasonInfoCache.getRecommendFinalHeroMap().get(position);
|
||||
Set<Integer> cacheHeroTid = new HashSet<>(recommendHeroSets.size());
|
||||
for(String heroId : heroIds){
|
||||
Hero hero = heroManager.getHero(heroId);
|
||||
int templateId = hero.getTemplateId();
|
||||
if(recommendHeroSets.contains(templateId) && !cacheHeroTid.contains(templateId)){
|
||||
cacheHeroTid.add(templateId);
|
||||
myRecommendHeroSize++;
|
||||
if(adventureManager.getAdventureStateInfoMap().containsKey(position)){
|
||||
AdventureStateInfo adventureStateInfo = adventureManager.getAdventureStateInfoMap().get(position);
|
||||
if(adventureStateInfo.getHeroIds()!=null && !adventureStateInfo.getHeroIds().isEmpty()){
|
||||
calAdvenrureReward(user,true,position);
|
||||
}
|
||||
totalForce += HeroLogic.getInstance().calHeoForce(user,hero);
|
||||
}
|
||||
|
||||
adventureManager.station(new AdventureStateInfo(position,heroIds,(int)(System.currentTimeMillis()/1000),hourDuration,totalForce,myRecommendHeroSize),allowTime);
|
||||
if(adventureManager.getUpdateTime() == 0){
|
||||
adventureManager.setUpdateTime(System.currentTimeMillis());
|
||||
}
|
||||
|
||||
adventureManager.station(new AdventureStateInfo(position,heroIds,(int)(System.currentTimeMillis()/1000)));
|
||||
//发送成功
|
||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.ADVENTURE_STATION_RESPONSE_VALUE,null,true);
|
||||
}
|
||||
|
||||
private void flushAdventureTime( User user ){
|
||||
public void calAdventureRewardByHeroChange(User user,Set<String> heroIds) throws Exception {
|
||||
AdventureManager adventureManager = user.getAdventureManager();
|
||||
long updateTime = adventureManager.getUpdateTime();
|
||||
if(updateTime ==0 || TimeUtils.isSameDayWithNow(updateTime)){
|
||||
return;
|
||||
}
|
||||
int vipLevel = user.getPlayerInfoManager().getVipLevel();
|
||||
int allowTime = SVipLevelConfig.getsVipLevelConfigMap().get(vipLevel).getPrivilegeMap().get(1);
|
||||
Map<Integer, Integer> allowTimeMap = adventureManager.getAllowTimeMap();
|
||||
if(allowTimeMap!=null && !allowTimeMap.isEmpty()){
|
||||
Map<Integer,Integer> result = new HashMap<>();
|
||||
for(Integer position : allowTimeMap.keySet()){
|
||||
result.put(position,allowTime);
|
||||
//检验
|
||||
Map<Integer, AdventureStateInfo> adventureStateInfoMap = adventureManager.getAdventureStateInfoMap();
|
||||
for(AdventureStateInfo adventureStateInfoTmp:adventureStateInfoMap.values()){
|
||||
List<String> heroIdsOccupy = adventureStateInfoTmp.getHeroIds();
|
||||
boolean remove = heroIdsOccupy.removeAll(heroIds);
|
||||
if(remove){
|
||||
//提前结算
|
||||
int position = adventureStateInfoTmp.getPosition();
|
||||
calAdvenrureReward(user,true,position);
|
||||
adventureManager.station(new AdventureStateInfo(adventureStateInfoTmp.getPosition(),heroIdsOccupy,(int)(System.currentTimeMillis()/1000)));
|
||||
}
|
||||
adventureManager.setUpdateTime(System.currentTimeMillis());
|
||||
adventureManager.setAllowTimeMap(result);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void clearStation(ISession session,int position) throws Exception {
|
||||
int uid = session.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
//消耗道具全部加一遍基础奖励。
|
||||
public CommonProto.Drop.Builder calAdvenrureReward(User user, boolean isOnLine,int position) throws Exception {
|
||||
Map<int[], Float> tempDropRation = new HashMap<>();
|
||||
AdventureManager adventureManager = user.getAdventureManager();
|
||||
AdventureStateInfo adventureStateInfo = adventureManager.getAdventureStateInfoMap().get(position);
|
||||
if( null == adventureStateInfo ){
|
||||
MessageUtil.sendErrorResponse(session,0, MessageTypeProto.MessageType.ADVENTURE_REWARD_RESPONSE_VALUE,"");
|
||||
return;
|
||||
}
|
||||
int startTime = adventureStateInfo.getStartTime();
|
||||
int hourDuration = adventureStateInfo.getHourDuration();
|
||||
Map<Integer, AdventureStateInfo> adventureStateInfoMap = adventureManager.getAdventureStateInfoMap();
|
||||
int now = (int)(System.currentTimeMillis()/1000);
|
||||
if( (now - startTime ) /3600 < hourDuration ){
|
||||
MessageUtil.sendErrorResponse(session,0, MessageTypeProto.MessageType.ADVENTURE_REWARD_RESPONSE_VALUE,"驻扎时长不到");
|
||||
return;
|
||||
}
|
||||
//计算奖励
|
||||
SAdventureConfig sAdventureConfig = SAdventureConfig.getsAdventureConfigByPosition(position);
|
||||
int recommendForce = sAdventureConfig.getRecommendForce();
|
||||
|
||||
|
||||
SAdventureSetting sAdventureSetting = SAdventureSetting.getsAdventureSetting(position);
|
||||
|
||||
|
||||
float[][] baseRewardRatio = sAdventureSetting.getBaseRewardRatio();
|
||||
float[][] randomRewardRatio = sAdventureSetting.getRandomRewardRatio();
|
||||
float[] hourRewardRatio = sAdventureSetting.getHourRewardRatio();
|
||||
|
||||
int totalForce =adventureStateInfo.getTotalForce();
|
||||
int myRecommendHeroSize =adventureStateInfo.getMyRecommendHeroSize();
|
||||
float myForceRatio = totalForce*1.0f / recommendForce;
|
||||
|
||||
float hourRewardRatioTmp = MathUtils.calABX(hourDuration, hourRewardRatio);
|
||||
float baseRewardRatioTmp = calRatio(myForceRatio, baseRewardRatio) * hourRewardRatioTmp;
|
||||
float randomRewardRatioTmp = calRatio(myForceRatio, randomRewardRatio) * hourRewardRatioTmp;
|
||||
int[] baseRewardGroup = sAdventureConfig.getBaseRewardGroup();
|
||||
int[][] recommendRewardGroup = sAdventureConfig.getRecommendRewardGroup();
|
||||
int[] randomRewardGroup = sAdventureConfig.getRandomRewardGroup();
|
||||
Map<int[],Float> dropInfoMap = new HashMap<>();
|
||||
dropInfoMap.put(baseRewardGroup,baseRewardRatioTmp);
|
||||
dropInfoMap.put(randomRewardGroup,randomRewardRatioTmp);
|
||||
if(myRecommendHeroSize>0){
|
||||
int[] recommendRewardGroupDetail = recommendRewardGroup[myRecommendHeroSize - 1];
|
||||
for(int i=0;i<recommendRewardGroupDetail.length;i=i+2){
|
||||
int hourLimit = recommendRewardGroupDetail[i];
|
||||
if(hourDuration<=hourLimit){
|
||||
dropInfoMap.put(new int[]{recommendRewardGroupDetail[i+1]},1.0f);
|
||||
break;
|
||||
for(AdventureStateInfo adventureStateInfoTmp:adventureStateInfoMap.values()){
|
||||
int positionTmp = adventureStateInfoTmp.getPosition();
|
||||
if(position!=0 && positionTmp!=position){
|
||||
continue;
|
||||
}
|
||||
int startTime = adventureStateInfoTmp.getStartTime();
|
||||
int times = (now - startTime)%60;
|
||||
int size = adventureStateInfoTmp.getHeroIds().size();
|
||||
if(times>0){
|
||||
adventureStateInfoTmp.setStartTime(startTime+times*60);
|
||||
SAdventureConfig sAdventureConfig = SAdventureConfig.getSAdventureConfigByPosition(positionTmp);
|
||||
int leaveBonus = sAdventureConfig.getLeaveBonus();
|
||||
if(!isOnLine){
|
||||
times = times>leaveBonus?leaveBonus:times;
|
||||
}
|
||||
int baseRewardGroup[] = sAdventureConfig.getBaseRewardGroup();
|
||||
float rewardRation = calRation(size,sAdventureConfig.getNumIncome());
|
||||
tempDropRation.put(baseRewardGroup,rewardRation * times);
|
||||
adventureManager.updateTemp(sAdventureConfig.getRandomRewardGroup(),rewardRation*times);
|
||||
}
|
||||
}
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, dropInfoMap);
|
||||
//清除占领
|
||||
adventureManager.clearStation(position);
|
||||
FightInfoProto.TakeAventureRewardResponse response = FightInfoProto.TakeAventureRewardResponse.newBuilder().setDrop(drop).build();
|
||||
|
||||
//发送成功
|
||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.ADVENTURE_REWARD_RESPONSE_VALUE,response,true);
|
||||
if(!isOnLine){
|
||||
tempDropRation.putAll(adventureManager.getTempDropRation());
|
||||
adventureManager.clearTemp();
|
||||
}
|
||||
return ItemUtil.drop(user, tempDropRation);
|
||||
}
|
||||
|
||||
public float calRatio(float value,float[][] base){
|
||||
float result = 0;
|
||||
for(int i=0;i< base.length;i++){
|
||||
float weight = base[i][0];
|
||||
if(value>= weight){
|
||||
result = base[i][1];
|
||||
private float calRation(float source,float[][] rationInfos){
|
||||
float result = 0.0f;
|
||||
for(float[] item : rationInfos){
|
||||
float num = item[0];
|
||||
float value = item[1];
|
||||
if(source<num){
|
||||
break;
|
||||
}
|
||||
result = value;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -542,12 +542,12 @@ public class HeroLogic {
|
|||
|
||||
|
||||
|
||||
public void recyleHeroBySystem(User user,Set<String> removeHeroIds){
|
||||
public void recyleHeroBySystem(User user,Set<String> removeHeroIds) throws Exception {
|
||||
HeroManager heroManager = user.getHeroManager();
|
||||
for(String useHeroId : removeHeroIds){
|
||||
heroManager.removeHero(useHeroId);
|
||||
}
|
||||
|
||||
CombatLogic.getInstance().calAdventureRewardByHeroChange(user,removeHeroIds);
|
||||
}
|
||||
|
||||
//初始属性*(1+化境增长)*等级系数 + 初始属性*突破系数
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.ljsd.jieling.thread;
|
||||
|
||||
import com.ljsd.jieling.thread.task.MinuteJob;
|
||||
import com.ljsd.jieling.thread.task.PlatConfigureTask;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -64,9 +63,6 @@ public class ThreadManager {
|
|||
|
||||
// testTask 已秒为单位 延迟10s, 间隔30s为周期执行
|
||||
scheduledExecutor.scheduleAtFixedRate(platConfigureTask, 10, PlatConfigureTask.SLEEP_INTEVAL_TIME, TimeUnit.SECONDS);
|
||||
long diff = now/1000 % 60 ;
|
||||
scheduledExecutor.scheduleAtFixedRate(new MinuteJob(), 60 - diff, 60, TimeUnit.SECONDS);
|
||||
LOGGER.info("All Task running ...");
|
||||
}
|
||||
|
||||
public ScheduledThreadPoolExecutor getScheduledExecutor() {
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
package com.ljsd.jieling.thread.task;
|
||||
|
||||
|
||||
import com.ljsd.jieling.logic.fight.CombatLogic;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class MinuteJob extends Thread {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(MinuteJob.class);
|
||||
public MinuteJob(){
|
||||
super("minute-job-thread");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
LOGGER.info("MinuteJob start working");
|
||||
CombatLogic.getInstance().checkAdventureFlush();
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("the exception={}",e);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -90,17 +90,11 @@ public class CBean2Proto {
|
|||
return mailProto;
|
||||
}
|
||||
|
||||
public static CommonProto.AdventureStateInfo getAdventureStateInfo(AdventureStateInfo adventureStateInfo,int position,int allowTime){
|
||||
CommonProto.AdventureStateInfo.Builder builder = CommonProto.AdventureStateInfo.newBuilder().setAllowTime(allowTime).setPositionId(position);
|
||||
public static CommonProto.AdventureStateInfo getAdventureStateInfo(AdventureStateInfo adventureStateInfo,int position){
|
||||
CommonProto.AdventureStateInfo.Builder builder = CommonProto.AdventureStateInfo.newBuilder().setPositionId(position);
|
||||
if(adventureStateInfo!=null){
|
||||
int startTime = adventureStateInfo.getStartTime();
|
||||
int now = (int)(System.currentTimeMillis()/1000);
|
||||
int hourDuration = adventureStateInfo.getHourDuration();
|
||||
int remainTime = startTime + hourDuration*60*60 - now;
|
||||
remainTime = remainTime<0?0:remainTime;
|
||||
builder.addAllHeroIdList(adventureStateInfo.getHeroIds())
|
||||
.setHourDuration(hourDuration)
|
||||
.setRemainTime(remainTime);
|
||||
builder.addAllHeroIdList(adventureStateInfo.getHeroIds()).setStartTime(startTime);
|
||||
}
|
||||
return builder.build();
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import com.ljsd.jieling.handler.map.MapManager;
|
|||
import com.ljsd.jieling.handler.map.TemporaryItems;
|
||||
import com.ljsd.jieling.logic.dao.*;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.item.ItemLogic;
|
||||
import com.ljsd.jieling.logic.fight.CombatLogic;
|
||||
import com.ljsd.jieling.protocols.CommonProto;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -495,6 +495,7 @@ public class ItemUtil {
|
|||
if (itemMap == null) {
|
||||
return true;
|
||||
}
|
||||
CombatLogic.getInstance().calAdvenrureReward(user,true,0);
|
||||
TemporaryItems temporaryItems = user.getMapManager().getTemporaryItems();
|
||||
Map<Integer, Item> temporaryItemList = new HashMap<>();
|
||||
if (temporaryItems != null) {
|
||||
|
|
Loading…
Reference in New Issue