合并代码2
parent
2050067fb1
commit
ff3f04af63
|
@ -226,6 +226,7 @@ function BattleMain.Execute(args, fightData, optionData)
|
|||
else
|
||||
resultList.result = BattleLogic.Result
|
||||
end
|
||||
resultList.curRound=curRound
|
||||
local allHeroDamage, allEnemyDamage = BattleLogic.GetAllDamage()
|
||||
-- print(allHeroDamage, allEnemyDamage)
|
||||
if _type == BATTLE_SERVER_TYPE.GuildBossFight -- 公会boss
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
package com.ljsd.jieling.core.function;
|
||||
|
||||
import com.ljsd.jieling.core.FunctionManager;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.logic.dao.TimeControllerOfFunction;
|
||||
import com.ljsd.jieling.logic.sevenworld.SevenWorldLogic;
|
||||
|
||||
/**
|
||||
* @author lvxinran
|
||||
* @date 2019/11/23
|
||||
* @discribe 七界功能
|
||||
*/
|
||||
public class SevenWorldFunction implements FunctionManager {
|
||||
|
||||
@Override
|
||||
public void closeAction(){
|
||||
// 发奖
|
||||
SevenWorldLogic.getInstance().sendRankReward();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startAction(TimeControllerOfFunction timeControllerOfFunction) {
|
||||
// 清除排行榜信息
|
||||
RedisUtil.getInstence().del(RedisKey.SEVEN_WORLD_INTEGRAL_RANK);
|
||||
}
|
||||
}
|
|
@ -349,6 +349,9 @@ public interface BIReason {
|
|||
|
||||
int SEVEN_WORLD_ACTIVATION_RELIC = 1210;//七界,解锁遗物
|
||||
int SEVEN_WORLD_CHALLENGE = 1211;//七界,挑战
|
||||
int SEVEN_WORLD_FUNCTION_END = 1212;//七界功能结束
|
||||
int SEVEN_WORLD_ACTIVITY_END = 1213;//七界活动结束
|
||||
|
||||
int SEVEN_WORLD_TREASURE = 1214;//七界秘宝
|
||||
|
||||
}
|
|
@ -34,6 +34,7 @@ import com.ljsd.jieling.logic.fight.*;
|
|||
import com.ljsd.jieling.logic.fight.result.FightResult;
|
||||
import com.ljsd.jieling.logic.hero.HeroAttributeEnum;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.logic.item.ItemLogic;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||
import com.ljsd.jieling.logic.rank.rankImpl.AbstractRank;
|
||||
|
@ -2810,26 +2811,7 @@ public class MapLogic {
|
|||
* @throws Exception
|
||||
*/
|
||||
public void clearEndLessDrop(int uid) throws Exception {
|
||||
User user = UserManager.getUser(uid);
|
||||
// 根据功能类型获取需要清理的道具列表
|
||||
List<SItem> itemList = SItem.getItemMapByRecycle().get(FunctionIdEnum.Endless.getFunctionType());
|
||||
if (itemList == null || itemList.isEmpty()){
|
||||
return;
|
||||
}
|
||||
for (SItem item:itemList){
|
||||
// 获取玩家背包道具并消耗
|
||||
Item item1 = user.getItemManager().getItem(item.getId());
|
||||
if(item1!=null){
|
||||
if(item1.getItemId()==0){
|
||||
user.getItemManager().removeItem(item.getId());
|
||||
continue;
|
||||
}
|
||||
System.out.println("======================清理无尽副本道具,玩家:{ " + uid + " },道具id:{ " + item1.getItemId() + " }");
|
||||
int[][] cost= new int[1][];
|
||||
cost[0] = new int[]{item1.getItemId(),(int)item1.getItemNum()};
|
||||
ItemUtil.itemCost(user,cost,BIReason.ENDLESS_REASON_CHANGE,0);
|
||||
}
|
||||
}
|
||||
ItemLogic.getInstance().functionEndClearItem(uid,FunctionIdEnum.Endless.getFunctionType(),BIReason.ENDLESS_REASON_CHANGE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -403,7 +403,6 @@ public class BehaviorUtil {
|
|||
|
||||
/**
|
||||
* h获取fightTeamInfo
|
||||
* @param groupId
|
||||
* @return
|
||||
*/
|
||||
public static List<CommonProto.FightTeamInfo> getFightTeamInfos(Map<Integer, List<CommonProto.FightUnitInfo>> monsterByGroup,List<CommonProto.FightUnitInfo> monsterPokemonByGroup,int mosterNum) {
|
||||
|
@ -412,7 +411,7 @@ public class BehaviorUtil {
|
|||
CommonProto.FightTeamInfo.Builder monsterTeamInfo = CommonProto.FightTeamInfo.newBuilder();
|
||||
monsterTeamInfo.addAllFightUnitList(monsterByGroup.get(mosterNum));
|
||||
if(monsterPokemonByGroup!=null){
|
||||
monsterTeamInfo .addAllPokemonUnitList(monsterPokemonByGroup);
|
||||
monsterTeamInfo.addAllPokemonUnitList(monsterPokemonByGroup);
|
||||
}
|
||||
monsterGroupList.add(monsterTeamInfo.build());
|
||||
}
|
||||
|
|
|
@ -508,7 +508,7 @@ public class TowerMap extends AbstractMap {
|
|||
// 记录战报
|
||||
FightRecordLogic.getInstance().addRecordMap(user,fightResult.getFightData());
|
||||
// LOGGER.info("endFight() uid=>{},nextEventId=>{}", uid, nextEventId);
|
||||
MapMissionManager.updateMapMission(user, EventType.fightEvent, groupId, fightResult.getDuration());
|
||||
MapMissionManager.updateMapMission(user, EventType.fightEvent, groupId, (int)fightResult.getDuration());
|
||||
ReportUtil.onReportEvent(user,ReportEventEnum.CHALLENGE_PANOPTIC_MIRROR_ENEMY.getType(),trialInfo.getFloor(),resultCode==1?"胜利":"失败");
|
||||
// LOGGER.info("endFight() uid=>{} sMonsterGroup.getRewardgroup()=>{} misson=>{} eventDrop=>{}, missionDrop=>{}", uid, sMonsterGroup.getRewardgroup(), fastFightResponse.getMission(), fastFightResponse.getEnventDrop(), fastFightResponse.getMissionDrop());
|
||||
}
|
||||
|
|
|
@ -4,32 +4,31 @@ import com.ljsd.jieling.exception.ErrorCode;
|
|||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.globals.Global;
|
||||
import com.ljsd.jieling.jbean.*;
|
||||
import com.ljsd.jieling.jbean.ActivityManager;
|
||||
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.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.activity.event.ActivityStateChangeEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.HeroFiveStarGetEvent;
|
||||
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.logic.mail.MailLogic;
|
||||
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import config.SCHero;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import util.TimeUtils;
|
||||
import config.SActivityRewardConfig;
|
||||
import config.SErrorCodeEerverConfig;
|
||||
import config.SGlobalActivity;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
@ -193,6 +192,14 @@ public abstract class AbstractActivity implements IActivity, IEventHandler {
|
|||
MessageUtil.sendMessage(session, 1, rewardResponseValue, build, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 数数上报
|
||||
* @param user
|
||||
* @param reward
|
||||
* @param missionId
|
||||
* @throws Exception
|
||||
*/
|
||||
protected void reportTakeActivityReward(User user, int[][] reward, int missionId) throws Exception {
|
||||
List<Integer> itemId = new ArrayList<>(reward.length);
|
||||
List<Integer> itemNum = new ArrayList<>(reward.length);
|
||||
|
|
|
@ -109,4 +109,6 @@ public interface ActivityType {
|
|||
int PREPARE_FIFTEEN_ACTIVITY = 80;//15日登陆预告
|
||||
int THEME_ACTIVITY_SHOP = 81;//ThemeActivityTask活动商店
|
||||
int XUN_BAO_MI_ZONG = 82;//寻宝迷踪
|
||||
|
||||
int SEVEN_WORLD_TREASURE = 83;//七界秘宝
|
||||
}
|
||||
|
|
|
@ -82,7 +82,8 @@ public enum ActivityTypeEnum {
|
|||
SUPERFUND328(ActivityType.SUPERFUND328,SuperFundActivity::new),//超值基金328
|
||||
PREPARE_FIFTEEN_ACTIVITY(ActivityType.PREPARE_FIFTEEN_ACTIVITY,DefaultEmptyActivity::new),//超值基金328
|
||||
THEME_ACTIVITY_SHOP(ActivityType.THEME_ACTIVITY_SHOP,DefaultEmptyActivity::new),
|
||||
XUN_BAO_MI_ZONG(ActivityType.XUN_BAO_MI_ZONG,XunBaoMiZongActivity::new)
|
||||
XUN_BAO_MI_ZONG(ActivityType.XUN_BAO_MI_ZONG,XunBaoMiZongActivity::new),
|
||||
SEVEN_WORLD_TREASURE(ActivityType.SEVEN_WORLD_TREASURE,SevenWorldActivity::new),
|
||||
;
|
||||
|
||||
private int type;
|
||||
|
|
|
@ -0,0 +1,138 @@
|
|||
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.ActivityMission;
|
||||
import com.ljsd.jieling.jbean.ActivityProgressInfo;
|
||||
import com.ljsd.jieling.logic.dao.Item;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.bean.ReceiveWelfareBag;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import config.SQijieStage;
|
||||
import config.SQijieTreasure;
|
||||
import manager.STableManager;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author hj
|
||||
* 七界秘宝活动
|
||||
*/
|
||||
public class SevenWorldActivity extends AbstractActivity {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(SevenWorldActivity.class);
|
||||
/**
|
||||
* 礼包id
|
||||
*/
|
||||
private static final int GIFT = 108;
|
||||
|
||||
SevenWorldActivity(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initActivity(User user) {
|
||||
ActivityMission mission = new ActivityMission();
|
||||
// 读表获取阶段奖励信息
|
||||
Set<Integer> keySet = STableManager.getConfig(SQijieTreasure.class).keySet();
|
||||
// 初始化阶段奖励
|
||||
ActivityLogic.getInstance().initOtherMission(mission, new ArrayList<>(keySet));
|
||||
user.getActivityManager().getActivityMissionMap().put(id, mission);
|
||||
// 礼包初始化
|
||||
ReceiveWelfareBag bag = (ReceiveWelfareBag)user.getPlayerInfoManager().getNewRechargeInfo().getReceiveMap().get(GIFT);
|
||||
if (bag != null){
|
||||
bag.setOpen(true);
|
||||
}
|
||||
LOGGER.info("七界秘宝初始化...{}",id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityEndOnMySelf(User user) throws Exception {
|
||||
// 删除活动积分
|
||||
int removeItemId = STableManager.getConfig(SQijieStage.class).get(0).getTreasureIntegral()[0];
|
||||
Item item = user.getItemManager().getItem(removeItemId);
|
||||
if(item!=null){
|
||||
int[][] cost = {{item.getItemId(), (int) item.getItemNum()}};
|
||||
ItemUtil.itemCost(user,cost,BIReason.SEVEN_WORLD_ACTIVITY_END,id);
|
||||
}
|
||||
// 礼包重置
|
||||
ReceiveWelfareBag bag = (ReceiveWelfareBag)user.getPlayerInfoManager().getNewRechargeInfo().getReceiveMap().get(GIFT);
|
||||
if (bag != null){
|
||||
bag.refresh();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean takeReward(ISession session, int missionId) throws Exception {
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
// activity check
|
||||
ActivityMission mission = user.getActivityManager().getActivityMissionMap().get(id);
|
||||
ActivityProgressInfo progressInfo = mission.getActivityMissionMap().get(missionId);
|
||||
// 已领取
|
||||
if (progressInfo.getState() == ActivityType.FINISH_TAKED){
|
||||
throw new ErrorCodeException(ErrorCode.HAD_TAKE_REWARD);
|
||||
}
|
||||
SQijieTreasure treasure = STableManager.getConfig(SQijieTreasure.class).get(missionId);
|
||||
CommonProto.Drop.Builder drop = null;
|
||||
// 未领取
|
||||
if (progressInfo.getState() == ActivityType.WILL_TAKE && checkValue(user,missionId)){
|
||||
drop = ItemUtil.drop(user, treasure.getReward(), BIReason.SEVEN_WORLD_TREASURE);
|
||||
progressInfo.setState(ActivityType.HAD_TAKED);
|
||||
reportTakeActivityReward(user,treasure.getReward(),missionId);
|
||||
}
|
||||
// 完美领取
|
||||
if (progressInfo.getState() == ActivityType.HAD_TAKED && checkGift(user)){
|
||||
drop = ItemUtil.drop(user, treasure.getTreasureReward(), BIReason.SEVEN_WORLD_TREASURE);
|
||||
progressInfo.setState(ActivityType.FINISH_TAKED);
|
||||
reportTakeActivityReward(user,treasure.getTreasureReward(),missionId);
|
||||
}
|
||||
// 更新数据库
|
||||
mission.getActivityMissionMap().put(missionId, progressInfo);
|
||||
// 发送奖励
|
||||
PlayerInfoProto.TakeActivityRewardResponse build = PlayerInfoProto.TakeActivityRewardResponse.newBuilder().setDrop(drop).build();
|
||||
MessageUtil.sendMessage(session, 1, rewardResponseValue, build, true);
|
||||
// 状态推送
|
||||
sendActivityProgress(session, mission, null);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验礼包状态
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
private boolean checkGift(User user){
|
||||
ReceiveWelfareBag bag = (ReceiveWelfareBag)user.getPlayerInfoManager().getNewRechargeInfo().getReceiveMap().get(GIFT);
|
||||
return bag != null && bag.isOpen() && bag.isBought();
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验值
|
||||
* @param user
|
||||
* @param missionId
|
||||
* @return
|
||||
*/
|
||||
private boolean checkValue(User user,int missionId){
|
||||
SQijieTreasure treasure = STableManager.getConfig(SQijieTreasure.class).get(missionId);
|
||||
if (treasure == null){
|
||||
LOGGER.error("七界秘宝档位不存在,uid:{},missionId:{}",user.getId(),missionId);
|
||||
return false;
|
||||
}
|
||||
int[][] integral = treasure.getIntegral();
|
||||
Item item = user.getItemManager().getItem(integral[0][0]);
|
||||
if (item == null){
|
||||
LOGGER.error("七界秘宝道具不存,uid:{},itemId:{}",user.getId(),integral[0][0]);
|
||||
return false;
|
||||
}
|
||||
return item.getItemNum() >= integral[0][1];
|
||||
}
|
||||
|
||||
}
|
|
@ -19,7 +19,7 @@ public class MailManager extends MongoBase {
|
|||
return mailMap;
|
||||
}
|
||||
|
||||
public void addMail(Mail mail) throws Exception {
|
||||
public void addMail(Mail mail){
|
||||
mail.init(mail.getRoleUid(), getMongoKey() + ".mailMap." + mail.getId());
|
||||
updateString("mailMap." + mail.getId(), mail);
|
||||
mailMap.put(mail.getId(), mail);
|
||||
|
|
|
@ -2,6 +2,8 @@ package com.ljsd.jieling.logic.dao;
|
|||
|
||||
import com.ljsd.common.mogodb.MongoBase;
|
||||
import com.ljsd.jieling.core.VipPrivilegeType;
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.globals.Global;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.NewRechargeInfo;
|
||||
|
@ -9,6 +11,7 @@ import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig;
|
|||
import config.SCampTowerSetting;
|
||||
import config.SMonthcardConfig;
|
||||
import config.SPrivilegeTypeConfig;
|
||||
import config.SQijieStage;
|
||||
import manager.STableManager;
|
||||
import util.MathUtils;
|
||||
import util.TimeUtils;
|
||||
|
@ -175,13 +178,9 @@ public class PlayerManager extends MongoBase {
|
|||
private boolean openFourChallenge = false;
|
||||
|
||||
/**
|
||||
* 七界层数, key: 周几 value: 层id
|
||||
* 开启的七界层数, key: 七届类型, value: 最高层数
|
||||
*/
|
||||
private Map<Integer,Integer> sevenWorldTier = new HashMap<>();
|
||||
/**
|
||||
* 开启的七界层数, key: 七届类型, value: 每种类型对应开启的层id列表
|
||||
*/
|
||||
private Map<Integer,List<Integer>> sevenWorldOpenTier = new HashMap<>();
|
||||
private Map<Integer,Integer> sevenWorldOpenTier = new HashMap<>();
|
||||
/**
|
||||
* 七界试炼遗物信息,只存储激活的遗物信息, key:遗物id, value:遗物状态,0:未激活,1:已激活
|
||||
*/
|
||||
|
@ -1228,39 +1227,46 @@ public class PlayerManager extends MongoBase {
|
|||
updateString("openFourChallenge",openFourChallenge);
|
||||
}
|
||||
|
||||
public Map<Integer, Integer> getSevenWorldTier() {
|
||||
return sevenWorldTier;
|
||||
}
|
||||
|
||||
public int getSevenWorldTier(int week) {
|
||||
return sevenWorldTier.getOrDefault(week,0);
|
||||
}
|
||||
|
||||
public void setSevenWorldTier(Map<Integer, Integer> sevenWorldTier) {
|
||||
this.sevenWorldTier = sevenWorldTier;
|
||||
updateString("sevenWorldTier",sevenWorldTier);
|
||||
}
|
||||
|
||||
public void putSevenWorldTier(int week, int tierId) {
|
||||
this.sevenWorldTier.put(week,tierId);
|
||||
updateString("sevenWorldTier",sevenWorldTier);
|
||||
}
|
||||
|
||||
public Map<Integer, List<Integer>> getSevenWorldOpenTier() {
|
||||
public Map<Integer, Integer> getSevenWorldOpenTier() {
|
||||
return sevenWorldOpenTier;
|
||||
}
|
||||
|
||||
public List<Integer> getSevenWorldOpenTier(int key) {
|
||||
return sevenWorldOpenTier.getOrDefault(key,new ArrayList<>());
|
||||
public Integer getSevenWorldOpenTier(int week) throws ErrorCodeException {
|
||||
int id = getSevenWorldOpenTier().getOrDefault(week,0);
|
||||
if (id == 0){
|
||||
//第一次,初始层
|
||||
return Collections.min(SQijieStage.getDateMap().get(week));
|
||||
}
|
||||
SQijieStage stage = STableManager.getConfig(SQijieStage.class).get(id);
|
||||
if (stage == null){
|
||||
// 不存在的层数
|
||||
System.out.printf("七界,挑战层数不存在:{%d}\n",id);
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||
}
|
||||
if (stage.getNextID() != 0){
|
||||
// 可挑战(下一层)
|
||||
return stage.getNextID();
|
||||
}else{
|
||||
// 最高层
|
||||
return stage.getId();
|
||||
}
|
||||
}
|
||||
|
||||
public void setSevenWorldOpenTier(Map<Integer, List<Integer>> sevenWorldOpenTier) {
|
||||
this.sevenWorldOpenTier = sevenWorldOpenTier;
|
||||
updateString("sevenWorldOpenTier",sevenWorldOpenTier);
|
||||
public int getSevenWorldOpenTierCount() {
|
||||
int count = 0;
|
||||
for (Integer value : getSevenWorldOpenTier().values()) {
|
||||
SQijieStage stage = STableManager.getConfig(SQijieStage.class).get(value);
|
||||
if (value == null){
|
||||
System.out.printf("SQijieStage,配置表读取不到,关卡id:{%d}\n",value);
|
||||
continue;
|
||||
}
|
||||
count += stage.getStage();
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
public void putSevenWorldOpenTier(int key,List<Integer> list) {
|
||||
this.sevenWorldOpenTier.put(key,list);
|
||||
public void putSevenWorldOpenTier(int key,int tier) {
|
||||
sevenWorldOpenTier.put(key,tier);
|
||||
updateString("sevenWorldOpenTier",sevenWorldOpenTier);
|
||||
}
|
||||
|
||||
|
@ -1268,16 +1274,6 @@ public class PlayerManager extends MongoBase {
|
|||
return sevenWorldRelic;
|
||||
}
|
||||
|
||||
public boolean sevenWorldRelicIsOpen(int id) {
|
||||
Integer integer = sevenWorldRelic.get(id);
|
||||
return integer != null;
|
||||
}
|
||||
|
||||
public void setSevenWorldRelic(Map<Integer, Integer> sevenWorldRelic) {
|
||||
this.sevenWorldRelic = sevenWorldRelic;
|
||||
updateString("sevenWorldRelic",sevenWorldRelic);
|
||||
}
|
||||
|
||||
public void putSevenWorldRelic(int id, int status) {
|
||||
this.sevenWorldRelic.put(id,status);
|
||||
updateString("sevenWorldRelic",sevenWorldRelic);
|
||||
|
|
|
@ -205,7 +205,7 @@ public class GuildChallengeLogic {
|
|||
}
|
||||
FightResult fightResult = FightDispatcher.dispatcher(pveFightEvent);
|
||||
fightData = fightResult.getFightData();
|
||||
int damageInt = fightResult.getDuration();
|
||||
int damageInt = (int)fightResult.getDuration();
|
||||
|
||||
if(fightResult.getResult()==1) {
|
||||
if(guildInfo.getBossHpRemain()!=-1){
|
||||
|
|
|
@ -1087,7 +1087,7 @@ public class GuildFightLogic {
|
|||
FightResult fightResult = FightDispatcher.dispatcher(fightEvent);
|
||||
PlayerLogic.getInstance().checkAndUpdate(user, VipPrivilegeType.GUILD_BOSS_CHALLENGE_TIMES, 1);
|
||||
//校验结果码 1:胜利
|
||||
int myHurt = fightResult.getDuration();
|
||||
int myHurt = (int)fightResult.getDuration();
|
||||
if(myHurt>user.getGuildMyInfo().getMaxBossHurt()){
|
||||
user.getGuildMyInfo().setMaxBossHurt(myHurt);
|
||||
}
|
||||
|
|
|
@ -2,10 +2,7 @@ package com.ljsd.jieling.logic.fight;
|
|||
|
||||
import com.ljsd.fight.FightType;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.logic.fight.eventhandler.DefaultOfRedisCacheFightHandler;
|
||||
import com.ljsd.jieling.logic.fight.eventhandler.DefaultWithoutHandFightHandler;
|
||||
import com.ljsd.jieling.logic.fight.eventhandler.IFightEventProcesor;
|
||||
import com.ljsd.jieling.logic.fight.eventhandler.PVPFightHandler;
|
||||
import com.ljsd.jieling.logic.fight.eventhandler.*;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -52,7 +49,7 @@ public enum GameFightType {
|
|||
TowerMap(FightType.TowerMap,new DefaultWithoutHandFightHandler(),null),
|
||||
|
||||
FourChallenge(FightType.FourChallenge,new DefaultWithoutHandFightHandler(),null),
|
||||
SevenWorld(FightType.QIJIE_FIGHT,new DefaultWithoutHandFightHandler(),null),
|
||||
SevenWorld(FightType.QIJIE_FIGHT,new SevenWorldFightHandler(),null),
|
||||
;
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,230 @@
|
|||
package com.ljsd.jieling.logic.fight.eventhandler;
|
||||
|
||||
import com.ljsd.fight.CheckFight;
|
||||
import com.ljsd.jieling.config.clazzStaticCfg.MapStaticConfig;
|
||||
import com.ljsd.jieling.handler.map.behavior.BehaviorUtil;
|
||||
import com.ljsd.jieling.logic.activity.fourChallenge.FourChallengeLogic;
|
||||
import com.ljsd.jieling.logic.dao.Hero;
|
||||
import com.ljsd.jieling.logic.dao.TeamPosHeroInfo;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.fight.FightEvent;
|
||||
import com.ljsd.jieling.logic.fight.FightUtil;
|
||||
import com.ljsd.jieling.logic.fight.PVEFightEvent;
|
||||
import com.ljsd.jieling.logic.fight.result.FightResult;
|
||||
import com.ljsd.jieling.logic.fight.specialparm.SpecialForTeamBuildEnum;
|
||||
import com.ljsd.jieling.logic.help.HelpHero;
|
||||
import com.ljsd.jieling.logic.help.HelpHeroLogic;
|
||||
import com.ljsd.jieling.logic.hero.HeroAttributeEnum;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.util.FightDataUtil;
|
||||
import com.ljsd.jieling.util.MonsterUtil;
|
||||
import config.*;
|
||||
import manager.STableManager;
|
||||
import org.luaj.vm2.LuaValue;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import rpc.protocols.CommonProto;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.stream.Collectors;
|
||||
/**
|
||||
* @author hj
|
||||
* 七界试炼挑战
|
||||
*/
|
||||
public class SevenWorldFightHandler implements IFightEventProcesor {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(SevenWorldFightHandler.class);
|
||||
|
||||
@Override
|
||||
public FightResult process(FightEvent fightEvent) throws Exception {
|
||||
PVEFightEvent pveFightEvent = (PVEFightEvent)fightEvent;
|
||||
User user = UserManager.getUserInMem(pveFightEvent.getAttackUid());
|
||||
if (user == null){
|
||||
return null;
|
||||
}
|
||||
CommonProto.FightTeamInfo fightTeamInfo = makePersonFightData(user, pveFightEvent.getTeamId());
|
||||
int fightSeed = FightUtil.getFightSeed();
|
||||
//怪物剩余血量
|
||||
List<CommonProto.FightTeamInfo> monsterFightTeamInfos = makeMonsterFightData(user,pveFightEvent.getMonsterGroupId(),pveFightEvent.getNums());
|
||||
LuaValue getFightData = FightDataUtil.getFinalFightData(fightTeamInfo, monsterFightTeamInfos);
|
||||
LuaValue getOptionData = FightDataUtil.getOptionData(pveFightEvent.getAttackUid()+"");
|
||||
long[] fightResult = CheckFight.getInstance().checkFight(fightSeed, fightEvent.getMostTime(), getFightData, getOptionData, fightEvent.getFightType().getFightType());
|
||||
|
||||
FightResult.Builder builder = FightResult.newBuilder();
|
||||
builder.setCheckResult(fightResult);
|
||||
builder.setSeed(fightSeed);
|
||||
builder.setFightTeamInfo(fightTeamInfo);
|
||||
builder.setMonsterTeamList(monsterFightTeamInfos);
|
||||
String fightId = FightUtil.getFightId(fightEvent.getAttackUid(),fightEvent.getFightType());
|
||||
CommonProto.FightData fightData = CommonProto.FightData.newBuilder()
|
||||
.setFightType(fightEvent.getFightType().getFightType().getType())
|
||||
.setHeroFightInfos(fightTeamInfo)
|
||||
.addAllMonsterList(monsterFightTeamInfos)
|
||||
.setFightSeed(fightSeed)
|
||||
.setFightMaxTime(fightEvent.getMostTime())
|
||||
.setFightId(fightId)
|
||||
.build();
|
||||
builder.setFightData(fightData);
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 制作玩家的战斗信息
|
||||
* @param user
|
||||
* @param teamId
|
||||
* @return
|
||||
*/
|
||||
public static CommonProto.FightTeamInfo makePersonFightData(User user,int teamId){
|
||||
user.getTeamPosManager().setCurTeamPosId(teamId);
|
||||
List<CommonProto.FightUnitInfo> heroFightInfos = new ArrayList<>();
|
||||
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
||||
for (TeamPosHeroInfo teamPosHeroInfo : teamPosHeroInfos) {
|
||||
Hero hero = user.getHeroManager().getHero(teamPosHeroInfo.getHeroId());
|
||||
if (hero == null) {
|
||||
// 四灵试炼,助战
|
||||
if (FourChallengeLogic.isFourChallengeTeam(teamId)){
|
||||
HelpHero helpHero = HelpHeroLogic.getHelpHero(user.getId(), teamPosHeroInfo.getHeroId());
|
||||
if (helpHero == null){
|
||||
continue;
|
||||
}
|
||||
hero = helpHero.getHero();
|
||||
}
|
||||
}
|
||||
StringBuilder propertySb = new StringBuilder();
|
||||
String heroSkill = getHeroSkills(user,hero,teamPosHeroInfo.getPosition()).toString();
|
||||
String property = HeroLogic.getInstance().getHeroProperty(user,hero,propertySb,true,teamId).toString();
|
||||
CommonProto.FightUnitInfo heroFightInfo = CommonProto.FightUnitInfo
|
||||
.newBuilder()
|
||||
.setUnitId(String.valueOf(hero.getTemplateId()))
|
||||
.setUnitSkillIds(heroSkill.substring(0,heroSkill.length()-1))
|
||||
.setProperty(property.substring(0, property.length()-1))
|
||||
.setPosition(teamPosHeroInfo.getPosition())
|
||||
.setStar(hero.getStar())
|
||||
.setSkinId(hero.getSkin())
|
||||
.build();
|
||||
heroFightInfos.add(heroFightInfo);
|
||||
}
|
||||
return CommonProto.FightTeamInfo.
|
||||
newBuilder()
|
||||
.addAllFightUnitList(heroFightInfos)
|
||||
.addAllPokemonUnitList(HeroLogic.getInstance().getPokemonSkills(user))
|
||||
.setTeamPassiveList(HeroLogic.getInstance().getPokenmonPassiveSkills(user,teamId))
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 英雄技能
|
||||
* @param user
|
||||
* @param hero
|
||||
* @param index
|
||||
* @return
|
||||
*/
|
||||
private static StringBuilder getHeroSkills(User user,Hero hero,int index){
|
||||
StringBuilder sb = new StringBuilder();
|
||||
List<Integer> heroSkillList = HeroLogic.getInstance().getHeroSkillList(user, hero);
|
||||
heroSkillList.addAll(relicSkills(user,hero.getTemplateId(),index,1));
|
||||
HeroLogic.getInstance().coverSkill(heroSkillList);
|
||||
for(int i=0;i<heroSkillList.size();i++){
|
||||
Integer skill = heroSkillList.get(i);
|
||||
if(i<2){
|
||||
sb.append(skill).append(HeroLogic.DIVISION);
|
||||
continue;
|
||||
}
|
||||
SPassiveSkillLogicConfig config = SPassiveSkillLogicConfig.getConfig(skill);
|
||||
if(config!=null &&config.getEffectiveRange()==1){
|
||||
sb.append(skill).append(HeroLogic.DIVISION);
|
||||
}
|
||||
}
|
||||
return sb;
|
||||
}
|
||||
|
||||
/**
|
||||
* 遗物技能
|
||||
* @param user
|
||||
* @param index
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
private static List<Integer> relicSkills(User user,int heroTid,int index,int type){
|
||||
List<Integer> list = new ArrayList<>();
|
||||
Map<Integer, Integer> relic = user.getPlayerInfoManager().getSevenWorldRelic();
|
||||
Set<Integer> relicSet = relic.keySet().stream().filter(v -> relic.get(v) == 1).collect(Collectors.toSet());
|
||||
Map<Integer, SQijieHolyConfig> config = STableManager.getConfig(SQijieHolyConfig.class);
|
||||
for (Integer id : relicSet) {
|
||||
SQijieHolyConfig holyConfig = config.get(id);
|
||||
if (holyConfig == null){
|
||||
LOGGER.error("SQijieHolyConfig,配置表读取失败遗物失败,uid:{},遗物id:{}",user.getId(),id);
|
||||
continue;
|
||||
}
|
||||
int[] positions = holyConfig.getPosition();
|
||||
SCHero scHero = SCHero.getsCHero().get(heroTid);
|
||||
int pos = index <= 3?1:2;
|
||||
if (positions[0] == type){
|
||||
// 角色属性验证
|
||||
if (positions[1] == 0 || positions[1] == scHero.getPropertyName()){
|
||||
// 角色职业验证
|
||||
if (positions[2] == 0 || positions[2] == scHero.getProfession()){
|
||||
// 角色位置验证
|
||||
if (positions[3] == 0 || positions[3] == pos){
|
||||
list.add(holyConfig.getBuff());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 制作怪物战斗信息
|
||||
* @param indexId
|
||||
* @param nums
|
||||
* @return
|
||||
*/
|
||||
private static List<CommonProto.FightTeamInfo> makeMonsterFightData(User user,int indexId,int nums){
|
||||
SQijieStage stage = STableManager.getConfig(SQijieStage.class).get(indexId);
|
||||
int monsterGroup = stage.getMonsterGroup();
|
||||
Map<Integer, List<CommonProto.FightUnitInfo>> monsterByGroup = FightUtil.makeMonsterGroup(monsterGroup);
|
||||
// 技能处理
|
||||
for (List<CommonProto.FightUnitInfo> value : monsterByGroup.values()) {
|
||||
for (CommonProto.FightUnitInfo info : value) {
|
||||
monsterSkills(user,stage,info);
|
||||
}
|
||||
}
|
||||
// 灵兽
|
||||
List<CommonProto.FightUnitInfo> monsterPokemonByGroup = MonsterUtil.getMonsterPokemonByGroup(monsterGroup);
|
||||
List<CommonProto.FightTeamInfo> monsterTeamList = new ArrayList<>(nums);
|
||||
for(int i=0;i<nums;i++){
|
||||
List<CommonProto.FightTeamInfo> monsterGroupList = BehaviorUtil.getFightTeamInfos(monsterByGroup,monsterPokemonByGroup, i);
|
||||
monsterTeamList.addAll(monsterGroupList);
|
||||
}
|
||||
return monsterTeamList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 怪物技能处理
|
||||
* @param user
|
||||
* @param monster
|
||||
*/
|
||||
private static void monsterSkills(User user,SQijieStage stage, CommonProto.FightUnitInfo monster){
|
||||
List<Integer> relicSkills = relicSkills(user, Integer.parseInt(monster.getUnitId()), monster.getPosition(), 0);
|
||||
StringBuilder str = new StringBuilder();
|
||||
// 原本的技能
|
||||
str.append(monster.getUnitSkillIds());
|
||||
// 特性被动
|
||||
for (int i : stage.getBuff()) {
|
||||
SQijieStageBuff stageBuff = STableManager.getConfig(SQijieStageBuff.class).get(i);
|
||||
if (stageBuff == null){
|
||||
LOGGER.error("SQijieStageBuff, 配置表读取失败,uid:{},Buffid:{}",user.getId(),i);
|
||||
continue;
|
||||
}
|
||||
str.append(HeroLogic.DIVISION).append(stageBuff.getPassiveSkillLogic());
|
||||
}
|
||||
// 遗物技能
|
||||
relicSkills.forEach(v->str.append(HeroLogic.DIVISION).append(v));
|
||||
monster.toBuilder().setUnitSkillIds(str.toString());
|
||||
}
|
||||
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package com.ljsd.jieling.logic.fight.passiveSkillCal;
|
||||
|
||||
import com.ljsd.jieling.logic.dao.Hero;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import config.SPassiveSkillLogicConfig;
|
||||
|
||||
import java.util.Map;
|
||||
|
|
|
@ -147,8 +147,8 @@ public class HeroLogic{
|
|||
pokemonTemplate.add(HeroAttributeEnum.TreatFacter.getPropertyId()); // 治疗加成系数
|
||||
pokemonTemplate.add(HeroAttributeEnum.CureFacter.getPropertyId()); // 受治疗
|
||||
}
|
||||
private static final String VERTICAL = "|";
|
||||
private static final String DIVISION = "#";
|
||||
public static final String VERTICAL = "|";
|
||||
public static final String DIVISION = "#";
|
||||
|
||||
public static final int HERO_MAX_STAR = 10; // 英雄最大星级,大于10星为觉醒
|
||||
|
||||
|
@ -2030,7 +2030,6 @@ public class HeroLogic{
|
|||
sb.append(skill).append(DIVISION);
|
||||
}
|
||||
}
|
||||
|
||||
return sb;
|
||||
}
|
||||
|
||||
|
|
|
@ -1005,4 +1005,39 @@ public class ItemLogic {
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 功能结束清除道具
|
||||
* @param uid
|
||||
* @param type
|
||||
* @param reason
|
||||
* @throws Exception
|
||||
*/
|
||||
public void functionEndClearItem(int uid,int type,int reason){
|
||||
try {
|
||||
User user = UserManager.getUser(uid);
|
||||
// 根据功能类型获取需要清理的道具列表
|
||||
List<SItem> itemList = SItem.getItemMapByRecycle().get(type);
|
||||
if (itemList == null || itemList.isEmpty()){
|
||||
return;
|
||||
}
|
||||
for (SItem item:itemList){
|
||||
// 获取玩家背包道具并消耗
|
||||
Item item1 = user.getItemManager().getItem(item.getId());
|
||||
if(item1!=null){
|
||||
if(item1.getItemId()==0){
|
||||
user.getItemManager().removeItem(item.getId());
|
||||
continue;
|
||||
}
|
||||
LOGGER.info("清理玩家道具,uid:{},type:{},reason:{},item:{}",uid,type,reason,item.getId());
|
||||
int[][] cost= new int[1][];
|
||||
cost[0] = new int[]{item1.getItemId(),(int)item1.getItemNum()};
|
||||
ItemUtil.itemCost(user,cost,reason,0);
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
LOGGER.error("功能结束清除道具报错:{}",e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -343,15 +343,15 @@ public class MailLogic {
|
|||
}
|
||||
}
|
||||
//发送邮件
|
||||
public void sendMail(int uid, String title, String content, String reward, int sendTime, int mailEffectiveTime) throws Exception {
|
||||
try {
|
||||
User user = UserManager.getUser(uid);
|
||||
public void sendMail(int uid, String title, String content, String reward, int sendTime, int mailEffectiveTime){
|
||||
User user = UserManager.getUserInMem(uid);
|
||||
if (user != null){
|
||||
Mail mail = new Mail(uid,title,content,reward,sendTime, mailEffectiveTime,"system",Global.MAIL_TYPE_SYS);
|
||||
user.getMailManager().addMail(mail);
|
||||
LOGGER.info("sendMail==>uid={},title={},reward:{}",uid,title,reward);
|
||||
MessageUtil.sendRedIndication(uid, GlobalsDef.MAIL_RED_TYPE);
|
||||
}catch (Exception e){
|
||||
LOGGER.error(e.toString()+";sendMail==>uid={},title={},reward:{}",uid,title,reward);
|
||||
}else {
|
||||
LOGGER.error("用户为空,error sendMail==>uid={},title={},reward:{}",uid,title,reward);
|
||||
}
|
||||
}
|
||||
//发送邮件
|
||||
|
|
|
@ -14,8 +14,7 @@ public class CrossRank extends AbstractRank {
|
|||
|
||||
@Override
|
||||
public void addRank(int uid, String rkey, double... data){
|
||||
String key = RedisUtil.getInstence().getKey(redisKey,rkey,false);
|
||||
RedisUtil.getInstence().incrementZsetScore(key,"",String.valueOf(uid), getScore(data));
|
||||
RedisUtil.getInstence().incrementZsetScore(getCrossRedisKey(),"",String.valueOf(uid),getScore(data),false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -4,10 +4,14 @@ import com.ljsd.GameApplication;
|
|||
import com.ljsd.jieling.core.FunctionIdEnum;
|
||||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
import com.ljsd.jieling.core.HandlerLogicThread;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.globals.Global;
|
||||
import com.ljsd.jieling.logic.GlobleSystemLogic;
|
||||
import com.ljsd.jieling.logic.dao.Hero;
|
||||
import com.ljsd.jieling.logic.dao.TeamEnum;
|
||||
import com.ljsd.jieling.logic.dao.TeamPosHeroInfo;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
|
@ -16,6 +20,9 @@ import com.ljsd.jieling.logic.fight.FightDispatcher;
|
|||
import com.ljsd.jieling.logic.fight.GameFightType;
|
||||
import com.ljsd.jieling.logic.fight.PVEFightEvent;
|
||||
import com.ljsd.jieling.logic.fight.result.FightResult;
|
||||
import com.ljsd.jieling.logic.item.ItemLogic;
|
||||
import com.ljsd.jieling.logic.mail.MailLogic;
|
||||
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||
import com.ljsd.jieling.logic.rank.RankContext;
|
||||
import com.ljsd.jieling.logic.rank.RankEnum;
|
||||
import com.ljsd.jieling.logic.rank.rankImpl.AbstractRank;
|
||||
|
@ -23,12 +30,18 @@ import com.ljsd.jieling.util.CBean2Proto;
|
|||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import config.*;
|
||||
import manager.STableManager;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.redis.core.ZSetOperations;
|
||||
import org.springframework.stereotype.Component;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
import util.MathUtils;
|
||||
import util.StringUtil;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author hj
|
||||
|
@ -38,6 +51,7 @@ import java.util.*;
|
|||
*/
|
||||
@Component
|
||||
public class SevenWorldLogic {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(SevenWorldLogic.class);
|
||||
/**
|
||||
* 获取单例
|
||||
* @return
|
||||
|
@ -104,34 +118,23 @@ public class SevenWorldLogic {
|
|||
int week = TimeUtils.getDayOfWeek();
|
||||
// 客户端传层数不为0,表示切换层数
|
||||
int tierId = proto.getTierId();
|
||||
int tier = user.getPlayerInfoManager().getSevenWorldOpenTier(week);
|
||||
if (tierId > 0){
|
||||
List<Integer> list = user.getPlayerInfoManager().getSevenWorldOpenTier().get(week);
|
||||
if (list == null || !list.contains(tierId)){
|
||||
if (tier < tierId){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE,"层数不存在");
|
||||
}
|
||||
// 赋值
|
||||
user.getPlayerInfoManager().putSevenWorldTier(week,tierId);
|
||||
}else {
|
||||
tierId = user.getPlayerInfoManager().getSevenWorldTier(week);
|
||||
tier = tierId;
|
||||
}
|
||||
|
||||
// 默认值
|
||||
if (tierId == 0){
|
||||
tierId = Collections.min(SQijieStage.dateMap.get(week));
|
||||
}
|
||||
|
||||
// 从排行榜获取信息
|
||||
AbstractRank rankEnum = RankContext.getRankEnum(RankEnum.CROSS_SEVEN_WORLD_RANK.getType());
|
||||
PlayerInfoProto.RankResponse.Builder builder = PlayerInfoProto.RankResponse.newBuilder();
|
||||
rankEnum.getCrossMyInfo(user,"",builder);
|
||||
|
||||
// 层数,排名,积分
|
||||
int ranking = builder.getMyRankInfo().getRank();
|
||||
int integral = builder.getMyRankInfo().getParam2();
|
||||
int count = user.getPlayerInfoManager().getSevenWorldOpenTier().values().stream().mapToInt(List::size).sum();
|
||||
|
||||
int integral = (int) builder.getMyRankInfo().getParam1();
|
||||
int count = user.getPlayerInfoManager().getSevenWorldOpenTierCount();
|
||||
return PlayerInfoProto.SevenWorldInfoResponse.newBuilder()
|
||||
.setId(tierId).setRanking(ranking).setIntegral(integral).setTotalTier(40).build();
|
||||
.setId(tier).setRanking(ranking).setIntegral(integral).setTotalTier(count).build();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -145,7 +148,7 @@ public class SevenWorldLogic {
|
|||
User user = verify(uid);
|
||||
// 开启层数验证
|
||||
int value = SSpecialConfig.getIntegerValue(SSpecialConfig.QIJIEHOLYCONFIG);
|
||||
int count = user.getPlayerInfoManager().getSevenWorldOpenTier().values().stream().mapToInt(List::size).sum();
|
||||
int count = user.getPlayerInfoManager().getSevenWorldOpenTierCount();
|
||||
if (value > count){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"未达到层数");
|
||||
}
|
||||
|
@ -187,23 +190,27 @@ public class SevenWorldLogic {
|
|||
*/
|
||||
public PlayerInfoProto.SevenWorldChallengeResponse sevenWorldChallenge(int uid, PlayerInfoProto.SevenWorldChallengeRequest proto) throws Exception {
|
||||
User user = verify(uid);
|
||||
// 查询,挑战次数是否满足
|
||||
boolean countBol = PlayerLogic.getInstance().check(user, proto.getPrivilageTypeId(),1);
|
||||
if (proto.getPrivilageTypeId() == 0 || !countBol){
|
||||
LOGGER.error("七界挑战失败,挑战id:{},挑战结果:{}",proto.getPrivilageTypeId(),countBol);
|
||||
throw new ErrorCodeException(ErrorCode.REFRESH_WHEL_TIME_NOT,"挑战次数不足");
|
||||
}
|
||||
// 今天周几
|
||||
int week = TimeUtils.getDayOfWeek();
|
||||
// 当前天数挑战过的层
|
||||
List<Integer> openTier = user.getPlayerInfoManager().getSevenWorldOpenTier(week);
|
||||
// 可挑战的最高层
|
||||
int openTier = user.getPlayerInfoManager().getSevenWorldOpenTier(week);
|
||||
// 层数id
|
||||
int tierId = proto.getTierId();
|
||||
Map<Integer, SQijieStage> stageMap = STableManager.getConfig(SQijieStage.class);
|
||||
Set<Integer> set = SQijieStage.dateMap.get(week);
|
||||
Set<Integer> set = SQijieStage.getDateMap().get(week);
|
||||
// 是否是今天开启的层
|
||||
SQijieStage stage = stageMap.get(tierId);
|
||||
if (stage == null || !set.contains(tierId)){
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL,"层数信息错误");
|
||||
}
|
||||
// 上一层
|
||||
SQijieStage stageNext = stageMap.get(stage.getNextID());
|
||||
// null表示第一层,上一层没有挑战不能挑战当前层
|
||||
if (stageNext != null && !openTier.contains(stageNext.getId())){
|
||||
if (tierId > openTier){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE,"当前层未解锁");
|
||||
}
|
||||
// 队伍验证
|
||||
|
@ -213,8 +220,8 @@ public class SevenWorldLogic {
|
|||
}
|
||||
|
||||
PlayerInfoProto.SevenWorldChallengeResponse.Builder builder = PlayerInfoProto.SevenWorldChallengeResponse.newBuilder();
|
||||
// 战斗逻辑
|
||||
PVEFightEvent pveFightEvent = new PVEFightEvent(user.getId(), TeamEnum.SEVEN_WORLD_TEAM.getTeamId(), 20, "", GameFightType.SevenWorld, stage.getMonsterGroup(), 3);
|
||||
// 战斗逻辑,特殊处理,怪物id位置要传自增id
|
||||
PVEFightEvent pveFightEvent = new PVEFightEvent(user.getId(), TeamEnum.SEVEN_WORLD_TEAM.getTeamId(), 20, "", GameFightType.SevenWorld, stage.getId(), 1);
|
||||
FightResult fightResult = FightDispatcher.dispatcher(pveFightEvent);
|
||||
// 战斗异常
|
||||
if (fightResult.getResult() == -1) {
|
||||
|
@ -222,34 +229,191 @@ public class SevenWorldLogic {
|
|||
}
|
||||
// 挑战成功,计算奖励
|
||||
if (fightResult.getResult() == 1){
|
||||
int[][] reward = rewardBuff(user, fightResult, stage);
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, reward, BIReason.SEVEN_WORLD_CHALLENGE);
|
||||
builder.setDrop(drop);
|
||||
// 领取奖励
|
||||
rewardBuff(user, fightResult, stage, builder);
|
||||
// 消耗次数
|
||||
PlayerLogic.getInstance().checkAndUpdate(user, proto.getPrivilageTypeId(),1);
|
||||
if (tierId == openTier){
|
||||
// 层数
|
||||
user.getPlayerInfoManager().putSevenWorldOpenTier(week,tierId);
|
||||
}
|
||||
}
|
||||
// 战斗数据
|
||||
builder.setResult(fightResult.getResult());
|
||||
builder.setFightData(fightResult.getFightData());
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
private int[][] rewardBuff(User user, FightResult fightResult, SQijieStage stage){
|
||||
/**
|
||||
* 奖励计算
|
||||
*/
|
||||
private void rewardBuff(User user, FightResult fightResult, SQijieStage stage, PlayerInfoProto.SevenWorldChallengeResponse.Builder response) throws Exception {
|
||||
List<TeamPosHeroInfo> heroInfos = user.getTeamPosManager().getTeamPosForHero().get(TeamEnum.SEVEN_WORLD_TEAM.getTeamId());
|
||||
Map<Integer, SQijieUpgrade> upgradeMap = STableManager.getConfig(SQijieUpgrade.class);
|
||||
// 队伍加成
|
||||
int[] conditionValue = stage.getConditionValue();
|
||||
for (int v : conditionValue) {
|
||||
SQijieUpgrade upgrade = upgradeMap.get(v);
|
||||
int[][] conditionValue = stage.getConditionValue();
|
||||
double buff = 0;
|
||||
// 阵容加成
|
||||
for (int[] v : conditionValue) {
|
||||
SQijieUpgrade upgrade = upgradeMap.get(v[0]);
|
||||
if (upgrade == null){
|
||||
LOGGER.error("SQijieUpgrade,配置表读取不到,uid:{},关卡id:{}",user.getId(),v[0]);
|
||||
continue;
|
||||
}
|
||||
// 阵营条件,-1表示没有条件
|
||||
if (upgrade.getPropertyName() != -1){
|
||||
|
||||
int num = heroNumByPropertyName(user, heroInfos).getOrDefault(upgrade.getPropertyName(),0);
|
||||
boolean judge = (upgrade.getMin() == -1 || upgrade.getMin() <= num) && (upgrade.getMax() == -1 || upgrade.getMax() >= num);
|
||||
if(!judge){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// 作用条件,-1表示没有条件
|
||||
if (upgrade.getProfession() != -1){
|
||||
int num = heroNumByProfession(user, heroInfos).getOrDefault(upgrade.getProfession(),0);
|
||||
boolean judge = (upgrade.getMin() == -1 || upgrade.getMin() <= num) && (upgrade.getMax() == -1 || upgrade.getMax() >= num);
|
||||
if(!judge){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
buff += v[1];
|
||||
response.addTeamBuffIds(v[0]);
|
||||
}
|
||||
// 回合加成
|
||||
int curRound = fightResult.getCurRound();
|
||||
for (int[] round : stage.getRoundReward()) {
|
||||
if (curRound <= round[0]){
|
||||
buff += round[1];
|
||||
response.setRound(round[0]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// 遗物加成
|
||||
Map<Integer, Integer> relic = user.getPlayerInfoManager().getSevenWorldRelic();
|
||||
Set<Integer> relicSet = relic.keySet().stream().filter(v -> relic.get(v) == 1).collect(Collectors.toSet());
|
||||
Map<Integer, SQijieHolyConfig> config = STableManager.getConfig(SQijieHolyConfig.class);
|
||||
for (Integer key : relicSet) {
|
||||
SQijieHolyConfig holyConfig = config.get(key);
|
||||
if (holyConfig == null){
|
||||
LOGGER.error("SQijieHolyConfig,配置表读取不到,uid:{},遗物id:{}",user.getId(),key);
|
||||
continue;
|
||||
}
|
||||
buff+=holyConfig.getAddition();
|
||||
response.addRelicIds(key);
|
||||
}
|
||||
// 奖励
|
||||
CommonProto.Drop.Builder drop = CommonProto.Drop.newBuilder();
|
||||
// 基础奖励,没有加成
|
||||
ItemUtil.drop(user,stage.getReward(),drop,BIReason.SEVEN_WORLD_CHALLENGE);
|
||||
// 星界奖励,有加成
|
||||
int[][] jieLingReward = stage.getJielingReward();
|
||||
for (int[] reward : jieLingReward) {
|
||||
int ceil = (int) Math.ceil(reward[1] * (buff / 10000));
|
||||
reward[1] = reward[1]+ceil;
|
||||
}
|
||||
ItemUtil.drop(user,jieLingReward,drop,BIReason.SEVEN_WORLD_CHALLENGE);
|
||||
// 排行榜添加积分
|
||||
addRank(user.getId(),jieLingReward[1][1]);
|
||||
// 七界秘宝积分,没有加成
|
||||
ItemUtil.drop(user,new int[][]{stage.getTreasureIntegral()},drop,BIReason.SEVEN_WORLD_CHALLENGE);
|
||||
response.setDrop(drop);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加排行榜
|
||||
* @param uid
|
||||
* @param score
|
||||
*/
|
||||
private void addRank(int uid,int score){
|
||||
AbstractRank rankEnum = RankContext.getRankEnum(RankEnum.CROSS_SEVEN_WORLD_RANK.getType());
|
||||
rankEnum.addRank(uid,"",score);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据阵营分类
|
||||
* @param user
|
||||
* @param heroInfos
|
||||
* @return
|
||||
* @throws ErrorCodeException
|
||||
*/
|
||||
private Map<Integer,Integer> heroNumByPropertyName(User user,List<TeamPosHeroInfo> heroInfos) throws ErrorCodeException {
|
||||
Map<Integer,Integer> map = new HashMap<>(5);
|
||||
for (TeamPosHeroInfo info : heroInfos) {
|
||||
Hero hero = user.getHeroManager().getHero(info.getHeroId());
|
||||
if (hero == null){
|
||||
throw new ErrorCodeException(ErrorCode.SYS_ERROR_CODE,"1数据库英雄找不到!");
|
||||
}
|
||||
SCHero scHero = SCHero.getsCHero().get(hero.getTemplateId());
|
||||
if (scHero == null){
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL,"1配置表英雄找不到!");
|
||||
}
|
||||
// 单个类型存储
|
||||
map.put(scHero.getPropertyName(),map.getOrDefault(scHero.getPropertyName(), 0)+1);
|
||||
// 全部类型存储
|
||||
map.put(0,map.getOrDefault(0, 0)+1);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据作用分类
|
||||
* @param user
|
||||
* @param heroInfos
|
||||
* @return
|
||||
* @throws ErrorCodeException
|
||||
*/
|
||||
private Map<Integer,Integer> heroNumByProfession(User user,List<TeamPosHeroInfo> heroInfos) throws ErrorCodeException {
|
||||
Map<Integer,Integer> map = new HashMap<>(5);
|
||||
for (TeamPosHeroInfo info : heroInfos) {
|
||||
Hero hero = user.getHeroManager().getHero(info.getHeroId());
|
||||
if (hero == null){
|
||||
throw new ErrorCodeException(ErrorCode.SYS_ERROR_CODE,"2数据库英雄找不到!");
|
||||
}
|
||||
SCHero scHero = SCHero.getsCHero().get(hero.getTemplateId());
|
||||
if (scHero == null){
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL,"2配置表英雄找不到!");
|
||||
}
|
||||
// 单个类型存储
|
||||
map.put(scHero.getProfession(),map.getOrDefault(scHero.getProfession(), 0)+1);
|
||||
// 全部类型存储
|
||||
map.put(0,map.getOrDefault(0, 0)+1);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 结束发送奖励
|
||||
*/
|
||||
public void sendRankReward(){
|
||||
// 排行榜
|
||||
Set<ZSetOperations.TypedTuple<String>> range = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.SEVEN_WORLD_INTEGRAL_RANK,"",0,-1);
|
||||
// 排名
|
||||
int rank = 1;
|
||||
for (ZSetOperations.TypedTuple<String> tuple : range) {
|
||||
User user = UserManager.getUserInMem(Integer.parseInt(tuple.getValue()));
|
||||
if (user == null){
|
||||
return;
|
||||
}
|
||||
String title = SErrorCodeEerverConfig.getI18NMessage("Qijie_mail_title");
|
||||
String content = SErrorCodeEerverConfig.getI18NMessageNeedConvert("Qijie_mail_txt", new Object[]{rank},new int[0],"#");
|
||||
// 排行奖励
|
||||
Map<Integer, SQijieRanking> config = STableManager.getConfig(SQijieRanking.class);
|
||||
for (SQijieRanking value : config.values()) {
|
||||
// 排名区间
|
||||
if (rank >= value.getMinRank() && rank <= value.getMaxRank()){
|
||||
// 发邮件奖励
|
||||
String reward = StringUtil.parseArrayToString(value.getRankingReward());
|
||||
MailLogic.getInstance().sendMail(user.getId(),title,content,reward,TimeUtils.nowInt(), Global.MAIL_EFFECTIVE_TIME);
|
||||
// 清除道具
|
||||
ItemLogic.getInstance().functionEndClearItem(user.getId(),FunctionIdEnum.CrossSevenWorld.getFunctionType(),BIReason.SEVEN_WORLD_FUNCTION_END);
|
||||
LOGGER.info("七界结束,发送邮件并删除道具,uid:{},奖励:{},",user.getId(),reward);
|
||||
break;
|
||||
}
|
||||
}
|
||||
rank++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -373,9 +373,6 @@ public class StoreLogic implements IEventHandler {
|
|||
}
|
||||
}
|
||||
}
|
||||
if(storeManager.getStoreInfoMap().containsKey(sStoreTypeConfig.getId())){
|
||||
continue;
|
||||
}
|
||||
if(sStoreTypeConfig.getStoreOpenRule() == 7){
|
||||
|
||||
long startTime = ToolsUtil.getTimeLong(sStoreTypeConfig.getStartTimeLong(), sStoreTypeConfig.getEndTimeLong(),ActivityType.OPEN_TYPE_SERVER,0, 1);
|
||||
|
|
|
@ -117,7 +117,7 @@ public class MessageUtil {
|
|||
}
|
||||
|
||||
|
||||
public static void sendRedIndication(int sendUid,int redType) throws Exception {
|
||||
public static void sendRedIndication(int sendUid,int redType){
|
||||
ISession session = OnlineUserManager.sessionMap.get(sendUid);
|
||||
if(session!=null){
|
||||
PlayerInfoProto.RedPointInfo redPointInfo = PlayerInfoProto.RedPointInfo.newBuilder().setType(redType).build();
|
||||
|
@ -126,7 +126,11 @@ public class MessageUtil {
|
|||
if(redType == GlobalsDef.MAIL_RED_TYPE){
|
||||
return;
|
||||
}
|
||||
User user = UserManager.getUser(sendUid);
|
||||
User user = UserManager.getUserInMem(sendUid);
|
||||
if (user == null){
|
||||
LOGGER.error("发送红点报错,uid:{},type:{}",sendUid,redType);
|
||||
return;
|
||||
}
|
||||
Set<Integer> reds = user.getPlayerInfoManager().getReds();
|
||||
reds.add(redType);
|
||||
user.getPlayerInfoManager().setReds(reds);
|
||||
|
|
|
@ -12,12 +12,17 @@ public class SQijieHolyConfig implements BaseConfig {
|
|||
|
||||
private int quality;
|
||||
|
||||
private int type;
|
||||
|
||||
private int[][] attri;
|
||||
|
||||
private int[] cost;
|
||||
|
||||
private int[] addition;
|
||||
private int addition;
|
||||
|
||||
private int[] position;
|
||||
|
||||
private int buff;
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
@ -41,9 +46,19 @@ public class SQijieHolyConfig implements BaseConfig {
|
|||
return cost;
|
||||
}
|
||||
|
||||
public int[] getAddition() {
|
||||
public int getAddition() {
|
||||
return addition;
|
||||
}
|
||||
|
||||
public int[] getPosition() {
|
||||
return position;
|
||||
}
|
||||
|
||||
public int getBuff() {
|
||||
return buff;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
}
|
|
@ -14,7 +14,7 @@ public class SQijieRanking implements BaseConfig {
|
|||
|
||||
private int maxRank;
|
||||
|
||||
private float[][] rankingReward;
|
||||
private int[][] rankingReward;
|
||||
|
||||
|
||||
@Override
|
||||
|
@ -35,7 +35,7 @@ public class SQijieRanking implements BaseConfig {
|
|||
return maxRank;
|
||||
}
|
||||
|
||||
public float[][] getRankingReward() {
|
||||
public int[][] getRankingReward() {
|
||||
return rankingReward;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,19 +26,17 @@ public class SQijieStage implements BaseConfig {
|
|||
|
||||
private int[] buff;
|
||||
|
||||
private int[] conditionValue;
|
||||
|
||||
private int[] addition;
|
||||
private int[][] conditionValue;
|
||||
|
||||
private int[][] roundReward;
|
||||
|
||||
private int[][] reward;
|
||||
|
||||
private int[] jielingReward;
|
||||
private int[][] jielingReward;
|
||||
|
||||
private int[] integral;
|
||||
private int[] treasureIntegral;
|
||||
|
||||
public static Map<Integer, Set<Integer>> dateMap = new HashMap<>();
|
||||
private static Map<Integer, Set<Integer>> dateMap = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
@ -49,10 +47,9 @@ public class SQijieStage implements BaseConfig {
|
|||
set.add(k);
|
||||
map.put(v.getDate(),set);
|
||||
});
|
||||
dateMap = map;
|
||||
setDateMap(map);
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
@ -85,14 +82,6 @@ public class SQijieStage implements BaseConfig {
|
|||
return buff;
|
||||
}
|
||||
|
||||
public int[] getConditionValue() {
|
||||
return conditionValue;
|
||||
}
|
||||
|
||||
public int[] getAddition() {
|
||||
return addition;
|
||||
}
|
||||
|
||||
public int[][] getRoundReward() {
|
||||
return roundReward;
|
||||
}
|
||||
|
@ -101,15 +90,27 @@ public class SQijieStage implements BaseConfig {
|
|||
return reward;
|
||||
}
|
||||
|
||||
public int[] getJielingReward() {
|
||||
return jielingReward;
|
||||
}
|
||||
|
||||
public int[] getIntegral() {
|
||||
return integral;
|
||||
}
|
||||
|
||||
public int getNextID() {
|
||||
return nextID;
|
||||
}
|
||||
|
||||
public int[][] getConditionValue() {
|
||||
return conditionValue;
|
||||
}
|
||||
|
||||
public int[][] getJielingReward() {
|
||||
return jielingReward;
|
||||
}
|
||||
|
||||
public int[] getTreasureIntegral() {
|
||||
return treasureIntegral;
|
||||
}
|
||||
|
||||
public static Map<Integer, Set<Integer>> getDateMap() {
|
||||
return dateMap;
|
||||
}
|
||||
|
||||
public static void setDateMap(Map<Integer, Set<Integer>> dateMap) {
|
||||
SQijieStage.dateMap = dateMap;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue