法宝丢失问题,助战克隆导致入库数据异常处理
parent
0eb673e594
commit
ea310891c5
|
@ -15,6 +15,13 @@ public class Baubles extends PropertyItem{
|
|||
public Baubles() {
|
||||
}
|
||||
|
||||
// 克隆
|
||||
public Baubles(Baubles baubles) {
|
||||
super(baubles);
|
||||
this.masterId = baubles.getMasterId();
|
||||
this.blessList = new HashSet<>(baubles.getBlessList());
|
||||
}
|
||||
|
||||
public Baubles(int uid, int equipId) {
|
||||
super(uid, equipId);
|
||||
}
|
||||
|
|
|
@ -25,6 +25,15 @@ public class PropertyItem extends MongoBase {
|
|||
this.equipId = equipId;
|
||||
}
|
||||
|
||||
// 克隆
|
||||
public PropertyItem(PropertyItem item) {
|
||||
this.id = item.getId();
|
||||
this.equipId = item.getEquipId();
|
||||
this.level = item.getLevel();
|
||||
this.buildLevel = item.getBuildLevel();
|
||||
this.heroId = item.getHeroId();
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
|
|
@ -287,22 +287,23 @@ public class CBean2Proto {
|
|||
HelpTypeEnum type = HelpTypeEnum.getType(hero.getPropertyId());
|
||||
// 英雄镜像
|
||||
EquipManager equipManager = user.getEquipManager();
|
||||
Hero clone = hero.clone();
|
||||
// 魂宝灵宝镜像
|
||||
List<PropertyItem> jewels = buildPropertyItemList(equipManager, hero.getJewelInfo());
|
||||
List<PropertyItem> jewels = buildPropertyItemList(equipManager, clone.getJewelInfo());
|
||||
// 法相
|
||||
List<PropertyItem> faxiangs = buildPropertyItemList(equipManager, hero.getFaxiangList());
|
||||
List<PropertyItem> faxiangs = buildPropertyItemList(equipManager, clone.getFaxiangList());
|
||||
// 结果返回,援助类型不在这里写
|
||||
HelpHero helpHero = new HelpHero();
|
||||
helpHero.setUid(user.getId());
|
||||
helpHero.setFunctionType(type);
|
||||
helpHero.setCreatTime(TimeUtils.now());
|
||||
helpHero.setHero(hero);
|
||||
helpHero.setHero(clone);
|
||||
helpHero.setState(0);
|
||||
helpHero.setJewels(jewels);
|
||||
helpHero.setFaxiangs(faxiangs);
|
||||
helpHero.setFourTotalTier(user.getPlayerInfoManager().getFourChallengeTotal());
|
||||
helpHero.setBaubles(equipManager.getBaubles(hero.getBauBlesId()));
|
||||
helpHero.setBaublesList(buildBaublesList(equipManager, hero.getBauBlesId()));
|
||||
helpHero.setBaubles(equipManager.getBaubles(clone.getBauBlesId()));
|
||||
helpHero.setBaublesList(buildBaublesList(equipManager, clone.getBauBlesId()));
|
||||
return helpHero;
|
||||
}
|
||||
|
||||
|
@ -310,17 +311,18 @@ public class CBean2Proto {
|
|||
* 克隆装备信息
|
||||
*/
|
||||
public static List<PropertyItem> buildPropertyItemList(EquipManager equipManager, Set<String> infoList){
|
||||
List<PropertyItem> List = new ArrayList<>();
|
||||
List<PropertyItem> items = new ArrayList<>();
|
||||
if (infoList == null || infoList.isEmpty()){
|
||||
return List;
|
||||
return items;
|
||||
}
|
||||
for (String id: infoList){
|
||||
PropertyItem item = equipManager.getEquip(id);
|
||||
if (item != null){
|
||||
List.add(item);
|
||||
PropertyItem clone = new PropertyItem(item);
|
||||
items.add(clone);
|
||||
}
|
||||
}
|
||||
return List;
|
||||
return items;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -338,10 +340,10 @@ public class CBean2Proto {
|
|||
if (blessList != null && !blessList.isEmpty()){
|
||||
for (String id: blessList){
|
||||
Baubles item = equipManager.getBaubles(id);
|
||||
if (item == null){
|
||||
continue;
|
||||
if (item != null){
|
||||
Baubles clone = new Baubles(item);
|
||||
list.add(clone);
|
||||
}
|
||||
list.add(item);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
|
|
Loading…
Reference in New Issue