Merge branch 'master_dev' into master_assist

master_dev
grimm 2024-04-15 18:00:19 +08:00
commit e1eb601ec1
4 changed files with 24 additions and 16 deletions

View File

@ -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);
} }

View File

@ -29,8 +29,8 @@ public class Item extends MongoBase {
} }
public void setItemId(int itemId){ public void setItemId(int itemId){
updateString("itemId", itemId);
this.itemId = itemId; this.itemId = itemId;
updateString("itemId", itemId);
} }
public long getItemNum() { public long getItemNum() {
@ -38,8 +38,8 @@ public class Item extends MongoBase {
} }
public void setItemNum(long itemNum){ public void setItemNum(long itemNum){
updateString("itemNum", itemNum);
this.itemNum = itemNum; this.itemNum = itemNum;
updateString("itemNum", itemNum);
} }
public int getEndingTime() { public int getEndingTime() {
@ -47,7 +47,7 @@ public class Item extends MongoBase {
} }
public void setEndingTime(int endingTime){ public void setEndingTime(int endingTime){
updateString("endingTime", endingTime);
this.endingTime = endingTime; this.endingTime = endingTime;
updateString("endingTime", endingTime);
} }
} }

View File

@ -637,6 +637,7 @@ public class EquipLogic {
if (!cost){ if (!cost){
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH); throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
} }
CommonProto.Drop.Builder drop = ItemUtil.drop(user, new int[][]{{giftId, 1}}, BIReason.GIFT_UP_STAR_GET); CommonProto.Drop.Builder drop = ItemUtil.drop(user, new int[][]{{giftId, 1}}, BIReason.GIFT_UP_STAR_GET);
ItemUtil.itemCost(user, costList, BIReason.GIFT_UP_STAR_COST, 0); ItemUtil.itemCost(user, costList, BIReason.GIFT_UP_STAR_COST, 0);
HeroInfoProto.GiftEquipUpStarResponse.Builder builder = HeroInfoProto.GiftEquipUpStarResponse.newBuilder().setDrop(drop); HeroInfoProto.GiftEquipUpStarResponse.Builder builder = HeroInfoProto.GiftEquipUpStarResponse.newBuilder().setDrop(drop);
@ -839,10 +840,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 +853,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);
} }

View File

@ -1067,7 +1067,7 @@ public class ItemUtil {
switch (itemId){ switch (itemId){
case ReportUtil.COIN_ID: case ReportUtil.COIN_ID:
if(type==1){ if(type==1){
item =ReportEventEnum.GET_COINS; item = ReportEventEnum.GET_COINS;
}else{ }else{
item = ReportEventEnum.COST_COINS; item = ReportEventEnum.COST_COINS;
} }
@ -1087,7 +1087,8 @@ public class ItemUtil {
} }
break; break;
default: default:
return; item = ReportEventEnum.GET_ITEM;
break;
} }
ReportUtil.onReportEvent(user,item.getType(),itemNum,String.valueOf(reason)); ReportUtil.onReportEvent(user,item.getType(),itemNum,String.valueOf(reason));