增加修复itemId缺失的道具异常问题

detached
DESKTOP-C3M45P4\dengdan 2024-09-24 16:21:48 +08:00
parent 070a7c0235
commit ead7e335b7
2 changed files with 19 additions and 1 deletions

View File

@ -179,7 +179,8 @@ public class GetPlayerInfoHandler extends BaseHandler{
List<CommonProto.SixiangxinfaInfo> sixiangxinfaInfos = getSixiangxinfaInfos(heroManager); List<CommonProto.SixiangxinfaInfo> sixiangxinfaInfos = getSixiangxinfaInfos(heroManager);
List<CommonProto.PracticeSkillInfo> practiceSkillInfos = getPracticeSkillInfos(heroManager); List<CommonProto.PracticeSkillInfo> practiceSkillInfos = getPracticeSkillInfos(heroManager);
List<CommonProto.FaBaoSoulInfo> faBaoSoulInfos = getFaBaoSoulInfos(heroManager); List<CommonProto.FaBaoSoulInfo> faBaoSoulInfos = getFaBaoSoulInfos(heroManager);
// 道具修复
user.getItemManager().checkItem();
// 开服时间戳 // 开服时间戳
long openTime = TimeUtils.stringToTimeLong2(GameApplication.serverConfig.getOpenTime()); long openTime = TimeUtils.stringToTimeLong2(GameApplication.serverConfig.getOpenTime());
PlayerInfoProto.GetPlayerInfoResponse getPlayerInfoResponse = PlayerInfoProto.GetPlayerInfoResponse.newBuilder() PlayerInfoProto.GetPlayerInfoResponse getPlayerInfoResponse = PlayerInfoProto.GetPlayerInfoResponse.newBuilder()

View File

@ -112,4 +112,21 @@ public class ItemManager extends MongoBase {
this.huashenEnabled.add(id); this.huashenEnabled.add(id);
updateString("huashenEnabled", huashenEnabled); updateString("huashenEnabled", huashenEnabled);
} }
/**
* itemId
*/
public void checkItem(){
if(itemMap != null){
for(int itemId : itemMap.keySet()){
Item item= itemMap.get(itemId);
if(item != null){
//itemId缺失或者不匹配,需重构
if(item.getItemId() == 0 || item.getItemId() != itemId){
item = this.newItem(itemId,item.getItemNum());
}
}
}
}
}
} }