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;
}
public void setBauBlesId(String bauBlesId) {
this.bauBlesId = bauBlesId;
public void setBauBlesId(String bauBles) {
this.bauBlesId = bauBles;
updateString("bauBlesId", bauBlesId);
}

View File

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

View File

@ -637,6 +637,7 @@ public class EquipLogic {
if (!cost){
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
}
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);
HeroInfoProto.GiftEquipUpStarResponse.Builder builder = HeroInfoProto.GiftEquipUpStarResponse.newBuilder().setDrop(drop);
@ -839,10 +840,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 +853,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);
}

View File

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