礼物装备
parent
630a719c7d
commit
ba818ad0a1
|
|
@ -100,7 +100,7 @@ public class CheckFight {
|
|||
//todo type
|
||||
args.set("type",fightType.getType());
|
||||
args.set("maxRound",maxTime);
|
||||
LuaValue result = func.call( args,fightData,optionData);
|
||||
LuaValue result = func.call(args,fightData,optionData);
|
||||
long[] resultCache = new long[9];//对方阵容走配置 Todo 后面结构走配置
|
||||
resultCache[0]= result.get("result").tolong();
|
||||
resultCache[1]= result.get("duration").tolong();
|
||||
|
|
|
|||
|
|
@ -441,4 +441,7 @@ public interface BIReason {
|
|||
|
||||
int GEM_NEW_LOTTERY_REWARD = 1331;//命格抽卡奖励
|
||||
int GEM_NEW_LOTTERY_COST = 1332;//命格抽卡消耗
|
||||
|
||||
int GIFT_EQUIP_UP_COST = 1333;//礼物穿戴消耗
|
||||
int GIFT_EQUIP_DOWN_REWARD = 1334;//礼物脱卸获得
|
||||
}
|
||||
|
|
@ -154,7 +154,7 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
|||
faBaoJuLingHandler(user);//法宝修改
|
||||
//森罗幻境自动挂机返回掉落展示清除
|
||||
Map<Integer,Integer> dropShow = mapManager.getTowerGetRewardInfoShowMap();
|
||||
if(dropShow != null && dropShow.size() > 0){
|
||||
if(dropShow != null && !dropShow.isEmpty()){
|
||||
dropShow.clear();
|
||||
}
|
||||
|
||||
|
|
@ -236,6 +236,7 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
|||
.addAllPracticeSkillInfos(practiceSkillInfos)
|
||||
.addAllFaBaoSoulInfos(faBaoSoulInfos)
|
||||
.addAllLifeGridInfos(getLifeGridInfos(heroManager))
|
||||
.addAllGiftIds(user.getPlayerInfoManager().getPlayerGiftEquipList())
|
||||
.build();
|
||||
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
package com.ljsd.jieling.handler.equip;
|
||||
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.equip.EquipLogic;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import rpc.protocols.HeroInfoProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
/**
|
||||
* 穿脱礼物装备
|
||||
*/
|
||||
public class WearGiftEquipHandler extends BaseHandler<HeroInfoProto.GiftEquipWearRequest> {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.GiftEquipWearRequest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processWithProto(ISession iSession, HeroInfoProto.GiftEquipWearRequest proto) throws Exception {
|
||||
EquipLogic.getInstance().wearGiftEquip(iSession, proto);
|
||||
}
|
||||
}
|
||||
|
|
@ -66,7 +66,9 @@ public class Hero extends MongoBase implements Comparable<Hero>,Cloneable {
|
|||
private int propertyId; // 阵营id(人 佛 妖 道)
|
||||
|
||||
//被神魂绑定英雄 英雄动态id:英雄神魂等级(反绑)
|
||||
private Map<String,Integer>godSoulBeBindMap=new HashMap<>();
|
||||
private Map<String,Integer> godSoulBeBindMap = new HashMap<>();
|
||||
|
||||
private Set<Integer> heroGiftEquipList = new HashSet<>();//礼物装备列表
|
||||
|
||||
public Hero() {
|
||||
//绑定关系
|
||||
|
|
@ -111,10 +113,6 @@ public class Hero extends MongoBase implements Comparable<Hero>,Cloneable {
|
|||
|
||||
/**
|
||||
* 初始化英雄,不入英雄背包
|
||||
* @param uid
|
||||
* @param heroTid
|
||||
* @param level
|
||||
* @param hero
|
||||
*/
|
||||
public Hero(Hero hero,int uid,int heroTid,int level) {
|
||||
this.setRootCollection(User._COLLECTION_NAME);
|
||||
|
|
@ -614,6 +612,45 @@ public class Hero extends MongoBase implements Comparable<Hero>,Cloneable {
|
|||
updateString("equipAdvanceLv", equipAdvanceLv);
|
||||
}
|
||||
|
||||
public void setSoulEquipByPositionMap(Map<Integer, Integer> soulEquipByPositionMap) {
|
||||
this.soulEquipByPositionMap = soulEquipByPositionMap;
|
||||
updateString("soulEquipByPositionMap", soulEquipByPositionMap);
|
||||
}
|
||||
|
||||
public void setGodSealByPositionMap(Map<Integer, Integer> godSealByPositionMap) {
|
||||
this.godSealByPositionMap = godSealByPositionMap;
|
||||
updateString("godSealByPositionMap", godSealByPositionMap);
|
||||
}
|
||||
|
||||
public void setFaxiangList(Set<String> faxiangList) {
|
||||
this.faxiangList = faxiangList;
|
||||
updateString("faxiangList", faxiangList);
|
||||
}
|
||||
|
||||
public void setGodSoulBindMap(Map<Integer, List<String>> godSoulBindMap) {
|
||||
this.godSoulBindMap = godSoulBindMap;
|
||||
updateString("godSoulBindMap", godSoulBindMap);
|
||||
}
|
||||
|
||||
public void setGodSoulBeBindMap(Map<String, Integer> godSoulBeBindMap) {
|
||||
this.godSoulBeBindMap = godSoulBeBindMap;
|
||||
updateString("godSoulBeBindMap", godSoulBeBindMap);
|
||||
}
|
||||
|
||||
public void setHeroGiftEquipList(Set<Integer> heroGiftEquipList) {
|
||||
this.heroGiftEquipList = heroGiftEquipList;
|
||||
updateString("heroGiftEquipList", heroGiftEquipList);
|
||||
}
|
||||
|
||||
public void addHeroGiftEquip(int giftEquip) {
|
||||
this.heroGiftEquipList.add(giftEquip);
|
||||
updateString("heroGiftEquipList", heroGiftEquipList);
|
||||
}
|
||||
|
||||
public Set<Integer> getHeroGiftEquipList() {
|
||||
return heroGiftEquipList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object clone(){
|
||||
Hero clone = null;
|
||||
|
|
|
|||
|
|
@ -173,7 +173,6 @@ public class HeroManager extends MongoBase {
|
|||
|
||||
/**
|
||||
* 获取总好感度等级
|
||||
* @return
|
||||
*/
|
||||
public int getTotalLikeLv() {
|
||||
int allHeroLikableNum = HeroUpLikableRequestHandler.GetAllHeroLikableNum(getHeroLikableMap());
|
||||
|
|
@ -184,7 +183,7 @@ public class HeroManager extends MongoBase {
|
|||
|
||||
public int getLikableSendTime() { return likableSendTime; }
|
||||
|
||||
private Map<Integer,Integer>faBaoSoulMap= new HashMap<>();//法宝之魂数据
|
||||
private Map<Integer,Integer> faBaoSoulMap= new HashMap<>();//法宝之魂数据
|
||||
|
||||
public Map<Integer, Integer> getFaBaoSoulMap() {
|
||||
return faBaoSoulMap;
|
||||
|
|
@ -339,8 +338,7 @@ public class HeroManager extends MongoBase {
|
|||
}
|
||||
|
||||
public Hero getHero(String heroId) {
|
||||
Hero hero = heroMap.get(heroId);
|
||||
return hero;
|
||||
return heroMap.get(heroId);
|
||||
}
|
||||
|
||||
public void removeHero(int uid,String heroId) {
|
||||
|
|
|
|||
|
|
@ -212,6 +212,8 @@ public class PlayerManager extends MongoBase {
|
|||
private Set<Integer> desireOpenFabaoList = new HashSet<>();//心愿可以选择的法宝列表
|
||||
private final Map<Integer, Integer> desireDraw = new HashMap<>();//选择的心愿
|
||||
|
||||
private Map<Integer, int[]> duoduiTower = new HashMap<>();//多对塔记录
|
||||
|
||||
//挑战副本等级
|
||||
private int endlessNewReplica; //无尽副本
|
||||
private int treasureReplica; //宝物副本
|
||||
|
|
@ -220,6 +222,8 @@ public class PlayerManager extends MongoBase {
|
|||
|
||||
private Map<Integer, Integer> gemDrawCountMap = new HashMap<>();// 命格抽卡次数记录
|
||||
|
||||
private Set<Integer> playerGiftEquipList = new HashSet<>();//礼物装备列表
|
||||
|
||||
public PlayerManager(){
|
||||
this.setRootCollection(User._COLLECTION_NAME);
|
||||
}
|
||||
|
|
@ -255,12 +259,26 @@ public class PlayerManager extends MongoBase {
|
|||
updateString("desireOpenFabaoList", desireOpenFabaoList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 多对塔记录
|
||||
*/
|
||||
private Map<Integer, int[]> duoduiTower = new HashMap<>();
|
||||
public Set<Integer> getPlayerGiftEquipList() {
|
||||
return playerGiftEquipList;
|
||||
}
|
||||
|
||||
public void setDuoduiTowerTier(int key,int tier) {
|
||||
public void setPlayerGiftEquipList(Set<Integer> playerGiftEquipList) {
|
||||
this.playerGiftEquipList = playerGiftEquipList;
|
||||
updateString("playerGiftEquipList", playerGiftEquipList);
|
||||
}
|
||||
|
||||
public void addPlayerGiftEquip(int giftEquip) {
|
||||
this.playerGiftEquipList.add(giftEquip);
|
||||
updateString("playerGiftEquipList", playerGiftEquipList);
|
||||
}
|
||||
|
||||
public void setDuoduiTower(Map<Integer, int[]> duoduiTower) {
|
||||
this.duoduiTower = duoduiTower;
|
||||
updateString("duoduiTower", duoduiTower);
|
||||
}
|
||||
|
||||
public void setDuoduiTowerTier(int key, int tier) {
|
||||
int[] ints = this.duoduiTower.get(key);
|
||||
if (ints == null || ints.length == 0){
|
||||
ints = new int[2];
|
||||
|
|
|
|||
|
|
@ -19,15 +19,18 @@ import com.ljsd.jieling.util.ItemUtil;
|
|||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import com.ljsd.jieling.util.ToolsUtil;
|
||||
import config.*;
|
||||
import manager.STableManager;
|
||||
import org.apache.commons.lang3.RandomUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.HeroInfoProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
import util.StringUtil;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
|
@ -452,4 +455,209 @@ public class EquipLogic {
|
|||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 穿脱礼物装备
|
||||
*/
|
||||
public void wearGiftEquip(ISession iSession, HeroInfoProto.GiftEquipWearRequest proto) throws Exception {
|
||||
User user = UserManager.getUser(iSession.getUid());
|
||||
int operate = proto.getOperate();
|
||||
String role = proto.getRole();
|
||||
List<Integer> giftIds = proto.getGiftIdsList();
|
||||
HashSet<Integer> set = new HashSet<>(giftIds);
|
||||
if (set.size() != giftIds.size()){
|
||||
String format = MessageFormat.format("礼物穿戴报错,存在重复礼物, uid:{0},list:{1}", user.getId(), giftIds);
|
||||
throw new ErrorCodeException(format);
|
||||
}
|
||||
PlayerManager playerManager = user.getPlayerInfoManager();
|
||||
HeroManager heroManager = user.getHeroManager();
|
||||
int[][] items = ToolsUtil.convertListTo2DArray(giftIds);
|
||||
if (operate == 1){
|
||||
// 穿戴
|
||||
boolean checked = ItemUtil.checkCostLong(user, items, 1);
|
||||
if (!checked){
|
||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||
}
|
||||
if (role.equals("0")){
|
||||
// 主角礼物
|
||||
Set<Integer> playerGifts = playerManager.getPlayerGiftEquipList();
|
||||
if (hasDuplicates(playerGifts, set)){
|
||||
String format = MessageFormat.format("礼物穿戴报错, 主角礼物已穿戴,uid:{0},list:{1}, roleList:{2}", user.getId(), giftIds, playerGifts);
|
||||
throw new ErrorCodeException(format);
|
||||
}
|
||||
playerGifts.addAll(giftIds);
|
||||
playerManager.setPlayerGiftEquipList(playerGifts);
|
||||
}else {
|
||||
// 英雄礼物
|
||||
Hero hero = heroManager.getHero(role);
|
||||
if (hero == null){
|
||||
String format = MessageFormat.format("礼物穿戴报错, 英雄不存在,uid:{0},role:{1}", user.getId(), role);
|
||||
throw new ErrorCodeException(format);
|
||||
}
|
||||
Set<Integer> heroGifts = hero.getHeroGiftEquipList();
|
||||
if (hasDuplicates(heroGifts, set)){
|
||||
String format = MessageFormat.format("礼物穿戴报错, 英雄礼物已穿戴,uid:{0},list:{1}, roleList:{2}", user.getId(), giftIds, heroGifts);
|
||||
throw new ErrorCodeException(format);
|
||||
}
|
||||
int boxNum = getHeroGiftBoxNum(user);
|
||||
if (heroGifts.size() + set.size() > boxNum){
|
||||
String format = MessageFormat.format("礼物穿戴报错, 英雄礼物超出格子数量,uid:{0},wear:{1}, allow:{2}", user.getId(), heroGifts.size() + set.size(), boxNum);
|
||||
throw new ErrorCodeException(format);
|
||||
}
|
||||
int templateId = hero.getTemplateId();
|
||||
SCHero scHero = SCHero.getsCHero().get(templateId);
|
||||
if (scHero == null){
|
||||
String format = MessageFormat.format("礼物穿戴报错, 英雄配置不存在,uid:{0},id:{1}", user.getId(), templateId);
|
||||
throw new ErrorCodeException(format);
|
||||
}
|
||||
Map<Integer, SEquipConfig> equipConfig = SEquipConfig.equipConfigMap;
|
||||
for (Integer id : set) {
|
||||
SEquipConfig config = equipConfig.get(id);
|
||||
if (config == null){
|
||||
String format = MessageFormat.format("礼物穿戴报错, 英雄礼物配置不存在,uid:{0},id:{1}", user.getId(), id);
|
||||
throw new ErrorCodeException(format);
|
||||
}
|
||||
if (config.getRangeHeroTids() != null && !config.getRangeHeroTids().contains(templateId)){
|
||||
String format = MessageFormat.format("礼物穿戴报错, 该礼物无法配置给改英雄,uid:{0},id:{1},hero:{2}", user.getId(), id, scHero.getId());
|
||||
throw new ErrorCodeException(format);
|
||||
}
|
||||
boolean profession = EquipLogic.getInstance().verifyEquipProfessionLimit(templateId, id);
|
||||
if (!profession){
|
||||
throw new ErrorCodeException(ErrorCode.HERO_UN_MATCH,"职业不满足条件:"+id);
|
||||
}
|
||||
}
|
||||
heroGifts.addAll(giftIds);
|
||||
hero.setHeroGiftEquipList(heroGifts);
|
||||
}
|
||||
ItemUtil.itemCost(user, items, BIReason.GIFT_EQUIP_UP_COST ,1);
|
||||
}
|
||||
else {
|
||||
// 脱下
|
||||
if (role.equals("0")){
|
||||
String format = MessageFormat.format("礼物脱卸报错, 主角礼物无法脱卸,uid:{0}", user.getId());
|
||||
throw new ErrorCodeException(format);
|
||||
}
|
||||
// 英雄礼物
|
||||
Hero hero = heroManager.getHero(role);
|
||||
if (hero == null){
|
||||
String format = MessageFormat.format("礼物脱卸报错, 英雄不存在,uid:{0},role:{1}", user.getId(), role);
|
||||
throw new ErrorCodeException(format);
|
||||
}
|
||||
Set<Integer> heroGifts = hero.getHeroGiftEquipList();
|
||||
if (!heroGifts.containsAll(set)){
|
||||
String format = MessageFormat.format("礼物脱卸报错, 英雄礼物不存在,uid:{0},list:{1}, roleList:{2}", user.getId(), giftIds, heroGifts);
|
||||
throw new ErrorCodeException(format);
|
||||
}
|
||||
heroGifts.removeAll(set);
|
||||
hero.setHeroGiftEquipList(heroGifts);
|
||||
|
||||
ItemUtil.drop(user, items, BIReason.GIFT_EQUIP_DOWN_REWARD);
|
||||
}
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GiftEquipWearResponse_VALUE, null, true);
|
||||
}
|
||||
|
||||
public static boolean hasDuplicates(Set<Integer> list1, Set<Integer> list2) {
|
||||
for (Integer element : list2) {
|
||||
if (list1.contains(element)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 装备验证职业条件
|
||||
*/
|
||||
public boolean verifyEquipProfessionLimit(int heroId, int equipId){
|
||||
// 默认值
|
||||
boolean result = false;
|
||||
// 装备信息
|
||||
SEquipConfig equip = STableManager.getConfig(SEquipConfig.class).get(equipId);
|
||||
// 英雄信息
|
||||
SCHero hero = SCHero.getsCHero().get(heroId);
|
||||
if (equip == null || hero == null){
|
||||
LOGGER.error("装备神印,装备ID或者英雄ID错误,表内容查询失败,equip:{},hero:{}",equipId,heroId);
|
||||
return false;
|
||||
}
|
||||
// 判断条件查表去
|
||||
switch (equip.getProfessionLimit()){
|
||||
case 0:
|
||||
result = true;
|
||||
break;
|
||||
case 1:
|
||||
if (hero.getProfession() == 1){
|
||||
result = true;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (hero.getProfession() == 2){
|
||||
result = true;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (hero.getProfession() == 4){
|
||||
result = true;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if (hero.getProfession() == 3){
|
||||
result = true;
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
if (hero.getJob() == 1){
|
||||
result = true;
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
if (hero.getJob() == 2){
|
||||
result = true;
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
if (hero.getProfession() == 2 || hero.getProfession() == 3){
|
||||
result = true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取礼物收集值
|
||||
* @param user 玩家
|
||||
* @return 收集值
|
||||
*/
|
||||
public int getGiftProsperityNum(User user){
|
||||
Set<Integer> giftEquipList = user.getPlayerInfoManager().getPlayerGiftEquipList();
|
||||
Map<Integer, SEquipConfig> configMap = SEquipConfig.equipConfigMap;
|
||||
int num = 0;
|
||||
for (Integer id : giftEquipList) {
|
||||
SEquipConfig config = configMap.get(id);
|
||||
if (config == null){
|
||||
continue;
|
||||
}
|
||||
num += config.getGift();
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取英雄礼物各自数量
|
||||
* @param user 玩家
|
||||
* @return 格子数
|
||||
*/
|
||||
public int getHeroGiftBoxNum(User user){
|
||||
int prosperityNum = getGiftProsperityNum(user);
|
||||
int resultBox = 0;
|
||||
for (SGiftConfig value : SGiftConfig.map.values()) {
|
||||
if (prosperityNum <= value.getGift()){
|
||||
resultBox = value.getBox();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return resultBox;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -225,7 +225,7 @@ public class FightUtil {
|
|||
meCrossFightTeam, heCrossFightTeam, FightUtil.getFightSeed(), false, fightType, mostTime);
|
||||
}
|
||||
|
||||
public static CommonProto.FightTeamInfo getCrossFightTeam(CSPlayer csPlayer, int teamId) throws Exception {
|
||||
public static CommonProto.FightTeamInfo getCrossFightTeam(CSPlayer csPlayer, int teamId) throws ErrorCodeException {
|
||||
User user = PlayerLogic.getInstance().getUserByRpc(csPlayer.getUserId());
|
||||
if (user == null){
|
||||
throw new ErrorCodeException(ErrorCode.USE_NOT_EXIT);
|
||||
|
|
|
|||
|
|
@ -24,11 +24,11 @@ import com.ljsd.jieling.logic.activity.ActivityType;
|
|||
import com.ljsd.jieling.logic.activity.event.*;
|
||||
import com.ljsd.jieling.logic.activity.eventhandler.HeroFiveStarGetEventHandler;
|
||||
import com.ljsd.jieling.logic.activity.eventhandler.PokemonFiveStarGetEventHandler;
|
||||
import com.ljsd.jieling.logic.activity.eventhandler.SaveHeroForceEventHandler;
|
||||
import com.ljsd.jieling.logic.activity.fourChallenge.FourChallengeLogic;
|
||||
import com.ljsd.jieling.logic.dao.*;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.dao.vo.HeroVo;
|
||||
import com.ljsd.jieling.logic.equip.EquipLogic;
|
||||
import com.ljsd.jieling.logic.expedition.ExpeditionLogic;
|
||||
import com.ljsd.jieling.logic.fight.CombatLogic;
|
||||
import com.ljsd.jieling.logic.fight.passiveSkillCal.PassiveskillCalEnum;
|
||||
|
|
@ -481,7 +481,7 @@ public class HeroLogic {
|
|||
index = index % count;
|
||||
}
|
||||
///天地洪炉默认没选择up道具特殊处理(奇数为普通卡池)
|
||||
if (user.getHeroManager().getTrumpSelectItemMap().size() == 0 && sLotteryRewardConfig.getPool() % 2 == 1) {
|
||||
if (user.getHeroManager().getTrumpSelectItemMap().isEmpty() && sLotteryRewardConfig.getPool() % 2 == 1) {
|
||||
HashMap<Integer, Integer> map = new HashMap<>();
|
||||
for (int i = 0; i < count; i++) {
|
||||
map.put(i + 1, list.get(i).getReward()[0]);
|
||||
|
|
@ -1457,7 +1457,7 @@ public class HeroLogic {
|
|||
.filter(v -> v.getType() == 1)
|
||||
.forEach(v -> heroIdsList.add(v.getItemId()));
|
||||
ErrorCode err = null;
|
||||
if (heroIdsList.size() > 0) {
|
||||
if (!heroIdsList.isEmpty()) {
|
||||
err = ItemLogic.getInstance().checkHeroResolve(heroIdsList, user);
|
||||
}
|
||||
if (null != err) {
|
||||
|
|
@ -2081,7 +2081,7 @@ public class HeroLogic {
|
|||
|
||||
///法宝之魂共鸣技能
|
||||
Map<Integer, Integer> faBaoGongMingSkillMap = heroVo.getFaBaoGongMingSkillMap();
|
||||
if (faBaoGongMingSkillMap.size() > 0) {
|
||||
if (!faBaoGongMingSkillMap.isEmpty()) {
|
||||
List<Integer> faBaoSoulSkills=new ArrayList<>();
|
||||
for (Map.Entry<Integer, Integer> entry : faBaoGongMingSkillMap.entrySet()) {
|
||||
SXiuXianSkill sXiuXianSkill = STableManager.getConfig(SXiuXianSkill.class).get(entry.getValue());
|
||||
|
|
@ -2102,7 +2102,7 @@ public class HeroLogic {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (faBaoSoulSkills.size()>0) {
|
||||
if (!faBaoSoulSkills.isEmpty()) {
|
||||
skillList.addAll(faBaoSoulSkills);
|
||||
}
|
||||
}
|
||||
|
|
@ -2692,6 +2692,8 @@ public class HeroLogic {
|
|||
applyEquipSuiteAttribute(heroAllAttribute, hero);
|
||||
// 魂灵宝加成
|
||||
applyJewelAttribute(heroAllAttribute, hero, user);
|
||||
// 礼物装备加成
|
||||
applyGiftEquipAttribute(heroAllAttribute, hero, user);
|
||||
// 法宝,法相加成
|
||||
applyEquipTalismanaAndFaxiangAttribute(heroAllAttribute, hero, user);
|
||||
// 魂印和神印属性加成
|
||||
|
|
@ -2877,7 +2879,7 @@ public class HeroLogic {
|
|||
}
|
||||
//英雄总好感度属性加成
|
||||
Map<Integer, Integer> allLikablePropAddMap = heroManager.getAllLikablePropAddMap();
|
||||
if (allLikablePropAddMap.size() > 0) {
|
||||
if (!allLikablePropAddMap.isEmpty()) {
|
||||
int[][] allLikableProp = ItemUtil.mapToArray(allLikablePropAddMap);
|
||||
combinedAttribute(allLikableProp, heroAllAttribute);
|
||||
}
|
||||
|
|
@ -3020,6 +3022,23 @@ public class HeroLogic {
|
|||
}
|
||||
}
|
||||
|
||||
private void applyGiftEquipAttribute(Map<Integer, Long> heroAllAttribute, Hero hero, User user){
|
||||
// ... 礼物装备 ...
|
||||
Set<Integer> heroGiftEquipList = hero.getHeroGiftEquipList();
|
||||
Set<Integer> playerGiftEquipList = user.getPlayerInfoManager().getPlayerGiftEquipList();
|
||||
HashSet<Integer> set = new HashSet<>();
|
||||
set.addAll(heroGiftEquipList);
|
||||
set.addAll(playerGiftEquipList);
|
||||
Map<Integer, SEquipConfig> configMap = SEquipConfig.equipConfigMap;
|
||||
for (Integer id : set) {
|
||||
SEquipConfig config = configMap.get(id);
|
||||
if (config == null){
|
||||
continue;
|
||||
}
|
||||
combinedAttribute(config.getProperty(), heroAllAttribute);
|
||||
}
|
||||
}
|
||||
|
||||
private void applyJewelAttribute(Map<Integer, Long> heroAllAttribute, Hero hero, User user){
|
||||
// ... 魂灵宝属性 ...
|
||||
EquipManager equipManager = user.getEquipManager();
|
||||
|
|
@ -3548,7 +3567,7 @@ public class HeroLogic {
|
|||
if (null == equip || null == hero) {
|
||||
throw new ErrorCodeException(ErrorCode.HERO_EQUIP_ERR);
|
||||
}
|
||||
if (null != equip.getHeroId() && !equip.getHeroId().equals("")) {
|
||||
if (null != equip.getHeroId() && !equip.getHeroId().isEmpty()) {
|
||||
if (heroManager.getHero(equip.getHeroId()) == null) {
|
||||
equip.setHeroId("");
|
||||
}
|
||||
|
|
@ -3668,7 +3687,7 @@ public class HeroLogic {
|
|||
Map<Integer, Integer> randomMap = new ConcurrentHashMap<>();
|
||||
randomMap.put(itemId, composeNum);
|
||||
CommonProto.Drop.Builder drop = ItemUtil.useRandomItem(user, randomMap, BIReason.COMPOS_HERO_REWARD);
|
||||
if (drop.getPokemonList().size() > 0) {
|
||||
if (!drop.getPokemonList().isEmpty()) {
|
||||
fiveStarPokemonPushByCombine(user, drop.getPokemonList().get(0).getTempId(), composeNum);
|
||||
}
|
||||
HeroInfoProto.HeroComposeResponse heroComposeResponse = HeroInfoProto.HeroComposeResponse
|
||||
|
|
@ -3714,7 +3733,7 @@ public class HeroLogic {
|
|||
long totalForce = 0;
|
||||
targetUser.getTeamPosManager().setCurTeamPosId(teamId);
|
||||
Map<Integer, List<TeamPosHeroInfo>> teamPosForHero = targetUser.getTeamPosManager().getTeamPosForHero();
|
||||
if (teamPosForHero == null || teamPosForHero.size() == 0) {
|
||||
if (teamPosForHero == null || teamPosForHero.isEmpty()) {
|
||||
return totalForce;
|
||||
}
|
||||
List<TeamPosHeroInfo> teamPosHeroInfoList = teamPosForHero.get(teamId);
|
||||
|
|
@ -3945,7 +3964,7 @@ public class HeroLogic {
|
|||
Map<Integer, SChangingCardLevel> poolConfig = SChangingCardLevel.getConfigByPoolId(card.getLevelUpPool());
|
||||
if (poolConfig != null) {
|
||||
List<SChangingCardLevel> levelList = poolConfig.values().stream().filter(n -> n.getLevel() == level).collect(Collectors.toList());
|
||||
if (levelList.size() > 0) {
|
||||
if (!levelList.isEmpty()) {
|
||||
combinedAttribute(levelList.get(0).getPropList(), attrMap);
|
||||
}
|
||||
}
|
||||
|
|
@ -4346,12 +4365,12 @@ public class HeroLogic {
|
|||
if (reason == BIReason.UPHERO_DECOMPOS_HERO_REWARD) {
|
||||
// 装备
|
||||
Map<Integer, Integer> equipByPositionMap = hero.getEquipByPositionMap();
|
||||
if (equipByPositionMap != null && equipByPositionMap.size() > 0) {
|
||||
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.size() > 0) {
|
||||
if (soulEquipByPositionMap != null && !soulEquipByPositionMap.isEmpty()) {
|
||||
soulEquipByPositionMap.forEach((k, v) -> returnItemMap.put(v, returnItemMap.getOrDefault(v, 0) + 1));
|
||||
}
|
||||
// 宝器
|
||||
|
|
@ -4403,7 +4422,7 @@ public class HeroLogic {
|
|||
}
|
||||
//返还法宝修炼材料
|
||||
Map<Integer, Integer> especialEquipReturnItem = ItemLogic.getInstance().heroEspecialEquipReturnItem(hero);
|
||||
if (especialEquipReturnItem != null && especialEquipReturnItem.size() > 0) {
|
||||
if (especialEquipReturnItem != null && !especialEquipReturnItem.isEmpty()) {
|
||||
for (Map.Entry<Integer, Integer> entry : especialEquipReturnItem.entrySet()) {
|
||||
returnItemMap.put(entry.getKey(), returnItemMap.getOrDefault(entry.getKey(), 0) + entry.getValue());
|
||||
}
|
||||
|
|
@ -6261,7 +6280,7 @@ public class HeroLogic {
|
|||
if (!indexBox.contains(position)){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"位置未解锁:"+position);
|
||||
}
|
||||
boolean profession = verifyProfessionByGodSeal(hero.getTemplateId(), equipId);
|
||||
boolean profession = EquipLogic.getInstance().verifyEquipProfessionLimit(hero.getTemplateId(), equipId);
|
||||
if (!profession){
|
||||
throw new ErrorCodeException(ErrorCode.HERO_UN_MATCH,"职业不满足条件:"+equipId);
|
||||
}
|
||||
|
|
@ -6356,69 +6375,6 @@ public class HeroLogic {
|
|||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.UpGodSealResponse_VALUE, builder.build());
|
||||
}
|
||||
|
||||
/**
|
||||
* 装备神印验证职业条件
|
||||
* @param heroId
|
||||
* @param equipId
|
||||
* @return
|
||||
*/
|
||||
private boolean verifyProfessionByGodSeal(int heroId,int equipId){
|
||||
// 默认值
|
||||
boolean result = false;
|
||||
// 装备信息
|
||||
SEquipConfig equip = STableManager.getConfig(SEquipConfig.class).get(equipId);
|
||||
// 英雄信息
|
||||
SCHero hero = SCHero.getsCHero().get(heroId);
|
||||
if (equip == null || hero == null){
|
||||
LOGGER.error("装备神印,装备ID或者英雄ID错误,表内容查询失败,equip:{},hero:{}",equipId,heroId);
|
||||
return false;
|
||||
}
|
||||
// 判断条件查表去
|
||||
switch (equip.getProfessionLimit()){
|
||||
case 0:
|
||||
result = true;
|
||||
break;
|
||||
case 1:
|
||||
if (hero.getProfession() == 1){
|
||||
result = true;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (hero.getProfession() == 2){
|
||||
result = true;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (hero.getProfession() == 4){
|
||||
result = true;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if (hero.getProfession() == 3){
|
||||
result = true;
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
if (hero.getJob() == 1){
|
||||
result = true;
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
if (hero.getJob() == 2){
|
||||
result = true;
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
if (hero.getProfession() == 2 || hero.getProfession() == 3){
|
||||
result = true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化玉虚固定英雄池
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -272,9 +272,6 @@ public class CBean2Proto {
|
|||
/**
|
||||
* 助战,hero对象转redis类型
|
||||
* 存入redis时调用
|
||||
* @param user
|
||||
* @param hero
|
||||
* @return
|
||||
*/
|
||||
public static HelpHero heroToHelpHero(User user,Hero hero) throws Exception {
|
||||
// 获取神将类型
|
||||
|
|
@ -284,7 +281,7 @@ public class CBean2Proto {
|
|||
Hero heroVo = getHeroVoToHero(user, hero);
|
||||
// 魂宝灵宝镜像
|
||||
List<Jewel> jewels = new ArrayList<>();
|
||||
if (heroVo.getJewelInfo() != null && heroVo.getJewelInfo().size() > 0){
|
||||
if (heroVo.getJewelInfo() != null && !heroVo.getJewelInfo().isEmpty()){
|
||||
// 装备列表
|
||||
Map<String, PropertyItem> equipMap = user.getEquipManager().getEquipMap();
|
||||
for (String id:heroVo.getJewelInfo()){
|
||||
|
|
@ -298,7 +295,7 @@ public class CBean2Proto {
|
|||
// 法相
|
||||
List<Faxiang> faxiang = new ArrayList<>();
|
||||
Set<String> faxiangList = heroVo.getFaxiangList();
|
||||
if (faxiangList != null && faxiangList.size() > 0){
|
||||
if (faxiangList != null && !faxiangList.isEmpty()){
|
||||
// 装备列表
|
||||
Map<String, Faxiang> faxiangMap = user.getEquipManager().getFaxiangMap();
|
||||
for (String id : faxiangList) {
|
||||
|
|
@ -321,9 +318,6 @@ public class CBean2Proto {
|
|||
|
||||
/**
|
||||
* 创建英雄镜像
|
||||
* @param user
|
||||
* @param hero
|
||||
* @return
|
||||
*/
|
||||
private static Hero getHeroVoToHero(User user,Hero hero) throws Exception {
|
||||
Hero clone = (Hero) hero.clone();
|
||||
|
|
@ -338,9 +332,6 @@ public class CBean2Proto {
|
|||
|
||||
/**
|
||||
* 获取魂宝灵宝镜像
|
||||
* @param user
|
||||
* @param hero
|
||||
* @return
|
||||
*/
|
||||
private static Jewel getJewelVoToJewel(User user,Hero hero,Jewel jewel){
|
||||
Jewel clone = jewel.clone();
|
||||
|
|
@ -351,9 +342,6 @@ public class CBean2Proto {
|
|||
|
||||
/**
|
||||
* 四灵,获取个人信息
|
||||
* @param everyUser
|
||||
* @param function
|
||||
* @return
|
||||
*/
|
||||
// public static CommonProto.UserRank.Builder getOneUserRank(User everyUser, int function, ArenaRecord arenaRecord){
|
||||
// return CommonProto.UserRank.newBuilder()
|
||||
|
|
@ -382,7 +370,7 @@ public class CBean2Proto {
|
|||
public static CommonProto.Hero getHero(Hero hero,HeroManager heroManager){
|
||||
// 鸿蒙阵装备同步
|
||||
Collection<Integer> equipList =hero.getEquipByPositionMap().values();
|
||||
if(equipList.size() ==0 ){
|
||||
if(equipList.isEmpty()){
|
||||
equipList = hero.getEquipByHongmengPositionMap(heroManager).values();
|
||||
}
|
||||
|
||||
|
|
@ -458,14 +446,12 @@ public class CBean2Proto {
|
|||
.addAllGodSeals(godSeals)
|
||||
.addAllEquipStrong(equipStrongList)
|
||||
.setEquipAdvanceLv(hero.getEquipAdvanceLv())
|
||||
.addAllGiftEquipIds(hero.getHeroGiftEquipList())
|
||||
.build();
|
||||
}
|
||||
|
||||
/***
|
||||
* 获取鸿蒙阵英雄属性
|
||||
* @param hero
|
||||
* @param heroManager
|
||||
* @return
|
||||
*/
|
||||
public static CommonProto.Hero getHeroByHongMeng(Hero hero,HeroManager heroManager){
|
||||
CommonProto.Hero hero1 = getHero(hero,heroManager);
|
||||
|
|
@ -516,8 +502,6 @@ public class CBean2Proto {
|
|||
|
||||
/**
|
||||
* 获取魂灵宝信息,纯装备信息
|
||||
* @param equip
|
||||
* @return
|
||||
*/
|
||||
public static CommonProto.Equip getEquipProto(PropertyItem equip){
|
||||
CommonProto.Equip.Builder equipProto = CommonProto.Equip.newBuilder();
|
||||
|
|
@ -534,8 +518,6 @@ public class CBean2Proto {
|
|||
|
||||
/**
|
||||
* 获取法相信息,纯装备信息
|
||||
* @param faxiang
|
||||
* @return
|
||||
*/
|
||||
public static CommonProto.Equip getFaxiangEquipProto(Faxiang faxiang){
|
||||
CommonProto.Equip.Builder equipProto = CommonProto.Equip.newBuilder();
|
||||
|
|
@ -548,9 +530,6 @@ public class CBean2Proto {
|
|||
|
||||
/**
|
||||
* 获取装备信息,需要添加和玩家有关的调用次方法
|
||||
* @param equip
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
public static CommonProto.Equip getEquipProto(PropertyItem equip,User user){
|
||||
CommonProto.Equip.Builder proto = getEquipProto(equip).toBuilder();
|
||||
|
|
@ -564,8 +543,6 @@ public class CBean2Proto {
|
|||
|
||||
/**
|
||||
* 常用于基础装备,只要装备模板id即可
|
||||
* @param equipId
|
||||
* @return
|
||||
*/
|
||||
public static CommonProto.Equip getEquipProto(int equipId) {
|
||||
return CommonProto.Equip.newBuilder().setEquipId(equipId).build();
|
||||
|
|
|
|||
|
|
@ -608,11 +608,7 @@ public class ItemUtil {
|
|||
int itemType = getItemType(sItem);
|
||||
long amount = MathUtils.numRount((itemNum * MathUtils.floatToDouble(dropRatio)));
|
||||
switch (itemType) {
|
||||
case GlobalItemType.SOUL_MARK:
|
||||
case GlobalItemType.GOD_SEAL:
|
||||
case GlobalItemType.ITEM:
|
||||
case GlobalItemType.ESPECIAL_EQUIP:
|
||||
case GlobalItemType.EQUIP:
|
||||
putCountLongMap(itemId,amount, itemObj.getItemMap());
|
||||
break;
|
||||
case GlobalItemType.CARD:
|
||||
|
|
@ -672,6 +668,10 @@ public class ItemUtil {
|
|||
case GlobalItemType.GENERAL_DEBRIS:
|
||||
case GlobalItemType.HERO_CHANGE_CARD:
|
||||
case GlobalItemType.MAGIC_SOLDIER_FRAGMENTS:
|
||||
case GlobalItemType.SOUL_MARK:
|
||||
case GlobalItemType.GOD_SEAL:
|
||||
case GlobalItemType.ESPECIAL_EQUIP:
|
||||
case GlobalItemType.EQUIP:
|
||||
itemType = GlobalItemType.ITEM;
|
||||
break;
|
||||
default:
|
||||
|
|
@ -697,150 +697,164 @@ public class ItemUtil {
|
|||
/**
|
||||
* 添加道具
|
||||
*/
|
||||
public static int addItemByMail(User user, Map<Integer, Long> itemMap,CommonProto.Drop.Builder dropBuilder,int reason) throws Exception {
|
||||
public static int addItemByMail(User user, Map<Integer, Long> itemMap, CommonProto.Drop.Builder dropBuilder, int reason) throws Exception {
|
||||
if (itemMap.isEmpty()) {
|
||||
return 1;
|
||||
}
|
||||
EquipManager equipManager=user.getEquipManager();
|
||||
List<CommonProto.Item> itemProtoList = new CopyOnWriteArrayList<>();
|
||||
|
||||
EquipManager equipManager = user.getEquipManager();
|
||||
ItemManager itemManager = user.getItemManager();
|
||||
List<CommonProto.Item> sendToFront = new CopyOnWriteArrayList<>();
|
||||
//超过上限不能直接获得
|
||||
Map<Integer,Integer> extraItem = new HashMap<>(itemMap.size());
|
||||
List<Integer>changeEquipList=null;
|
||||
List<CommonProto.Item> itemProtoList = new ArrayList<>();
|
||||
List<CommonProto.Item> sendToFront = new ArrayList<>();
|
||||
Map<Integer, Integer> extraItem = new HashMap<>(itemMap.size());
|
||||
List<Integer> changeEquipList = null;
|
||||
|
||||
for (Map.Entry<Integer, Long> entry : itemMap.entrySet()) {
|
||||
SItem sItem = SItem.getsItemMap().get (entry.getKey());
|
||||
if (sItem.getItemBaseType()==6){
|
||||
equipManager.addEquipList(entry.getKey());
|
||||
int itemId = entry.getKey();
|
||||
long itemNum = entry.getValue();
|
||||
|
||||
SItem sItem = SItem.getsItemMap().get(itemId);
|
||||
if (sItem.getItemBaseType() == 6) {
|
||||
equipManager.addEquipList(itemId);
|
||||
}
|
||||
if (sItem.getItemType()==3 && reason != BIReason.EQUIP_UNLOAD_REWARD && reason != BIReason.UPHERO_DECOMPOS_HERO_REWARD && reason != BIReason.DECOMPOS_HERO_REWARD){
|
||||
if (changeEquipList==null) {
|
||||
changeEquipList=new ArrayList<>();
|
||||
|
||||
if (sItem.getItemType() == 3 && reason != BIReason.EQUIP_UNLOAD_REWARD && reason != BIReason.UPHERO_DECOMPOS_HERO_REWARD && reason != BIReason.DECOMPOS_HERO_REWARD) {
|
||||
if (changeEquipList == null) {
|
||||
changeEquipList = new ArrayList<>();
|
||||
}
|
||||
itemManager.setEquipBookMap(entry.getKey(),entry.getValue());
|
||||
changeEquipList.add(entry.getKey());
|
||||
itemManager.setEquipBookMap(itemId, itemNum);
|
||||
changeEquipList.add(itemId);
|
||||
}
|
||||
|
||||
long itemNumlimit = sItem.getItemNumlimit();
|
||||
long itemNum = entry.getValue().intValue();
|
||||
if(itemNum <= 0){
|
||||
if (itemNum <= 0) {
|
||||
continue;
|
||||
}
|
||||
if (itemNum >= itemNumlimit){
|
||||
|
||||
if (itemNum >= itemNumlimit) {
|
||||
itemNum = itemNumlimit;
|
||||
}
|
||||
Item item = itemManager.getItem(entry.getKey());
|
||||
|
||||
Item item = itemManager.getItem(itemId);
|
||||
if (item == null) {
|
||||
item = itemManager.newItem(entry.getKey(), itemNum);
|
||||
item = itemManager.newItem(itemId, itemNum);
|
||||
} else {
|
||||
if(sItem.getId()==Global.MISSING_ROOM_ITEM&&reason==BIReason.ADVENTURE_BASE_REWARD){
|
||||
if (sItem.getId() == Global.MISSING_ROOM_ITEM && reason == BIReason.ADVENTURE_BASE_REWARD) {
|
||||
itemNumlimit = SPlayerLevelConfig.getsPlayerLevelConfigMap().get(user.getPlayerInfoManager().getLevel()).getMazeTreasureMax();
|
||||
}
|
||||
//数量超过了
|
||||
if(item.getItemNum()> itemNumlimit){
|
||||
|
||||
//如果是寻龙玉,直接返回不给
|
||||
if(sItem.getId()==Global.MISSING_ROOM_ITEM&&reason==BIReason.ADVENTURE_BASE_REWARD){
|
||||
if (item.getItemNum() > itemNumlimit) {
|
||||
if (sItem.getId() == Global.MISSING_ROOM_ITEM && reason == BIReason.ADVENTURE_BASE_REWARD) {
|
||||
continue;
|
||||
}
|
||||
if(reason==BIReason.TAKE_MAIL_REWARD){
|
||||
if (reason == BIReason.TAKE_MAIL_REWARD) {
|
||||
return 2;
|
||||
}else{
|
||||
extraItem.put(entry.getKey(), (int) (extraItem.getOrDefault(entry.getKey(),0)+entry.getValue()));
|
||||
} else {
|
||||
extraItem.put(itemId, extraItem.getOrDefault(itemId, 0) + (int) itemNum);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (item.getItemNum() + entry.getValue() > itemNumlimit){
|
||||
if(sItem.getId()==Global.MISSING_ROOM_ITEM&&reason==BIReason.ADVENTURE_BASE_REWARD){
|
||||
item.setItemNum((int) (item.getItemNum() + entry.getValue()));
|
||||
}else{
|
||||
if(reason==BIReason.TAKE_MAIL_REWARD){
|
||||
|
||||
if (item.getItemNum() + itemNum > itemNumlimit) {
|
||||
if (sItem.getId() == Global.MISSING_ROOM_ITEM && reason == BIReason.ADVENTURE_BASE_REWARD) {
|
||||
item.setItemNum((int) (item.getItemNum() + itemNum));
|
||||
} else {
|
||||
if (reason == BIReason.TAKE_MAIL_REWARD) {
|
||||
return 2;
|
||||
}else{
|
||||
extraItem.put(entry.getKey(), (int) (extraItem.getOrDefault(entry.getKey(),0)+entry.getValue()));
|
||||
} else {
|
||||
extraItem.put(itemId, extraItem.getOrDefault(itemId, 0) + (int) itemNum);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
item.setItemNum(item.getItemNum() + entry.getValue());
|
||||
|
||||
} else {
|
||||
item.setItemNum(item.getItemNum() + itemNum);
|
||||
}
|
||||
}
|
||||
if(itemNum>=0){
|
||||
itemProtoList.add(CBean2Proto.getItem(item,itemNum));
|
||||
|
||||
if (itemNum >= 0) {
|
||||
itemProtoList.add(CBean2Proto.getItem(item, itemNum));
|
||||
}
|
||||
|
||||
// 触发任务,东海寻仙
|
||||
if (sItem.getItemType() == GlobalItemType.TRANSFORMATION_CARD){
|
||||
if (sItem.getItemType() == GlobalItemType.TRANSFORMATION_CARD) {
|
||||
long count = itemNum;
|
||||
while (count >= Integer.MAX_VALUE){
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.ONE_MISSION_TYPE_CONSUME,MissionType.GET_TRANSFIGURATION_CARD_NUM,sItem.getQuantity(),Integer.MAX_VALUE);
|
||||
count-=Integer.MAX_VALUE;
|
||||
while (count >= Integer.MAX_VALUE) {
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.ONE_MISSION_TYPE_CONSUME, MissionType.GET_TRANSFIGURATION_CARD_NUM, sItem.getQuantity(), Integer.MAX_VALUE);
|
||||
count -= Integer.MAX_VALUE;
|
||||
}
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.ONE_MISSION_TYPE_CONSUME,MissionType.GET_TRANSFIGURATION_CARD_NUM,sItem.getQuantity(),(int)count);
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.ONE_MISSION_TYPE_CONSUME, MissionType.GET_TRANSFIGURATION_CARD_NUM, sItem.getQuantity(), (int) count);
|
||||
}
|
||||
|
||||
int eventType = ParamEventBean.UserItemEvent;
|
||||
if(currencyMap.contains(entry.getKey())){
|
||||
if (currencyMap.contains(itemId)) {
|
||||
eventType = ParamEventBean.UserCurrencyEvent;
|
||||
}
|
||||
KtEventUtils.onKtEvent(user, eventType,reason,GlobalsDef.addReason,entry.getKey(),itemNum,item.getItemNum());
|
||||
KtEventUtils.onKtEvent(user, eventType, reason, GlobalsDef.addReason, itemId, itemNum, item.getItemNum());
|
||||
|
||||
baseItemReport(user,item.getItemId(),(int)itemNum,1,reason);
|
||||
baseItemReport(user, itemId, (int) itemNum, 1, reason);
|
||||
|
||||
if(sItem.getId() == Global.EXP){
|
||||
userLevelUp(user,itemNum);
|
||||
if (sItem.getId() == Global.EXP) {
|
||||
userLevelUp(user, itemNum);
|
||||
}
|
||||
if(sItem.getId() == Global.TREASURE_SCORE){
|
||||
if (sItem.getId() == Global.TREASURE_SCORE) {
|
||||
treasureLevelUp(user);
|
||||
}
|
||||
extraDropAop(user,dropBuilder,sItem);
|
||||
sendToFront.add(CBean2Proto.getItem(item,-1));
|
||||
if(sItem.getItemType()==GlobalItemType.EQUIP){
|
||||
if(reason!=BIReason.EQUIP_UNLOAD_REWARD&&reason!=BIReason.DECOMPOS_HERO_REWARD&&reason!=BIReason.UPHERO_DECOMPOS_HERO_REWARD){
|
||||
user.getUserMissionManager().onGameEvent(user,GameEvent.GET_EQUIP,sItem.getId(),(int)itemNum);
|
||||
ReportUtil.onReportEvent(user,ReportEventEnum.GET_EQUIP.getType(),sItem.getId(),(int)itemNum,reason);
|
||||
|
||||
extraDropAop(user, dropBuilder, sItem);
|
||||
sendToFront.add(CBean2Proto.getItem(item, -1));
|
||||
|
||||
if (sItem.getItemType() == GlobalItemType.EQUIP) {
|
||||
if (reason != BIReason.EQUIP_UNLOAD_REWARD && reason != BIReason.DECOMPOS_HERO_REWARD && reason != BIReason.UPHERO_DECOMPOS_HERO_REWARD) {
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.GET_EQUIP, sItem.getId(), (int) itemNum);
|
||||
ReportUtil.onReportEvent(user, ReportEventEnum.GET_EQUIP.getType(), sItem.getId(), (int) itemNum, reason);
|
||||
}
|
||||
}
|
||||
if (sItem.getItemType() == GlobalItemType.SOUL_MARK) {
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.ONE_MISSION_TYPE_CONSUME, MissionType.GOT_SOUL_MARK, sItem.getId(), (int)itemNum);
|
||||
}
|
||||
if(sItem.getId()==Global.DAILY_TASK_REMOVE_ITEM){
|
||||
user.getUserMissionManager().onGameEvent(user,GameEvent.ONE_MISSION_TYPE_CONSUME,MissionType.DAILY_TASK_FINISH,(int)itemNum);
|
||||
}
|
||||
//日志记录
|
||||
ItemLogic.getInstance().addItemLog(new ItemLog(user,0,reason,item,itemNum));
|
||||
}
|
||||
//发送装备图鉴修改推送
|
||||
SendEquipBookIndication(user.getId(),itemManager,changeEquipList);
|
||||
|
||||
for(Map.Entry<Integer,Integer> entry:extraItem.entrySet()){
|
||||
itemProtoList.add(CBean2Proto.getItem(itemManager.getItemMap().get(entry.getKey()),entry.getValue()));
|
||||
if (sItem.getItemType() == GlobalItemType.SOUL_MARK) {
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.ONE_MISSION_TYPE_CONSUME, MissionType.GOT_SOUL_MARK, sItem.getId(), (int) itemNum);
|
||||
}
|
||||
|
||||
if (sItem.getId() == Global.DAILY_TASK_REMOVE_ITEM) {
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.ONE_MISSION_TYPE_CONSUME, MissionType.DAILY_TASK_FINISH, (int) itemNum);
|
||||
}
|
||||
|
||||
// 日志记录
|
||||
ItemLogic.getInstance().addItemLog(new ItemLog(user, 0, reason, item, itemNum));
|
||||
}
|
||||
|
||||
// 发送装备图鉴修改推送
|
||||
SendEquipBookIndication(user.getId(), itemManager, changeEquipList);
|
||||
|
||||
for (Map.Entry<Integer, Integer> entry : extraItem.entrySet()) {
|
||||
itemProtoList.add(CBean2Proto.getItem(itemManager.getItemMap().get(entry.getKey()), entry.getValue()));
|
||||
}
|
||||
|
||||
if (dropBuilder != null) {
|
||||
dropBuilder.addAllItemlist(itemProtoList);
|
||||
}
|
||||
|
||||
if(!sendToFront.isEmpty()||extraItem.size()>0){
|
||||
MessageUtil.sendBagIndication(user.getId(),0,sendToFront,extraItem.size()>0);
|
||||
boolean extraBol = !extraItem.isEmpty();
|
||||
if (!sendToFront.isEmpty() || extraBol) {
|
||||
MessageUtil.sendBagIndication(user.getId(), 0, sendToFront, extraBol);
|
||||
}
|
||||
if(extraItem.size()>0){
|
||||
|
||||
if (extraBol) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
for(Map.Entry<Integer,Integer> entry:extraItem.entrySet()){
|
||||
builder.append(entry.getKey()).append("#").append(entry.getValue());
|
||||
String title = SErrorCodeEerverConfig.getI18NMessage("item_max_mail_title");
|
||||
SItem item = SItem.getsItemMap().get(entry.getKey());
|
||||
String content = SErrorCodeEerverConfig.getI18NMessageNeedConvert("item_max_mail_content",new String[]{item.getName(),String.valueOf(item.getItemNumlimit())},new int[]{1,0},"#");
|
||||
MailLogic.getInstance().sendMail(user.getId(),title,content,builder.toString(),TimeUtils.nowInt(),Global.MAIL_EFFECTIVE_TIME);
|
||||
builder = new StringBuilder();
|
||||
for (Map.Entry<Integer, Integer> entry : extraItem.entrySet()) {
|
||||
builder.append(entry.getKey()).append("#").append(entry.getValue()).append(",");
|
||||
}
|
||||
builder.deleteCharAt(builder.length() - 1);
|
||||
String title = SErrorCodeEerverConfig.getI18NMessage("item_max_mail_title");
|
||||
String content = SErrorCodeEerverConfig.getI18NMessageNeedConvert("item_max_mail_content", new String[]{}, new int[]{}, "#");
|
||||
|
||||
MailLogic.getInstance().sendMail(user.getId(), title, content, builder.toString(), TimeUtils.nowInt(), GlobalsDef.addReason);
|
||||
}
|
||||
Poster.getPoster().dispatchEvent(new AddItemEvent(user.getId(),itemMap));
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送装备图鉴修改推送
|
||||
*/
|
||||
* 发送装备图鉴修改推送
|
||||
*/
|
||||
private static void SendEquipBookIndication(int _uid,ItemManager _itemManage, List<Integer>_equipList){
|
||||
if (_equipList==null||_equipList.isEmpty())return;
|
||||
List<CommonProto.EquipBookInfo>equipList=new ArrayList<>();
|
||||
|
|
@ -1559,32 +1573,19 @@ public class ItemUtil {
|
|||
}
|
||||
SItem sItem = SItem.getsItemMap().get(itemId);
|
||||
int itemType = getItemType(sItem);
|
||||
switch (itemType) {
|
||||
case GlobalItemType.ITEM:
|
||||
case GlobalItemType.SOUL_MARK:
|
||||
case GlobalItemType.GOD_SEAL:
|
||||
case GlobalItemType.EQUIP:
|
||||
case GlobalItemType.ESPECIAL_EQUIP:
|
||||
putCountMap(itemId,itemNum,itemMap);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void selectCost(int[][] costItems, Map<Integer, Integer> itemMap,int times) {
|
||||
for (int[] costItem : costItems){
|
||||
int itemId = costItem[0];
|
||||
int itemNum = costItem[1]*times;
|
||||
SItem sItem = SItem.getsItemMap().get(itemId);
|
||||
int itemType = getItemType(sItem);
|
||||
if (itemType == GlobalItemType.ITEM) {
|
||||
putCountMap(itemId, itemNum, itemMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void selectCost(int[][] costItems, Map<Integer, Integer> itemMap, int times) {
|
||||
for (int[] item : costItems) {
|
||||
item[1] = item[1]*times;
|
||||
}
|
||||
selectCost(costItems, itemMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用随机物品
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.ljsd.jieling.logic.activity.ActivityType;
|
|||
import util.TimeUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class ToolsUtil {
|
||||
|
|
@ -70,29 +71,26 @@ public class ToolsUtil {
|
|||
|
||||
// System.out.println("Random Value: " + randomValue);
|
||||
// System.out.println("Start Index: " + startIndex);
|
||||
|
||||
return startIndex;
|
||||
}
|
||||
|
||||
//
|
||||
// /**
|
||||
// *
|
||||
// * @param type 获取1 开始时间2 结束时间
|
||||
// */
|
||||
// public long getTimeLong(long createUserTime,int type) {
|
||||
// long baseTime = startTimeLong;
|
||||
// if(type == 2){
|
||||
// baseTime = endTimeLong;
|
||||
// }
|
||||
// long startTime=0;
|
||||
// if(time ==1){
|
||||
// startTime = baseTime;
|
||||
// }else if(time == 3){
|
||||
// long serverOpenTime = GameApplication.serverConfig.getCacheOpenTime();
|
||||
// startTime = serverOpenTime + baseTime*1000;
|
||||
// }else if(time == 2){
|
||||
// startTime = TimeUtils.getAppointTimeInXDay(createUserTime,0) + baseTime*1000;
|
||||
// }
|
||||
// return startTime;
|
||||
// }
|
||||
/**
|
||||
* list转二位数组
|
||||
*/
|
||||
public static int[][] convertListTo2DArray(List<Integer> list) {
|
||||
int[][] array2D = new int[list.size()][2];
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
int num = list.get(i);
|
||||
|
||||
// 创建一个新的一维数组,并将数值添加到数组中
|
||||
int[] newArray = {num, 1};
|
||||
|
||||
// 将新的一维数组添加到二维数组中
|
||||
array2D[i] = newArray;
|
||||
}
|
||||
|
||||
return array2D;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,6 +59,8 @@ public class SEquipConfig implements BaseConfig,Comparable<SEquipConfig> {
|
|||
|
||||
private int shenYinType;
|
||||
|
||||
private int gift;
|
||||
|
||||
/**
|
||||
* 位置,星级,装备信息
|
||||
*/
|
||||
|
|
@ -201,6 +203,10 @@ public class SEquipConfig implements BaseConfig,Comparable<SEquipConfig> {
|
|||
return shenYinType;
|
||||
}
|
||||
|
||||
public int getGift() {
|
||||
return gift;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(SEquipConfig o) {
|
||||
return this.getStar() - o.getStar();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,39 @@
|
|||
package config;
|
||||
|
||||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="GiftConfig")
|
||||
public class SGiftConfig implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int gift;
|
||||
|
||||
private int box;
|
||||
|
||||
public static Map<Integer, SGiftConfig> map = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
map = STableManager.getConfig(SGiftConfig.class);
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getGift() {
|
||||
return gift;
|
||||
}
|
||||
|
||||
public int getBox() {
|
||||
return box;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue