添加装备图鉴修改推送

back_recharge
yuanshuai 2021-10-14 15:27:14 +08:00
parent 8dceb89111
commit 4fe6e452ea
1 changed files with 37 additions and 4 deletions

View File

@ -33,6 +33,7 @@ import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
import com.ljsd.jieling.logic.store.newRechargeInfo.PushRechargeType;
import com.ljsd.jieling.network.session.ISession;
import rpc.protocols.CommonProto;
import rpc.protocols.HeroInfoProto;
import rpc.protocols.MessageTypeProto;
import rpc.protocols.PlayerInfoProto;
import config.SGameSetting;
@ -598,14 +599,18 @@ public class ItemUtil {
List<CommonProto.Item> sendToFront = new CopyOnWriteArrayList<>();
//超过上限不能直接获得
Map<Integer,Integer> extraItem = new HashMap<>(itemMap.size());
List<Integer>changeEquipList=null;
for (Map.Entry<Integer, Long> entry : itemMap.entrySet()) {
SItem sItem = SItem.getsItemMap().get (entry.getKey());
if (sItem.getItemBaseType()==6){
equipManager.addEquipList(entry.getKey());
}
if (sItem.getItemType()==3){
if (changeEquipList==null) {
changeEquipList=new ArrayList<>();
}
itemManager.setEquipBookMap(entry.getKey(),entry.getValue());
changeEquipList.add(entry.getKey());
}
long itemNumlimit = sItem.getItemNumlimit();
long itemNum = entry.getValue().intValue();
@ -683,6 +688,9 @@ public class ItemUtil {
//日志记录
ItemLogic.getInstance().addItemLog(new ItemLog(user.getId(),0,user.getPlayerInfoManager().getLevel(),String.valueOf(TimeUtils.now()),reason,sItem.getId(),itemNum,item.getItemNum()));
}
//发送装备图鉴修改推送
SendEquipBookIndication(user.getId(),itemManager,changeEquipList);
for(Map.Entry<Integer,Integer> entry:extraItem.entrySet()){
itemProtoList.add(CBean2Proto.getItem(itemManager.getItemMap().get(entry.getKey()),entry.getValue()));
}
@ -723,14 +731,18 @@ public class ItemUtil {
List<CommonProto.Item> sendToFront = new CopyOnWriteArrayList<>();
//超过上限不能直接获得
Map<Integer,Integer> extraItem = new HashMap<>(itemMap.size());
List<Integer>changeEquipList=null;
for (Map.Entry<Integer, Long> entry : itemMap.entrySet()) {
SItem sItem = SItem.getsItemMap().get (entry.getKey());
if (sItem.getItemBaseType()==6){
equipManager.addEquipList(entry.getKey());
}
if (sItem.getItemType()==3){
if (changeEquipList==null) {
changeEquipList=new ArrayList<>();
}
itemManager.setEquipBookMap(entry.getKey(),entry.getValue());
changeEquipList.add(entry.getKey());
}
long itemNumlimit = sItem.getItemNumlimit();
@ -809,6 +821,10 @@ public class ItemUtil {
//日志记录
ItemLogic.getInstance().addItemLog(new ItemLog(user.getId(),0,user.getPlayerInfoManager().getLevel(),String.valueOf(TimeUtils.now()),reason,sItem.getId(),itemNum,item.getItemNum()));
}
//发送装备图鉴修改推送
SendEquipBookIndication(user.getId(),itemManager,changeEquipList);
for(Map.Entry<Integer,Integer> entry:extraItem.entrySet()){
itemProtoList.add(CBean2Proto.getItem(itemManager.getItemMap().get(entry.getKey()),entry.getValue()));
}
@ -832,8 +848,25 @@ public class ItemUtil {
return 1;
}
///发送装备图鉴修改推送
private static void SendEquipBookIndication(int _uid,ItemManager _itemManage, List<Integer>_equipList){
if (_equipList==null||_equipList.isEmpty())return;
List<CommonProto.EquipBookInfo>equipList=new ArrayList<>();
for (Integer integer : _equipList) {
if (_itemManage.getEquipBookMap().containsKey(integer)) {
CommonProto.EquipBookInfo equipInfo=CommonProto.EquipBookInfo.newBuilder()
.setEquipId(integer)
.setNum(_itemManage.getEquipBookMap().get(integer).intValue())
.build();
equipList.add(equipInfo);
}
}
HeroInfoProto.EquipBookIndication build=HeroInfoProto.EquipBookIndication.newBuilder()
.addAllChangeEquipList(equipList)
.build();
ISession sessionByUid = OnlineUserManager.getSessionByUid(_uid);
MessageUtil.sendIndicationMessage(sessionByUid,1, MessageTypeProto.MessageType.EQUIP_BOOK_INDICATION_VALUE,build,true);
}
/**
* //zsx 保留 TODO 由事件分发到 playlogic 去处理