大闹天宫,招募英雄装备问题处理
parent
a6a71fa7c0
commit
7a3075ffe9
|
@ -6,6 +6,7 @@ import com.ljsd.jieling.exception.ErrorCodeException;
|
|||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.dao.ExpeditionNodeInfo;
|
||||
import com.ljsd.jieling.logic.dao.Hero;
|
||||
import com.ljsd.jieling.logic.dao.PropertyItem;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.expedition.ExpeditionLogic;
|
||||
|
@ -93,20 +94,30 @@ public class HeroNodeGetInfoRequestHandler extends BaseHandler<Expedition.HeroNo
|
|||
|
||||
heroMapTemp.forEach((s, hero) -> {
|
||||
CommonProto.ViewHeroInfo.Builder inner = CommonProto.ViewHeroInfo.newBuilder();
|
||||
|
||||
// 英雄属性
|
||||
Map<Integer, Integer> heroNotBufferAttribute = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero, true, 0);
|
||||
for(Map.Entry<Integer,Integer> item : heroNotBufferAttribute.entrySet()){
|
||||
inner.addSpecialEffects(CommonProto.SpecialEffects.newBuilder().setPropertyId(item.getKey()).setPropertyValue(item.getValue()).build());
|
||||
}
|
||||
for(Integer equipId : hero.getEquipByPositionMap().values()){
|
||||
// 装备
|
||||
for(Integer equipId : hero.getEquipByPositionMap().values()){
|
||||
inner.addEquip(CBean2Proto.getEquipProto(equipId));
|
||||
}
|
||||
// 大闹天宫装备信息
|
||||
Map<String, PropertyItem> equipMap = user.getExpeditionManager().getEquipMap();
|
||||
// 魂宝,灵宝
|
||||
for(String equipId : hero.getJewelInfo()){
|
||||
inner.addEquip(CBean2Proto.getEquipProto(equipMap.get(equipId)));
|
||||
}
|
||||
// 英雄战力
|
||||
inner.setForce(HeroLogic.getInstance().calForce(heroNotBufferAttribute));
|
||||
// 英雄
|
||||
inner.setHero(CBean2Proto.getHero(hero));
|
||||
builder.addViewHeroInfo(inner);
|
||||
user.getExpeditionManager().getGHeroSet().add(hero.getTemplateId());
|
||||
});
|
||||
|
||||
// nodeInfo.setState(ExpeditionLogic.NODESTATE_HERO);
|
||||
return builder.build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -204,23 +204,23 @@ public class ExpeditionManager extends MongoBase {
|
|||
}
|
||||
|
||||
|
||||
public void addEquip(User user, PropertyItem equip) throws Exception {
|
||||
public void addEquip(PropertyItem equip){
|
||||
equip.init(this.getRootId(),getMongoKey() + ".equipMap." + equip.getId());
|
||||
updateString("equipMap." + equip.getId(), equip);
|
||||
equipMap.put(equip.getId(),equip);
|
||||
}
|
||||
|
||||
public void clearEquip() throws Exception {
|
||||
updateString("equipMap", equipMap);
|
||||
public void clearEquip(){
|
||||
equipMap.clear();
|
||||
updateString("equipMap", equipMap);
|
||||
}
|
||||
|
||||
public void clearEquipToTemp() throws Exception {
|
||||
updateString("equipMapTemp" , equipMapTemp);
|
||||
public void clearEquipToTemp(){
|
||||
equipMapTemp.clear();
|
||||
updateString("equipMapTemp" , equipMapTemp);
|
||||
}
|
||||
|
||||
public void addEquipToTemp(User user, PropertyItem equip) throws Exception {
|
||||
public void addEquipToTemp(PropertyItem equip){
|
||||
equip.init(this.getRootId(),getMongoKey() + ".equipMapTemp." + equip.getId());
|
||||
updateString("equipMapTemp." + equip.getId(), equip);
|
||||
equipMapTemp.put(equip.getId(),equip);
|
||||
|
|
|
@ -30,6 +30,15 @@ public class Jewel extends PropertyItem {
|
|||
this.setJewelType(STableManager.getConfig(SJewelConfig.class).get(jewelId).getLocation());
|
||||
}
|
||||
|
||||
public Jewel(int uid,int jewelId,Jewel jewel){
|
||||
this.setRootCollection(User._COLLECTION_NAME);
|
||||
super.setId(KeyGenUtils.produceIdByModule(UUIDEnum.JEWEL, uid));
|
||||
this.setEquipId(jewelId);
|
||||
this.setJewelType(STableManager.getConfig(SJewelConfig.class).get(jewelId).getLocation());
|
||||
this.setBuildLevel(jewel.getBuildLevel());
|
||||
this.setLevel(jewel.getLevel());
|
||||
}
|
||||
|
||||
public int getBuildLevel() {
|
||||
return buildLevel;
|
||||
}
|
||||
|
|
|
@ -617,7 +617,7 @@ public class ExpeditionLogic {
|
|||
* @param newHero
|
||||
* @param type
|
||||
*/
|
||||
private static void addExpeditionJewel(User user,Hero newHero,int type) throws Exception {
|
||||
private static void addExpeditionJewel(User user,Hero newHero,int type){
|
||||
Set<String> jewelInfo = newHero.getJewelInfo();
|
||||
if (jewelInfo == null || jewelInfo.size() <= 0){
|
||||
// 没有魂宝灵宝
|
||||
|
@ -642,15 +642,13 @@ public class ExpeditionLogic {
|
|||
continue;
|
||||
}
|
||||
// 修改装备id为表里类型,1:魂宝,2:灵宝
|
||||
if (jewel.getJewelType() == 1){
|
||||
jewel.setEquipId(equip[0]);
|
||||
}else {
|
||||
jewel.setEquipId(equip[1]);
|
||||
}
|
||||
int jewelId = jewel.getJewelType() == 1?equip[0]:equip[1];
|
||||
|
||||
Jewel jews = new Jewel(user.getId(), jewelId,jewel);
|
||||
// 添加到大闹天宫装备背包,此操作会更新唯一id
|
||||
user.getExpeditionManager().addEquip(user,jewel);
|
||||
user.getExpeditionManager().addEquip(jews);
|
||||
// 新的装备id
|
||||
set.add(jewel.getId());
|
||||
set.add(jews.getId());
|
||||
}
|
||||
newHero.setJewelInfo(set);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue