送无限抽活动优化

duhui 2022-10-19 17:20:47 +08:00
parent c4a00a45a4
commit de7600323e
6 changed files with 67 additions and 94 deletions

View File

@ -30,6 +30,7 @@ import com.ljsd.jieling.logic.GlobalDataManaager;
import com.ljsd.jieling.logic.OnlineUserManager;
import com.ljsd.jieling.logic.activity.ActivityLogic;
import com.ljsd.jieling.logic.activity.ActivityType;
import com.ljsd.jieling.logic.activity.ActivityTypeEnum;
import com.ljsd.jieling.logic.activity.event.*;
import com.ljsd.jieling.logic.dao.*;
import com.ljsd.jieling.logic.dao.root.User;
@ -1831,7 +1832,6 @@ public class MapLogic {
MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightEndResponse.build(), true);
RankContext.getRankEnum(RankEnum.MAIN_LEVEL_RANK.getType()).addRank(uid, "", sMainLevelConfig.getVirtureId(), user.getPlayerInfoManager().getMaxForce());
ReportUtil.onReportEvent(user, ReportEventEnum.PASS_STAGE.getType(), String.valueOf(fightId), "", sMainLevelConfig.getReward(), new Date());
}
@ -1852,6 +1852,7 @@ public class MapLogic {
Poster.getPoster().dispatchEvent(new FightMainEvent(user.getId(), fightId));
Poster.getPoster().dispatchEvent(new NewWelfareEvent(user, NewWelfareTypeEnum.LEVEL_FIGHT.getType(), fightId));
user.getMainLevelManager().updateFight(updateFightId, state);
Poster.getPoster().dispatchEvent(new FightMainEvent(user.getId(), fightId, 1));
// 爱玩信息上报
AiWanPlayerInfoUpload.getInstance().upload(user,AiWanPlayerInfoUpload.levelup);
BuyGoodsNewLogic.openPush(session, user, PushRechargeType.main_line.getType(), fightId, 0);

View File

@ -24,22 +24,26 @@ public class StartFightRequestHandler extends BaseHandler<FightInfoProto.FightSt
int type = fightStartRequest.getType();
int fightId = fightStartRequest.getFightId();
int teamId = fightStartRequest.getTeamId();
if(type == 2){
FightInfoProto.FightStartResponse.Builder builder = FightInfoProto.FightStartResponse.newBuilder();
MapLogic.getInstance().getMap(UserManager.getUser(iSession.getUid())).startFight(iSession.getUid(),builder);
MessageUtil.sendMessage(iSession,1, MessageTypeProto.MessageType.FIGHT_START_RESPONSE_VALUE,builder.build(),true);
}else
if(type == 3){
MapLogic.getInstance().startSuddlenlyFight(iSession,teamId, MessageTypeProto.MessageType.FIGHT_START_RESPONSE);
}else if(type == 5){
MapLogic.getInstance().startMonsterAttackFight(iSession,fightId,teamId, MessageTypeProto.MessageType.FIGHT_START_RESPONSE);
}else if(type == 6){
MapLogic.getInstance().startMainLevelFight(iSession,fightId,teamId, MessageTypeProto.MessageType.FIGHT_START_RESPONSE);
} else if(type == 7){
GuildFightLogic.startBossFight(iSession, teamId,MessageTypeProto.MessageType.FIGHT_START_RESPONSE);
}else {
throw new ErrorCodeException(ErrorCode.newDefineCode("type is wrong:" + type));
switch (type){
case 2:
FightInfoProto.FightStartResponse.Builder builder = FightInfoProto.FightStartResponse.newBuilder();
MapLogic.getInstance().getMap(UserManager.getUser(iSession.getUid())).startFight(iSession.getUid(),builder);
MessageUtil.sendMessage(iSession,1, MessageTypeProto.MessageType.FIGHT_START_RESPONSE_VALUE,builder.build(),true);
break;
case 3:
MapLogic.getInstance().startSuddlenlyFight(iSession,teamId, MessageTypeProto.MessageType.FIGHT_START_RESPONSE);
break;
case 5:
MapLogic.getInstance().startMonsterAttackFight(iSession,fightId,teamId, MessageTypeProto.MessageType.FIGHT_START_RESPONSE);
break;
case 6:
MapLogic.getInstance().startMainLevelFight(iSession,fightId,teamId, MessageTypeProto.MessageType.FIGHT_START_RESPONSE);
break;
case 7:
GuildFightLogic.startBossFight(iSession, teamId,MessageTypeProto.MessageType.FIGHT_START_RESPONSE);
break;
default:
throw new ErrorCodeException(ErrorCode.newDefineCode("FIGHT_START_REQUEST type is wrong:" + type));
}
}
}

