白金装备提交
parent
aa21c96a4f
commit
8dceb89111
|
@ -3,13 +3,52 @@ package com.ljsd.jieling.logic.dao;
|
||||||
import com.ljsd.common.mogodb.MongoBase;
|
import com.ljsd.common.mogodb.MongoBase;
|
||||||
import com.ljsd.jieling.logic.dao.root.User;
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
public class ItemManager extends MongoBase {
|
public class ItemManager extends MongoBase {
|
||||||
|
|
||||||
|
|
||||||
private Map<Integer, Item> itemMap = new ConcurrentHashMap<>();
|
private Map<Integer, Item> itemMap = new ConcurrentHashMap<>();
|
||||||
|
///兼容线上数据,计算统计装备(为了做白金装备图鉴,需要初始化统计一次用户身上所有装备)true:已经计算过了 false:未计算
|
||||||
|
private boolean isAbsEquip;
|
||||||
|
|
||||||
|
public boolean getIsAbsEquip() {
|
||||||
|
return isAbsEquip;
|
||||||
|
}
|
||||||
|
public void setAbsEquip(boolean absEquip) {
|
||||||
|
isAbsEquip = absEquip;
|
||||||
|
updateString("isAbsEquip", isAbsEquip);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<Integer, Long> equipBookMap = new HashMap<>();
|
||||||
|
|
||||||
|
public Map<Integer, Long> getEquipBookMap() {
|
||||||
|
return equipBookMap;
|
||||||
|
}
|
||||||
|
public void setEquipBookMap(int equipId,long addNum) {
|
||||||
|
long _num=addNum;
|
||||||
|
if (this.equipBookMap.containsKey(equipId)){
|
||||||
|
_num+=this.equipBookMap.get(equipId);
|
||||||
|
}
|
||||||
|
this.equipBookMap.put(equipId,_num);
|
||||||
|
updateString("equipBookMap." + equipId, _num);
|
||||||
|
}
|
||||||
|
private Set<Integer> equipBookEnabled = new HashSet<>();
|
||||||
|
|
||||||
|
public Set<Integer> getEquipBookEnabled() {
|
||||||
|
return equipBookEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addEquipBookEnabled(int bookId) {
|
||||||
|
this.equipBookEnabled.add(bookId);
|
||||||
|
updateString("equipBookEnabled", equipBookEnabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public ItemManager() {
|
public ItemManager() {
|
||||||
this.setRootCollection(User._COLLECTION_NAME);
|
this.setRootCollection(User._COLLECTION_NAME);
|
||||||
|
|
|
@ -2306,6 +2306,9 @@ public class HeroLogic{
|
||||||
//魂印图鉴加成
|
//魂印图鉴加成
|
||||||
Set<Integer> equipBookEnabled = equipManager.getEquipBookEnabled();
|
Set<Integer> equipBookEnabled = equipManager.getEquipBookEnabled();
|
||||||
bonuses(equipBookEnabled,heroAllAttribute);
|
bonuses(equipBookEnabled,heroAllAttribute);
|
||||||
|
//白金装备加成
|
||||||
|
Set<Integer> whiteBookEnabled = user.getItemManager().getEquipBookEnabled();
|
||||||
|
bonuses(whiteBookEnabled,heroAllAttribute);
|
||||||
//英雄皮肤加成 记得判断皮肤过期
|
//英雄皮肤加成 记得判断皮肤过期
|
||||||
int skin = hero.getSkin();
|
int skin = hero.getSkin();
|
||||||
if(skin!=0){
|
if(skin!=0){
|
||||||
|
@ -3877,9 +3880,33 @@ public class HeroLogic{
|
||||||
for (int enabled:user.getEquipManager().getEquipBookEnabled()){
|
for (int enabled:user.getEquipManager().getEquipBookEnabled()){
|
||||||
builder.addAllBookEnabled(enabled);
|
builder.addAllBookEnabled(enabled);
|
||||||
}
|
}
|
||||||
|
//添加白金装备羁绊
|
||||||
|
for (Integer enabled : user.getItemManager().getEquipBookEnabled()) {
|
||||||
|
builder.addAllBookEnabled(enabled);
|
||||||
|
}
|
||||||
|
|
||||||
for (Integer equip:equipManager.getEquipList()) {
|
for (Integer equip:equipManager.getEquipList()) {
|
||||||
builder.addEquipGot(equip);
|
builder.addEquipGot(equip);
|
||||||
|
}
|
||||||
|
if (!user.getItemManager().getIsAbsEquip()) {
|
||||||
|
for (Map.Entry<Integer, Item> equipEntry : user.getItemManager().getItemMap().entrySet()) {
|
||||||
|
if (SItem.getsItemMap().get(equipEntry.getKey()).getItemType()==3) {
|
||||||
|
user.getItemManager().setEquipBookMap(equipEntry.getValue().getItemId(),equipEntry.getValue().getItemNum());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (Map.Entry<String, Hero> stringHeroEntry : user.getHeroManager().getHeroMap().entrySet()) {
|
||||||
|
for (Map.Entry<Integer, Integer> entry : stringHeroEntry.getValue().getEquipByPositionMap().entrySet()) {
|
||||||
|
user.getItemManager().setEquipBookMap(entry.getValue(),1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
user.getItemManager().setAbsEquip(true);
|
||||||
|
}
|
||||||
|
for (Map.Entry<Integer, Long> entry : user.getItemManager().getEquipBookMap().entrySet()) {
|
||||||
|
CommonProto.EquipBookInfo equipBook=CommonProto.EquipBookInfo.newBuilder()
|
||||||
|
.setEquipId(entry.getKey())
|
||||||
|
.setNum(entry.getValue().intValue())
|
||||||
|
.build();
|
||||||
|
builder.addEquipList(equipBook);
|
||||||
}
|
}
|
||||||
MessageUtil.sendMessage(session,1,MessageTypeProto.MessageType.GET_ALL_PROPERTY_INFO_RESPONSE_VALUE,builder.build(),true);
|
MessageUtil.sendMessage(session,1,MessageTypeProto.MessageType.GET_ALL_PROPERTY_INFO_RESPONSE_VALUE,builder.build(),true);
|
||||||
}
|
}
|
||||||
|
@ -3900,7 +3927,7 @@ public class HeroLogic{
|
||||||
if(user.getPlayerInfoManager().getLevel()<bookConfig.getOpenLevel()){
|
if(user.getPlayerInfoManager().getLevel()<bookConfig.getOpenLevel()){
|
||||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||||
}
|
}
|
||||||
int[] teamers = bookConfig.getTeamers();
|
int[][] teamers = bookConfig.getTeamers();
|
||||||
int[][] reward = bookConfig.getReward();
|
int[][] reward = bookConfig.getReward();
|
||||||
CommonProto.Drop.Builder drop = null;
|
CommonProto.Drop.Builder drop = null;
|
||||||
//神将激活
|
//神将激活
|
||||||
|
@ -3918,9 +3945,8 @@ public class HeroLogic{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//判断羁绊神将是否在集合
|
//判断羁绊神将是否在集合
|
||||||
for(int tmp:teamers){
|
for(int[]tmp:teamers){
|
||||||
if(!hero.contains(tmp)){
|
if(!hero.contains(tmp[0])){
|
||||||
System.out.println(tmp);
|
|
||||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3935,8 +3961,8 @@ public class HeroLogic{
|
||||||
if(equipManager.getEquipBookEnabled().contains(bookId)){
|
if(equipManager.getEquipBookEnabled().contains(bookId)){
|
||||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||||
}
|
}
|
||||||
for (int equip:teamers){
|
for (int[]equip:teamers){
|
||||||
if (!equipManager.getEquipList().contains(equip)){
|
if (!equipManager.getEquipList().contains(equip[0])){
|
||||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3950,14 +3976,29 @@ public class HeroLogic{
|
||||||
if(pokemonManager.getPokemonBookEnabled().contains(bookId)){
|
if(pokemonManager.getPokemonBookEnabled().contains(bookId)){
|
||||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||||
}
|
}
|
||||||
for(int pokemon:teamers){
|
for(int[]pokemon:teamers){
|
||||||
if(!pokemonManager.getPokemonGot().contains(pokemon)){
|
if(!pokemonManager.getPokemonGot().contains(pokemon[0])){
|
||||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pokemonManager.addPokemonBookEnabled(bookId);
|
pokemonManager.addPokemonBookEnabled(bookId);
|
||||||
drop = ItemUtil.drop(user,reward , BIReason.ACTIVATION_HERO_FETTER);
|
drop = ItemUtil.drop(user,reward , BIReason.ACTIVATION_HERO_FETTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//白金装备激活
|
||||||
|
if(bookConfig.getFetterType()==4){
|
||||||
|
ItemManager itemManager = user.getItemManager();
|
||||||
|
if(itemManager.getEquipBookEnabled().contains(bookId)){
|
||||||
|
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||||
|
}
|
||||||
|
for(int[]pokemon:teamers){
|
||||||
|
if(!itemManager.getEquipBookMap().containsKey(pokemon[0])||itemManager.getEquipBookMap().get(pokemon[0])<pokemon[1]){
|
||||||
|
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
itemManager.addEquipBookEnabled(bookId);
|
||||||
|
drop = ItemUtil.drop(user,reward , BIReason.ACTIVATION_HERO_FETTER);
|
||||||
|
}
|
||||||
PlayerInfoProto.UseAndPriceItemResponse.Builder useAndPriceItemResponse = PlayerInfoProto.UseAndPriceItemResponse.newBuilder();
|
PlayerInfoProto.UseAndPriceItemResponse.Builder useAndPriceItemResponse = PlayerInfoProto.UseAndPriceItemResponse.newBuilder();
|
||||||
if (drop != null) {
|
if (drop != null) {
|
||||||
useAndPriceItemResponse.setDrop(drop);
|
useAndPriceItemResponse.setDrop(drop);
|
||||||
|
|
|
@ -604,6 +604,9 @@ public class ItemUtil {
|
||||||
if (sItem.getItemBaseType()==6){
|
if (sItem.getItemBaseType()==6){
|
||||||
equipManager.addEquipList(entry.getKey());
|
equipManager.addEquipList(entry.getKey());
|
||||||
}
|
}
|
||||||
|
if (sItem.getItemType()==3){
|
||||||
|
itemManager.setEquipBookMap(entry.getKey(),entry.getValue());
|
||||||
|
}
|
||||||
long itemNumlimit = sItem.getItemNumlimit();
|
long itemNumlimit = sItem.getItemNumlimit();
|
||||||
long itemNum = entry.getValue().intValue();
|
long itemNum = entry.getValue().intValue();
|
||||||
if(itemNum <= 0){
|
if(itemNum <= 0){
|
||||||
|
@ -726,6 +729,9 @@ public class ItemUtil {
|
||||||
if (sItem.getItemBaseType()==6){
|
if (sItem.getItemBaseType()==6){
|
||||||
equipManager.addEquipList(entry.getKey());
|
equipManager.addEquipList(entry.getKey());
|
||||||
}
|
}
|
||||||
|
if (sItem.getItemType()==3){
|
||||||
|
itemManager.setEquipBookMap(entry.getKey(),entry.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
long itemNumlimit = sItem.getItemNumlimit();
|
long itemNumlimit = sItem.getItemNumlimit();
|
||||||
long itemNum = entry.getValue().intValue();
|
long itemNum = entry.getValue().intValue();
|
||||||
|
|
|
@ -10,7 +10,7 @@ public class SSpiritAnimalBook implements BaseConfig {
|
||||||
|
|
||||||
private int id;
|
private int id;
|
||||||
|
|
||||||
private int[] teamers;
|
private int[][] teamers;
|
||||||
|
|
||||||
private int[][] activePara;
|
private int[][] activePara;
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ public class SSpiritAnimalBook implements BaseConfig {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int[] getTeamers() {
|
public int[][] getTeamers() {
|
||||||
return teamers;
|
return teamers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue