back_recharge
王永芳 2019-06-14 18:50:01 +08:00
commit 9346c5e82b
8 changed files with 153 additions and 56 deletions

View File

@ -17,15 +17,58 @@ import com.ljsd.jieling.util.MessageUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentLinkedQueue;
public class HandlerLogicThread extends Thread{
private static final Logger LOGGER = LoggerFactory.getLogger(HandlerLogicThread.class);
private static Set<Integer> whiteMsg = new HashSet<>();
static {
whiteMsg.add(MessageTypeProto.MessageType.MAP_ENTER_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.MAP_START_EXPLORE_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.MAP_UDPATE_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.EVENT_UPDATE_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.MAP_FAST_FIGHT_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.FIGHT_START_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.FIGHT_END_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.MAP_OUT_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.LOGIN_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.GET_PLAYERINFO_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.GET_VIP_MISSION_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.GET_ITEMINFO_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.GET_ALL_EQUIP_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.GET_ALL_POKEMON_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.GET_HEROINFO_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.GET_TEAMPOS_INFO_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.GET_WORKSHOP_INFO_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.GET_ALL_MAIL_INFO_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.GET_ALL_LEVE_DIFFICULTT_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.GET_ALL_ACTIVITY_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.GET_FUNCTIONOFTIME_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.GET_SECRETBOX_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.GET_DAILY_MISSION_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.ADVENTURE_INFO_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.GET_FRIEND_INFO_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.GET_STARE_INFOS_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.ARENA_INFO_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.GET_RINGFIRE_INFO_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.BUY_STORE_ITEM_REQUEST_VALUE);
//日后删除
whiteMsg.add(MessageTypeProto.MessageType.GET_CHAT_MESSAGE_REQUEST_VALUE);
}
public ConcurrentLinkedQueue<PacketNetData> handlerLinkedQueue = new ConcurrentLinkedQueue();
@Override
public void run() {
while (GameApplication.start) {
@ -58,6 +101,11 @@ public class HandlerLogicThread extends Thread{
MessageUtil.sendErrorResponse(session,0,msgId+1,"funciton not");
return;
}
b = checkIsPermit(msgId, session);
if(!b){
MessageUtil.sendErrorResponse(session,0,msgId+1,"在地图探索中,不可以操作");
return;
}
}
@ -73,6 +121,17 @@ public class HandlerLogicThread extends Thread{
}
private boolean checkIsPermit(int msgId,ISession session) throws Exception {
int uid = session.getUid();
User user = UserManager.getUser(uid);
int curMapId = user.getMapManager().getCurMapId();
if(curMapId!=0 && !whiteMsg.contains(msgId)){
return false;
}
return true;
}
private boolean checkFunctionIsOpen(int msgId,ISession session ) {
int uid = session.getUid();
try {

View File

@ -159,6 +159,9 @@ public class MapLogic {
mapManager.setCurMapId(mapId);
initMap(mapManager, user);
user.setMapManager(mapManager);
}else if(mapManager.getCurMapId()!=mapId){
MessageUtil.sendErrorResponse(iSession, 0, messageType.getNumber(), "地图错误,应进入" + mapManager.getCurMapId());
return;
}
List<CommonProto.Cell> cells = new ArrayList<>(mapManager.getMapInfo().size());
for (Map.Entry<Integer, Cell> entry : mapManager.getMapInfo().entrySet()) {
@ -528,8 +531,8 @@ public class MapLogic {
}
}
}
updateMapMission(mapManager,EventType.updateOptionalEvent, optionId,0);
updateMapMission(mapManager,EventType.updatePonintEvent, pointId,0);
updateMapMission(mapManager,EventType.updateOptionalEvent, optionId,optionId);
updateMapMission(mapManager,EventType.updatePonintEvent, pointId,pointId);
CommonProto.Drop.Builder dropBuilder = null;
if (sOptionConfig.getReward().length > 0) {
dropBuilder = ItemUtil.drop(user, sOptionConfig.getReward(), 1, 1, BIReason.MAP_EVENET_REWARD);
@ -945,7 +948,7 @@ public class MapLogic {
fastFightResponse.addAllRemainHpList(remainHp);
fastFightResponse.build();
// LOGGER.info("endFight() uid=>{},nextEventId=>{}", uid, nextEventId);
updateMapMission(mapManager,EventType.fightEvent,0, groupId);
updateMapMission(mapManager,EventType.fightEvent,groupId, groupId);
// LOGGER.info("endFight() uid=>{} sMonsterGroup.getRewardgroup()=>{} misson=>{} eventDrop=>{}, missionDrop=>{}", uid, sMonsterGroup.getRewardgroup(), fastFightResponse.getMission(), fastFightResponse.getEnventDrop(), fastFightResponse.getMissionDrop());
MessageUtil.sendMessage(session, 1, messageType.getNumber(), fastFightResponse.build(), true);
}
@ -1139,7 +1142,7 @@ public class MapLogic {
}
fightEndResponse.setEventId(nextEventId);
// LOGGER.info("endFight() uid=>{},nextEventId=>{}", uid, nextEventId);
updateMapMission(mapManager,EventType.fightEvent,0,monsterGroupId);
updateMapMission(mapManager,EventType.fightEvent,monsterGroupId,monsterGroupId);
// LOGGER.info("endFight() uid=>{} sMonsterGroup.getRewardgroup()=>{} misson=>{} eventDrop=>{}, missionDrop=>{}", uid, sMonsterGroup.getRewardgroup(), fightEndResponse.getMission(), fightEndResponse.getEnventDrop(), fightEndResponse.getMissionDrop());
MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightEndResponse.build(), true);
@ -1173,6 +1176,7 @@ public class MapLogic {
public int updateMapMission(MapManager mapManager,int eventType,int eventId,int bossIdOrItemId){
LOGGER.info("the eventtype ={},eventId={},bossItemId={}",eventType,eventId,bossIdOrItemId);
int mapId = mapManager.getCurMapId();
if(mapId==0){
return 0;
@ -1191,50 +1195,8 @@ public class MapLogic {
int score = sAccomplishmentConfig.getScore();
int logic = sAccomplishmentConfig.getLogic();
int[][] values = sAccomplishmentConfig.getValues();
int targetEventId = values[0][0];
int targetEventValue = values[1][0];
if(eventType == EventType.updateOptionalEvent && logic == MapMissionType.FINISH_EVEVNT.getMissionTypeValue()){
for(int targetEventIdTmp : values[0]){
if(targetEventIdTmp == eventId){
if(missionValue<targetEventValue){
allMissionProgress.put(missionId,missionValue+1);
needUpdate = true;
if(missionValue+1 == targetEventValue){
addScore+=score;
}
}
}
}
}
//updatePonintEvent optionalConfig获取
if(eventType == EventType.updatePonintEvent){
//处理采矿 、宝箱
MapPointConfig mapPointConfig = MapPointConfig.getScMapEventMap().get(eventId);
if(mapPointConfig!=null){
if((mapPointConfig.getStyle() == 2 && logic == MapMissionType.DIGGER_EVENT.getMissionTypeValue() )|| (mapPointConfig.getStyle() == 7 && logic == MapMissionType.OPEN_BOX.getMissionTypeValue())){
if(missionValue<targetEventValue){
allMissionProgress.put(missionId,missionValue+1);
needUpdate = true;
if(missionValue+1 == targetEventValue){
addScore+=score;
}
}
}
}
}
//todo 战斗结束处理
if(eventType == EventType.fightEvent){
if(logic == MapMissionType.KILL_BOSS.getMissionTypeValue()){
if(targetEventId == bossIdOrItemId){
if(missionValue<targetEventValue){
allMissionProgress.put(missionId,missionValue+1);
needUpdate = true;
if(missionValue+1 == targetEventValue){
addScore+=score;
}
}
}
}
if(logic == MapMissionType.VICTORY_EVENT.getMissionTypeValue()){
if(missionValue<targetEventValue){
allMissionProgress.put(missionId,missionValue+1);
@ -1245,8 +1207,43 @@ public class MapLogic {
}
}
}
if(eventType == EventType.updateOptionalEvent || eventType == EventType.fightEvent){
if(logic ==MapMissionType.FINISH_EVEVNT.getMissionTypeValue() || logic == MapMissionType.KILL_BOSS.getMissionTypeValue()){
for(int targetEventIdTmp : values[0]){
if(targetEventIdTmp == eventId){
if(missionValue<targetEventValue){
allMissionProgress.put(missionId,missionValue+1);
needUpdate = true;
if(missionValue+1 == targetEventValue){
addScore+=score;
}
}
}
}
}
//todo 行脚商人 在地图商店买东西需要特殊处理
continue;
}
//updatePonintEvent optionalConfig获取
if(eventType == EventType.updatePonintEvent){
//处理采矿 、宝箱
MapPointConfig mapPointConfig = MapPointConfig.getScMapEventMap().get(eventId);
if(mapPointConfig!=null){
if((mapPointConfig.getStyle() == 2 && logic == MapMissionType.DIGGER_EVENT.getMissionTypeValue() )|| (mapPointConfig.getStyle() == 7 && logic == MapMissionType.OPEN_BOX.getMissionTypeValue())){
if(missionValue<targetEventValue){
allMissionProgress.put(missionId,missionValue+1);
needUpdate = true;
if(missionValue+1 == targetEventValue){
addScore+=score;
}
}
}
}
}
/* int targetEventId = values[0][0];
if(eventType == EventType.shopEvent){
if(logic == MapMissionType.BUY_GOODS_ID_EVENT.getMissionTypeValue()){
if(targetEventId == eventId && bossIdOrItemId == targetEventValue && missionValue==0 ){
@ -1256,7 +1253,7 @@ public class MapLogic {
}
if(logic == MapMissionType.BUY_GOODS_TYPE_EVENT.getMissionTypeValue()){
if(targetEventId == eventId && missionValue==0 ){
if(targetEventId == eventId && missionValue==0){
SItem sItem = SItem.getsItemMap().get(bossIdOrItemId);
if(sItem.getItemType() == targetEventValue){
allMissionProgress.put(missionId,1);
@ -1266,9 +1263,9 @@ public class MapLogic {
}
}
}
}
}*/
}
if(addScore!=0){
mapMission.setTotalWeight(mapMission.getTotalWeight()+addScore);
if (mapMission.getTotalWeight() >= 100) {

View File

@ -308,6 +308,7 @@ public class CombatLogic {
MessageUtil.sendErrorResponse(iSession,0, MessageTypeProto.MessageType.ADVENTURE_UPLEVEL_RESPONSE_VALUE,"item not");
return;
}
getAdventureReward(user, arenaId, true,1);
adventureStateInfo.setLevel(adventureStateInfo.getLevel()+1);
MessageUtil.sendMessage(iSession,1, MessageTypeProto.MessageType.ADVENTURE_UPLEVEL_RESPONSE_VALUE,null,true);
}
@ -324,7 +325,7 @@ public class CombatLogic {
return;
}
}
adventureFastReward = getAdventureReward(user, position);
adventureFastReward = getAdventureReward(user, position,false,0);
}else{
String err = StoreLogic.checkBuyGoodsAndUpdate(user,7,10008,1);
@ -338,9 +339,12 @@ public class CombatLogic {
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.ADVENTURE_REWARD_RESPONSE_VALUE,build,true);
}
private Map<Integer,CommonProto.Drop> getAdventureReward(User user, int position) throws Exception {
public Map<Integer,CommonProto.Drop> getAdventureReward(User user, int position,boolean sendMail,int reason) throws Exception {
AdventureManager adventureManager = user.getAdventureManager();
Map<Integer, AdventureStateInfo> adventureStateInfoMap = adventureManager.getAdventureStateInfoMap();
if(adventureStateInfoMap.isEmpty()){
return null;
}
int now = (int)(System.currentTimeMillis()/1000);
SGameSetting gameSetting = SGameSetting.getGameSetting();
int adventureRefresh = gameSetting.getAdventureRefresh();
@ -376,6 +380,31 @@ public class CombatLogic {
ItemUtil.combineReward(randomRewardGroup[adventureStateInfoTmp.getLevel()-1], 1f,randomItemMap,randomCardMap,randomEquipMap,randomRandomMap);
}
}
if(sendMail){
adventureStateInfoTmp.setStartTime(now);
}
}
if(sendMail){
if(!baseItemMap.isEmpty()){
String title = "";
String content = "";
if(reason == 1){
title = SErrorCodeEerverConfig.getI18NMessage("adventuren_reward_of_uplevel_title");
content = SErrorCodeEerverConfig.getI18NMessage("adventuren_reward_of_uplevel_content");
}else if(reason == 2){
title = SErrorCodeEerverConfig.getI18NMessage("adventuren_reward_of_viplevel_title");
content = SErrorCodeEerverConfig.getI18NMessage("adventuren_reward_of_viplevel_content");
}else {
return null;
}
String reward = ItemUtil.getReward(baseItemMap, baseCardMap, baseEquipMap, baseRandomMap);
String randomReward = ItemUtil.getReward(randomItemMap, randomCardMap, randomEquipMap, randomRandomMap);
if(randomReward.length()!=0){
reward = reward + "|" + randomReward;
}
MailLogic.getInstance().sendMail(user.getId(),title,content,reward,now,Global.MAIL_EFFECTIVE_TIME);
}
return null;
}
ItemUtil.drop(user,baseBuilder,baseItemMap,baseCardMap,baseEquipMap,baseRandomMap,BIReason.ADVENTURE_BASE_REWARD);
ItemUtil.drop(user,randomBuilder,randomItemMap,randomCardMap,randomEquipMap,randomRandomMap,BIReason.ADVENTURE_RANDOM_REWARDD);

View File

@ -1401,6 +1401,8 @@ public class HeroLogic {
Pokemon pokemon = pokemonManager.getRingFireMap().get(pokemonId);
if(pokemon == null){
pokemon = new Pokemon(pokemonId);
pokemon.setAllStage(1);
pokemonManager.addRingFirePokemon(pokemon);
}
SRingTypeConfig sRingTypeConfig = SRingTypeConfig.config.get(pokemonId);
if(sRingTypeConfig == null){

View File

@ -198,9 +198,17 @@ public class ItemLogic {
int[][] sumConsume = SHeroLevlConfig.getsHeroLevlConfigMap().get(hero.getLevel()).getSumConsume();
ItemUtil.combineReward(sumConsume,baseItemMap,baseCardMap,baseEquipMap,baseRandomMap);
int breakId = hero.getBreakId();
if(breakId!=0){
int starBreakId = hero.getStarBreakId();
if(breakId!=0 || starBreakId!=0){
SCHeroRankUpConfig scHeroRankUpConfig = SCHeroRankUpConfig.scHeroRankUpConfigMap.get(breakId);
ItemUtil.combineReward(scHeroRankUpConfig.getSumConsume(),baseItemMap,baseCardMap,baseEquipMap,baseRandomMap);
if(scHeroRankUpConfig!=null){
ItemUtil.combineReward(scHeroRankUpConfig.getSumConsume(),baseItemMap,baseCardMap,baseEquipMap,baseRandomMap);
}
scHeroRankUpConfig = SCHeroRankUpConfig.scHeroRankUpConfigMap.get(starBreakId);
if(scHeroRankUpConfig!=null){
ItemUtil.combineReward(scHeroRankUpConfig.getSumConsume(),baseItemMap,baseCardMap,baseEquipMap,baseRandomMap);
}
continue;
}
SItem sItem = SItem.getsItemMap().get(hero.getTemplateId());

View File

@ -9,6 +9,7 @@ import com.ljsd.jieling.logic.activity.ActivityLogic;
import com.ljsd.jieling.logic.activity.ActivityType;
import com.ljsd.jieling.logic.dao.*;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.fight.CombatLogic;
import com.ljsd.jieling.logic.hero.HeroLogic;
import com.ljsd.jieling.logic.mail.MailLogic;
import com.ljsd.jieling.logic.mission.GameEvent;
@ -167,6 +168,7 @@ public class PlayerLogic {
MessageUtil.sendErrorResponse(session,0, MessageTypeProto.MessageType.VIP_LEVELUP_RESPONSE_VALUE,"not finfish");
return;
}
CombatLogic.getInstance().getAdventureReward(user, -1, true,2);
int vipLevel = playerInfoManager.getVipLevel();
playerInfoManager.updateVipInfo(user,vipLevel+1);
CommonProto.VipMissionInfo vipMissionResponse = MissionLoigc.getVipMissionResponse(user);

View File

@ -282,6 +282,6 @@ public class CBean2Proto {
}
public static CommonProto.RingFireInfo getRingFire(Pokemon pokemon) {
return CommonProto.RingFireInfo.newBuilder().addAllComonpentId(pokemon.getComonpentsLevelMap().values()).setStage(pokemon.getAllStage()).build();
return CommonProto.RingFireInfo.newBuilder().addAllComonpentId(pokemon.getComonpentsLevelMap().keySet()).setStage(pokemon.getAllStage()).setId(pokemon.getId()).build();
}
}

View File

@ -176,7 +176,7 @@ public class ItemUtil {
addEquip(user, equipMap, dropBuilder,reason);
}
private static String getReward(Map<Integer, Integer> itemMap,Map<Integer, Integer> cardMap,Map<Integer, Integer> equipMap, Map<Integer,Integer> randomMap) {
public static String getReward(Map<Integer, Integer> itemMap,Map<Integer, Integer> cardMap,Map<Integer, Integer> equipMap, Map<Integer,Integer> randomMap) {
StringBuilder reward= new StringBuilder();
for (Map.Entry<Integer, Integer> entry : itemMap.entrySet()){
if (reward.length() == 0){