View File

@ -210,53 +210,6 @@ public abstract class AbstractMap implements IMap {
* @throws Exception
*/
public void startFight(int uid,FightInfoProto.FightStartResponse.Builder responseBuilder) throws Exception{
// User user = UserManager.getUser(uid);
// MapManager mapManager = user.getMapManager();
// if (mapManager.getMapInfo() == null) {
// LOGGER.info("mapManager.getMapInfo() == null");
//// throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
// }
// if (mapManager.getCanMoveTime() > 0) {
// long leftTime = mapManager.getCanMoveTime() - TimeUtils.now();
// if (leftTime > 0) {
//// throw new ErrorCodeException(ErrorCode.HERO_LIVE_AGAIN,Collections.singletonList((leftTime / 1000)+""));
// }
// }
// Cell cell = mapManager.getMapInfo().get(mapManager.getTriggerXY());
// if (cell == null) {
// cell = mapManager.getMapInfo().get(mapManager.getCurXY());
// if (cell == null) {
// LOGGER.info("cell == null xy is wrong =>{} triggerXY=>{}", mapManager.getCurXY(), mapManager.getTriggerXY());
//// throw new ErrorCodeException(ErrorCode.newDefineCode("cell == null"));
// }
// }
// int bigEventId = cell.getEventId();
// SEventPointConfig sEventPointConfig = STableManager.getConfig(SEventPointConfig.class).get(bigEventId);
// if (sEventPointConfig == null) {
// LOGGER.info("sEventPointConfig == null");
//// throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
// }
// String fightReadyKey = RedisKey.getKey(RedisKey.FIGHT_READY, Integer.toString(uid), false);
// String fightReady = (String) RedisUtil.getInstence().get(fightReadyKey);
// int groupId;
// String pointId = "0";
// if (fightReady != null) {
// String[] split = fightReady.split("#");
// RedisUtil.getInstence().del(fightReadyKey);
// groupId = monsterGroupChange(Integer.parseInt(split[0]),user.getPlayerInfoManager().getLevel(),mapManager.getCurMapId());
// if (split.length > 1) {
// pointId = split[1];
// }
// } else {
// int[] option = sEventPointConfig.getOption();
// if (option == null||option.length<1) {
// LOGGER.info("option == null sEventPointConfig.getId()=>{}", sEventPointConfig.getId());
//// throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
// }
// groupId = monsterGroupChange(option[0],user.getPlayerInfoManager().getLevel(),mapManager.getCurMapId());
// }
// SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId());
// BehaviorUtil.getFightInfo(user,401, groupId, responseBuilder, pointId, sChallengeConfig.getMostTime(), true);
}
public void fastFight(int uid, FightInfoProto.FastFightResponse.Builder fastFightResponseBuilder) throws Exception {

View File

@ -1,9 +1,7 @@
package com.ljsd.jieling.logic.activity;
import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig;
import com.ljsd.jieling.core.GlobalsDef;
import com.ljsd.jieling.globals.BIReason;
import com.ljsd.jieling.jbean.ActivityMission;
import com.ljsd.jieling.logic.activity.event.FightMainEvent;
import com.ljsd.jieling.logic.activity.event.IEvent;
@ -11,12 +9,9 @@ import com.ljsd.jieling.logic.activity.event.Poster;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.expedition.ExpeditionLogic;
import com.ljsd.jieling.util.ItemUtil;
import com.ljsd.jieling.util.ToolsUtil;
import config.SGlobalActivity;
import config.SGlobalSystemConfig;
import config.SMainLevelConfig;
import manager.STableManager;
import java.util.ArrayList;
import java.util.List;
@ -28,20 +23,19 @@ public class FightMainEventHandler implements IEventHandler{
Poster.getPoster().listenEvent(this, FightMainEvent.class);
}
@Override
public void onEvent(IEvent event) throws Exception {
if (!(event instanceof FightMainEvent))
if (!(event instanceof FightMainEvent)) {
return;
}
FightMainEvent fightMainEvent = (FightMainEvent) event;
if (fightMainEvent.getSort() != 0){
return;
}
int fightId = fightMainEvent.getFightId();
int uid = fightMainEvent.getUid();
User user = UserManager.getUser(uid);
/* if(fightId == 1151){
user.getPlayerInfoManager().updateGuidePoint(1,-1);
}*/
User user = UserManager.getUser(fightMainEvent.getUid());
// 大闹天宫十四天开启
ExpeditionLogic.openTreasure(user,2,fightId);
//检测更新vip是否有新开
user.getPlayerInfoManager().updateVipInfo(GlobalsDef.MAIN_LEVEL_UNLOCK_PRIVILEGE,10_000_000 * (fightId % 10) + fightId);
@ -52,9 +46,6 @@ public class FightMainEventHandler implements IEventHandler{
if(activityMission!=null && activityMission.getActivityState() == ActivityType.UNOPEN_STATE){
int virtureId = SMainLevelConfig.config.get( openRules[1]).getVirtureId();
SMainLevelConfig mineMainLevelConfig = SMainLevelConfig.config.get(fightId);
// if(user.getMainLevelManager().getState() == 2 ){
// mineMainLevelConfig = SMainLevelConfig.config.get(user.getMainLevelManager().getFightId());
// }
if(mineMainLevelConfig!=null && virtureId <= mineMainLevelConfig.getVirtureId()){
activityMission.setActivityState(ActivityType.OPEN_STATE);
ActivityLogic.getInstance().sendActivityInfo(user,sGlobalActivity.getId());
@ -64,7 +55,6 @@ public class FightMainEventHandler implements IEventHandler{
for (int shopId : sGlobalActivity.getShopId()) {
ActivityLogic.getInstance().checkNeedOpenStore(user,shopId,startTime,endTime);
}
}
}
}
@ -72,16 +62,5 @@ public class FightMainEventHandler implements IEventHandler{
ActivityTypeEnum.getActicityType(sGlobalActivity.getId()).update(user,user.getPlayerInfoManager().getLevel());
}
}
/*List<SGlobalSystemConfig> sGlobalSystemConfigs = STableManager.getFigureConfig(CommonStaticConfig.class).getsGlobalSystemConfigMapByTypeAndConditionMap().get(1).get(fightId);
if(sGlobalSystemConfigs == null){
return;
}
for(SGlobalSystemConfig sGlobalSystemConfig : sGlobalSystemConfigs){
int[][] openGifts = sGlobalSystemConfig.getOpenGifts();
if(openGifts!=null && openGifts.length>0){
ItemUtil.drop(user,openGifts, BIReason.SYSTERM_OPEN_REWARD);
}
}*/
}
}

View File

@ -5,6 +5,10 @@ import com.ljsd.jieling.exception.ErrorCodeException;
import com.ljsd.jieling.globals.BIReason;
import com.ljsd.jieling.jbean.ActivityMission;
import com.ljsd.jieling.jbean.ActivityProgressInfo;
import com.ljsd.jieling.logic.OnlineUserManager;
import com.ljsd.jieling.logic.activity.event.FightMainEvent;
import com.ljsd.jieling.logic.activity.event.IEvent;
import com.ljsd.jieling.logic.activity.event.Poster;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.network.session.ISession;
@ -30,6 +34,22 @@ public class GiveEndlessDrawActivity extends AbstractActivity {
GiveEndlessDrawActivity(int id) {
super(id);
Poster.getPoster().listenEvent(this, FightMainEvent.class);
}
@Override
public void onEvent(IEvent event) throws Exception {
if (!(event instanceof FightMainEvent)) {
return;
}
FightMainEvent event1 = (FightMainEvent) event;
if (event1.getSort() != 1){
return;
}
ISession session = OnlineUserManager.sessionMap.get(event1.getUid());
User user = UserManager.getUser(event1.getUid());
// 状态推送
sendActivityProgress(session, user.getActivityManager().getActivityMissionMap().get(id), null);
}
@Override
@ -99,7 +119,7 @@ public class GiveEndlessDrawActivity extends AbstractActivity {
SMainLevelConfig mainLv = SMainLevelConfig.config.get(mainLvId);
if (value != null && mainLv != null){
//关卡满足
if (mainLv.getVirtureId() >= value.getVirtureId()){
if (mainLv.getVirtureId() > value.getVirtureId()){
state = 1;
}
}

View File

@ -5,9 +5,21 @@ public class FightMainEvent implements IEvent {
private int uid;
private int fightId;
/**
*
*/
private int sort;
public FightMainEvent(int uid, int fightId) {
this.uid = uid;
this.fightId = fightId;
this.sort = 0;
}
public FightMainEvent(int uid, int fightId, int sort) {
this.uid = uid;
this.fightId = fightId;
this.sort = sort;
}
public int getUid() {
@ -17,4 +29,8 @@ public class FightMainEvent implements IEvent {
public int getFightId() {
return fightId;
}
public int getSort() {
return sort;
}
}