back_recharge
wangyuan 2019-05-28 10:01:23 +08:00
parent 672121e598
commit 3d86b7d034
37 changed files with 479 additions and 138 deletions

View File

@ -89,7 +89,7 @@ public class GMRequestHandler extends BaseHandler{
SCHero scHero = SCHero.getsCHero().get(hero.getTemplateId());
Map<Integer, SCHeroRankUpConfig> scHeroRankUpConfigByType = SCHeroRankUpConfig.getScHeroRankUpConfigByShow(GlobalsDef.UP_STAR_TYPE,scHero.getStar());
SCHeroRankUpConfig scHeroRankUpConfig = scHeroRankUpConfigByType.get(prarm2-1);
hero.setLevel(scHeroRankUpConfig.getLimitLevel());
hero.setLevel(cUser,scHeroRankUpConfig.getLimitLevel());
hero.setBreakId(scHeroRankUpConfig.getId());
}
CommonProto.Hero finalHeroProto = CBean2Proto.getHero(hero);
@ -220,13 +220,6 @@ public class GMRequestHandler extends BaseHandler{
return dropBuilder;
}
private void giveItem(User cUser,int itemId,int itemNum) throws Exception {
CommonProto.Drop.Builder dropBuilder = CommonProto.Drop.newBuilder();
Map<Integer,Integer> itemMap = new ConcurrentHashMap<>();
itemMap.put(itemId,itemNum);
ItemUtil.addItem(cUser,itemMap,dropBuilder);
}
public void update(long newTime,int uid) {
LOGGER.error("update->uid={},newTime={}", uid, newTime);
Date currentTime = new Date();

View File

@ -74,7 +74,7 @@ public class GetPlayerInfoHandler extends BaseHandler{
for(Map.Entry<Integer,Integer> vipInfoItem : vipInfo.entrySet()){
privilegeList.add(CommonProto.Privilege.newBuilder()
.setId(vipInfoItem.getKey())
. setUseeTimes(vipInfoItem.getValue())
. setUsedTimes(vipInfoItem.getValue())
.build());
}
CommonProto.Player player = CBean2Proto.getPlayer(userId, user.getPlayerInfoManager(), user.getPlayerInfoManager().getMapId(), user.getMapManager().getCurMapId(),user.getMapManager());

View File

@ -14,6 +14,7 @@ import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.fight.CheckFight;
import com.ljsd.jieling.logic.hero.HeroAttributeEnum;
import com.ljsd.jieling.logic.hero.HeroLogic;
import com.ljsd.jieling.logic.mission.GameEvent;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.CommonProto;
import com.ljsd.jieling.protocols.FightInfoProto;
@ -1289,6 +1290,7 @@ public class MapLogic {
stars = new HashSet<>();
}
stars.add(STAR_1);
user.getUserMissionManager().onGameEvent(user,GameEvent.STORY_FIGHT,mapManager.getCurMapId());
mapManager.setStars(stars);
SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId());
if (useTime > 0 && useTime <= sChallengeConfig.getTime()) {
@ -1699,6 +1701,7 @@ public class MapLogic {
if (levelDifficulty.getState() != Global.FIGHT_CLEARANCE) {
reward = sLevelDifficultyConfig.getFirstReward();
levelDifficulty.setState(Global.FIGHT_CLEARANCE);
user.getUserMissionManager().onGameEvent(user,GameEvent.STORY_FIGHT,fightId);
}
CommonProto.Drop.Builder drop = ItemUtil.drop(user,reward, 1, 0);
levelDifficulty.setChallengeTimes(levelDifficulty.getChallengeTimes() +1);
@ -1783,6 +1786,7 @@ public class MapLogic {
playerInfoManager.setMaxStamina(sPlayerLevelConfig.getMaxEnergy());
itemNum += sPlayerLevelConfig.getAddEnergy();
}
user.getUserMissionManager().onGameEvent(user,GameEvent.USER_LEVELUP,oldLevel,playerInfoManager.getLevel());
}
if (itemNum > 0){
String reward = Global.STAMINA +"#" +itemNum;

View File

@ -0,0 +1,24 @@
package com.ljsd.jieling.handler.mission;
import com.ljsd.jieling.handler.BaseHandler;
import com.ljsd.jieling.logic.mission.MissionLoigc;
import com.ljsd.jieling.netty.cocdex.PacketNetData;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.MessageTypeProto;
import com.ljsd.jieling.protocols.PlayerInfoProto;
import org.springframework.stereotype.Component;
@Component
public class TakeMissionRewardHandler extends BaseHandler {
@Override
public MessageTypeProto.MessageType getMessageCode() {
return MessageTypeProto.MessageType.TAKE_MISSION_REWARD_REQUEST;
}
@Override
public void process(ISession iSession, PacketNetData netData) throws Exception {
byte[] bytes = netData.parseClientProtoNetData();
PlayerInfoProto.TakeMissionRewardRequest takeMissionRewardRequest = PlayerInfoProto.TakeMissionRewardRequest.parseFrom(bytes);
MissionLoigc.takeMissionReward(iSession,takeMissionRewardRequest.getType(),takeMissionRewardRequest.getMissionId());
}
}

View File

@ -0,0 +1,24 @@
package com.ljsd.jieling.handler.vip;
import com.ljsd.jieling.handler.BaseHandler;
import com.ljsd.jieling.logic.player.PlayerLogic;
import com.ljsd.jieling.netty.cocdex.PacketNetData;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.MessageTypeProto;
import com.ljsd.jieling.protocols.PlayerInfoProto;
import org.springframework.stereotype.Component;
@Component
public class UserForceChangeHandler extends BaseHandler {
@Override
public MessageTypeProto.MessageType getMessageCode() {
return MessageTypeProto.MessageType.USER_FORCE_CHANGE_REQUEST;
}
@Override
public void process(ISession iSession, PacketNetData netData) throws Exception {
byte[] bytes = netData.parseClientProtoNetData();
PlayerInfoProto.UserForceChangeRequest userForceChangeRequest = PlayerInfoProto.UserForceChangeRequest.parseFrom(bytes);
PlayerLogic.getInstance().userforceChange(iSession,userForceChangeRequest.getTeamId());
}
}

View File

@ -5,17 +5,21 @@ import com.ljsd.jieling.logic.player.PlayerLogic;
import com.ljsd.jieling.netty.cocdex.PacketNetData;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.MessageTypeProto;
import com.ljsd.jieling.protocols.PlayerInfoProto;
import org.springframework.stereotype.Component;
@Component
public class VipTakeLevelRewardHandler extends BaseHandler {
@Override
public MessageTypeProto.MessageType getMessageCode() {
return MessageTypeProto.MessageType.VIP_TAKE_LEVELREWARD_REQUEST;
return MessageTypeProto.MessageType.VIP_TAKE_REWARD_REQUEST;
}
@Override
public void process(ISession iSession, PacketNetData netData) throws Exception {
PlayerLogic.getInstance().takeVipLevelRewad(iSession);
byte[] bytes = netData.parseClientProtoNetData();
PlayerInfoProto.VipTakeBoxRequest vipTakeBoxRequest = PlayerInfoProto.VipTakeBoxRequest.parseFrom(bytes);
int type = vipTakeBoxRequest.getType();
PlayerLogic.getInstance().takeVipLevelRewad(iSession,type);
}
}

View File

@ -369,7 +369,7 @@ public class ActivityLogic {
CommonProto.Drop.Builder extraDrop = ItemUtil.drop(user, new int[][]{extraItem});
PlayerInfoProto.SecretBoxRandomResponse build = PlayerInfoProto.SecretBoxRandomResponse.newBuilder().setDrop(drop).setExtrarReward(extraDrop).build();
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.SECRETBOX_RANDOM_RESPONSE_VALUE,build,true);
user.getUserMissionManager().onGameEvent(GameEvent.SECRETBOX,id,randCount);
user.getUserMissionManager().onGameEvent(user,GameEvent.SECRETBOX,id,randCount);
}
private int[] getSecretBoxRewardByPool(int secretBoxRandomPool) {

View File

@ -15,6 +15,7 @@ import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.fight.CheckFight;
import com.ljsd.jieling.logic.hero.HeroLogic;
import com.ljsd.jieling.logic.mail.MailLogic;
import com.ljsd.jieling.logic.mission.GameEvent;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.ArenaInfoProto;
import com.ljsd.jieling.protocols.CommonProto;
@ -184,7 +185,7 @@ public class ArenaLogic {
}
if(arenaManager.getCount() == 0){
RedisUtil.getInstence().incrementZsetScore(RedisKey.ARENA_RANK,Integer.toString(curSeason),Integer.toString(uid),myscoreChange + SArenaSetting.getSArenaSetting().getScore() );
RedisUtil.getInstence().incrementZsetScore(RedisKey.ARENA_RANK,Integer.toString(curSeason),Integer.toString(uid),myscoreChange + myscore);
}else{
RedisUtil.getInstence().incrementZsetScore(RedisKey.ARENA_RANK,Integer.toString(curSeason),Integer.toString(uid),myscoreChange);
}
@ -192,6 +193,7 @@ public class ArenaLogic {
//组战斗数据
ArenaInfoProto.ArenaChallengeResponse build = builder.setMyScoreChange(myscoreChange).setDefScoreChange(defScoreChange).addAllArenaEnemys(getArenaEnemyList(arenaManager.getArenaEnemies())).build();
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.ARENA_CHALLENGE_RESPONSE_VALUE,build,true);
user.getUserMissionManager().onGameEvent(user, GameEvent.ARENA_CHALLENGE,fightResult,myscoreChange + myscore);
}
public void setMyArenaEnemys(int uid,User user){

View File

@ -11,6 +11,9 @@ public class CumulationData {
// keyitemidvalue 数量
private Map<Integer,Integer> consumeMaterialMap = new HashMap<>(); // 消耗材料
//获取材料
// private Map<Integer,Integer> getMaterialMap = new HashMap<>();
//key: 抽卡类型 value 抽卡次数
private Map<Integer,Integer> randomCountMap = new HashMap<>(); // 抽卡次数统计
@ -26,6 +29,11 @@ public class CumulationData {
private Map<Integer,Integer> sHeroCountMap=new HashMap<>(); // 妖灵师数量统计
/**
* x key: value
*/
private Map<Integer,Integer> heroLevleCountMap = new HashMap<>();
/**
* key: value:
*/
@ -41,7 +49,9 @@ public class CumulationData {
private int killInvasionbossCount; //外敌入侵击杀次数
private int userForce; // 玩家战力
private int arenaFightNums;
private int arenaScore;
public void updateData(GameEvent gameEvent, Object...parm) throws Exception {
@ -108,4 +118,24 @@ public class CumulationData {
public void setKillInvasionbossCount(int killInvasionbossCount) {
this.killInvasionbossCount = killInvasionbossCount;
}
public Map<Integer, Integer> getHeroLevleCountMap() {
return heroLevleCountMap;
}
public int getArenaFightNums() {
return arenaFightNums;
}
public int getArenaScore() {
return arenaScore;
}
public void setArenaFightNums(int arenaFightNums) {
this.arenaFightNums = arenaFightNums;
}
public void setArenaScore(int arenaScore) {
this.arenaScore = arenaScore;
}
}

View File

@ -3,6 +3,7 @@ package com.ljsd.jieling.logic.dao;
import com.ljsd.common.mogodb.MongoBase;
import com.ljsd.jieling.db.mongo.MongoKey;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.mission.GameEvent;
import java.util.HashMap;
import java.util.Map;
@ -20,9 +21,10 @@ public class EquipManager extends MongoBase {
this.equipMap = new HashMap<>();
}
public void addEquip(Equip equip) throws Exception {
public void addEquip(User user,Equip equip) throws Exception {
updateString("equipMap." + equip.getId(), equip);
equipMap.put(equip.getId(),equip);
user.getUserMissionManager().onGameEvent(user, GameEvent.GET_EQUIP,equip.getEquipId());
}
public void remove(String equipId){

View File

@ -6,6 +6,7 @@ import com.ljsd.jieling.config.SGameSetting;
import com.ljsd.jieling.core.GlobalsDef;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.hero.HeroLogic;
import com.ljsd.jieling.logic.mission.GameEvent;
import com.ljsd.jieling.util.KeyGenUtils;
import com.ljsd.jieling.util.UUIDEnum;
import org.slf4j.Logger;
@ -85,12 +86,8 @@ public class Hero extends MongoBase {
this.id = id;
}
public void setTemplateId(int templateId) throws Exception {
updateString("templateId",templateId);
this.templateId = templateId;
}
public void setLevel(int level) throws Exception {
public void setLevel(User user,int level) throws Exception {
user.getUserMissionManager().onGameEvent(user, GameEvent.HERO_LEVEL_UP,this.level,level);
updateString("level",level);
this.level = level;
}
@ -129,11 +126,6 @@ public class Hero extends MongoBase {
return skillList;
}
public void setSkillList(List<Integer> skillList) {
this.skillList = skillList;
}
public Map<Integer, String> getEquipByPositionMap() {
return equipByPositionMap;
}

View File

@ -47,7 +47,11 @@ public class PlayerManager extends MongoBase {
private long loginTime;
private int hadTakeVip; //领取vip等级礼包
private int hadTakeLevelBoxVip; //领取vip等级礼包
private int hadTakeDailyBoxVip; //领取vip每日礼包
private int maxForce; //玩家历史最高战力
private Map<Integer,Integer> guidePoints = new HashMap<>();
@ -222,7 +226,7 @@ public class PlayerManager extends MongoBase {
}
}
updateString("vipInfo", vipInfo);
user.getUserMissionManager().onGameEvent(GameEvent.VIP_LEVLUP,vipLevel);
user.getUserMissionManager().onGameEvent(user,GameEvent.VIP_LEVLUP,vipLevel);
}
@ -249,12 +253,30 @@ public class PlayerManager extends MongoBase {
updateString("vipInfo", vipInfo);
}
public int getHadTakeVip() {
return hadTakeVip;
public int getMaxForce() {
return maxForce;
}
public void setHadTakeVip(int hadTakeVip) {
updateString("hadTakeVip", hadTakeVip);
this.hadTakeVip = hadTakeVip;
public void setMaxForce(int maxForce) {
updateString("maxForce", maxForce);
this.maxForce = maxForce;
}
public int getHadTakeLevelBoxVip() {
return hadTakeLevelBoxVip;
}
public void setHadTakeLevelBoxVip(int hadTakeLevelBoxVip) {
updateString("hadTakeLevelBoxVip", hadTakeLevelBoxVip);
this.hadTakeLevelBoxVip = hadTakeLevelBoxVip;
}
public int getHadTakeDailyBoxVip() {
return hadTakeDailyBoxVip;
}
public void setHadTakeDailyBoxVip(int hadTakeDailyBoxVip) {
updateString("hadTakeDailyBoxVip", hadTakeDailyBoxVip);
this.hadTakeDailyBoxVip = hadTakeDailyBoxVip;
}
}

View File

@ -2,6 +2,7 @@ package com.ljsd.jieling.logic.dao;
import com.ljsd.common.mogodb.MongoBase;
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.event.MissionEventDistributor;
@ -40,15 +41,15 @@ public class UserMissionManager extends MongoBase {
}
}
public Map<GameMisionType, List<MissionStateChangeInfo>> onGameEvent(GameEvent eventType, Object ...parm) throws Exception {
return MissionEventDistributor.onGameEvent(this,eventType,parm);
public Map<GameMisionType, List<MissionStateChangeInfo>> onGameEvent(User user,GameEvent eventType, Object ...parm) throws Exception {
return MissionEventDistributor.onGameEvent(user,eventType,parm);
}
public void calCumulationDataResult(GameEvent gameEvent,Map<GameMisionType, List<MissionStateChangeInfo>> missionTypeEnumListMap ,Object...parm) throws Exception {
public void calCumulationDataResult(User user,GameEvent gameEvent, Map<GameMisionType, List<MissionStateChangeInfo>> missionTypeEnumListMap , Object...parm) throws Exception {
cumulationData.updateData(gameEvent,parm);
vipMissionIdsType.calCumulationDataResult(missionTypeEnumListMap.get(GameMisionType.VIPMISSION),cumulationData);
vipMissionIdsType.calCumulationDataResult(user,missionTypeEnumListMap.get(GameMisionType.VIPMISSION),cumulationData);
updateString("cumulationData",cumulationData);
updateString("vipMissionIdsType",vipMissionIdsType);
}

View File

@ -5,6 +5,7 @@ import com.ljsd.jieling.config.SWorkShopSetting;
import com.ljsd.jieling.db.mongo.MongoKey;
import com.ljsd.jieling.logic.dao.root.MailingSystem;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.mission.GameEvent;
import com.ljsd.jieling.util.MathUtils;
import java.util.ArrayList;
@ -37,7 +38,7 @@ public class WorkShopController extends MongoBase {
updateString("openBlueStateMap." + type, openBlueStateMap.get(type));
}
public void addWorkShopExp(int addExp) throws Exception {
public void addWorkShopExp(User user,int addExp) throws Exception {
int maxExp = SWorkShopSetting.getMaxExp();
if(this.workShopExp >= maxExp){
return;
@ -50,6 +51,7 @@ public class WorkShopController extends MongoBase {
needLevelExp = sWorkShopSetting.getExp();
}
int curExp = MathUtils.setBetweenWithMax(this.workShopExp + addExp, 0, maxExp);
int oldLevel = this.workShopLevel;
while(curExp>=needLevelExp && curExp <= maxExp){
setWorkShopLevel(this.workShopLevel+1);
sWorkShopSetting = SWorkShopSetting.getsWorkShopSettingByLevel(this.workShopLevel + 1);
@ -59,6 +61,9 @@ public class WorkShopController extends MongoBase {
}
needLevelExp = sWorkShopSetting.getExp();
}
if(this.workShopLevel>oldLevel){
user.getUserMissionManager().onGameEvent(user,GameEvent.WORKSHOP_LEVELUP,oldLevel,this.workShopLevel);
}
setWorkShopExp(curExp);
}

View File

@ -15,6 +15,7 @@ import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.hero.HeroAttributeEnum;
import com.ljsd.jieling.logic.mail.MailLogic;
import com.ljsd.jieling.logic.mission.GameEvent;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.CommonProto;
import com.ljsd.jieling.protocols.FightInfoProto;
@ -562,7 +563,6 @@ public class CombatLogic {
public void challengeInvasionBoss(ISession session,String bossId,int teamId,int fightTimes,int skipFight) throws Exception {
int uid = session.getUid();
User user = UserManager.getUser(uid);
AdventureManager adventureManager = user.getAdventureManager();
SGameSetting sGameSetting = SGameSetting.getGameSetting();
int invasionBossPrivilege = sGameSetting.getInvasionBossPrivilege();
if(fightTimes<=0){
@ -611,6 +611,7 @@ public class CombatLogic {
if(fightResult == 1){
i = i+1;
sendRewardOfBossKilled(adventureBoss.getFindUserId(),uid,bossGroupId,adventureBoss.getArenaId(),adventureBoss.getArenaLevel());
user.getUserMissionManager().onGameEvent(user, GameEvent.KILLINVASIONBOSS);
RedisUtil.getInstence().removeMapEntrys(RedisKey.ADVENTRUEN_BOSS_INFO,"",bossId);
break;
}

View File

@ -195,7 +195,7 @@ public class HeroLogic {
dropHeroAndItem[j++] = tenTimesMustGetItem[i];
}
}
user.getUserMissionManager().onGameEvent(GameEvent.RANDOM_HERO,sLotterySetting.getLotteryType(),randCount);
user.getUserMissionManager().onGameEvent(user,GameEvent.RANDOM_HERO,sLotterySetting.getLotteryType(),perCount);
CommonProto.Drop.Builder drop = ItemUtil.drop(user, dropHeroAndItem);
HeroInfoProto.HeroRandResponse heroRandResponse = HeroInfoProto.HeroRandResponse.newBuilder().setDrop(drop).build();
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.HERO_RAND_RESPONSE_VALUE, heroRandResponse, true);
@ -445,7 +445,7 @@ public class HeroLogic {
return;
}
if(!isBreak){
hero.setLevel( oldLevel + 1);
hero.setLevel( user,oldLevel + 1);
}else{
hero.setBreakId(breakId);
}
@ -1159,6 +1159,7 @@ public class HeroLogic {
}
pokemon.upOrActiveComonpent(comonpentId);
MessageUtil.sendMessage(session,1,MessageTypeProto.MessageType.POKEMON_COMONPENT_LEVELUP_RESPONSE_VALUE,null,true);
user.getUserMissionManager().onGameEvent(user,GameEvent.POKEMON_UPLEVEL,pokemonId);
return;
}
if (checkPokemonComonpent(pokemonId, comonpentId,oldLevel, user)){
@ -1169,6 +1170,7 @@ public class HeroLogic {
//发送成功消息
MessageUtil.sendMessage(session,1,MessageTypeProto.MessageType.POKEMON_COMONPENT_LEVELUP_RESPONSE_VALUE,null,true);
user.getUserMissionManager().onGameEvent(user,GameEvent.POKEMON_UPLEVEL,pokemonId);
}
@ -1210,6 +1212,9 @@ public class HeroLogic {
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.POKEMON_ADVANCED_RESPONSE_VALUE,"道具不足");
return;
}
if(pokemon.getAllStage() == 0){
user.getUserMissionManager().onGameEvent(user,GameEvent.POKEMON_ADVANCED,pokemonId);
}
pokemon.setAllStage(pokemon.getAllStage()+1);
@ -1304,4 +1309,31 @@ public class HeroLogic {
}
return false;
}
public int calPokenmonForce(Pokemon pokemon){
Map<Integer,Integer> pokemonAttributeMap = new HashMap<>();
Map<Integer, Integer> comonpentsLevelMap = pokemon.getComonpentsLevelMap();
for(Map.Entry<Integer, Integer> comonpentsLevelItem : comonpentsLevelMap.entrySet()){
Integer comonpentId = comonpentsLevelItem.getKey();
Integer comonpentLevel = comonpentsLevelItem.getValue();
Map<Integer, SDifferDemonsComonpentsConfig> sDifferDemonsComonpentsConfigMap = SDifferDemonsComonpentsConfig.getsDifferDemonsComonpentsConfigMap(comonpentId);
SDifferDemonsComonpentsConfig sDifferDemonsComonpentsConfig = sDifferDemonsComonpentsConfigMap.get(comonpentLevel);
Map<Integer, Map<Integer, Integer>> extraAddMap = sDifferDemonsComonpentsConfig.getExtraAddMap();
combinedAttribute(sDifferDemonsComonpentsConfig.getBaseAttribute(),pokemonAttributeMap);
for(Map<Integer, Integer> item : extraAddMap.values()){
combinedAttribute(sDifferDemonsComonpentsConfig.getBaseAttribute(),item);
}
}
return calForce(pokemonAttributeMap);
}
public int calEquipForce(Equip equip){
Map<Integer,Integer> equipAttributeMap = new HashMap<>();
SEquipConfig sEquipConfig = SEquipConfig.getsEquipConfigById(equip.getEquipId());
Map<Integer, Integer> propertyValueByIdMap = equip.getPropertyValueByIdMap();
Map<Integer, Integer> secondValueByIdMap = equip.getSecondValueByIdMap();
combinedAttribute(propertyValueByIdMap,equipAttributeMap);
combinedAttribute(secondValueByIdMap,equipAttributeMap);
return calForce(equipAttributeMap)+sEquipConfig.getScore();
}
}

View File

@ -244,7 +244,7 @@ public class WorkShopLogic {
int type = sWorkShopFoundationConfig.getType();
int addExp = sWorkShopFoundationConfig.getExp()*nums;
if(type == GlobalsDef.WORK_SHOP_TYPE){
user.getWorkShopController().addWorkShopExp(addExp);
user.getWorkShopController().addWorkShopExp(user,addExp);
}else if( type == GlobalsDef.COOK_SHOP_TYPE){
user.getWorkShopController().addCookExp(addExp);
}
@ -298,9 +298,9 @@ public class WorkShopLogic {
int type = sWorkShopEquipmentConfig.getType();
int addExp = sWorkShopEquipmentConfig.getExp();
if(type == GlobalsDef.WORK_SHOP_TYPE){
user.getWorkShopController().addWorkShopExp(addExp);
user.getWorkShopController().addWorkShopExp(user,addExp);
Equip equip = new Equip(Integer.toString(uid), equipTid, user.getWorkShopController().getWorkShopLevel(),runneIdsList);
user.getEquipManager().addEquip(equip);
user.getEquipManager().addEquip(user,equip);
dropBuilder.addEquipId(CBean2Proto.getEquipProto(equip));
}else if( type == GlobalsDef.COOK_SHOP_TYPE){
user.getWorkShopController().addCookExp(addExp);
@ -334,7 +334,7 @@ public class WorkShopLogic {
clone.rebuildEquip(user.getWorkShopController().getWorkShopLevel());
equipManager.setUnDetermined(clone);
int addExp = sWorkShopRebuildConfig.getExp();
user.getWorkShopController().addWorkShopExp(addExp);
user.getWorkShopController().addWorkShopExp(user,addExp);
PlayerInfoProto.WorkShopRebuildRespoonse build = PlayerInfoProto.WorkShopRebuildRespoonse.newBuilder().setEquip(CBean2Proto.getEquipProto(clone)).build();
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.WORKSHOP_REBUILD_RESPONSE_VALUE,build,true);
}
@ -349,7 +349,7 @@ public class WorkShopLogic {
return;
}
if(state == 1){
equipManager.addEquip(unDetermined);
equipManager.addEquip(user,unDetermined);
}
equipManager.setUnDetermined(null);
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.WORKSHOP_REBUILD_CONFIRM_RESONSE_VALUE,null,true);

View File

@ -4,8 +4,17 @@ public enum GameEvent {
VIP_LEVLUP, //vip等级提升
RANDOM_HERO,// 抽卡
GET_HERO,//获取新英雄
GET_ITEM,//获取材料
HERO_LEVEL_UP, //英雄等级提升
POKEMON_ADVANCED, //异妖激活
POKEMON_UPLEVEL, //异妖升级 影响战力
ARENA_CHALLENGE, //竞技场挑战
USER_LEVELUP,
USER_FORCE_CHANGE,
CONSUMER_MATERIAL,//道具消耗
WORKSHOP_LEVELUP,//炼造等级达到
GET_EQUIP,//获取新英雄
STORY_FIGHT, //副本挑战
SECRETBOX,// 秘盒抽取
KILLINVASIONBOSS,// 外敌入侵击杀次数
VIP_MISSION_REWARD, //vip任务领取事件
}

View File

@ -1,23 +1,27 @@
package com.ljsd.jieling.logic.mission;
import com.ljsd.jieling.config.SCHero;
import com.ljsd.jieling.config.SEquipConfig;
import com.ljsd.jieling.config.STaskConfig;
import com.ljsd.jieling.config.SVipLevelConfig;
import com.ljsd.jieling.logic.dao.CumulationData;
import com.ljsd.jieling.logic.dao.PlayerManager;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.UserMissionManager;
import com.ljsd.jieling.logic.dao.*;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.hero.HeroLogic;
import com.ljsd.jieling.logic.mission.main.MissionStateChangeInfo;
import com.ljsd.jieling.logic.mission.main.VipMissionIdsType;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.CommonProto;
import com.ljsd.jieling.protocols.MessageTypeProto;
import com.ljsd.jieling.protocols.MissionInfoProto;
import com.ljsd.jieling.protocols.PlayerInfoProto;
import com.ljsd.jieling.util.ItemUtil;
import com.ljsd.jieling.util.MessageUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
public class MissionLoigc {
@ -33,7 +37,10 @@ public class MissionLoigc {
public static CommonProto.VipMissionInfo getVipMissionResponse(User user){
PlayerManager playerInfoManager = user.getPlayerInfoManager();
int vipLevel = playerInfoManager.getVipLevel();
CommonProto.VipMissionInfo.Builder builder = CommonProto.VipMissionInfo.newBuilder().setHadTaked(playerInfoManager.getHadTakeVip()).setVipLevel(vipLevel);
CommonProto.VipMissionInfo.Builder builder = CommonProto.VipMissionInfo.newBuilder()
.setHadTakeDailyBox(playerInfoManager.getHadTakeDailyBoxVip())
.setHadTakeLevelBox(playerInfoManager.getHadTakeLevelBoxVip())
.setVipLevel(vipLevel);
UserMissionManager userMissionManager = user.getUserMissionManager();
VipMissionIdsType vipMissionIdsType = userMissionManager.getVipMissionIdsType();
CumulationData cumulationData = userMissionManager.getCumulationData();
@ -47,7 +54,7 @@ public class MissionLoigc {
int progrss = sTaskConfig.getTaskValue()[1];
if(doingMissionIds.contains(missionId)){
state = 0;
progrss = getDoingProgress(cumulationData,sTaskConfig.getTaskType(),sTaskConfig.getTaskValue()[0]);
progrss = getDoingProgress(user,cumulationData,sTaskConfig.getTaskType(),sTaskConfig.getTaskValue()[0]);
}else if(finishMissionIds.contains(missionId)){
state = 1;
}
@ -56,21 +63,24 @@ public class MissionLoigc {
return builder.build();
}
public void takeMissionReward(ISession session,int type,int missionId) throws Exception {
public static void takeMissionReward(ISession session,int type,int missionId) throws Exception {
int uid = session.getUid();
User user = UserManager.getUser(uid);
UserMissionManager userMissionManager = user.getUserMissionManager();
if(type == 1){ //vip 任务
VipMissionIdsType vipMissionIdsType = userMissionManager.getVipMissionIdsType();
if(!vipMissionIdsType.getFinishMissionIds().contains(missionId) || vipMissionIdsType.getRewardedMissionIds().get(missionId)){
return;
Map<GameMisionType, List<MissionStateChangeInfo>> gameMisionTypeListMap = userMissionManager.onGameEvent(user, GameEvent.VIP_MISSION_REWARD, missionId);
List<MissionStateChangeInfo> missionStateChangeInfos = gameMisionTypeListMap.get(GameMisionType.VIPMISSION);
if(!missionStateChangeInfos.isEmpty()){
CommonProto.Drop.Builder drop = ItemUtil.drop(user, missionStateChangeInfos.get(0).getRewwardGroups(), 1f, 0);
MissionInfoProto.TakeMissionResponse build = MissionInfoProto.TakeMissionResponse.newBuilder().setDrop(drop).build();
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.TAKE_MISSION_REWARD_RESPONSE_VALUE,build,true);
}else{
MessageUtil.sendErrorResponse(session,0, MessageTypeProto.MessageType.TAKE_MISSION_REWARD_RESPONSE_VALUE,"mission can not get reward");
}
userMissionManager.onGameEvent(GameEvent.VIP_MISSION_REWARD,missionId);
}
}
public static int getDoingProgress(CumulationData cumulationData, int missionTypeId, int missionSubType){
public static int getDoingProgress(User user,CumulationData cumulationData, int missionTypeId, int missionSubType){
MissionType missionType = MissionType.findByMissionId(missionTypeId);
if(missionType == null){
return 0;
@ -81,34 +91,74 @@ public class MissionLoigc {
count = cumulationData.getRandomCountMap().get(1);
break;
case COLLECT_QUALITY_HERO:
break;
case HERO_LEVLE_COUNT:
break;
case POKEMON_ADVANCED:
break;
case POKEMON_FORCE:
break;
case POKEMON_ALL_FORCE:
break;
case ARENA_CHALLENEGE_NUMS:
break;
case ARENA_SCORE:
break;
case USER_LEVEL:
break;
case USER_FORCE:
break;
case USER_CONSUMER_MATERIAL:
break;
case USER_WORKSHOP_LEVEL:
break;
case USER_GET_MATERIAL:
break;
case STORY_TIMES:
for(Integer passNum :cumulationData.getStoryFightCountMap().values()){
count+=passNum;
Map<Integer, Integer> getsHeroCountMap = cumulationData.getsHeroCountMap();
for(Map.Entry<Integer,Integer> item : getsHeroCountMap.entrySet()){
SCHero scHero = SCHero.getsCHero().get(item.getKey());
int star = scHero.getStar();
if(star == missionSubType){
count += item.getValue();
}
}
break;
case HERO_LEVLE_COUNT:
count = cumulationData.getHeroLevleCountMap().get(missionSubType);
break;
case POKEMON_ADVANCED:{
Map<Integer, Pokemon> pokemonMap = user.getPokemonManager().getPokemonMap();
for(Pokemon pokemon : pokemonMap.values()){
if(pokemon.getAllStage()>0){
count++;
}
}
}
break;
case POKEMON_FORCE:{
int maxForce = 0;
Map<Integer, Pokemon> pokemonMap = user.getPokemonManager().getPokemonMap();
for(Pokemon pokemon : pokemonMap.values()){
int force = HeroLogic.getInstance().calPokenmonForce(pokemon);
if(maxForce< HeroLogic.getInstance().calPokenmonForce(pokemon)){
maxForce=force;
}
}
count = maxForce;
}
break;
case POKEMON_ALL_FORCE:
Map<Integer, Pokemon> pokemonMap = user.getPokemonManager().getPokemonMap();
for(Pokemon pokemon : pokemonMap.values()){
count = HeroLogic.getInstance().calPokenmonForce(pokemon);
}
break;
case ARENA_CHALLENEGE_NUMS:
count = cumulationData.getArenaFightNums();
break;
case ARENA_SCORE:
count = cumulationData.getArenaScore();
break;
case USER_LEVEL:
count = user.getPlayerInfoManager().getLevel();
break;
case USER_FORCE:
count = user.getPlayerInfoManager().getMaxForce();
break;
case USER_CONSUMER_MATERIAL:
count=cumulationData.getConsumeMaterialMap().get(missionSubType);
break;
case USER_WORKSHOP_LEVEL:
count =user.getWorkShopController().getWorkShopLevel();
break;
case USER_GET_EQUIP_QUALITY:
Map<Integer, Integer> equipCountMap = cumulationData.getsEquipCountMap();
for(Map.Entry<Integer,Integer> item:equipCountMap.entrySet()){
SEquipConfig sEquipConfig = SEquipConfig.getsEquipConfigById(item.getKey());
if(sEquipConfig.getQuality() == missionSubType){
count += item.getValue();
}
}
break;
case LEVEL_STORY_PASS:
case GENERAL_STORY_PASS:
case HERO_STORY_PASS:
count = cumulationData.getStoryFightCountMap().get(missionSubType);
@ -119,6 +169,14 @@ public class MissionLoigc {
case SECRETBOX_TIMES:
count = cumulationData.getSecretRandomCount();
break;
case EQUIP_FORCE_NUMS:
Map<String, Equip> equipMap = user.getEquipManager().getEquipMap();
for(Equip equip : equipMap.values()){
if(HeroLogic.getInstance().calEquipForce(equip)>missionSubType){
count++;
}
}
break;
default:
count = 0;
break;

View File

@ -16,9 +16,9 @@ public enum MissionType {
USER_FORCE(10), // 战力评分 玩家战力达到一定目标
USER_CONSUMER_MATERIAL(11), // 累计消耗元宝 玩家累计消耗元宝数量
USER_WORKSHOP_LEVEL(12), // 炼造等级 玩家炼造等级
USER_GET_MATERIAL(13), //获得某品质装备数量 玩家累计获得传说、史诗等品质装备的数量
USER_GET_EQUIP_QUALITY(13), //获得某品质装备数量 玩家累计获得传说、史诗等品质装备的数量
STORY_TIMES(14), //故事副本 通关故事副本关卡,涵盖简单,普通,困难
LEVEL_STORY_PASS(14), //故事副本 通关故事副本关卡,涵盖简单,普通,困难
GENERAL_STORY_PASS(15), //普通副本 通过普通副本1,2,3,4,5
HERO_STORY_PASS(16), //英雄副本 通过英雄副本1,2,3,4,5
@ -26,6 +26,8 @@ public enum MissionType {
KILL_INVASIONBOSS(17),//外敌入侵击杀次数 外敌入侵活动中击杀boss次数
SECRETBOX_TIMES(18),//抽取秘盒次数 累计抽取秘盒数量
EQUIP_FORCE_NUMS(19), //获得%s战力的装备件数
;
@ -62,9 +64,9 @@ public enum MissionType {
case 12:
return USER_WORKSHOP_LEVEL;
case 13:
return USER_GET_MATERIAL;
return USER_GET_EQUIP_QUALITY;
case 14:
return STORY_TIMES;
return LEVEL_STORY_PASS;
case 15:
return HERO_STORY_PASS;
case 16:
@ -73,6 +75,8 @@ public enum MissionType {
return KILL_INVASIONBOSS;
case 18:
return SECRETBOX_TIMES;
case 19:
return EQUIP_FORCE_NUMS;
default:
return null;
}

View File

@ -0,0 +1,17 @@
package com.ljsd.jieling.logic.mission.data;
import com.ljsd.jieling.logic.dao.CumulationData;
import com.ljsd.jieling.logic.mission.GameEvent;
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);
}
}
}

View File

@ -0,0 +1,23 @@
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;
public class ConsumerMaterialDataManager implements BaseDataManager{
@Override
public void updateData(CumulationData data, GameEvent gameEvent, Object... parm) {
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;
}
consumeMaterialMap.put(itemId,count);
}
}
}

View File

@ -12,6 +12,11 @@ public class DataManagerDistributor {
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());
}
public static void updateData(CumulationData data, GameEvent type, Object...parm) throws Exception {

View File

@ -0,0 +1,19 @@
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;
public class GetEquipDataManager implements BaseDataManager{
@Override
public void updateData(CumulationData data, GameEvent gameEvent, Object... parm) {
Map<Integer, Integer> equipCountMap = data.getsEquipCountMap();
int equipTid = (int)parm[0];
Integer count = equipCountMap.get(equipTid);
if(count == null){
count =0;
}
equipCountMap.put(equipTid,count+1);
}
}

View File

@ -12,6 +12,7 @@ public class GetHeroManager implements BaseDataManager {
Map<Integer, Integer> sHeroCountMap = data.getsHeroCountMap();
int count =1;
int heroTid = (int)parm[0];
int heroStar = (int)parm[1];
if(sHeroCountMap.containsKey(heroTid)){
count+=sHeroCountMap.get(heroTid);
}

View File

@ -0,0 +1,22 @@
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;
public class HeroLevelUpManager implements BaseDataManager{
@Override
public void updateData(CumulationData data, GameEvent gameEvent, Object... parm) {
int oldLevle = (int)parm[0];
int newLevle = (int)parm[1];
Map<Integer, Integer> heroLevleCountMap = data.getHeroLevleCountMap();
for(;oldLevle<newLevle;oldLevle++){
Integer count = heroLevleCountMap.get(oldLevle);
if(count == null){
count=0;
}
heroLevleCountMap.put(oldLevle,count+1);
}
}
}

View File

@ -0,0 +1,11 @@
package com.ljsd.jieling.logic.mission.data;
import com.ljsd.jieling.logic.dao.CumulationData;
import com.ljsd.jieling.logic.mission.GameEvent;
public class KillInvasionBossDataManager implements BaseDataManager{
@Override
public void updateData(CumulationData data, GameEvent gameEvent, Object... parm) {
data.setKillInvasionbossCount(data.getKillInvasionbossCount() +1);
}
}

View File

@ -1,6 +1,7 @@
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;
@ -11,5 +12,5 @@ import java.util.Map;
public interface BaseGameEventProcessor {
public void onGameEvent(UserMissionManager userMissionManager, Map<GameMisionType, List<MissionStateChangeInfo>> misionTypeListMap, GameEvent event, Object ...parm) throws Exception;
public void onGameEvent(User user, Map<GameMisionType, List<MissionStateChangeInfo>> misionTypeListMap, GameEvent event, Object ...parm) throws Exception;
}

View File

@ -1,6 +1,6 @@
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;
@ -10,7 +10,7 @@ import java.util.Map;
public class CumulationDataEventProcessor implements BaseGameEventProcessor{
@Override
public void onGameEvent(UserMissionManager userMissionManager, Map<GameMisionType, List<MissionStateChangeInfo>> misionTypeListMap, GameEvent event, Object... parm) throws Exception {
userMissionManager.calCumulationDataResult(event,misionTypeListMap,parm);
public void onGameEvent(User user, Map<GameMisionType, List<MissionStateChangeInfo>> misionTypeListMap, GameEvent event, Object... parm) throws Exception {
user.getUserMissionManager().calCumulationDataResult(user,event,misionTypeListMap,parm);
}
}

View File

@ -12,6 +12,7 @@ import com.ljsd.jieling.logic.mission.main.MissionStateChangeInfo;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.CommonProto;
import com.ljsd.jieling.protocols.MessageTypeProto;
import com.ljsd.jieling.protocols.PlayerInfoProto;
import com.ljsd.jieling.util.MessageUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -33,6 +34,16 @@ public class MissionEventDistributor {
eventProcessor.put(GameEvent.STORY_FIGHT,new StoryFightEventProcessor());
eventProcessor.put(GameEvent.RANDOM_HERO,new CumulationDataEventProcessor());
eventProcessor.put(GameEvent.GET_HERO,new CumulationDataEventProcessor());
eventProcessor.put(GameEvent.HERO_LEVEL_UP,new CumulationDataEventProcessor());
eventProcessor.put(GameEvent.POKEMON_ADVANCED,new CumulationDataEventProcessor());
eventProcessor.put(GameEvent.POKEMON_UPLEVEL,new CumulationDataEventProcessor());
eventProcessor.put(GameEvent.ARENA_CHALLENGE,new CumulationDataEventProcessor());
eventProcessor.put(GameEvent.USER_LEVELUP,new CumulationDataEventProcessor());
eventProcessor.put(GameEvent.USER_FORCE_CHANGE,new CumulationDataEventProcessor());
eventProcessor.put(GameEvent.CONSUMER_MATERIAL,new CumulationDataEventProcessor());
eventProcessor.put(GameEvent.WORKSHOP_LEVELUP,new CumulationDataEventProcessor());
eventProcessor.put(GameEvent.GET_EQUIP,new CumulationDataEventProcessor());
eventProcessor.put(GameEvent.SECRETBOX,new CumulationDataEventProcessor());
eventProcessor.put(GameEvent.VIP_MISSION_REWARD,new RewardEventProcessor());
}
@ -62,18 +73,17 @@ public class MissionEventDistributor {
return;
}
User user = UserManager.getUser(session.getUid());
UserMissionManager userMissionManager = user.getUserMissionManager();
Map<GameMisionType, List<MissionStateChangeInfo>> missionTypeEnumListMap = threadMissionChangeList.get();
if (sendIndication) {
List<MissionStateChangeInfo> missionStateChangeInfos = missionTypeEnumListMap.get(GameMisionType.VIPMISSION);
if (missionStateChangeInfos.size() != 0) {
sendMissionUpdate(session,userMissionManager,missionStateChangeInfos,GameMisionType.VIPMISSION);
sendMissionUpdate(session,user,missionStateChangeInfos,GameMisionType.VIPMISSION);
}
}
}
private static void sendMissionUpdate(ISession session,UserMissionManager userMissionManager,List<MissionStateChangeInfo> missionStateChangeInfos,GameMisionType gameMisionType) {
CommonProto.MissionUpdateListIndication.Builder builder = CommonProto.MissionUpdateListIndication.newBuilder();
private static void sendMissionUpdate(ISession session, User user ,List<MissionStateChangeInfo> missionStateChangeInfos,GameMisionType gameMisionType) {
PlayerInfoProto.MissionUpdateListIndication.Builder builder = PlayerInfoProto.MissionUpdateListIndication.newBuilder();
for(MissionStateChangeInfo missionStateChangeInfo : missionStateChangeInfos){
MissionState missionState = missionStateChangeInfo.getMissionState();
int state = missionState.getState();
@ -81,7 +91,7 @@ public class MissionEventDistributor {
if(missionState == MissionState.DOING){
if(gameMisionType == GameMisionType.VIPMISSION){
STaskConfig sTaskConfig = STaskConfig.getsTaskConfigById(missionStateChangeInfo.getMissionId());
progress= MissionLoigc.getDoingProgress(userMissionManager.getCumulationData(),sTaskConfig.getTaskType(),sTaskConfig.getTaskValue()[0]);
progress= MissionLoigc.getDoingProgress(user,user.getUserMissionManager().getCumulationData(),sTaskConfig.getTaskType(),sTaskConfig.getTaskValue()[0]);
}
}else if(missionState == MissionState.FINISH){
if(gameMisionType == GameMisionType.VIPMISSION){
@ -94,7 +104,7 @@ public class MissionEventDistributor {
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.MISSION_UPDATE_INDICATION_VALUE,builder.build(),true);
}
public static Map<GameMisionType, List<MissionStateChangeInfo>> onGameEvent(UserMissionManager userMissionManager, GameEvent event, Object ... parm) throws Exception {
public static Map<GameMisionType, List<MissionStateChangeInfo>> onGameEvent(User user, GameEvent event, Object ... parm) throws Exception {
BaseGameEventProcessor processor = eventProcessor.get(event);
if (processor == null) {
return null;
@ -104,7 +114,7 @@ public class MissionEventDistributor {
missionTypeEnumListMap = new HashMap<>(1);
}
processor.onGameEvent(userMissionManager, missionTypeEnumListMap,event,parm );
processor.onGameEvent(user, missionTypeEnumListMap,event,parm );
return missionTypeEnumListMap;
}
}

View File

@ -1,6 +1,6 @@
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;
@ -10,7 +10,7 @@ import java.util.Map;
public class RewardEventProcessor implements BaseGameEventProcessor{
@Override
public void onGameEvent(UserMissionManager userMissionManager,Map<GameMisionType, List<MissionStateChangeInfo>> missionTypeEnumListMap, GameEvent event, Object... parm) throws Exception {
userMissionManager.rewardMission(event,missionTypeEnumListMap,parm);
public void onGameEvent(User user, Map<GameMisionType, List<MissionStateChangeInfo>> missionTypeEnumListMap, GameEvent event, Object... parm) throws Exception {
user.getUserMissionManager().rewardMission(event,missionTypeEnumListMap,parm);
}
}

View File

@ -2,6 +2,7 @@ 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;
@ -12,7 +13,7 @@ import java.util.Map;
public class StoryFightEventProcessor implements BaseGameEventProcessor {
@Override
public void onGameEvent(UserMissionManager userMissionManager, Map<GameMisionType, List<MissionStateChangeInfo>> missionTypeEnumListMap, GameEvent event, Object... parm) {
public void onGameEvent(User user, Map<GameMisionType, List<MissionStateChangeInfo>> missionTypeEnumListMap, GameEvent event, Object... parm) {
}
}

View File

@ -1,6 +1,6 @@
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;
@ -11,7 +11,7 @@ import java.util.Map;
public class VipLevelUpEventProces implements BaseGameEventProcessor {
@Override
public void onGameEvent(UserMissionManager userMissionManager, Map<GameMisionType, List<MissionStateChangeInfo>> missionTypeEnumListMap, GameEvent event, Object... parm) {
userMissionManager.openMission(event, parm);
public void onGameEvent(User user, Map<GameMisionType, List<MissionStateChangeInfo>> missionTypeEnumListMap, GameEvent event, Object... parm) {
user.getUserMissionManager().openMission(event, parm);
}
}

View File

@ -2,6 +2,7 @@ package com.ljsd.jieling.logic.mission.main;
import com.google.common.collect.Sets;
import com.ljsd.jieling.logic.dao.CumulationData;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.mission.MissionState;
import java.util.BitSet;
@ -32,7 +33,7 @@ public abstract class AbstractMissionType {
missionTypeEnumListMap.add(stateChangeInfo);
}
public abstract void calCumulationDataResult(List<MissionStateChangeInfo> missionStateChangeInfos, CumulationData cumulationData);
public abstract void calCumulationDataResult(User user,List<MissionStateChangeInfo> missionStateChangeInfos, CumulationData cumulationData);
public boolean checkIsNew(int missionId){
if(doingMissionIds.contains(missionId)){

View File

@ -2,6 +2,7 @@ package com.ljsd.jieling.logic.mission.main;
import com.ljsd.jieling.config.STaskConfig;
import com.ljsd.jieling.logic.dao.CumulationData;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.mission.MissionLoigc;
import com.ljsd.jieling.logic.mission.MissionState;
@ -30,13 +31,13 @@ public class VipMissionIdsType extends AbstractMissionType{
@Override
public void calCumulationDataResult(List<MissionStateChangeInfo> missionStateChangeInfos, CumulationData cumulationData) {
public void calCumulationDataResult(User user,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);
boolean isFinish = MissionLoigc.getDoingProgress(cumulationData,sTaskConfig.getTaskType(),sTaskConfig.getTaskValue()[0])>=sTaskConfig.getTaskValue()[1];
boolean isFinish = MissionLoigc.getDoingProgress(user,cumulationData,sTaskConfig.getTaskType(),sTaskConfig.getTaskValue()[0])>=sTaskConfig.getTaskValue()[1];
if(!isFinish){
MissionStateChangeInfo doingInfo = new MissionStateChangeInfo(missionId,
MissionState.DOING, null);

View File

@ -1,6 +1,7 @@
package com.ljsd.jieling.logic.player;
import com.ljsd.jieling.config.SRandomName;
import com.ljsd.jieling.config.SVipLevelConfig;
import com.ljsd.jieling.core.GlobalsDef;
import com.ljsd.jieling.db.redis.RedisKey;
import com.ljsd.jieling.db.redis.RedisUtil;
@ -8,7 +9,9 @@ import com.ljsd.jieling.logic.dao.PlayerManager;
import com.ljsd.jieling.logic.dao.TeamPosManager;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.hero.HeroLogic;
import com.ljsd.jieling.logic.mail.MailLogic;
import com.ljsd.jieling.logic.mission.GameEvent;
import com.ljsd.jieling.logic.mission.MissionLoigc;
import com.ljsd.jieling.logic.mission.main.VipMissionIdsType;
import com.ljsd.jieling.network.session.ISession;
@ -31,6 +34,8 @@ public class PlayerLogic {
return InnerClass.instance;
}
static class InnerClass{
public final static PlayerLogic instance = new PlayerLogic();
}
@ -148,7 +153,7 @@ public class PlayerLogic {
int uid = session.getUid();
User user = UserManager.getUser(uid);
PlayerManager playerInfoManager = user.getPlayerInfoManager();
if(playerInfoManager.getHadTakeVip() == 0){
if(playerInfoManager.getHadTakeDailyBoxVip() == 0){
MessageUtil.sendErrorResponse(session,0, MessageTypeProto.MessageType.VIP_LEVELUP_RESPONSE_VALUE,"not take the vip level reward");
return;
}
@ -159,20 +164,48 @@ public class PlayerLogic {
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.VIP_LEVELUP_RESPONSE_VALUE,build,true);
}
public void takeVipLevelRewad(ISession session) throws Exception {
public void takeVipLevelRewad(ISession session,int type) throws Exception {
int uid = session.getUid();
User user = UserManager.getUser(uid);
PlayerManager playerInfoManager = user.getPlayerInfoManager();
if(playerInfoManager.getHadTakeVip() == 1){
MessageUtil.sendErrorResponse(session,0, MessageTypeProto.MessageType.VIP_TAKE_LEVELREWARD_RESPONSE_VALUE,"had taked the vip level reward");
return;
SVipLevelConfig sVipLevelConfig = SVipLevelConfig.getsVipLevelConfigMap().get(playerInfoManager.getVipLevel());
int[][] rewards=null;
if(type == 1){
if(playerInfoManager.getHadTakeDailyBoxVip() == 0 || playerInfoManager.getHadTakeLevelBoxVip() == 1 ){
MessageUtil.sendErrorResponse(session,0, MessageTypeProto.MessageType.VIP_TAKE_REWARD_RESPONSE_VALUE,"had taked the vip level reward");
return;
}
VipMissionIdsType vipMissionIdsType = user.getUserMissionManager().getVipMissionIdsType();
if(!vipMissionIdsType.getDoingMissionIds().isEmpty() || !vipMissionIdsType.getFinishMissionIds().isEmpty()){
MessageUtil.sendErrorResponse(session,0, MessageTypeProto.MessageType.VIP_TAKE_REWARD_RESPONSE_VALUE,"mission not finish");
return;
}
playerInfoManager.setHadTakeLevelBoxVip(1);
rewards = sVipLevelConfig.getVipBoxReward();
}else if(type == 2){
if(playerInfoManager.getHadTakeDailyBoxVip() == 1 || playerInfoManager.getHadTakeLevelBoxVip() == 0 ){
MessageUtil.sendErrorResponse(session,0, MessageTypeProto.MessageType.VIP_TAKE_REWARD_RESPONSE_VALUE,"had taked the vip daily reward");
return;
}
playerInfoManager.setHadTakeDailyBoxVip(1);
rewards = sVipLevelConfig.getVipBoxDailyReward();
}
VipMissionIdsType vipMissionIdsType = user.getUserMissionManager().getVipMissionIdsType();
if(!vipMissionIdsType.getDoingMissionIds().isEmpty() || !vipMissionIdsType.getFinishMissionIds().isEmpty()){
MessageUtil.sendErrorResponse(session,0, MessageTypeProto.MessageType.VIP_TAKE_LEVELREWARD_RESPONSE_VALUE,"mission not finish");
return;
CommonProto.Drop.Builder drop = ItemUtil.drop(user, rewards);
PlayerInfoProto.VipTakeBoxResponse build = PlayerInfoProto.VipTakeBoxResponse.newBuilder().setDrop(drop).build();
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.VIP_TAKE_REWARD_RESPONSE_VALUE,build,true);
}
public void userforceChange(ISession iSession, int teamId) throws Exception {
int uid = iSession.getUid();
User user = UserManager.getUser(uid);
if(user.getTeamPosManager().getTeamPosForHero().containsKey(teamId)){
int teamForce = HeroLogic.getInstance().calTeamTotalForce(user, teamId, true);
if(user.getPlayerInfoManager().getMaxForce() < teamForce){
user.getPlayerInfoManager().setMaxForce(teamForce);
user.getUserMissionManager().onGameEvent(user,GameEvent.USER_FORCE_CHANGE);
}
}
playerInfoManager.setHadTakeVip(1);
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.VIP_TAKE_LEVELREWARD_RESPONSE_VALUE,null,true);
MessageUtil.sendMessage(iSession,1, MessageTypeProto.MessageType.USER_FORCE_CHANGE_RESPONSE_VALUE,null,true);
}
}

View File

@ -375,8 +375,6 @@ public class ItemUtil {
if (dropBuilder != null) {
dropBuilder.addAllItemlist(itemProtoList);
}
//todo 为了测试 日后要删掉
// UserManager.ljsdMongoTemplate.lastUpdate();
}
@ -486,7 +484,7 @@ public class ItemUtil {
}
continue;
}
user.getEquipManager().addEquip(equip);
user.getEquipManager().addEquip(user,equip);
}
user.getMapManager().setTemporaryItems(null);
if(!isVictory){
@ -534,6 +532,7 @@ public class ItemUtil {
myItem.setItemNum(myItem.getItemNum() - needCount);
}
}
user.getUserMissionManager().onGameEvent(user,GameEvent.CONSUMER_MATERIAL,useItemMap);
}
@ -612,7 +611,7 @@ public class ItemUtil {
private static void addEquip(User user,int equipId ,List<CommonProto.Equip> equipList) throws Exception {
EquipManager equipManager = user.getEquipManager();
Equip equip = new Equip(user.getId(),equipId);
equipManager.addEquip(equip);
equipManager.addEquip(user,equip);
equipList.add(CBean2Proto.getEquipProto(equip));
}
@ -666,7 +665,7 @@ public class ItemUtil {
Hero hero = new Hero(user.getId(),heroStar[0],heroStar[1]);
heroManager.addHero(hero);
heroList.add(CBean2Proto.getHero(hero));
user.getUserMissionManager().onGameEvent(GameEvent.GET_HERO,heroStar[0]);
user.getUserMissionManager().onGameEvent(user,GameEvent.GET_HERO,heroStar[0],heroStar[1]);
}
/**
@ -687,16 +686,6 @@ public class ItemUtil {
return true;
}
private static void useMoney(User user, Map<Integer, Integer> moneyMap) throws Exception {
for (Map.Entry<Integer, Integer> entry : moneyMap.entrySet()) {
int itemId = entry.getKey();
int itemNum = entry.getValue();
if (itemId==GlobalItemType.GEM){
user.getPlayerInfoManager().setGem(user.getPlayerInfoManager().getGem() - itemNum);
}
}
}
public static boolean checkCost(User user, Map<Integer, Integer> itemMap) throws Exception {
if (itemMap == null) {
return true;