回滚神将修改,法宝抽卡修改
parent
50eacabe17
commit
63f1408a45
|
@ -172,25 +172,4 @@ public class Utils {
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* map转二维数组
|
||||
*/
|
||||
public static int[][] getTwoArrayInt(Map<Integer, Integer> map) {
|
||||
int[][] object = null;
|
||||
if (map != null && !map.isEmpty()) {
|
||||
int size = map.size();
|
||||
object = new int[size][2];
|
||||
|
||||
Iterator<Map.Entry<Integer, Integer>> iterator = map.entrySet().iterator();
|
||||
for (int i = 0; i < size; i++) {
|
||||
Map.Entry<Integer, Integer> entry = iterator.next();
|
||||
int key = entry.getKey();
|
||||
int value = entry.getValue();
|
||||
object[i][0] = key;
|
||||
object[i][1] = value;
|
||||
}
|
||||
}
|
||||
return object;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@ import java.util.Set;
|
|||
public class ItemStaticConfig extends AbstractClassStaticConfig {
|
||||
|
||||
private Map<Integer,Map<Integer,Integer>> euipTppes;
|
||||
|
||||
private Map<Integer,Map<Integer,Integer>> race2quality2soulid; //魂宝索引
|
||||
private Map<Integer,Map<Integer,Integer>> race2quality2id;//灵宝索引
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.ljsd.jieling.handler;
|
|||
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.logic.activity.ActivityLogic;
|
||||
import com.ljsd.jieling.logic.dao.PlayerManager;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
|
@ -41,7 +42,7 @@ public class DesireDrawCardHandler extends BaseHandler<PlayerInfoProto.DesireDra
|
|||
}
|
||||
break;
|
||||
case 4: //法宝心愿
|
||||
Set<Integer> fabaoList = playerManager.getDesireOpenFabaoList();
|
||||
Set<Integer> fabaoList = ActivityLogic.getInstance().getDesireOpenFabaoList();
|
||||
if (fabaoList.contains(tempId) || tempId == 0){
|
||||
playerManager.putDesireDraw(type, tempId);
|
||||
}
|
||||
|
|
|
@ -24,20 +24,16 @@ import com.ljsd.jieling.logic.activity.event.SuperBoxEvent;
|
|||
import com.ljsd.jieling.logic.activity.fourChallenge.FourChallengeLogic;
|
||||
import com.ljsd.jieling.logic.dao.*;
|
||||
import com.ljsd.jieling.logic.dao.root.GlobalSystemControl;
|
||||
import com.ljsd.jieling.logic.dao.root.GuildInfo;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.explorerMap.ExplorerMapLogic;
|
||||
import com.ljsd.jieling.logic.home.event.HomeEvent;
|
||||
import com.ljsd.jieling.logic.item.ItemLogic;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.logic.mission.MissionType;
|
||||
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||
import com.ljsd.jieling.logic.question.QuestionLogic;
|
||||
import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
|
||||
import com.ljsd.jieling.logic.store.StoreLogic;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.bean.AbstractWelfareBag;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.bean.ReceiveWelfareBag;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.rechargeHandler.RechargeHandler;
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.thread.task.RPCServerTask;
|
||||
|
@ -103,16 +99,12 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
|||
List<CommonProto.NewPlayerGuidePoint> list = new ArrayList<>();
|
||||
Map<Integer, Integer> guidePoints = playerInfoManager.getGuidePoints();
|
||||
for(Map.Entry<Integer,Integer> guideItem : guidePoints.entrySet()){
|
||||
list.add(CommonProto.NewPlayerGuidePoint.newBuilder()
|
||||
.setType(guideItem.getKey())
|
||||
. setId(guideItem.getValue())
|
||||
.build());
|
||||
list.add(CommonProto.NewPlayerGuidePoint.newBuilder().setType(guideItem.getKey()).setId(guideItem.getValue()).build());
|
||||
}
|
||||
|
||||
List<CommonProto.Privilege> privilegeList = new ArrayList<>();
|
||||
for(Map.Entry<Integer,VipInfo> vipInfoItem : vipInfo.entrySet()){
|
||||
privilegeList.add(CommonProto.Privilege.newBuilder()
|
||||
.setId(vipInfoItem.getKey())
|
||||
privilegeList.add(CommonProto.Privilege.newBuilder().setId(vipInfoItem.getKey())
|
||||
.setUsedTimes(vipInfoItem.getValue().getCount())
|
||||
.setEffectTime(vipInfoItem.getValue().getEffectTime())
|
||||
.build());
|
||||
|
@ -125,7 +117,7 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
|||
mapManager.setCurMapId(0);
|
||||
}
|
||||
}
|
||||
guildServerCheck(user);// 工会服务器id检查
|
||||
// guildServerCheck(user);// 工会服务器id检查
|
||||
CommonProto.Player player = CBean2Proto.getPlayer(userId, user.getPlayerInfoManager(), mapManager);
|
||||
CommonProto.SuddenlyBossInfo suddenlyBossInfo = CommonProto.SuddenlyBossInfo.newBuilder()
|
||||
.setSuddBossId(mapManager.getSuddenlyBoss())
|
||||
|
@ -150,7 +142,7 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
|||
FourChallengeLogic.getInstance().firstGetTimes(user);// 四灵试炼初始化
|
||||
StoreLogic.getInstance().reloadStoreInfo(user,7);//重载功能商店
|
||||
ExplorerMapLogic.getInstance().calOfflineReward(user);//挂机探索
|
||||
monthCardRefresh(user);//月卡特殊处理
|
||||
// monthCardRefresh(user);//月卡特殊处理
|
||||
faBaoJuLingHandler(user);//法宝修改
|
||||
//森罗幻境自动挂机返回掉落展示清除
|
||||
Map<Integer,Integer> dropShow = mapManager.getTowerGetRewardInfoShowMap();
|
||||
|
@ -244,7 +236,7 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
|||
Poster.getPoster().dispatchEvent(new HeroUpStarEvent(user.getId(),10023,0));// 登峰造极孙悟空
|
||||
finalActivityReset(user);// 常驻活动重置
|
||||
endLessTreasureHandler(user);// 无尽秘宝处理
|
||||
expeditionTreasureHandler(user);// 天宫秘宝刷新
|
||||
// expeditionTreasureHandler(user);// 天宫秘宝刷新
|
||||
user.getUserMissionManager().onGameEvent(user,GameEvent.ONE_MISSION_TYPE_CONSUME, MissionType.DAILY_TASK_FINISH,0);
|
||||
|
||||
if(playerInfoManager.getIsdayFirst()==0){
|
||||
|
@ -258,53 +250,53 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
|||
LOGGER.error("获取玩家信息报错:{}",e.getMessage(),e);
|
||||
}
|
||||
//道具异常检查
|
||||
ItemLogic.getInstance().checkItem(user);
|
||||
// ItemLogic.getInstance().checkItem(user);
|
||||
MessageUtil.sendIndicationMessage(iSession, 1, MessageTypeProto.MessageType.WorldLevelIndication_VALUE, PlayerInfoProto.WorldLevelIndication.newBuilder().setWorldLeve(GlobleSystemLogic.getGlobalWorldLevelCache()).build(), true);
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GET_PLAYERINFO_RESPONSE_VALUE, getPlayerInfoResponse, true);
|
||||
}
|
||||
|
||||
//月卡特殊处理
|
||||
private void monthCardRefresh(User user){
|
||||
try {
|
||||
RechargeHandler rechargeHandler = BuyGoodsNewLogic.getRechargeHandler(3);
|
||||
long time = 16932816000000L;
|
||||
AbstractWelfareBag bag = rechargeHandler.getBag(user, 25002);
|
||||
if (bag != null && bag.getRefreshTime() > time){
|
||||
bag.setRefreshTime(bag.getStartTime() + bag.getDailyUpdate() * TimeUtils.DAY);
|
||||
}
|
||||
|
||||
AbstractWelfareBag bag1 = rechargeHandler.getBag(user, 25003);
|
||||
if (bag1 != null && bag1.getRefreshTime() > time){
|
||||
bag1.setRefreshTime(bag1.getStartTime() + bag1.getDailyUpdate() * TimeUtils.DAY);
|
||||
}
|
||||
}catch (Exception e){
|
||||
LOGGER.error("月卡特殊处理异常:{}",user.getId(),e);
|
||||
}
|
||||
}
|
||||
// private void monthCardRefresh(User user){
|
||||
// try {
|
||||
// RechargeHandler rechargeHandler = BuyGoodsNewLogic.getRechargeHandler(3);
|
||||
// long time = 16932816000000L;
|
||||
// AbstractWelfareBag bag = rechargeHandler.getBag(user, 25002);
|
||||
// if (bag != null && bag.getRefreshTime() > time){
|
||||
// bag.setRefreshTime(bag.getStartTime() + bag.getDailyUpdate() * TimeUtils.DAY);
|
||||
// }
|
||||
//
|
||||
// AbstractWelfareBag bag1 = rechargeHandler.getBag(user, 25003);
|
||||
// if (bag1 != null && bag1.getRefreshTime() > time){
|
||||
// bag1.setRefreshTime(bag1.getStartTime() + bag1.getDailyUpdate() * TimeUtils.DAY);
|
||||
// }
|
||||
// }catch (Exception e){
|
||||
// LOGGER.error("月卡特殊处理异常:{}",user.getId(),e);
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* 检查工会得区服id,合服处理
|
||||
* @param user 用户
|
||||
*/
|
||||
private void guildServerCheck(User user){
|
||||
int guildId = user.getPlayerInfoManager().getGuildId();
|
||||
if (guildId == 0){
|
||||
return;
|
||||
}
|
||||
GuildInfo guildInfo = GuilidManager.getGuildInfo(guildId);
|
||||
if (guildInfo == null){
|
||||
LOGGER.info("玩家异常账号,公会id未找到==============={}",guildId);
|
||||
user.getPlayerInfoManager().setGuildId(0);
|
||||
return;
|
||||
}
|
||||
int serverId = GameApplication.serverId;
|
||||
if (guildInfo.getServerId() == serverId){
|
||||
return;
|
||||
}
|
||||
LOGGER.info("跨服公会信息,修改服务器id==============={}",guildId);
|
||||
guildInfo.setServerId(serverId);
|
||||
GuilidManager.saveOrUpdateGuildInfo(guildInfo);
|
||||
}
|
||||
// private void guildServerCheck(User user){
|
||||
// int guildId = user.getPlayerInfoManager().getGuildId();
|
||||
// if (guildId == 0){
|
||||
// return;
|
||||
// }
|
||||
// GuildInfo guildInfo = GuilidManager.getGuildInfo(guildId);
|
||||
// if (guildInfo == null){
|
||||
// LOGGER.info("玩家异常账号,公会id未找到==============={}",guildId);
|
||||
// user.getPlayerInfoManager().setGuildId(0);
|
||||
// return;
|
||||
// }
|
||||
// int serverId = GameApplication.serverId;
|
||||
// if (guildInfo.getServerId() == serverId){
|
||||
// return;
|
||||
// }
|
||||
// LOGGER.info("跨服公会信息,修改服务器id==============={}",guildId);
|
||||
// guildInfo.setServerId(serverId);
|
||||
// GuilidManager.saveOrUpdateGuildInfo(guildInfo);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 常驻活动重置
|
||||
|
@ -349,17 +341,17 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
|||
/**
|
||||
* 天宫秘宝刷新
|
||||
*/
|
||||
private void expeditionTreasureHandler(User user){
|
||||
// 天宫秘宝礼包获取
|
||||
ReceiveWelfareBag bagInfo = (ReceiveWelfareBag) user.getPlayerInfoManager().getNewRechargeInfo().getReceiveMap().get(106);
|
||||
if (bagInfo == null){
|
||||
return;
|
||||
}
|
||||
// 刷新礼包
|
||||
if (user.getExpeditionManager().getWorldTreasureReward().getIsBuy() == 0 && bagInfo.isBought()){
|
||||
bagInfo.refresh();
|
||||
}
|
||||
}
|
||||
// private void expeditionTreasureHandler(User user){
|
||||
// // 天宫秘宝礼包获取
|
||||
// ReceiveWelfareBag bagInfo = (ReceiveWelfareBag) user.getPlayerInfoManager().getNewRechargeInfo().getReceiveMap().get(106);
|
||||
// if (bagInfo == null){
|
||||
// return;
|
||||
// }
|
||||
// // 刷新礼包
|
||||
// if (user.getExpeditionManager().getWorldTreasureReward().getIsBuy() == 0 && bagInfo.isBought()){
|
||||
// bagInfo.refresh();
|
||||
// }
|
||||
// }
|
||||
|
||||
///登录获取四象心法数据
|
||||
public static List<CommonProto.SixiangxinfaInfo> getSixiangxinfaInfos(HeroManager heroManager) {
|
||||
|
|
|
@ -1,20 +1,15 @@
|
|||
package com.ljsd.jieling.handler;
|
||||
|
||||
import com.google.protobuf.GeneratedMessage;
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.logic.activity.ActivityLogic;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.util.CBean2Proto;
|
||||
import org.springframework.stereotype.Component;
|
||||
import rpc.protocols.*;
|
||||
import util.TimeUtils;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
|
@ -35,15 +30,15 @@ public class GetWishDrawCardInfoHandler extends BaseHandler<PlayerInfoProto.choi
|
|||
// 用户信息
|
||||
User user = UserManager.getUser(uid);
|
||||
int type = proto.getType();
|
||||
Set<Integer> set = new HashSet<>();
|
||||
int tmpId = 0;
|
||||
Set<Integer> set;
|
||||
int tmpId;
|
||||
switch (type){
|
||||
case 1://英雄卡池
|
||||
set = ActivityLogic.getInstance().getDesireOpenHeroList(user);
|
||||
tmpId = user.getPlayerInfoManager().getDesireDraw().getOrDefault(type, 0);
|
||||
break;
|
||||
case 4://法宝卡池
|
||||
set = ActivityLogic.getInstance().getDesireOpenFabaoList(user);
|
||||
set = ActivityLogic.getInstance().getDesireOpenFabaoList();
|
||||
tmpId = user.getPlayerInfoManager().getDesireDraw().getOrDefault(type, 0);
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
package com.ljsd.jieling.handler;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import config.SRechargeCommodityNewConfig;
|
||||
import org.springframework.stereotype.Component;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.HeroInfoProto;
|
||||
|
@ -26,6 +24,5 @@ public class SaveTeamPosHandler extends BaseHandler{
|
|||
int teamId = teamPosInfo.getTeamId();
|
||||
List<CommonProto.TeamHeroInfo> teamHeroInfosList = teamPosInfo.getTeamHeroInfosList();
|
||||
HeroLogic.getInstance().saveTeamPos(iSession,teamId,teamHeroInfosList);
|
||||
LOGGER.info(JSON.toJSONString(SRechargeCommodityNewConfig.configMap.get(1)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ public class UseAndPriceItemHandler extends BaseHandler<PlayerInfoProto.UseAndPr
|
|||
ItemLogic.getInstance().decomposeEquip(iSession,equipIdsList);
|
||||
break;
|
||||
case 3://恭送(分解)神将
|
||||
ItemLogic.getInstance().decomposeHero(iSession,heroIdsList,null);
|
||||
ItemLogic.getInstance().decomposeHero(iSession,heroIdsList);
|
||||
break;
|
||||
case 4://分解宝器
|
||||
ItemLogic.getInstance().decomposeJewel(iSession,equipIdsList);
|
||||
|
|
|
@ -49,7 +49,7 @@ public class FaBaoSoulUpLvRequestHandler extends BaseHandler<HeroInfoProto.FaBao
|
|||
throw new ErrorCodeException(ErrorCode.HERO_ITEM_NOT);
|
||||
}
|
||||
user.getHeroManager().putFaBaoSoulMap(faBaoId,faBaoLv);
|
||||
this.updateFaBaoGongMingLv(user,trumpConfig.getBookId());
|
||||
updateFaBaoGongMingLv(user,trumpConfig.getBookId());
|
||||
// 更新战力
|
||||
Poster.getPoster().dispatchEvent(new SaveHeroForceEvent(user.getId(),""));
|
||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.FA_BAO_SOUL_UPLV_RESPONSE_VALUE,null,true);
|
||||
|
|
|
@ -1966,32 +1966,20 @@ public class ActivityLogic implements IEventHandler{
|
|||
/**
|
||||
* 获取新加入的心愿法宝
|
||||
*/
|
||||
public Set<Integer> getDesireOpenFabaoList(User user) {
|
||||
// 开服时间戳
|
||||
long openTime = TimeUtils.stringToTimeLong2(GameApplication.serverConfig.getOpenTime());
|
||||
public Set<Integer> getDesireOpenFabaoList() {
|
||||
Set<Integer> result = new HashSet<>();
|
||||
// 当前时间戳
|
||||
long now = TimeUtils.now();
|
||||
// 差值
|
||||
long time = now - openTime;
|
||||
// set,存储最新的列表
|
||||
HashSet<Integer> set = new HashSet<>();
|
||||
// 全部的英雄列表
|
||||
Map<Integer, SCHero> heroMap = SCHero.getsCHero();
|
||||
// 满足条件的放入set
|
||||
for (SCHero hero : heroMap.values()) {
|
||||
int[] equipTalismana = hero.getEquipTalismana();
|
||||
if (time >= hero.getJoinWishDay() * TimeUtils.DAY && equipTalismana != null && equipTalismana.length > 1){
|
||||
set.add(equipTalismana[1]);
|
||||
|
||||
Map<Integer, SEquipTalismanaLottery> map = SEquipTalismanaLottery.map;
|
||||
for (SEquipTalismanaLottery lottery : map.values()) {
|
||||
long start = TimeUtils.stringToTimeLong(lottery.getStartTime(), TimeUtils.Stand_CeHua_Data_format);
|
||||
long end = TimeUtils.stringToTimeLong(lottery.getEndtime(), TimeUtils.Stand_CeHua_Data_format);
|
||||
if (now >= start && now < end){
|
||||
result = Arrays.stream(lottery.getDrop()).boxed().collect(Collectors.toSet());
|
||||
break;
|
||||
}
|
||||
}
|
||||
// set, 返回给客户端,最新的set
|
||||
HashSet<Integer> result = new HashSet<>();
|
||||
// 目前存储的全部set
|
||||
Set<Integer> fabaoList = user.getPlayerInfoManager().getDesireOpenFabaoList();
|
||||
// 之前没有记录的为新开放,需要返回给客户端
|
||||
set.stream().filter(v -> !fabaoList.contains(v)).forEach(result::add);
|
||||
// 更新玩家数据库
|
||||
user.getPlayerInfoManager().setDesireOpenFabaoList(set);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -209,7 +209,7 @@ public class PlayerManager extends MongoBase {
|
|||
private Map<Integer,LandInfo> landInfoMap = new HashMap<>();//栖云阁地块列表
|
||||
private HashSet<Integer> heroDispatchAgos = new HashSet<>();//栖云阁已派遣英雄列表
|
||||
private Set<Integer> desireOpenHeroList = new HashSet<>();//心愿可以选择的英雄列表
|
||||
private Set<Integer> desireOpenFabaoList = new HashSet<>();//心愿可以选择的法宝列表
|
||||
// private Set<Integer> desireOpenFabaoList = new HashSet<>();//心愿可以选择的法宝列表
|
||||
private final Map<Integer, Integer> desireDraw = new HashMap<>();//选择的心愿
|
||||
|
||||
private Map<Integer, int[]> duoduiTower = new HashMap<>();//多对塔记录
|
||||
|
@ -250,15 +250,6 @@ public class PlayerManager extends MongoBase {
|
|||
updateString("desireOpenHeroList", desireOpenHeroList);
|
||||
}
|
||||
|
||||
public Set<Integer> getDesireOpenFabaoList() {
|
||||
return desireOpenFabaoList;
|
||||
}
|
||||
|
||||
public void setDesireOpenFabaoList(Set<Integer> set) {
|
||||
this.desireOpenFabaoList = set;
|
||||
updateString("desireOpenFabaoList", desireOpenFabaoList);
|
||||
}
|
||||
|
||||
public Set<Integer> getPlayerGiftEquipList() {
|
||||
return playerGiftEquipList;
|
||||
}
|
||||
|
|
|
@ -45,7 +45,6 @@ import com.ljsd.jieling.logic.redpacket.WelfareRedPacketType;
|
|||
import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.PushRechargeType;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.tools.Utils;
|
||||
import com.ljsd.jieling.util.CBean2Proto;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
|
@ -346,7 +345,7 @@ public class HeroLogic {
|
|||
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.HERO_RAND_RESPONSE_VALUE, builder.build(), true);
|
||||
|
||||
if (sLotterySetting.getLotteryType() == GlobalsDef.RANDOM_LOTTERY_TYPE && !user.getPlayerInfoManager().isHasRandomLotteryType() && sLotterySetting.getPerCount() != 1) {
|
||||
//首次神将召唤 10连抽 给个攻略邮件
|
||||
// 首次 神将召唤 10连抽 给个攻略邮件
|
||||
String title = SErrorCodeEerverConfig.getI18NMessage("zhanneixin_title");
|
||||
String content = SErrorCodeEerverConfig.getI18NMessageNeedConvert("zhanneixin_content", new Object[]{user.getPlayerInfoManager().getNickName()}, new int[]{0}, "#");
|
||||
MailLogic.getInstance().sendSpecialMail(uid, title, content, "", (int) (TimeUtils.now() / 1000), Global.MAIL_EFFECTIVE_TIME, 1, 1);
|
||||
|
@ -835,9 +834,6 @@ public class HeroLogic {
|
|||
//保底次数计算
|
||||
for (Map.Entry<Integer, Integer> countEntry : randomPoolByType.get(mergePool).entrySet()) {
|
||||
SLotterySpecialConfig config = null;
|
||||
// if(specialConfigs.isEmpty()){
|
||||
// continue;
|
||||
// }
|
||||
for (SLotterySpecialConfig everyConfig : specialConfigs) {
|
||||
if (everyConfig.getDifferentType() != countEntry.getKey()) {
|
||||
continue;
|
||||
|
@ -1045,10 +1041,6 @@ public class HeroLogic {
|
|||
for (Map.Entry<Integer, List<TeamPosHeroInfo>> item : teamPosForHero.entrySet()) {
|
||||
int teamId = item.getKey();
|
||||
List<TeamPosHeroInfo> teamPosHeroInfoList = item.getValue();
|
||||
String teamName = teamNames.get(teamId);
|
||||
if (StringUtil.isEmpty(teamName)) {
|
||||
teamName = "";
|
||||
}
|
||||
List<CommonProto.TeamHeroInfo> teamHeroInfoList = new ArrayList<>();
|
||||
for (TeamPosHeroInfo teamPosHeroInfo : teamPosHeroInfoList) {
|
||||
teamHeroInfoList.add(
|
||||
|
@ -1503,15 +1495,8 @@ public class HeroLogic {
|
|||
}
|
||||
|
||||
//改成归元获得,同时返还法宝获得
|
||||
CommonProto.Drop.Builder baseBuilder = heroBackDrop(user, new ArrayList<>(removeHeroIds), 10000, BIReason.UPHERO_DECOMPOS_HERO_REWARD, true);
|
||||
CommonProto.Drop.Builder baseBuilder = disbandHeroDrop(user, removeHeroIds, BIReason.UPHERO_DECOMPOS_HERO_REWARD);
|
||||
|
||||
// 删除英雄
|
||||
for (String rmHeroId : removeHeroIds) {
|
||||
// 摘星阁,装备重置
|
||||
getHomeEquipStrongReset(user,rmHeroId,baseBuilder);
|
||||
// 删除英雄
|
||||
heroManager.removeHero(uid, rmHeroId);
|
||||
}
|
||||
// 消耗道具
|
||||
ItemUtil.itemCost(user, removeItemMap, BIReason.COMPLEX_EQUIP_CONSUME, 0);
|
||||
|
||||
|
@ -1616,6 +1601,7 @@ public class HeroLogic {
|
|||
|
||||
|
||||
//初始属性*(1+化境增长)*等级系数 + 初始属性*突破系数
|
||||
@SuppressWarnings("OptionalGetWithoutIsPresent")
|
||||
private Map<Integer, Long> calHeroAllAttribute(User user, Hero hero, boolean isForce) {
|
||||
Map<Integer, Long> result = new HashMap<>();
|
||||
int templateId = hero.getTemplateId();
|
||||
|
@ -2757,19 +2743,9 @@ public class HeroLogic {
|
|||
// 命格
|
||||
Map<Integer, GemNew> gemNewMap = user.getEquipManager().getGemNewMap();
|
||||
for (GemNew value : gemNewMap.values()) {
|
||||
int[][] property = Utils.getTwoArrayInt(value.getAttribute());
|
||||
int[][] property = ToolsUtil.getTwoArrayInt(value.getAttribute());
|
||||
combinedAttribute(property, heroAllAttribute);
|
||||
}
|
||||
// for (Map.Entry<Integer, Map<Integer, Integer>> lifeGridMapEntry : heroManager.getLifeGridMap().entrySet()) {
|
||||
// for (Map.Entry<Integer, Integer> entry : lifeGridMapEntry.getValue().entrySet()) {
|
||||
// int lifeStoneId = entry.getValue();
|
||||
// if (lifeStoneId <= 0){
|
||||
// continue;
|
||||
// }
|
||||
// SGemConfig sGemConfig=STableManager.getConfig(SGemConfig.class).get(lifeStoneId);
|
||||
// combinedAttribute(sGemConfig.getProperty(), heroAllAttribute);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
private void applyFourQuadrantAttribute(Map<Integer, Long> heroAllAttribute, int heroTempId, User user){
|
||||
|
@ -3572,7 +3548,6 @@ public class HeroLogic {
|
|||
if (type == 1) {
|
||||
List<Integer> positions = new ArrayList<>();
|
||||
for (String equipId : equipIds) {
|
||||
//
|
||||
int equipIdTid = Integer.parseInt(equipId);
|
||||
SEquipConfig sEquipConfig = STableManager.getConfig(SEquipConfig.class).get(equipIdTid);
|
||||
int position = sEquipConfig.getPosition();
|
||||
|
@ -3605,9 +3580,6 @@ public class HeroLogic {
|
|||
|
||||
// 更新战力
|
||||
Poster.getPoster().dispatchEvent(new SaveHeroForceEvent(user.getId(),heroId));
|
||||
// 鸿蒙阵,脱装备
|
||||
addOrUpdateHongmeng(session);
|
||||
|
||||
//发送成功消息
|
||||
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.EQUIP_UNLOAD_OPT_RESPONSE_VALUE, null, true);
|
||||
}
|
||||
|
@ -4208,9 +4180,8 @@ public class HeroLogic {
|
|||
*
|
||||
* @param session
|
||||
* @param heroIdList
|
||||
* @throws Exception
|
||||
*/
|
||||
public void especialEquipBack(ISession session, List<String> heroIdList) throws Exception {
|
||||
public void especialEquipBack(ISession session, List<String> heroIdList) {
|
||||
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.ESPECIAL_EQUIP_BACK_RESPONSE_VALUE, null, true);
|
||||
}
|
||||
|
||||
|
@ -4218,7 +4189,6 @@ public class HeroLogic {
|
|||
* 神将归元
|
||||
*/
|
||||
public void heroBack(ISession session, String heroId) throws Exception {
|
||||
int returnPercent = SSpecialConfig.getIntegerValue(SSpecialConfig.HERO_RETURN_PERCENT);
|
||||
int uid = session.getUid();
|
||||
int responseMsgId = MessageTypeProto.MessageType.HERO_RETURN_RESPONSE_VALUE;
|
||||
User user = UserManager.getUser(uid);
|
||||
|
@ -4251,7 +4221,7 @@ public class HeroLogic {
|
|||
throw new ErrorCodeException(ErrorCode.HERO_ITEM_NOT);
|
||||
}
|
||||
//单纯归元神将,不归元法宝
|
||||
CommonProto.Drop.Builder drop = heroBackDrop(user, heroList, returnPercent, BIReason.HERO_BACK_REWARD, false);
|
||||
CommonProto.Drop.Builder drop = heroBackDrop(user, heroList);
|
||||
List<CommonProto.Item> itemList = drop.getItemlistList();
|
||||
List<Integer> itemId = new ArrayList<>(itemList.size());
|
||||
List<Integer> itemNum = new ArrayList<>(itemList.size());
|
||||
|
@ -4263,96 +4233,147 @@ public class HeroLogic {
|
|||
hero.setLevel(1);
|
||||
hero.setBreakId(0);
|
||||
|
||||
//鸿蒙阵
|
||||
addOrUpdateHongmeng(session);
|
||||
|
||||
HeroInfoProto.HeroReturnResponse build = HeroInfoProto.HeroReturnResponse.newBuilder().setDrop(drop).build();
|
||||
MessageUtil.sendMessage(session, 1, responseMsgId, build, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 归元掉落
|
||||
*
|
||||
* @param user
|
||||
* @param heroIds
|
||||
* @param returnPercent
|
||||
* @return
|
||||
* @throws Exception
|
||||
* @param user 用户
|
||||
* @param heroIds 英雄id列表
|
||||
*/
|
||||
public CommonProto.Drop.Builder heroBackDrop(User user, List<String> heroIds, int returnPercent, int reason, boolean isAddEspecial) throws Exception {
|
||||
public CommonProto.Drop.Builder heroBackDrop(User user, List<String> heroIds) throws Exception {
|
||||
Map<Integer, Integer> returnItemMap = new HashMap<>();
|
||||
Map<String, PropertyItem> equipMap = user.getEquipManager().getEquipMap();
|
||||
int returnPercent = SSpecialConfig.getIntegerValue(SSpecialConfig.HERO_RETURN_PERCENT);
|
||||
for (String heroId : heroIds) {
|
||||
Hero hero = user.getHeroManager().getHero(heroId);
|
||||
//如果是进阶把装备、宝物返还
|
||||
if (reason == BIReason.UPHERO_DECOMPOS_HERO_REWARD) {
|
||||
// 装备
|
||||
Map<Integer, Integer> equipByPositionMap = hero.getEquipByPositionMap();
|
||||
if (equipByPositionMap != null && !equipByPositionMap.isEmpty()) {
|
||||
equipByPositionMap.forEach((k, v) -> returnItemMap.put(v, returnItemMap.getOrDefault(v, 0) + 1));
|
||||
}
|
||||
// 魂印
|
||||
Map<Integer, Integer> soulEquipByPositionMap = hero.getSoulEquipByPositionMap();
|
||||
if (soulEquipByPositionMap != null && !soulEquipByPositionMap.isEmpty()) {
|
||||
soulEquipByPositionMap.forEach((k, v) -> returnItemMap.put(v, returnItemMap.getOrDefault(v, 0) + 1));
|
||||
}
|
||||
// 宝器
|
||||
Set<String> jewelInfo = new HashSet<>(hero.getJewelInfo());
|
||||
for (String equipId : jewelInfo) {
|
||||
if (!equipMap.containsKey(equipId)) {
|
||||
continue;
|
||||
}
|
||||
equipMap.get(equipId).setHeroId("");
|
||||
hero.removeJewel(equipId);
|
||||
}
|
||||
// 神印
|
||||
Map<Integer, Integer> godSealByPositionMap = hero.getGodSealByPositionMap();
|
||||
if (godSealByPositionMap != null && !godSealByPositionMap.isEmpty()){
|
||||
for (Integer integer : godSealByPositionMap.values()) {
|
||||
returnItemMap.put(integer,1);
|
||||
}
|
||||
}
|
||||
// 法相
|
||||
Set<String> faxiangList = hero.getFaxiangList();
|
||||
if (!faxiangList.isEmpty()){
|
||||
Iterator<String> iterator = faxiangList.iterator();
|
||||
while (iterator.hasNext()){
|
||||
String next = iterator.next();
|
||||
user.getEquipManager().unloadFaxiang(next);
|
||||
iterator.remove();
|
||||
}
|
||||
hero.setFaxiang(faxiangList);
|
||||
}
|
||||
// 礼物装备
|
||||
Set<Integer> giftEquipList = hero.getHeroGiftEquipList();
|
||||
if (giftEquipList != null && !giftEquipList.isEmpty()) {
|
||||
giftEquipList.forEach(v -> returnItemMap.put(v, returnItemMap.getOrDefault(v, 0) + 1));
|
||||
}
|
||||
}
|
||||
int breakId = hero.getBreakId();
|
||||
int templateId = hero.getTemplateId();
|
||||
int breakId = hero.getBreakId();
|
||||
//进阶材料返还乘万分比
|
||||
Map<Integer, SHeroReturn> sHeroReturnMap = SHeroReturn.sheroReturnMap.get(templateId);
|
||||
int breakFloor = breakId == 0 ? 0 : STableManager.getConfig(SCHeroRankUpConfig.class).get(breakId).getPhase()[1];
|
||||
|
||||
SHeroReturn sHeroReturn = sHeroReturnMap.get(breakFloor);
|
||||
int[][] returnMaterials = sHeroReturn.getRankupReturn();
|
||||
SHeroLevlConfig sHeroLevlConfig = SHeroLevlConfig.getsHeroLevlConfigMap().get(hero.getOriginalLevel());
|
||||
int[][] levelReturn = ItemLogic.getInstance().itemReturnPercent(sHeroLevlConfig.getSumConsume(), returnPercent);
|
||||
//进阶材料返还乘万分比
|
||||
int[][] returnMaterials = sHeroReturnMap.get(breakFloor).getRankupReturn();
|
||||
for (int[] returnMaterial : returnMaterials) {
|
||||
returnItemMap.put(returnMaterial[0], returnItemMap.getOrDefault(returnMaterial[0], 0) + (int) (returnMaterial[1] / 10000d * returnPercent));
|
||||
}
|
||||
SHeroLevlConfig sHeroLevlConfig = SHeroLevlConfig.getsHeroLevlConfigMap().get(hero.getOriginalLevel());
|
||||
int[][] levelReturn = ItemLogic.getInstance().itemReturnPercent(sHeroLevlConfig.getSumConsume(), returnPercent);
|
||||
for (int[] ints : levelReturn) {
|
||||
returnItemMap.put(ints[0], returnItemMap.getOrDefault(ints[0], 0) + ints[1]);
|
||||
}
|
||||
}
|
||||
int[][] resultDrop = new int[returnItemMap.size()][];
|
||||
int index = 0;
|
||||
for (Map.Entry<Integer, Integer> entry : returnItemMap.entrySet()) {
|
||||
resultDrop[index] = new int[]{entry.getKey(), entry.getValue()};
|
||||
index++;
|
||||
int[][] resultDrop = ToolsUtil.getTwoArrayInt(returnItemMap);
|
||||
return ItemUtil.drop(user, resultDrop, BIReason.HERO_BACK_REWARD);
|
||||
}
|
||||
|
||||
/**
|
||||
* 消耗或分解神将掉落
|
||||
* @param user
|
||||
* @param heroIdsList
|
||||
* @param reason
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public CommonProto.Drop.Builder disbandHeroDrop(User user, List<String> heroIdsList, int reason) throws Exception {
|
||||
CommonProto.Drop.Builder drop = CommonProto.Drop.newBuilder();
|
||||
HeroManager heroManager = user.getHeroManager();
|
||||
EquipManager equipManager = user.getEquipManager();
|
||||
//1裸角色卡(没有突破过的角色卡)熔炼后返还的材料=当前等级返还升级材料+item表返还材料
|
||||
//2有过突破的卡 =当前等级返还升级材料+突破表返还材料
|
||||
Map<Integer, Long> baseItemMap = new HashMap<>();
|
||||
int rankUpReturnPercent = SSpecialConfig.getIntegerValue(SSpecialConfig.HERO_SACRIFICE_PERCENT);
|
||||
List<Integer> heroIdReport = new ArrayList<>();
|
||||
List<Integer> heroLevelReport = new ArrayList<>();
|
||||
List<Integer> heroStarReport = new ArrayList<>();
|
||||
Map<String, PropertyItem> equipMap = equipManager.getEquipMap();
|
||||
|
||||
for (String heroId : heroIdsList) {
|
||||
Hero hero = heroManager.getHeroMap().get(heroId);
|
||||
//摘星阁装备强化
|
||||
HeroLogic.getInstance().getHomeEquipStrongReset(user,heroId,drop);
|
||||
//卸下宝物
|
||||
Set<String> jewelInfo = new HashSet<>(hero.getJewelInfo());
|
||||
for (String equipId : jewelInfo) {
|
||||
if (!equipMap.containsKey(equipId)) {
|
||||
continue;
|
||||
}
|
||||
//这里保证两个是一致的
|
||||
equipMap.get(equipId).setHeroId("");
|
||||
hero.removeJewel(equipId);
|
||||
}
|
||||
// 装备
|
||||
Map<Integer, Integer> equipByPositionMap = hero.getEquipByPositionMap();
|
||||
if (equipByPositionMap != null && !equipByPositionMap.isEmpty()) {
|
||||
equipByPositionMap.forEach((k, v) -> baseItemMap.put(v, baseItemMap.getOrDefault(v, 0L) + 1));
|
||||
}
|
||||
// 魂印
|
||||
Map<Integer, Integer> soulEquipByPositionMap = hero.getSoulEquipByPositionMap();
|
||||
if (soulEquipByPositionMap != null && !soulEquipByPositionMap.isEmpty()) {
|
||||
soulEquipByPositionMap.forEach((k, v) -> baseItemMap.put(v, baseItemMap.getOrDefault(v, 0L) + 1));
|
||||
}
|
||||
// 神印
|
||||
Map<Integer, Integer> godSealByPositionMap = hero.getGodSealByPositionMap();
|
||||
if (godSealByPositionMap != null && !godSealByPositionMap.isEmpty()){
|
||||
for (Integer integer : godSealByPositionMap.values()) {
|
||||
baseItemMap.put(integer,1L);
|
||||
}
|
||||
}
|
||||
// 法相
|
||||
Set<String> faxiangList = hero.getFaxiangList();
|
||||
if (faxiangList != null && !faxiangList.isEmpty()){
|
||||
for (String key : faxiangList) {
|
||||
equipManager.unloadFaxiang(key);
|
||||
}
|
||||
}
|
||||
// 礼物装备
|
||||
Set<Integer> giftEquipList = hero.getHeroGiftEquipList();
|
||||
if (giftEquipList != null && !giftEquipList.isEmpty()){
|
||||
for (Integer id : giftEquipList) {
|
||||
baseItemMap.put(id,1L);
|
||||
}
|
||||
}
|
||||
// 法宝
|
||||
String bauBlesId = hero.getBauBlesId();
|
||||
if (!StringUtil.isEmpty(bauBlesId)){
|
||||
Baubles baubles = equipManager.getBaubles(bauBlesId);
|
||||
if (baubles != null){
|
||||
baubles.setHeroId("");
|
||||
}
|
||||
}
|
||||
hero.setBauBlesId("");
|
||||
// 潜能
|
||||
HeroLogic.getInstance().potentialBackDrop(hero, baseItemMap);
|
||||
|
||||
// 等级和星级
|
||||
int[][] sumConsume = SHeroLevlConfig.getsHeroLevlConfigMap().get(hero.getOriginalLevel()).getSumConsume();
|
||||
for (int[] item : sumConsume) {
|
||||
baseItemMap.put(item[0], baseItemMap.getOrDefault(item[0], 0L) + item[1]);
|
||||
}
|
||||
SHeroSacrifice starSHeroSacrifice = STableManager.getFigureConfig(HeroStaticConfig.class).getsHeroSacrificeMap(1, hero.getStar());
|
||||
for (int[] item : starSHeroSacrifice.getValue()) {
|
||||
baseItemMap.put(item[0], baseItemMap.getOrDefault(item[0], 0L) + item[1]);
|
||||
}
|
||||
int breakFloor = hero.getBreakId() == 0 ? 0 : STableManager.getConfig(SCHeroRankUpConfig.class).get(hero.getBreakId()).getPhase()[1];
|
||||
SHeroSacrifice breakSHeroSacrifice = STableManager.getFigureConfig(HeroStaticConfig.class).getsHeroSacrificeMap(2, breakFloor);
|
||||
for (int[] item : breakSHeroSacrifice.getValue()) {
|
||||
baseItemMap.put(item[0], baseItemMap.getOrDefault(item[0], 0L) + item[1]);
|
||||
}
|
||||
|
||||
// 日志
|
||||
heroIdReport.add(hero.getTemplateId());
|
||||
heroLevelReport.add(hero.getOriginalLevel());
|
||||
heroStarReport.add(hero.getStar());
|
||||
|
||||
// 删除英雄
|
||||
heroManager.removeHero(user.getId(),heroId);
|
||||
}
|
||||
return ItemUtil.drop(user, resultDrop, reason);
|
||||
|
||||
// 掉落
|
||||
long[][] itemArray = ItemUtil.mapToLongArray(baseItemMap);
|
||||
ItemUtil.drop(user, ItemLogic.itemReturnPercent(itemArray,rankUpReturnPercent), reason, drop);
|
||||
ReportUtil.onReportEvent(user, ReportEventEnum.SEND_HERO.getType(), heroIdReport, heroLevelReport, heroStarReport, new ArrayList<>(baseItemMap.keySet()), new ArrayList<>(baseItemMap.values()));
|
||||
return drop;
|
||||
}
|
||||
|
||||
public void changeHeroLockState(ISession session, String heroId, int lockState) throws Exception {
|
||||
|
@ -4637,17 +4658,7 @@ public class HeroLogic {
|
|||
switch (bookConfig.getFetterType()){
|
||||
case 1://神将激活
|
||||
HeroManager heroManager = user.getHeroManager();
|
||||
if (heroManager.getHeroHandBookEnabled().contains(bookId)) {
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
Map<Integer, Integer> heroHandBook = heroManager.getHeroHandBook();
|
||||
Set<Integer> hero = new HashSet<>();
|
||||
//将拥有的神将放到set集和中
|
||||
for (Map.Entry<Integer, Integer> entry : heroHandBook.entrySet()) {
|
||||
if (entry.getValue() != 0) {
|
||||
hero.add(entry.getKey());
|
||||
}
|
||||
}
|
||||
Set<Integer> hero = getHeroHands(bookId, heroManager);
|
||||
//判断羁绊神将是否在集合
|
||||
for (int[] tmp : tamers) {
|
||||
if (!hero.contains(tmp[0])) {
|
||||
|
@ -4694,15 +4705,7 @@ public class HeroLogic {
|
|||
itemManager.addEquipBookEnabled(bookId);
|
||||
break;
|
||||
case 5://神兵图鉴激活
|
||||
MagicSoldierManager soldierManager = user.getMagicSoldierManager();
|
||||
if (soldierManager.getMagicSoldierBook().contains(bookId)) {
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
for (int[] soldier : tamers) {
|
||||
if (!soldierManager.getMagicSoldierRecord().contains(soldier[0])) {
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
}
|
||||
MagicSoldierManager soldierManager = magicSoldierCheck(bookId, user, tamers);
|
||||
soldierManager.addMagicSoldierBook(bookId);
|
||||
break;
|
||||
default:
|
||||
|
@ -4717,6 +4720,34 @@ public class HeroLogic {
|
|||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), useAndPriceItemResponse.build(), true);
|
||||
}
|
||||
|
||||
private static MagicSoldierManager magicSoldierCheck(int bookId, User user, int[][] tamers) throws ErrorCodeException {
|
||||
MagicSoldierManager soldierManager = user.getMagicSoldierManager();
|
||||
if (soldierManager.getMagicSoldierBook().contains(bookId)) {
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
for (int[] soldier : tamers) {
|
||||
if (!soldierManager.getMagicSoldierRecord().contains(soldier[0])) {
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
}
|
||||
return soldierManager;
|
||||
}
|
||||
|
||||
private static Set<Integer> getHeroHands(int bookId, HeroManager heroManager) throws ErrorCodeException {
|
||||
if (heroManager.getHeroHandBookEnabled().contains(bookId)) {
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
Map<Integer, Integer> heroHandBook = heroManager.getHeroHandBook();
|
||||
Set<Integer> hero = new HashSet<>();
|
||||
//将拥有的神将放到set集和中
|
||||
for (Map.Entry<Integer, Integer> entry : heroHandBook.entrySet()) {
|
||||
if (entry.getValue() != 0) {
|
||||
hero.add(entry.getKey());
|
||||
}
|
||||
}
|
||||
return hero;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有异妖
|
||||
*
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.ljsd.jieling.logic.item;
|
||||
|
||||
import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig;
|
||||
import com.ljsd.jieling.config.clazzStaticCfg.HeroStaticConfig;
|
||||
import com.ljsd.jieling.core.VipPrivilegeType;
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
|
@ -474,123 +473,16 @@ public class ItemLogic {
|
|||
|
||||
/**
|
||||
* 分解卡牌|进阶消耗
|
||||
* 注:此方法会单次超过int最大值,需要特殊long处理
|
||||
*/
|
||||
public void decomposeHero(ISession iSession, List<String> heroIdsList, Set<Integer> filterItem) throws Exception {
|
||||
// 验证是否可以使用功能,恭送神将
|
||||
String[] heroIds = new String[heroIdsList.size()];
|
||||
heroIdsList.toArray(heroIds);
|
||||
// boolean useFunction = HeroLogic.getInstance().isUseFunction(iSession.getUid(), HongMengFunctionEnum.FAREWELL_HERO.getPropertyId(), heroIds);
|
||||
// if (!useFunction){
|
||||
// throw new ErrorCodeException(ErrorCode.HONGMENG_ING);
|
||||
// }
|
||||
public void decomposeHero(ISession iSession, List<String> heroIdsList) throws Exception {
|
||||
// 逻辑
|
||||
User user = UserManager.getUser(iSession.getUid());
|
||||
HeroManager heroManager = user.getHeroManager();
|
||||
ErrorCode erroMags = checkHeroResolve(heroIdsList, user);
|
||||
if (null != erroMags) {
|
||||
throw new ErrorCodeException(erroMags);
|
||||
ErrorCode errorMags = checkHeroResolve(heroIdsList, user);
|
||||
if (null != errorMags) {
|
||||
throw new ErrorCodeException(errorMags);
|
||||
}
|
||||
//1裸角色卡(没有突破过的角色卡)熔炼后返还的材料=当前等级返还升级材料+item表返还材料
|
||||
//2有过突破的卡 =当前等级返还升级材料+突破表返还材料
|
||||
Map<Integer, Long> baseItemMap = new HashMap<>();
|
||||
int rankUpReturnPercent = SSpecialConfig.getIntegerValue(SSpecialConfig.HERO_SACRIFICE_PERCENT);
|
||||
List<Integer> heroIdReport = new ArrayList<>();
|
||||
List<Integer> heroLevelReport = new ArrayList<>();
|
||||
List<Integer> heroStarReport = new ArrayList<>();
|
||||
Map<String, PropertyItem> equipMap = user.getEquipManager().getEquipMap();
|
||||
|
||||
CommonProto.Drop.Builder drop = CommonProto.Drop.newBuilder();
|
||||
|
||||
for (String heroId : heroIdsList) {
|
||||
Hero hero = heroManager.getHeroMap().get(heroId);
|
||||
|
||||
//摘星阁装备强化
|
||||
HeroLogic.getInstance().getHomeEquipStrongReset(user,heroId,drop);
|
||||
|
||||
//卸下宝物
|
||||
Set<String> jewelInfo = new HashSet<>(hero.getJewelInfo());
|
||||
for (String equipId : jewelInfo) {
|
||||
if (!equipMap.containsKey(equipId)) {
|
||||
continue;
|
||||
}
|
||||
//这里保证两个是一致的
|
||||
equipMap.get(equipId).setHeroId("");
|
||||
hero.removeJewel(equipId);
|
||||
}
|
||||
//卸下魂印装备
|
||||
Map<Integer, Integer> equipByPositionMap = hero.getEquipByPositionMap();
|
||||
Map<Integer, Integer> soulEquipByPositionMap = hero.getSoulEquipByPositionMap();
|
||||
if (equipByPositionMap != null && !equipByPositionMap.isEmpty()) {
|
||||
equipByPositionMap.forEach((k, v) -> baseItemMap.put(v, baseItemMap.getOrDefault(v, 0L) + 1));
|
||||
}
|
||||
if (soulEquipByPositionMap != null && !soulEquipByPositionMap.isEmpty()) {
|
||||
soulEquipByPositionMap.forEach((k, v) -> baseItemMap.put(v, baseItemMap.getOrDefault(v, 0L) + 1));
|
||||
}
|
||||
// 神印
|
||||
Map<Integer, Integer> godSealByPositionMap = hero.getGodSealByPositionMap();
|
||||
if (godSealByPositionMap != null && !godSealByPositionMap.isEmpty()){
|
||||
for (Integer integer : godSealByPositionMap.values()) {
|
||||
baseItemMap.put(integer,1L);
|
||||
}
|
||||
}
|
||||
// 法相
|
||||
Set<String> faxiangList = hero.getFaxiangList();
|
||||
if (faxiangList != null && !faxiangList.isEmpty()){
|
||||
for (String key : faxiangList) {
|
||||
user.getEquipManager().unloadFaxiang(key);
|
||||
}
|
||||
}
|
||||
// 礼物装备
|
||||
Set<Integer> giftEquipList = hero.getHeroGiftEquipList();
|
||||
if (giftEquipList != null && !giftEquipList.isEmpty()){
|
||||
for (Integer id : giftEquipList) {
|
||||
baseItemMap.put(id,1L);
|
||||
}
|
||||
}
|
||||
|
||||
heroIdReport.add(hero.getTemplateId());
|
||||
heroLevelReport.add(hero.getOriginalLevel());
|
||||
heroStarReport.add(hero.getStar());
|
||||
|
||||
heroManager.removeHero(user.getId(),heroId);
|
||||
int[][] sumConsume = SHeroLevlConfig.getsHeroLevlConfigMap().get(hero.getOriginalLevel()).getSumConsume();
|
||||
|
||||
SHeroSacrifice starSHeroSacrifice = STableManager.getFigureConfig(HeroStaticConfig.class).getsHeroSacrificeMap(1, hero.getStar());
|
||||
int breakFloor = hero.getBreakId() == 0 ? 0 : STableManager.getConfig(SCHeroRankUpConfig.class).get(hero.getBreakId()).getPhase()[1];
|
||||
|
||||
SHeroSacrifice breakSHeroSacrifice = STableManager.getFigureConfig(HeroStaticConfig.class).getsHeroSacrificeMap(2, breakFloor);
|
||||
for (int[] item : sumConsume) {
|
||||
baseItemMap.put(item[0], baseItemMap.getOrDefault(item[0], 0L) + item[1]);
|
||||
}
|
||||
for (int[] item : starSHeroSacrifice.getValue()) {
|
||||
baseItemMap.put(item[0], baseItemMap.getOrDefault(item[0], 0L) + item[1]);
|
||||
}
|
||||
for (int[] item : breakSHeroSacrifice.getValue()) {
|
||||
baseItemMap.put(item[0], baseItemMap.getOrDefault(item[0], 0L) + item[1]);
|
||||
}
|
||||
|
||||
// 潜能
|
||||
HeroLogic.getInstance().potentialBackDrop(hero, baseItemMap);
|
||||
}
|
||||
|
||||
long[][] itemArray = ItemUtil.mapToLongArray(baseItemMap);
|
||||
int reson = BIReason.DECOMPOS_HERO_REWARD;
|
||||
if (null != filterItem) {
|
||||
reson = BIReason.UPHERO_DECOMPOS_HERO_REWARD;
|
||||
for (Integer id : filterItem) {
|
||||
baseItemMap.remove(id);
|
||||
}
|
||||
} else {
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.ONE_MISSION_TYPE_CONSUME, MissionType.DECOMPOSE_TIMES, heroIdsList.size());
|
||||
}
|
||||
if (reson == BIReason.DECOMPOS_HERO_REWARD) {
|
||||
ReportUtil.onReportEvent(user, ReportEventEnum.SEND_HERO.getType(), heroIdReport, heroLevelReport, heroStarReport, new ArrayList<>(baseItemMap.keySet()), new ArrayList<>(baseItemMap.values()));
|
||||
}
|
||||
// 掉落
|
||||
ItemUtil.drop(user,itemReturnPercent(itemArray,rankUpReturnPercent),reson,drop);
|
||||
// 鸿蒙阵
|
||||
HeroLogic.getInstance().addOrUpdateHongmeng(iSession);
|
||||
CommonProto.Drop.Builder drop = HeroLogic.getInstance().disbandHeroDrop(user, heroIdsList, BIReason.DECOMPOS_HERO_REWARD);
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.ONE_MISSION_TYPE_CONSUME, MissionType.DECOMPOSE_TIMES, heroIdsList.size());
|
||||
ItemLogic.sendUseAndPriceItemMessage(iSession, MessageTypeProto.MessageType.USER_AND_PRICE_ITEM_RESPONSE_VALUE, drop);
|
||||
}
|
||||
|
||||
|
@ -599,7 +491,7 @@ public class ItemLogic {
|
|||
*
|
||||
* @param rankUpReturnPercent 注:这需要乘万分比(如果为90%,此处填9000)
|
||||
*/
|
||||
public long[][] itemReturnPercent(long[][] sumConsume, int rankUpReturnPercent) {
|
||||
public static long[][] itemReturnPercent(long[][] sumConsume, int rankUpReturnPercent) {
|
||||
long[][] tempReturn = new long[sumConsume.length][];
|
||||
for (int i = 0; i < sumConsume.length; i++) {
|
||||
tempReturn[i] = new long[]{sumConsume[i][0], Double.valueOf(sumConsume[i][1] * (double) rankUpReturnPercent / 10000).intValue()};
|
||||
|
|
|
@ -52,30 +52,9 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
public class ItemUtil {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ItemUtil.class);
|
||||
private static Map<Integer,String> dropRewardMap = new ConcurrentHashMap<>();
|
||||
private static Set<Integer> dropAddition = new HashSet<>();//掉落权重加成id
|
||||
public static Map<Integer,String> equipQulityNameMap = new HashMap<>(2);
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ItemUtil.class);
|
||||
private static Set<Integer> currencyMap = new HashSet<>(2);
|
||||
private static HashSet<Integer> rmbItemSet = new HashSet<>();
|
||||
|
||||
|
||||
static {
|
||||
equipQulityNameMap.put(5,"传说");
|
||||
equipQulityNameMap.put(6,"远古");
|
||||
|
||||
currencyMap.add(Global.GEM);
|
||||
currencyMap.add(Global.GOLD);
|
||||
currencyMap.add(Global.SOULCRYSTAL);
|
||||
currencyMap.add(Global.DEVILJADE);//妖灵玉
|
||||
currencyMap.add(Global.ELITEPROOF);//精英证明
|
||||
currencyMap.add(Global.HEARTFIRE);//心火明晶
|
||||
|
||||
rmbItemSet.add(GlobalItemType.RMB_CARD);//现金卡
|
||||
rmbItemSet.add(GlobalItemType.DAY_RMB_CARD);//日抛现金卡
|
||||
rmbItemSet.add(GlobalItemType.XIAN_RECHARGE_CARD);//仙充卡
|
||||
rmbItemSet.add(GlobalItemType.DAY_XIAN_RECHARGE_CARD);//日抛仙充卡
|
||||
}
|
||||
|
||||
/**
|
||||
* 将组好的ItemMap加到用户身上
|
||||
|
@ -688,6 +667,17 @@ public class ItemUtil {
|
|||
map.merge(itemId, itemNum, Long::sum);
|
||||
}
|
||||
|
||||
public static boolean ifCurrency(int type) {
|
||||
HashSet<Integer> currencyMap = new HashSet<>(6);
|
||||
currencyMap.add(Global.GEM);
|
||||
currencyMap.add(Global.GOLD);
|
||||
currencyMap.add(Global.SOULCRYSTAL);
|
||||
currencyMap.add(Global.DEVILJADE);//妖灵玉
|
||||
currencyMap.add(Global.ELITEPROOF);//精英证明
|
||||
currencyMap.add(Global.HEARTFIRE);//心火明晶
|
||||
return currencyMap.contains(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加道具
|
||||
*/
|
||||
|
@ -787,7 +777,7 @@ public class ItemUtil {
|
|||
}
|
||||
|
||||
int eventType = ParamEventBean.UserItemEvent;
|
||||
if (currencyMap.contains(itemId)) {
|
||||
if (ifCurrency(itemId)) {
|
||||
eventType = ParamEventBean.UserCurrencyEvent;
|
||||
}
|
||||
KtEventUtils.onKtEvent(user, eventType, reason, GlobalsDef.addReason, itemId, itemNum, item.getItemNum());
|
||||
|
@ -915,14 +905,13 @@ public class ItemUtil {
|
|||
while (exp >= levelUpExp && playerInfoManager.getLevel() < maxLevel.getPlayerLv()) {
|
||||
// 玩家等级2级发送道具改名卡
|
||||
if(playerInfoManager.getLevel()==2&&playerInfoManager.getNickName().equals(String.valueOf(playerInfoManager.getRootId()))){
|
||||
//TODO 走表
|
||||
String title = SErrorCodeEerverConfig.getI18NMessage("change_playername_title");
|
||||
String content = SErrorCodeEerverConfig.getI18NMessage("change_playername_txt");
|
||||
int[][] values = new int[1][2];
|
||||
values[0][0] = Global.CHANGENAME;
|
||||
values[0][1] = 1;
|
||||
String mailReward = ItemUtil.getMailReward(values);
|
||||
int nowTime = (int) (TimeUtils.now() / 1000);
|
||||
int nowTime = TimeUtils.nowInt();
|
||||
MailLogic.getInstance().sendMail(user.getId(), title, content, mailReward, nowTime, Global.MAIL_EFFECTIVE_TIME);
|
||||
}
|
||||
|
||||
|
@ -1075,7 +1064,7 @@ public class ItemUtil {
|
|||
continue;
|
||||
}
|
||||
int eventType = ParamEventBean.UserItemEvent;
|
||||
if(currencyMap.contains(myItem.getItemId())){
|
||||
if(ifCurrency(myItem.getItemId())){
|
||||
eventType = ParamEventBean.UserCurrencyEvent;
|
||||
}
|
||||
if (myItem.getItemNum() <= needCount && !STableManager.getFigureConfig(CommonStaticConfig.class).getNotDelete().contains(userItem.getKey())) {
|
||||
|
@ -1160,7 +1149,7 @@ public class ItemUtil {
|
|||
itemMap.remove(GlobalsDef.LUOFUZHENG_MONEY);
|
||||
|
||||
}
|
||||
if (itemMap.size() != 0){
|
||||
if (!itemMap.isEmpty()){
|
||||
for (Map.Entry<Integer, Item> entry :itemMap.entrySet()){
|
||||
|
||||
if (entry.getKey() ==Global.STAMINA){
|
||||
|
@ -1270,6 +1259,14 @@ public class ItemUtil {
|
|||
return itemType == GlobalItemType.JEWEL || itemType == GlobalItemType.FAXIANG_EQUIP || itemType == GlobalItemType.ESPECIAL_EQUIP;
|
||||
}
|
||||
|
||||
public static String getEquipQulityNameMap(int type) {
|
||||
HashMap<Integer, String> equipQulityNameMap = new HashMap<>();
|
||||
equipQulityNameMap.put(5,"传说");
|
||||
equipQulityNameMap.put(6,"远古");
|
||||
|
||||
return equipQulityNameMap.getOrDefault(type, "品质"+type);
|
||||
}
|
||||
|
||||
private static void addPropertyEquip(User user, int equipId, List<CommonProto.Equip> jewelList) {
|
||||
EquipManager equipManager = user.getEquipManager();
|
||||
SItem item = SItem.getsItemMap().get(equipId);
|
||||
|
@ -1288,7 +1285,7 @@ public class ItemUtil {
|
|||
String content = "lamp_lottery_equip_content";
|
||||
String nickName = user.getPlayerInfoManager().getNickName();
|
||||
String nameColor = user.getPlayerInfoManager().getNameColor();
|
||||
String message = SErrorCodeEerverConfig.getI18NMessageNeedConvert(content, new Object[]{nameColor, nickName, equipQulityNameMap.get(quantity), item.getName()}, new int[]{0,0,1,1});
|
||||
String message = SErrorCodeEerverConfig.getI18NMessageNeedConvert(content, new Object[]{nameColor, nickName, getEquipQulityNameMap(quantity), item.getName()}, new int[]{0,0,1,1});
|
||||
ChatLogic.getInstance().sendSysChatMessage(message,Global.LUCKY_LUCK,String.valueOf(equipId),0,0,0,0,0);
|
||||
}
|
||||
}
|
||||
|
@ -1363,6 +1360,17 @@ public class ItemUtil {
|
|||
}
|
||||
}
|
||||
|
||||
public static boolean ifRmbItemSet(int type) {
|
||||
HashSet<Integer> rmbItemSet = new HashSet<>(4);
|
||||
rmbItemSet.add(GlobalItemType.RMB_CARD);//现金卡
|
||||
rmbItemSet.add(GlobalItemType.DAY_RMB_CARD);//日抛现金卡
|
||||
rmbItemSet.add(GlobalItemType.XIAN_RECHARGE_CARD);//仙充卡
|
||||
rmbItemSet.add(GlobalItemType.DAY_XIAN_RECHARGE_CARD);//日抛仙充卡
|
||||
boolean result = rmbItemSet.contains(type);
|
||||
rmbItemSet.clear();
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* bt是否是记录累充人民币的类型
|
||||
* 真充券: 只获得对应金额的妖晶和名望经验
|
||||
|
@ -1376,7 +1384,7 @@ public class ItemUtil {
|
|||
integers.add(GlobalItemType.TRUE_RECHARGE_JUAN);
|
||||
integers.add(GlobalItemType.DAY_TRUE_RECHARGE_JUAN);
|
||||
|
||||
if (!rmbItemSet.contains(sItem.getItemType()) && !integers.contains(sItem.getItemType())){
|
||||
if (!ifRmbItemSet(sItem.getItemType()) && !integers.contains(sItem.getItemType())){
|
||||
return;
|
||||
}
|
||||
NewRechargeInfo info = user.getPlayerInfoManager().getNewRechargeInfo();
|
||||
|
@ -1611,14 +1619,11 @@ public class ItemUtil {
|
|||
public static void initDropReward() {
|
||||
Map<Integer, SRewardGroup> sRewardGroupMap = SRewardGroup.getsRewardItemMap();
|
||||
Map<Integer, SRewardItem> sRewardItemMap = SRewardItem.getsDropMap();
|
||||
if (sRewardGroupMap == null){
|
||||
return;
|
||||
}
|
||||
if (sRewardItemMap == null){
|
||||
if (sRewardGroupMap == null || sRewardItemMap == null){
|
||||
return;
|
||||
}
|
||||
Map<Integer,String> dropMap = new ConcurrentHashMap<>();
|
||||
for (Map.Entry<Integer,SRewardGroup> entry :sRewardGroupMap.entrySet()){
|
||||
for (Map.Entry<Integer,SRewardGroup> entry : sRewardGroupMap.entrySet()){
|
||||
SRewardGroup sRewardGroup = entry.getValue();
|
||||
int[] rewardItem = sRewardGroup.getRewardItem();
|
||||
StringBuilder rewardStr = new StringBuilder();
|
||||
|
|
|
@ -4,9 +4,7 @@ import com.ljsd.GameApplication;
|
|||
import com.ljsd.jieling.logic.activity.ActivityType;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.*;
|
||||
|
||||
public class ToolsUtil {
|
||||
|
||||
|
@ -93,4 +91,25 @@ public class ToolsUtil {
|
|||
return array2D;
|
||||
}
|
||||
|
||||
/**
|
||||
* map转二维数组
|
||||
*/
|
||||
public static int[][] getTwoArrayInt(Map<Integer, Integer> map) {
|
||||
int[][] object = null;
|
||||
if (map != null && !map.isEmpty()) {
|
||||
int size = map.size();
|
||||
object = new int[size][2];
|
||||
|
||||
Iterator<Map.Entry<Integer, Integer>> iterator = map.entrySet().iterator();
|
||||
for (int i = 0; i < size; i++) {
|
||||
Map.Entry<Integer, Integer> entry = iterator.next();
|
||||
int key = entry.getKey();
|
||||
int value = entry.getValue();
|
||||
object[i][0] = key;
|
||||
object[i][1] = value;
|
||||
}
|
||||
}
|
||||
return object;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ public class SCHeroRankUpConfig implements BaseConfig{
|
|||
|
||||
private int openStar;
|
||||
|
||||
private int consumeMaterial[][];
|
||||
private int[][] consumeMaterial;
|
||||
|
||||
private int star;
|
||||
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
package config;
|
||||
|
||||
import manager.Table;
|
||||
|
||||
@Table(name = "EquipTalismanaLottery")
|
||||
public class SEquipTalismanaLottery implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int[][] drop;
|
||||
|
||||
private int[][] probability;
|
||||
|
||||
private int[] costItem;
|
||||
|
||||
private int[] repeatedlyCost;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int[][] getDrop() {
|
||||
return drop;
|
||||
}
|
||||
|
||||
public int[][] getProbability() {
|
||||
return probability;
|
||||
}
|
||||
|
||||
public int[] getCostItem() {
|
||||
return costItem;
|
||||
}
|
||||
|
||||
public int[] getRepeatedlyCost() {
|
||||
return repeatedlyCost;
|
||||
}
|
||||
|
||||
}
|
|
@ -149,9 +149,6 @@ public class STableManager {
|
|||
if (tableNames == null) {
|
||||
return false;
|
||||
}
|
||||
if (tableNames.length == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (String oneTable : tableNames) {
|
||||
if (oneTable.equalsIgnoreCase(curTableName)) {
|
||||
|
|
Loading…
Reference in New Issue