法宝替换修改
parent
38c06778f1
commit
e607cb442d
|
@ -601,8 +601,8 @@ public class Hero extends MongoBase implements Comparable<Hero>,Cloneable {
|
||||||
return this.level;
|
return this.level;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBauBlesId(String bauBlesId) {
|
public void setBauBlesId(String bauBles) {
|
||||||
this.bauBlesId = bauBlesId;
|
this.bauBlesId = bauBles;
|
||||||
updateString("bauBlesId", bauBlesId);
|
updateString("bauBlesId", bauBlesId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -839,10 +839,9 @@ public class EquipLogic {
|
||||||
if (hero == null){
|
if (hero == null){
|
||||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE, "英雄不存在");
|
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE, "英雄不存在");
|
||||||
}
|
}
|
||||||
|
String heroBauBlesId = hero.getBauBlesId();
|
||||||
if (baublesId.isEmpty()){
|
if (baublesId.isEmpty()){
|
||||||
// 卸下
|
// 卸下
|
||||||
String heroBauBlesId = hero.getBauBlesId();
|
|
||||||
Baubles baubles = equipManager.getBaubles(heroBauBlesId);
|
Baubles baubles = equipManager.getBaubles(heroBauBlesId);
|
||||||
hero.setBauBlesId("");
|
hero.setBauBlesId("");
|
||||||
baubles.setHeroId("");
|
baubles.setHeroId("");
|
||||||
|
@ -853,16 +852,23 @@ public class EquipLogic {
|
||||||
if (baubles == null || !StringUtil.isEmpty(baubles.getMasterId())){
|
if (baubles == null || !StringUtil.isEmpty(baubles.getMasterId())){
|
||||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE, "法宝不存在或者处于庇佑状态");
|
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE, "法宝不存在或者处于庇佑状态");
|
||||||
}
|
}
|
||||||
|
// 检查英雄和法宝是否各有装备
|
||||||
|
if (!StringUtil.isEmpty(heroBauBlesId)){
|
||||||
|
hero.setBauBlesId("");
|
||||||
|
Baubles heroBauBles = equipManager.getBaubles(heroBauBlesId);
|
||||||
|
if (heroBauBles != null){
|
||||||
|
heroBauBles.setHeroId("");
|
||||||
|
}
|
||||||
|
}
|
||||||
String baublesHeroId = baubles.getHeroId();
|
String baublesHeroId = baubles.getHeroId();
|
||||||
if (!StringUtil.isEmpty(baublesHeroId)){
|
if (!StringUtil.isEmpty(baublesHeroId)){
|
||||||
Hero hero1 = heroManager.getHero(baublesHeroId);
|
baubles.setHeroId("");
|
||||||
hero1.setBauBlesId("");
|
Hero baublesHero = heroManager.getHero(baublesHeroId);
|
||||||
}
|
if (baublesHero != null){
|
||||||
String heroBauBlesId = hero.getBauBlesId();
|
baublesHero.setBauBlesId("");
|
||||||
if (!StringUtil.isEmpty(heroBauBlesId)){
|
}
|
||||||
Baubles baubles1 = equipManager.getBaubles(heroBauBlesId);
|
|
||||||
baubles1.setHeroId("");
|
|
||||||
}
|
}
|
||||||
|
// 装备法宝,双向索引
|
||||||
hero.setBauBlesId(baublesId);
|
hero.setBauBlesId(baublesId);
|
||||||
baubles.setHeroId(heroId);
|
baubles.setHeroId(heroId);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue