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