增加自动修复道具缺失itemId异常的问题
parent
3cdd5403c8
commit
662eb2aa92
|
@ -177,6 +177,8 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
|||
List<CommonProto.PracticeSkillInfo> practiceSkillInfos = getPracticeSkillInfos(heroManager);
|
||||
List<CommonProto.FaBaoSoulInfo> faBaoSoulInfos = getFaBaoSoulInfos(heroManager);
|
||||
|
||||
// 道具修复
|
||||
user.getItemManager().checkItem();
|
||||
// 开服时间戳
|
||||
long openTime = TimeUtils.stringToTimeLong2(GameApplication.serverConfig.getOpenTime());
|
||||
PlayerInfoProto.GetPlayerInfoResponse getPlayerInfoResponse = PlayerInfoProto.GetPlayerInfoResponse.newBuilder()
|
||||
|
|
|
@ -83,4 +83,21 @@ public class ItemManager extends MongoBase {
|
|||
addItem(item);
|
||||
return item;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修复部分道具信息缺失的问题,如没有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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue