mission
parent
0b4b87a003
commit
89716f3c90
|
@ -3,6 +3,9 @@ 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 ="TaskConfig")
|
||||
|
@ -20,10 +23,22 @@ public class STaskConfig implements BaseConfig {
|
|||
|
||||
private static Map<Integer,STaskConfig> sTaskConfigMap;
|
||||
|
||||
private static Map<Integer, List<STaskConfig>> sTaskConfigByTypeMap;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
sTaskConfigMap = STableManager.getConfig(STaskConfig.class);
|
||||
Map<Integer, STaskConfig> config = STableManager.getConfig(STaskConfig.class);
|
||||
Map<Integer, List<STaskConfig>> configTmp = new HashMap<>();
|
||||
for(STaskConfig sTaskConfig : config.values()){
|
||||
int taskType = sTaskConfig.getTaskType();
|
||||
if(!configTmp.containsKey(taskType)){
|
||||
configTmp.put(taskType,new ArrayList<>());
|
||||
}
|
||||
configTmp.get(taskType).add(sTaskConfig);
|
||||
}
|
||||
sTaskConfigMap = config;
|
||||
sTaskConfigByTypeMap = configTmp;
|
||||
|
||||
}
|
||||
|
||||
|
@ -31,6 +46,10 @@ public class STaskConfig implements BaseConfig {
|
|||
return sTaskConfigMap.get(missionId);
|
||||
}
|
||||
|
||||
public static List<STaskConfig> getsTaskConfigByType(int type) {
|
||||
return sTaskConfigByTypeMap.get(type);
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.ljsd.jieling.globals;
|
|||
|
||||
public interface Global {
|
||||
int STAMINA = 2; // 体力id
|
||||
int GEM = 16; // 妖精id
|
||||
int SEND_CARD_COUNT = 20; // 每页发送卡牌个数
|
||||
int SEND_ITEM_COUNT = 200; // 每页发送道具个数
|
||||
int SEND_EQUIP_COUNT = 20; // 每页发送装备个数
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.ljsd.jieling.logic.dao;
|
||||
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.logic.mission.MissionType;
|
||||
import com.ljsd.jieling.logic.mission.data.DataManagerDistributor;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
@ -8,14 +8,13 @@ import java.util.Map;
|
|||
|
||||
public class CumulationData {
|
||||
|
||||
// key:itemid,value 数量
|
||||
private Map<Integer,Integer> consumeMaterialMap = new HashMap<>(); // 消耗材料
|
||||
|
||||
//获取材料
|
||||
// private Map<Integer,Integer> getMaterialMap = new HashMap<>();
|
||||
|
||||
//key: 抽卡类型 value 抽卡次数
|
||||
private Map<Integer,Integer> randomCountMap = new HashMap<>(); // 抽卡次数统计
|
||||
// private Map<Integer,Integer> randomCountMap = new HashMap<>(); // 抽卡次数统计
|
||||
|
||||
public int recruitmentRands; //群英征募 群英招募次数
|
||||
|
||||
|
||||
/**
|
||||
|
@ -41,9 +40,8 @@ public class CumulationData {
|
|||
|
||||
/**
|
||||
* 获得某品质装备数量
|
||||
* key:equipTid value:数量
|
||||
*/
|
||||
private Map<Integer,Integer> sEquipCountMap=new HashMap<>(); // 装备数量统计
|
||||
private int[] sEquipQualityCount =new int[5]; // 装备数量统计
|
||||
|
||||
private int secretRandomCount; // 抽取秘盒次数
|
||||
|
||||
|
@ -53,39 +51,44 @@ public class CumulationData {
|
|||
|
||||
private int arenaScore;
|
||||
|
||||
private int consumeGem ;
|
||||
|
||||
public void updateData(GameEvent gameEvent, Object...parm) throws Exception {
|
||||
DataManagerDistributor.updateData(this, gameEvent,parm);
|
||||
|
||||
public Result updateData(MissionType missionType, Object...parm) throws Exception {
|
||||
return DataManagerDistributor.updateData(this, missionType,parm);
|
||||
}
|
||||
|
||||
public static class Result {
|
||||
public MissionType subType;
|
||||
public int param;
|
||||
public Map<Integer, Map<Integer, Integer>> param2;
|
||||
public long value;
|
||||
|
||||
public Result(MissionType subType) {
|
||||
this.subType = subType;
|
||||
}
|
||||
|
||||
public Result(MissionType subType, long value) {
|
||||
this.subType = subType;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public Result(MissionType subType, int param, long value) {
|
||||
this.subType = subType;
|
||||
this.param = param;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
|
||||
public Map<Integer, Integer> getConsumeMaterialMap() {
|
||||
return consumeMaterialMap;
|
||||
}
|
||||
|
||||
public void setConsumeMaterialMap(Map<Integer, Integer> consumeMaterialMap) {
|
||||
this.consumeMaterialMap = consumeMaterialMap;
|
||||
}
|
||||
|
||||
public Map<Integer, Integer> getRandomCountMap() {
|
||||
return randomCountMap;
|
||||
}
|
||||
|
||||
public void setRandomCountMap(Map<Integer, Integer> randomCountMap) {
|
||||
this.randomCountMap = randomCountMap;
|
||||
public Result(MissionType subType, Map<Integer, Map<Integer, Integer>> param2) {
|
||||
this.subType = subType;
|
||||
this.param2 = param2;
|
||||
}
|
||||
}
|
||||
|
||||
public Map<Integer, Integer> getsHeroCountMap() {
|
||||
return sHeroCountMap;
|
||||
}
|
||||
|
||||
public void setsHeroCountMap(Map<Integer, Integer> sHeroCountMap) {
|
||||
this.sHeroCountMap = sHeroCountMap;
|
||||
}
|
||||
|
||||
public Map<Integer, Integer> getStoryFightCountMap() {
|
||||
return storyFightCountMap;
|
||||
|
@ -95,14 +98,6 @@ public class CumulationData {
|
|||
this.storyFightCountMap = storyFightCountMap;
|
||||
}
|
||||
|
||||
public Map<Integer, Integer> getsEquipCountMap() {
|
||||
return sEquipCountMap;
|
||||
}
|
||||
|
||||
public void setsEquipCountMap(Map<Integer, Integer> sEquipCountMap) {
|
||||
this.sEquipCountMap = sEquipCountMap;
|
||||
}
|
||||
|
||||
public int getSecretRandomCount() {
|
||||
return secretRandomCount;
|
||||
}
|
||||
|
@ -138,4 +133,16 @@ public class CumulationData {
|
|||
public void setArenaScore(int arenaScore) {
|
||||
this.arenaScore = arenaScore;
|
||||
}
|
||||
|
||||
public int getConsumeGem() {
|
||||
return consumeGem;
|
||||
}
|
||||
|
||||
public void setConsumeGem(int consumeGem) {
|
||||
this.consumeGem = consumeGem;
|
||||
}
|
||||
|
||||
public void updateEquipQuality(int quality ){
|
||||
sEquipQualityCount[quality-1]=sEquipQualityCount[quality-1]+1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.ljsd.jieling.config.SVipLevelConfig;
|
|||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.logic.mission.GameMisionType;
|
||||
import com.ljsd.jieling.logic.mission.MissionType;
|
||||
import com.ljsd.jieling.logic.mission.event.MissionEventDistributor;
|
||||
import com.ljsd.jieling.logic.mission.main.MissionStateChangeInfo;
|
||||
import com.ljsd.jieling.logic.mission.main.VipMissionIdsType;
|
||||
|
@ -18,14 +19,14 @@ public class UserMissionManager extends MongoBase {
|
|||
//数据累加项
|
||||
private CumulationData cumulationData = new CumulationData();
|
||||
|
||||
public void openMission(GameEvent event, Object... parm){
|
||||
public void openMission(User user,GameEvent event, Object... parm){
|
||||
switch (event){
|
||||
case VIP_LEVLUP:{
|
||||
int vipLevle= (int)parm[0];
|
||||
SVipLevelConfig sVipLevelConfig = SVipLevelConfig.getsVipLevelConfigMap().get(vipLevle);
|
||||
int[] openRules = sVipLevelConfig.getOpenRules();
|
||||
for(int missionId:openRules){
|
||||
vipMissionIdsType.openMission(missionId);
|
||||
vipMissionIdsType.openMission(user,missionId);
|
||||
}
|
||||
updateString("vipMissionIdsType",vipMissionIdsType);
|
||||
}
|
||||
|
@ -47,11 +48,13 @@ public class UserMissionManager extends MongoBase {
|
|||
|
||||
|
||||
|
||||
public void calCumulationDataResult(User user,GameEvent gameEvent, Map<GameMisionType, List<MissionStateChangeInfo>> missionTypeEnumListMap , Object...parm) throws Exception {
|
||||
cumulationData.updateData(gameEvent,parm);
|
||||
vipMissionIdsType.calCumulationDataResult(user,missionTypeEnumListMap.get(GameMisionType.VIPMISSION),cumulationData);
|
||||
updateString("cumulationData",cumulationData);
|
||||
updateString("vipMissionIdsType",vipMissionIdsType);
|
||||
public void calCumulationDataResult(User user, MissionType missionType, Map<GameMisionType, List<MissionStateChangeInfo>> missionTypeEnumListMap , Object...parm) throws Exception {
|
||||
CumulationData.Result result = cumulationData.updateData(missionType, parm);
|
||||
if(result!=null){
|
||||
vipMissionIdsType.calCumulationDataResult(user,result,missionTypeEnumListMap.get(GameMisionType.VIPMISSION),cumulationData);
|
||||
updateString("cumulationData",cumulationData);
|
||||
updateString("vipMissionIdsType",vipMissionIdsType);
|
||||
}
|
||||
}
|
||||
|
||||
public VipMissionIdsType getVipMissionIdsType() {
|
||||
|
|
|
@ -143,7 +143,7 @@ public class MissionLoigc {
|
|||
case USER_FORCE:
|
||||
count = user.getPlayerInfoManager().getMaxForce();
|
||||
break;
|
||||
case USER_CONSUMER_MATERIAL:
|
||||
case USER_CONSUMER_GEM:
|
||||
count=cumulationData.getConsumeMaterialMap().get(missionSubType);
|
||||
break;
|
||||
case USER_WORKSHOP_LEVEL:
|
||||
|
|
|
@ -14,7 +14,7 @@ public enum MissionType {
|
|||
|
||||
USER_LEVEL(9), // 玩家等级 玩家等级
|
||||
USER_FORCE(10), // 战力评分 玩家战力达到一定目标
|
||||
USER_CONSUMER_MATERIAL(11), // 累计消耗元宝 玩家累计消耗元宝数量
|
||||
USER_CONSUMER_GEM(11), // 累计消耗元宝 玩家累计消耗元宝数量
|
||||
USER_WORKSHOP_LEVEL(12), // 炼造等级 玩家炼造等级
|
||||
USER_GET_EQUIP_QUALITY(13), //获得某品质装备数量 玩家累计获得传说、史诗等品质装备的数量
|
||||
|
||||
|
@ -31,10 +31,14 @@ public enum MissionType {
|
|||
|
||||
;
|
||||
|
||||
private int missionId;
|
||||
private int missionType;
|
||||
|
||||
private MissionType(int missionId) {
|
||||
this.missionId = missionId;
|
||||
public int getMissionTypeValue() {
|
||||
return missionType;
|
||||
}
|
||||
|
||||
private MissionType(int missionType) {
|
||||
this.missionType = missionType;
|
||||
}
|
||||
|
||||
public static MissionType findByMissionId(int missionTypeId){
|
||||
|
@ -60,7 +64,7 @@ public enum MissionType {
|
|||
case 10:
|
||||
return USER_FORCE;
|
||||
case 11:
|
||||
return USER_CONSUMER_MATERIAL;
|
||||
return USER_CONSUMER_GEM;
|
||||
case 12:
|
||||
return USER_WORKSHOP_LEVEL;
|
||||
case 13:
|
||||
|
|
|
@ -1,17 +1,23 @@
|
|||
package com.ljsd.jieling.logic.mission.data;
|
||||
|
||||
import com.ljsd.jieling.logic.dao.CumulationData;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.logic.mission.MissionType;
|
||||
|
||||
public class ArenaChallengeManager implements BaseDataManager{
|
||||
@Override
|
||||
public void updateData(CumulationData data, GameEvent gameEvent, Object... parm) {
|
||||
//int fightResult = (int)parm[0];
|
||||
int myscore = (int)parm[1];
|
||||
data.setArenaFightNums(data.getArenaFightNums()+1);
|
||||
if(myscore > data.getArenaScore()){
|
||||
data.setArenaScore(myscore);
|
||||
public CumulationData.Result updateData(CumulationData data, MissionType missionType, Object... parm) {
|
||||
CumulationData.Result result = null;
|
||||
if(missionType == MissionType.ARENA_CHALLENEGE_NUMS){
|
||||
data.setArenaFightNums(data.getArenaFightNums()+1);
|
||||
result = new CumulationData.Result(missionType);
|
||||
}else if(missionType == MissionType.ARENA_SCORE){
|
||||
int myscore = (int)parm[1];
|
||||
if(myscore > data.getArenaScore()){
|
||||
data.setArenaScore(myscore);
|
||||
result = new CumulationData.Result(missionType);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,8 @@ package com.ljsd.jieling.logic.mission.data;
|
|||
|
||||
import com.ljsd.jieling.logic.dao.CumulationData;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.logic.mission.MissionType;
|
||||
|
||||
public interface BaseDataManager {
|
||||
public void updateData(CumulationData data, GameEvent gameEvent, Object ...parm);
|
||||
public CumulationData.Result updateData(CumulationData data, MissionType missionType, Object ...parm);
|
||||
}
|
||||
|
|
|
@ -1,23 +1,25 @@
|
|||
package com.ljsd.jieling.logic.mission.data;
|
||||
|
||||
|
||||
import com.ljsd.jieling.globals.Global;
|
||||
import com.ljsd.jieling.logic.dao.CumulationData;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.logic.mission.MissionType;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class ConsumerMaterialDataManager implements BaseDataManager{
|
||||
@Override
|
||||
public void updateData(CumulationData data, GameEvent gameEvent, Object... parm) {
|
||||
public CumulationData.Result updateData(CumulationData data, MissionType missionType, Object... parm) {
|
||||
CumulationData.Result result = null;
|
||||
Map<Integer, Integer> consumeMaterialMapTmp = (Map<Integer, Integer>) parm[0];
|
||||
Map<Integer, Integer> consumeMaterialMap = data.getConsumeMaterialMap();
|
||||
for(Map.Entry<Integer,Integer> item : consumeMaterialMapTmp.entrySet()){
|
||||
int count =item.getValue();
|
||||
Integer itemId = item.getKey();
|
||||
Integer cacheCount = consumeMaterialMap.get(itemId);
|
||||
if(cacheCount!=null){
|
||||
count += cacheCount;
|
||||
if(missionType == MissionType.USER_CONSUMER_GEM){
|
||||
Integer count = consumeMaterialMapTmp.get(Global.GEM);
|
||||
if(count!=null){
|
||||
data.setConsumeGem(data.getConsumeGem() + count);
|
||||
result = new CumulationData.Result(missionType);
|
||||
}
|
||||
consumeMaterialMap.put(itemId,count);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,29 +1,53 @@
|
|||
package com.ljsd.jieling.logic.mission.data;
|
||||
|
||||
import com.ljsd.jieling.logic.dao.CumulationData;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.logic.mission.MissionType;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class DataManagerDistributor {
|
||||
private static Map<GameEvent, BaseDataManager> judges = new HashMap<>();
|
||||
private static Map<MissionType, BaseDataManager> judges = new HashMap<>();
|
||||
|
||||
public static void init(){
|
||||
judges.put(GameEvent.RANDOM_HERO,new RandomHeroDataManager());
|
||||
judges.put(GameEvent.GET_HERO,new GetHeroManager());
|
||||
judges.put(GameEvent.HERO_LEVEL_UP,new HeroLevelUpManager());
|
||||
judges.put(GameEvent.ARENA_CHALLENGE,new ArenaChallengeManager());
|
||||
judges.put(GameEvent.CONSUMER_MATERIAL,new ConsumerMaterialDataManager());
|
||||
judges.put(GameEvent.GET_EQUIP,new GetEquipDataManager());
|
||||
judges.put(GameEvent.KILLINVASIONBOSS,new KillInvasionBossDataManager());
|
||||
judges.put(MissionType.RECRUITMENT_RANDOM_HEROES,new RandomHeroDataManager());
|
||||
judges.put(MissionType.COLLECT_QUALITY_HERO,new GetHeroManager());
|
||||
judges.put(MissionType.HERO_LEVLE_COUNT,new HeroLevelUpManager());
|
||||
|
||||
|
||||
judges.put(MissionType.POKEMON_ADVANCED,new DefaultDataManager());
|
||||
judges.put(MissionType.POKEMON_FORCE ,new DefaultDataManager());
|
||||
judges.put(MissionType.POKEMON_ALL_FORCE ,new DefaultDataManager());
|
||||
|
||||
judges.put(MissionType.ARENA_CHALLENEGE_NUMS,new ArenaChallengeManager());
|
||||
judges.put(MissionType.ARENA_SCORE,new ArenaChallengeManager());
|
||||
|
||||
judges.put(MissionType.USER_LEVEL,new DefaultDataManager());
|
||||
judges.put(MissionType.USER_FORCE,new DefaultDataManager());
|
||||
|
||||
judges.put(MissionType.USER_CONSUMER_GEM,new DefaultDataManager());
|
||||
|
||||
judges.put(MissionType.USER_WORKSHOP_LEVEL,new DefaultDataManager());
|
||||
|
||||
judges.put(MissionType.USER_GET_EQUIP_QUALITY,new GetEquipDataManager());
|
||||
|
||||
judges.put(MissionType.LEVEL_STORY_PASS,new DefaultDataManager());
|
||||
judges.put(MissionType.GENERAL_STORY_PASS,new DefaultDataManager());
|
||||
judges.put(MissionType.HERO_STORY_PASS,new DefaultDataManager());
|
||||
|
||||
judges.put(MissionType.KILL_INVASIONBOSS,new KillInvasionBossDataManager());
|
||||
judges.put(MissionType.SECRETBOX_TIMES,new SecretboxRandomManager());
|
||||
judges.put(MissionType.EQUIP_FORCE_NUMS,new DefaultDataManager());
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static void updateData(CumulationData data, GameEvent type, Object...parm) throws Exception {
|
||||
BaseDataManager updater = judges.get(type);
|
||||
public static CumulationData.Result updateData(CumulationData data, MissionType missionType, Object...parm) throws Exception {
|
||||
BaseDataManager updater = judges.get(missionType);
|
||||
if(updater==null){
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
updater.updateData(data, type,parm);
|
||||
return updater.updateData(data, missionType,parm);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
package com.ljsd.jieling.logic.mission.data;
|
||||
|
||||
import com.ljsd.jieling.logic.dao.CumulationData;
|
||||
import com.ljsd.jieling.logic.mission.MissionType;
|
||||
|
||||
public class DefaultDataManager implements BaseDataManager{
|
||||
@Override
|
||||
public CumulationData.Result updateData(CumulationData data, MissionType missionType, Object... parm) {
|
||||
return new CumulationData.Result(missionType);
|
||||
}
|
||||
}
|
|
@ -1,19 +1,20 @@
|
|||
package com.ljsd.jieling.logic.mission.data;
|
||||
|
||||
import com.ljsd.jieling.config.SEquipConfig;
|
||||
import com.ljsd.jieling.logic.dao.CumulationData;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.logic.mission.MissionType;
|
||||
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class GetEquipDataManager implements BaseDataManager{
|
||||
@Override
|
||||
public void updateData(CumulationData data, GameEvent gameEvent, Object... parm) {
|
||||
Map<Integer, Integer> equipCountMap = data.getsEquipCountMap();
|
||||
public CumulationData.Result updateData(CumulationData data, MissionType missionType, Object... parm) {
|
||||
CumulationData.Result result = null;
|
||||
int equipTid = (int)parm[0];
|
||||
Integer count = equipCountMap.get(equipTid);
|
||||
if(count == null){
|
||||
count =0;
|
||||
if(missionType == MissionType.USER_GET_EQUIP_QUALITY){
|
||||
data.updateEquipQuality(SEquipConfig.getsEquipConfigById(equipTid).getQuality());
|
||||
result = new CumulationData.Result(missionType);
|
||||
}
|
||||
equipCountMap.put(equipTid,count+1);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,13 +2,13 @@ package com.ljsd.jieling.logic.mission.data;
|
|||
|
||||
|
||||
import com.ljsd.jieling.logic.dao.CumulationData;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.logic.mission.MissionType;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class GetHeroManager implements BaseDataManager {
|
||||
@Override
|
||||
public void updateData(CumulationData data, GameEvent gameEvent, Object ...parm) {
|
||||
public CumulationData.Result updateData(CumulationData data, MissionType missionType, Object ...parm) {
|
||||
Map<Integer, Integer> sHeroCountMap = data.getsHeroCountMap();
|
||||
int count =1;
|
||||
int heroTid = (int)parm[0];
|
||||
|
@ -17,5 +17,6 @@ public class GetHeroManager implements BaseDataManager {
|
|||
count+=sHeroCountMap.get(heroTid);
|
||||
}
|
||||
sHeroCountMap.put(heroTid,count);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
package com.ljsd.jieling.logic.mission.data;
|
||||
|
||||
import com.ljsd.jieling.logic.dao.CumulationData;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.logic.mission.MissionType;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class HeroLevelUpManager implements BaseDataManager{
|
||||
@Override
|
||||
public void updateData(CumulationData data, GameEvent gameEvent, Object... parm) {
|
||||
public CumulationData.Result updateData(CumulationData data, MissionType missionType, Object... parm) {
|
||||
int oldLevle = (int)parm[0];
|
||||
int newLevle = (int)parm[1];
|
||||
Map<Integer, Integer> heroLevleCountMap = data.getHeroLevleCountMap();
|
||||
|
@ -17,6 +17,8 @@ public class HeroLevelUpManager implements BaseDataManager{
|
|||
count=0;
|
||||
}
|
||||
heroLevleCountMap.put(oldLevle,count+1);
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
package com.ljsd.jieling.logic.mission.data;
|
||||
|
||||
import com.ljsd.jieling.logic.dao.CumulationData;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.logic.mission.MissionType;
|
||||
|
||||
public class KillInvasionBossDataManager implements BaseDataManager{
|
||||
@Override
|
||||
public void updateData(CumulationData data, GameEvent gameEvent, Object... parm) {
|
||||
public CumulationData.Result updateData(CumulationData data, MissionType missionType, Object... parm) {
|
||||
data.setKillInvasionbossCount(data.getKillInvasionbossCount() +1);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,19 +1,16 @@
|
|||
package com.ljsd.jieling.logic.mission.data;
|
||||
|
||||
import com.ljsd.jieling.logic.dao.CumulationData;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
|
||||
import java.util.Map;
|
||||
import com.ljsd.jieling.logic.mission.MissionType;
|
||||
|
||||
public class RandomHeroDataManager implements BaseDataManager{
|
||||
@Override
|
||||
public void updateData(CumulationData data, GameEvent gameEvent, Object... parm) {
|
||||
Map<Integer, Integer> randomCountMap = data.getRandomCountMap();
|
||||
int randomType = (int)parm[0];
|
||||
public CumulationData.Result updateData(CumulationData data, MissionType missionType, Object... parm) {
|
||||
int count =(int)parm[1];
|
||||
if(randomCountMap.containsKey(randomType)){
|
||||
count += randomCountMap.get(randomType);
|
||||
CumulationData.Result result = null;
|
||||
if(missionType == MissionType.RECRUITMENT_RANDOM_HEROES){
|
||||
result = new CumulationData.Result(missionType, ++data.recruitmentRands);
|
||||
}
|
||||
randomCountMap.put(randomType,count);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
package com.ljsd.jieling.logic.mission.data;
|
||||
|
||||
|
||||
import com.ljsd.jieling.logic.dao.CumulationData;
|
||||
import com.ljsd.jieling.logic.mission.MissionType;
|
||||
|
||||
public class SecretboxRandomManager implements BaseDataManager{
|
||||
@Override
|
||||
public CumulationData.Result updateData(CumulationData data, MissionType missionType, Object... parm) {
|
||||
data.setSecretRandomCount(data.getSecretRandomCount() + (int)parm[0]);
|
||||
return new CumulationData.Result(missionType);
|
||||
}
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
package com.ljsd.jieling.logic.mission.event;
|
||||
|
||||
import com.ljsd.jieling.logic.dao.UserMissionManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.logic.mission.GameMisionType;
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.ljsd.jieling.logic.mission.event;
|
|||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.logic.mission.GameMisionType;
|
||||
import com.ljsd.jieling.logic.mission.MissionType;
|
||||
import com.ljsd.jieling.logic.mission.main.MissionStateChangeInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -11,6 +12,9 @@ import java.util.Map;
|
|||
public class CumulationDataEventProcessor implements BaseGameEventProcessor{
|
||||
@Override
|
||||
public void onGameEvent(User user, Map<GameMisionType, List<MissionStateChangeInfo>> misionTypeListMap, GameEvent event, Object... parm) throws Exception {
|
||||
user.getUserMissionManager().calCumulationDataResult(user,event,misionTypeListMap,parm);
|
||||
List<MissionType> typeList = MissionEventDistributor.eventEnumListMap.get(event);
|
||||
for (MissionType type : typeList) {
|
||||
user.getUserMissionManager().calCumulationDataResult(user,type,misionTypeListMap,parm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,10 +4,7 @@ import com.ljsd.jieling.config.STaskConfig;
|
|||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.UserMissionManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.logic.mission.GameMisionType;
|
||||
import com.ljsd.jieling.logic.mission.MissionLoigc;
|
||||
import com.ljsd.jieling.logic.mission.MissionState;
|
||||
import com.ljsd.jieling.logic.mission.*;
|
||||
import com.ljsd.jieling.logic.mission.main.MissionStateChangeInfo;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.CommonProto;
|
||||
|
@ -28,23 +25,93 @@ import java.util.Map;
|
|||
public class MissionEventDistributor {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(MissionEventDistributor.class);
|
||||
private static Map<GameEvent, BaseGameEventProcessor> eventProcessor = new HashMap<>();
|
||||
protected static Map<GameEvent, List<MissionType>> eventEnumListMap = new HashMap<>();
|
||||
|
||||
public static void init(){
|
||||
List<MissionType> typeList = new ArrayList<>();
|
||||
eventProcessor.put(GameEvent.VIP_LEVLUP,new VipLevelUpEventProces());
|
||||
eventProcessor.put(GameEvent.STORY_FIGHT,new StoryFightEventProcessor());
|
||||
|
||||
typeList.add(MissionType.RECRUITMENT_RANDOM_HEROES);
|
||||
eventEnumListMap.put(GameEvent.RANDOM_HERO,typeList);
|
||||
eventProcessor.put(GameEvent.RANDOM_HERO,new CumulationDataEventProcessor());
|
||||
|
||||
typeList = new ArrayList<>();
|
||||
typeList.add(MissionType.COLLECT_QUALITY_HERO);
|
||||
eventEnumListMap.put(GameEvent.GET_HERO,typeList);
|
||||
eventProcessor.put(GameEvent.GET_HERO,new CumulationDataEventProcessor());
|
||||
|
||||
|
||||
|
||||
typeList = new ArrayList<>();
|
||||
typeList.add(MissionType.HERO_LEVLE_COUNT);
|
||||
eventEnumListMap.put(GameEvent.HERO_LEVEL_UP,typeList);
|
||||
eventProcessor.put(GameEvent.HERO_LEVEL_UP,new CumulationDataEventProcessor());
|
||||
|
||||
typeList = new ArrayList<>();
|
||||
typeList.add(MissionType.POKEMON_ADVANCED);
|
||||
eventEnumListMap.put(GameEvent.POKEMON_ADVANCED,typeList);
|
||||
eventProcessor.put(GameEvent.POKEMON_ADVANCED,new CumulationDataEventProcessor());
|
||||
|
||||
typeList = new ArrayList<>();
|
||||
typeList.add(MissionType.POKEMON_FORCE);
|
||||
typeList.add(MissionType.POKEMON_ALL_FORCE);
|
||||
eventEnumListMap.put(GameEvent.POKEMON_UPLEVEL,typeList);
|
||||
eventProcessor.put(GameEvent.POKEMON_UPLEVEL,new CumulationDataEventProcessor());
|
||||
|
||||
typeList = new ArrayList<>();
|
||||
typeList.add(MissionType.ARENA_CHALLENEGE_NUMS);
|
||||
typeList.add(MissionType.ARENA_SCORE);
|
||||
eventEnumListMap.put(GameEvent.ARENA_CHALLENGE,typeList);
|
||||
eventProcessor.put(GameEvent.ARENA_CHALLENGE,new CumulationDataEventProcessor());
|
||||
|
||||
|
||||
typeList = new ArrayList<>();
|
||||
typeList.add(MissionType.USER_LEVEL);
|
||||
eventEnumListMap.put(GameEvent.USER_LEVELUP,typeList);
|
||||
eventProcessor.put(GameEvent.USER_LEVELUP,new CumulationDataEventProcessor());
|
||||
|
||||
typeList = new ArrayList<>();
|
||||
typeList.add(MissionType.USER_FORCE);
|
||||
eventEnumListMap.put(GameEvent.USER_FORCE_CHANGE,typeList);
|
||||
eventProcessor.put(GameEvent.USER_FORCE_CHANGE,new CumulationDataEventProcessor());
|
||||
|
||||
typeList = new ArrayList<>();
|
||||
typeList.add(MissionType.USER_CONSUMER_GEM);
|
||||
eventEnumListMap.put(GameEvent.CONSUMER_MATERIAL,typeList);
|
||||
eventProcessor.put(GameEvent.CONSUMER_MATERIAL,new CumulationDataEventProcessor());
|
||||
|
||||
|
||||
typeList = new ArrayList<>();
|
||||
typeList.add(MissionType.USER_WORKSHOP_LEVEL);
|
||||
eventEnumListMap.put(GameEvent.WORKSHOP_LEVELUP,typeList);
|
||||
eventProcessor.put(GameEvent.WORKSHOP_LEVELUP,new CumulationDataEventProcessor());
|
||||
|
||||
typeList = new ArrayList<>();
|
||||
typeList.add(MissionType.USER_GET_EQUIP_QUALITY);
|
||||
typeList.add(MissionType.EQUIP_FORCE_NUMS);
|
||||
eventEnumListMap.put(GameEvent.GET_EQUIP,typeList);
|
||||
eventProcessor.put(GameEvent.GET_EQUIP,new CumulationDataEventProcessor());
|
||||
|
||||
|
||||
typeList = new ArrayList<>();
|
||||
typeList.add(MissionType.LEVEL_STORY_PASS);
|
||||
typeList.add(MissionType.GENERAL_STORY_PASS);
|
||||
typeList.add(MissionType.HERO_STORY_PASS);
|
||||
eventEnumListMap.put(GameEvent.STORY_FIGHT,typeList);
|
||||
eventProcessor.put(GameEvent.STORY_FIGHT,new CumulationDataEventProcessor());
|
||||
|
||||
|
||||
typeList = new ArrayList<>();
|
||||
typeList.add(MissionType.KILL_INVASIONBOSS);
|
||||
eventEnumListMap.put(GameEvent.KILLINVASIONBOSS,typeList);
|
||||
eventProcessor.put(GameEvent.KILLINVASIONBOSS,new CumulationDataEventProcessor());
|
||||
|
||||
|
||||
typeList = new ArrayList<>();
|
||||
typeList.add(MissionType.SECRETBOX_TIMES);
|
||||
eventEnumListMap.put(GameEvent.SECRETBOX,typeList);
|
||||
eventProcessor.put(GameEvent.SECRETBOX,new CumulationDataEventProcessor());
|
||||
|
||||
eventProcessor.put(GameEvent.VIP_MISSION_REWARD,new RewardEventProcessor());
|
||||
}
|
||||
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
package com.ljsd.jieling.logic.mission.event;
|
||||
|
||||
|
||||
import com.ljsd.jieling.logic.dao.UserMissionManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.logic.mission.GameMisionType;
|
||||
import com.ljsd.jieling.logic.mission.main.MissionStateChangeInfo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class StoryFightEventProcessor implements BaseGameEventProcessor {
|
||||
|
||||
@Override
|
||||
public void onGameEvent(User user, Map<GameMisionType, List<MissionStateChangeInfo>> missionTypeEnumListMap, GameEvent event, Object... parm) {
|
||||
|
||||
}
|
||||
}
|
|
@ -12,6 +12,6 @@ import java.util.Map;
|
|||
public class VipLevelUpEventProces implements BaseGameEventProcessor {
|
||||
@Override
|
||||
public void onGameEvent(User user, Map<GameMisionType, List<MissionStateChangeInfo>> missionTypeEnumListMap, GameEvent event, Object... parm) {
|
||||
user.getUserMissionManager().openMission(event, parm);
|
||||
user.getUserMissionManager().openMission(user,event, parm);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ public abstract class AbstractMissionType {
|
|||
//已领取的任务,在可控范围内,使用map存储,利于查找
|
||||
private BitSet rewardedMissionIds = new BitSet(1024);
|
||||
|
||||
public abstract void openMission(int missionId);
|
||||
public abstract void openMission(User user,int missionId);
|
||||
|
||||
public abstract int[] reward(int missionId);
|
||||
|
||||
|
@ -33,7 +33,7 @@ public abstract class AbstractMissionType {
|
|||
missionTypeEnumListMap.add(stateChangeInfo);
|
||||
}
|
||||
|
||||
public abstract void calCumulationDataResult(User user,List<MissionStateChangeInfo> missionStateChangeInfos, CumulationData cumulationData);
|
||||
public abstract void calCumulationDataResult(User user,CumulationData.Result result,List<MissionStateChangeInfo> missionStateChangeInfos, CumulationData cumulationData);
|
||||
|
||||
public boolean checkIsNew(int missionId){
|
||||
if(doingMissionIds.contains(missionId)){
|
||||
|
@ -53,16 +53,11 @@ public abstract class AbstractMissionType {
|
|||
return doingMissionIds;
|
||||
}
|
||||
|
||||
public void addFinishMissionId(int missionId) throws Exception {
|
||||
public void addFinishMissionId(int missionId) {
|
||||
finishMissionIds.add(missionId);
|
||||
}
|
||||
|
||||
public Set<Integer> getFinishMissionIds() {
|
||||
return finishMissionIds;
|
||||
}
|
||||
|
||||
|
||||
public BitSet getRewardedMissionIds() {
|
||||
return rewardedMissionIds;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,11 +16,19 @@ public class VipMissionIdsType extends AbstractMissionType{
|
|||
}
|
||||
|
||||
@Override
|
||||
public void openMission(int missionId) {
|
||||
public void openMission(User user,int missionId) {
|
||||
if(!checkIsNew(missionId)){
|
||||
return;
|
||||
}
|
||||
addDoingMission(missionId);
|
||||
STaskConfig sTaskConfig = STaskConfig.getsTaskConfigById(missionId);
|
||||
boolean isFinish = MissionLoigc.getDoingProgress(user,user.getUserMissionManager().getCumulationData(),sTaskConfig.getTaskType(),sTaskConfig.getTaskValue()[0])>=sTaskConfig.getTaskValue()[1];
|
||||
if(!isFinish){
|
||||
addDoingMission(missionId);
|
||||
}else{
|
||||
addFinishMissionId(missionId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -31,12 +39,17 @@ public class VipMissionIdsType extends AbstractMissionType{
|
|||
|
||||
|
||||
@Override
|
||||
public void calCumulationDataResult(User user,List<MissionStateChangeInfo> missionStateChangeInfos, CumulationData cumulationData) {
|
||||
public void calCumulationDataResult(User user,CumulationData.Result result,List<MissionStateChangeInfo> missionStateChangeInfos, CumulationData cumulationData) {
|
||||
Set<Integer> doingMissionIds = getDoingMissionIds();
|
||||
Iterator<Integer> doingIterator = doingMissionIds.iterator();
|
||||
while (doingIterator.hasNext()){
|
||||
Integer missionId = doingIterator.next();
|
||||
STaskConfig sTaskConfig = STaskConfig.getsTaskConfigById(missionId);
|
||||
List<STaskConfig> sTaskConfigs = STaskConfig.getsTaskConfigByType(result.subType.getMissionTypeValue());
|
||||
if(sTaskConfigs == null){
|
||||
return;
|
||||
}
|
||||
for(STaskConfig sTaskConfig : sTaskConfigs){
|
||||
int missionId = sTaskConfig.getId();
|
||||
if(!doingMissionIds.contains(missionId)){
|
||||
continue;
|
||||
}
|
||||
boolean isFinish = MissionLoigc.getDoingProgress(user,cumulationData,sTaskConfig.getTaskType(),sTaskConfig.getTaskValue()[0])>=sTaskConfig.getTaskValue()[1];
|
||||
if(!isFinish){
|
||||
MissionStateChangeInfo doingInfo = new MissionStateChangeInfo(missionId,
|
||||
|
@ -62,7 +75,7 @@ public class VipMissionIdsType extends AbstractMissionType{
|
|||
}
|
||||
}
|
||||
missionStateChangeInfos.add(finishInfo);
|
||||
doingIterator.remove();
|
||||
doingMissionIds.remove(missionId);
|
||||
getFinishMissionIds().add(missionId);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue