增加修复itemId缺失的道具异常问题
parent
070a7c0235
commit
ead7e335b7
|
@ -179,7 +179,8 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
|||
List<CommonProto.SixiangxinfaInfo> sixiangxinfaInfos = getSixiangxinfaInfos(heroManager);
|
||||
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()
|
||||
|
|
|
@ -112,4 +112,21 @@ public class ItemManager extends MongoBase {
|
|||
this.huashenEnabled.add(id);
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue