Merge branch 'master_test_gn_arean' into master_test_gn
commit
197616887a
|
@ -22,7 +22,7 @@ public enum FightType {
|
||||||
TenDespairArray(16),//十绝阵
|
TenDespairArray(16),//十绝阵
|
||||||
Firend(17),//好友
|
Firend(17),//好友
|
||||||
TowerMap(18),//森罗幻境
|
TowerMap(18),//森罗幻境
|
||||||
|
TaSuiLingXiao(19),//踏碎凌霄
|
||||||
;
|
;
|
||||||
|
|
||||||
private int type;
|
private int type;
|
||||||
|
|
|
@ -0,0 +1,132 @@
|
||||||
|
package com.ljsd.jieling.handler.activity;
|
||||||
|
import com.google.protobuf.GeneratedMessage;
|
||||||
|
import com.ljsd.fight.FightType;
|
||||||
|
import com.ljsd.jieling.core.GlobalsDef;
|
||||||
|
import com.ljsd.jieling.exception.ErrorCode;
|
||||||
|
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||||
|
import com.ljsd.jieling.globals.BIReason;
|
||||||
|
import com.ljsd.jieling.handler.BaseHandler;
|
||||||
|
import com.ljsd.jieling.jbean.ActivityMission;
|
||||||
|
import com.ljsd.jieling.jbean.ActivityProgressInfo;
|
||||||
|
import com.ljsd.jieling.ktbeans.ReportEventEnum;
|
||||||
|
import com.ljsd.jieling.ktbeans.ReportUtil;
|
||||||
|
import com.ljsd.jieling.logic.activity.event.GoldRefreshEvent;
|
||||||
|
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||||
|
import com.ljsd.jieling.logic.activity.event.TaSuiLingXiaoEvent;
|
||||||
|
import com.ljsd.jieling.logic.dao.UserManager;
|
||||||
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
|
import com.ljsd.jieling.logic.fight.*;
|
||||||
|
import com.ljsd.jieling.logic.fight.result.FightResult;
|
||||||
|
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||||
|
import com.ljsd.jieling.util.ItemUtil;
|
||||||
|
import config.SMonsterConfig;
|
||||||
|
import config.SMonsterGroup;
|
||||||
|
import config.SNewHeroConfig;
|
||||||
|
import manager.STableManager;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import rpc.protocols.ActivityProto;
|
||||||
|
import rpc.protocols.MessageTypeProto;
|
||||||
|
import rpc.protocols.CommonProto;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class TasuilingxiaoHandler extends BaseHandler<ActivityProto.TasuilingxiaoRequest> {
|
||||||
|
@Override
|
||||||
|
public MessageTypeProto.MessageType getMessageCode() {
|
||||||
|
return MessageTypeProto.MessageType.TasuilingxiaoRequest;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public GeneratedMessage processWithProto(int uid, ActivityProto.TasuilingxiaoRequest proto) throws Exception {
|
||||||
|
// 用户信息
|
||||||
|
User user = UserManager.getUser(uid);
|
||||||
|
if (user == null) {
|
||||||
|
throw new ErrorCodeException(ErrorCode.UNKNOWN);
|
||||||
|
}
|
||||||
|
// 读表
|
||||||
|
SNewHeroConfig newHeroConfig = STableManager.getConfig(SNewHeroConfig.class).get(proto.getActivityId());
|
||||||
|
int monsterGroupId = newHeroConfig.getMonsterGroup(); //怪物id
|
||||||
|
// 战斗逻辑
|
||||||
|
PVEFightEvent pveFightEvent = new PVEFightEvent(user.getId(), GlobalsDef.FORMATION_NORMAL, 20, "", GameFightType.NewGeneral, monsterGroupId, 3);
|
||||||
|
FightResult fightResult = FightDispatcher.dispatcher(pveFightEvent);
|
||||||
|
CommonProto.FightData fightData = CommonProto.FightData.newBuilder()
|
||||||
|
.setFightMaxTime(20)
|
||||||
|
.setFightSeed(fightResult.getSeed())
|
||||||
|
.setHeroFightInfos(fightResult.getFightTeamInfo())
|
||||||
|
.addAllMonsterList(fightResult.getMonsterTeamList())
|
||||||
|
.setFightType(FightType.TaSuiLingXiao.getType())
|
||||||
|
.setFightId(FightUtil.getFightId(user.getId(), FightType.TaSuiLingXiao.getType()))
|
||||||
|
.build();
|
||||||
|
|
||||||
|
// 记录战报
|
||||||
|
FightRecordLogic.getInstance().addRecordMap(user,fightData);
|
||||||
|
// 道具逻辑,封装好的
|
||||||
|
CommonProto.Drop.Builder drop = CommonProto.Drop.newBuilder();
|
||||||
|
// 消耗道具
|
||||||
|
//PlayerLogic.getInstance().checkAndUpdate(user, proto.getPrivilageTypeId(),1);
|
||||||
|
SMonsterGroup sMonsterGroup = SMonsterGroup.getsMonsterGroupMap().get(monsterGroupId);
|
||||||
|
// 获取怪物组
|
||||||
|
int[][] contents = sMonsterGroup.getContents();
|
||||||
|
double bossBlood = 0.0; //怪物初始化血量
|
||||||
|
for (int i = 0; i < contents.length; i++) {
|
||||||
|
int[] ints = contents[i];
|
||||||
|
for (int j = 0; j < ints.length; j++) {
|
||||||
|
if (ints[j] == 0){
|
||||||
|
// 怪物不存在
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
SMonsterConfig monsterConfig = STableManager.getConfig(SMonsterConfig.class).get(ints[j]);
|
||||||
|
// 计算总血量
|
||||||
|
bossBlood+=monsterConfig.getHp();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 战斗结果,{战斗结果,战斗时间,单位1剩余血量......}
|
||||||
|
long[] checkResult = fightResult.getCheckResult();
|
||||||
|
//输
|
||||||
|
double lessBlood = 0.0;
|
||||||
|
|
||||||
|
if (checkResult[0] == 1){
|
||||||
|
lessBlood = bossBlood;
|
||||||
|
}else {
|
||||||
|
// 输 checkResult第三位开始为血量,下标0开始
|
||||||
|
for (int i = 2; i < checkResult.length; i++) {
|
||||||
|
lessBlood+=checkResult[i];
|
||||||
|
}
|
||||||
|
lessBlood = bossBlood - lessBlood;
|
||||||
|
//return ActivityProto.TasuilingxiaoResponse.newBuilder().setFightData(fightData).setDrop(drop).setDamageVal((int)lessBlood).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
//取出所有奖励状态
|
||||||
|
ActivityMission mission = user.getActivityManager().getActivityMissionMap().get(proto.getActivityId());
|
||||||
|
int [][]damageListData = newHeroConfig.getValueDropCell();
|
||||||
|
//完成目标个数
|
||||||
|
int goal = 0;
|
||||||
|
List<Integer> listState =mission.getActivityMissionMap().entrySet().stream()
|
||||||
|
.sorted(Map.Entry.comparingByKey()).map(e->e.getValue().getState()).collect(Collectors.toList());
|
||||||
|
List<Integer>dropList = new ArrayList<Integer>();
|
||||||
|
for (int i = 0; i < damageListData.length; i++) {
|
||||||
|
int[] ints = damageListData[i];
|
||||||
|
if(ints[0] > lessBlood){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
goal += 1;
|
||||||
|
if(i <= listState.size()-1){
|
||||||
|
if( listState.get(i) != 1){
|
||||||
|
dropList.add(ints[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
boolean extarReward = PlayerLogic.getInstance().check(user, newHeroConfig.getDailyNumber(), 1);
|
||||||
|
if(extarReward){
|
||||||
|
dropList.add(newHeroConfig.getDailyReward());
|
||||||
|
user.getPlayerInfoManager().updateVipPrivilage(newHeroConfig.getDailyNumber(),1);
|
||||||
|
}
|
||||||
|
Poster.getPoster().dispatchEvent(new TaSuiLingXiaoEvent(uid,(int)lessBlood,goal));
|
||||||
|
ItemUtil.drop(user,dropList.stream().mapToInt(Integer::intValue).toArray(),drop,1,0, BIReason.TA_SUI_LING_XIAO);
|
||||||
|
return ActivityProto.TasuilingxiaoResponse.newBuilder().setFightData(fightData).setDrop(drop).setDamageVal((int)lessBlood).build();
|
||||||
|
}
|
||||||
|
}
|
|
@ -106,7 +106,8 @@ public enum ReportEventEnum {
|
||||||
START_DEMON_INVASION(72,"start_demon_invasion",CommonEventHandler.getInstance(),new String[]{"stage_id_travel","boss_ids","combat_results"}),
|
START_DEMON_INVASION(72,"start_demon_invasion",CommonEventHandler.getInstance(),new String[]{"stage_id_travel","boss_ids","combat_results"}),
|
||||||
// 通过逍遥游
|
// 通过逍遥游
|
||||||
COMPLETE_TRAVEL(73,"complete_travel",CommonEventHandler.getInstance(),new String[]{"stage_id_travel"}),
|
COMPLETE_TRAVEL(73,"complete_travel",CommonEventHandler.getInstance(),new String[]{"stage_id_travel"}),
|
||||||
|
// 新将来袭
|
||||||
|
TA_SUI_LING_XIAO(74,"tasuilingxiao_boss",CommonEventHandler.getInstance(),new String[]{"boss_id","damage_num","reward_nums_list"}),
|
||||||
|
|
||||||
VIP_LEVEL_UP(100,"", new VipLevelUpEventHandler(),new String[]{""});
|
VIP_LEVEL_UP(100,"", new VipLevelUpEventHandler(),new String[]{""});
|
||||||
|
|
||||||
|
|
|
@ -72,6 +72,7 @@ public interface ActivityType {
|
||||||
int NEW_EIGHT_LOGIN = 56;//新的八日登录
|
int NEW_EIGHT_LOGIN = 56;//新的八日登录
|
||||||
int SIGN_BOX= 57;//累计签到宝箱
|
int SIGN_BOX= 57;//累计签到宝箱
|
||||||
int JADE_DYNASTY_RECHARGE_SUM = 58;//破阵诛仙累充
|
int JADE_DYNASTY_RECHARGE_SUM = 58;//破阵诛仙累充
|
||||||
|
int TA_SUI_LING_XIAO = 66;//踏碎凌霄
|
||||||
int JADE_DYNASTY_MISSION = 20000;//破阵诛仙任务
|
int JADE_DYNASTY_MISSION = 20000;//破阵诛仙任务
|
||||||
int JADE_DYNASTY_SHOP = 20001;//破阵诛仙限时商市
|
int JADE_DYNASTY_SHOP = 20001;//破阵诛仙限时商市
|
||||||
int JADE_DYNASTY_RARE_SHOP = 20002;//破阵诛仙珍奇宝阁
|
int JADE_DYNASTY_RARE_SHOP = 20002;//破阵诛仙珍奇宝阁
|
||||||
|
@ -92,4 +93,5 @@ public interface ActivityType {
|
||||||
int DEMON_TREASURE = 36;//降妖夺宝
|
int DEMON_TREASURE = 36;//降妖夺宝
|
||||||
int NEW_GENERAL_ATTACK = 200;//新将来袭
|
int NEW_GENERAL_ATTACK = 200;//新将来袭
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,6 +70,8 @@ public enum ActivityTypeEnum {
|
||||||
FIFTEEN_LOGIN(ActivityType.FIFTEEN_LOGIN,FifteenActivity::new),
|
FIFTEEN_LOGIN(ActivityType.FIFTEEN_LOGIN,FifteenActivity::new),
|
||||||
LUCKY_GET(ActivityType.LUCKY_GET,LuckyGetActivity::new),
|
LUCKY_GET(ActivityType.LUCKY_GET,LuckyGetActivity::new),
|
||||||
EQUIP_UPLEVEL(ActivityType.EQUIP_UPLEVEL,EquipUpLevelActivity::new),
|
EQUIP_UPLEVEL(ActivityType.EQUIP_UPLEVEL,EquipUpLevelActivity::new),
|
||||||
|
TA_SUI_LING_XIAO(ActivityType.TA_SUI_LING_XIAO,TaSuiLingXiaoActivity::new),
|
||||||
|
|
||||||
|
|
||||||
;
|
;
|
||||||
private int type;
|
private int type;
|
||||||
|
|
|
@ -0,0 +1,75 @@
|
||||||
|
package com.ljsd.jieling.logic.activity;
|
||||||
|
|
||||||
|
import com.ljsd.jieling.exception.ErrorCode;
|
||||||
|
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||||
|
import com.ljsd.jieling.globals.BIReason;
|
||||||
|
import com.ljsd.jieling.jbean.ActivityManager;
|
||||||
|
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.BlessInfoRefreshEvent;
|
||||||
|
import com.ljsd.jieling.logic.activity.event.IEvent;
|
||||||
|
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||||
|
import com.ljsd.jieling.logic.activity.event.TaSuiLingXiaoEvent;
|
||||||
|
import com.ljsd.jieling.logic.dao.UserManager;
|
||||||
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
|
import com.ljsd.jieling.util.ItemUtil;
|
||||||
|
import com.ljsd.jieling.util.MessageUtil;
|
||||||
|
import config.SActivityRewardConfig;
|
||||||
|
import config.SGlobalActivity;
|
||||||
|
import config.SLuckyCatConfig;
|
||||||
|
import rpc.protocols.MessageTypeProto;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class TaSuiLingXiaoActivity extends AbstractActivity {
|
||||||
|
|
||||||
|
public TaSuiLingXiaoActivity(int id) {
|
||||||
|
super(id);
|
||||||
|
Poster.getPoster().listenEvent(this, TaSuiLingXiaoEvent.class);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onEvent(IEvent event) throws Exception {
|
||||||
|
if(event instanceof TaSuiLingXiaoEvent){
|
||||||
|
User user = UserManager.getUser(((TaSuiLingXiaoEvent) event).getUid());
|
||||||
|
if(user == null){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(user.getActivityManager().getActivityMissionMap().get(id) == null){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
update(user,((TaSuiLingXiaoEvent) event).getCount(),((TaSuiLingXiaoEvent) event).getGoal());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean takeReward(ISession session, int missionId) throws Exception{
|
||||||
|
//不能领取 随掉落走
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update(User user, int count,int goal) {
|
||||||
|
ActivityMission activityMission = user.getActivityManager().getActivityMissionMap().get(id);
|
||||||
|
if( null == activityMission){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(count>activityMission.getV()){
|
||||||
|
//最大伤害更新
|
||||||
|
activityMission.setV(count);
|
||||||
|
}
|
||||||
|
//领取状态更新
|
||||||
|
activityMission.getActivityMissionMap().entrySet().stream()
|
||||||
|
.sorted(Map.Entry.comparingByKey()).limit(goal)
|
||||||
|
.forEachOrdered(x->{
|
||||||
|
if(x.getValue().getState() !=1){
|
||||||
|
x.getValue().setState(1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//历史最高伤害
|
||||||
|
ISession sessionByUid = OnlineUserManager.getSessionByUid(user.getId());
|
||||||
|
sendActivityProgress(sessionByUid, activityMission, null);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
package com.ljsd.jieling.logic.activity.event;
|
||||||
|
|
||||||
|
public class TaSuiLingXiaoEvent implements IEvent {
|
||||||
|
private int uid;
|
||||||
|
private int count;
|
||||||
|
private int goal;
|
||||||
|
|
||||||
|
public int getCount() {
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCount(int count) {
|
||||||
|
this.count = count;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getUid() {
|
||||||
|
return uid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUid(int uid) {
|
||||||
|
this.uid = uid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TaSuiLingXiaoEvent(int uid, int count, int goal) {
|
||||||
|
this.uid = uid;
|
||||||
|
this.count = count;
|
||||||
|
this.goal = goal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getGoal() {
|
||||||
|
return goal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGoal(int goal) {
|
||||||
|
this.goal = goal;
|
||||||
|
}
|
||||||
|
}
|
|
@ -20,6 +20,14 @@ public class SNewHeroConfig implements BaseConfig {
|
||||||
|
|
||||||
private int[][] dropCell;
|
private int[][] dropCell;
|
||||||
|
|
||||||
|
private int[][] valueDropCell;
|
||||||
|
|
||||||
|
private int dailyReward;
|
||||||
|
|
||||||
|
private int dailyNumber;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() throws Exception {
|
public void init() throws Exception {
|
||||||
|
@ -50,6 +58,15 @@ public class SNewHeroConfig implements BaseConfig {
|
||||||
public int[][] getDropCell() {
|
public int[][] getDropCell() {
|
||||||
return dropCell;
|
return dropCell;
|
||||||
}
|
}
|
||||||
|
public int[][] getValueDropCell() {
|
||||||
|
return valueDropCell;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDailyReward() {
|
||||||
|
return dailyReward;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDailyNumber() {
|
||||||
|
return dailyNumber;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue