原有的升级通知更换到setLevel外边,因为这个方法不只是升级用,也可能归送

hero实现clone接口,对象克隆
back_recharge
duhui 2021-03-15 16:18:16 +08:00
parent f85e86a2eb
commit 15fbc91a9b
4 changed files with 112 additions and 88 deletions

View File

@ -16,6 +16,7 @@ import com.ljsd.jieling.handler.map.*;
import com.ljsd.jieling.logic.dao.*; import com.ljsd.jieling.logic.dao.*;
import com.ljsd.jieling.logic.dao.root.User; import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.fight.CombatLogic; import com.ljsd.jieling.logic.fight.CombatLogic;
import com.ljsd.jieling.logic.mission.GameEvent;
import com.ljsd.jieling.logic.mission.main.VipMissionIdsType; import com.ljsd.jieling.logic.mission.main.VipMissionIdsType;
import com.ljsd.jieling.logic.player.PlayerLogic; import com.ljsd.jieling.logic.player.PlayerLogic;
import com.ljsd.jieling.netty.cocdex.PacketNetData; import com.ljsd.jieling.netty.cocdex.PacketNetData;
@ -153,7 +154,8 @@ public class GMRequestHandler extends BaseHandler{
Map<Integer, SCHeroRankUpConfig> scHeroRankUpConfigByType = STableManager.getFigureConfig(HeroStaticConfig.class).getScHeroRankUpConfigByShow(GlobalsDef.UP_STAR_TYPE,scHero.getStar()); Map<Integer, SCHeroRankUpConfig> scHeroRankUpConfigByType = STableManager.getFigureConfig(HeroStaticConfig.class).getScHeroRankUpConfigByShow(GlobalsDef.UP_STAR_TYPE,scHero.getStar());
Map<Integer, SCHeroRankUpConfig> scHeroRankUpConfigByTypeTree = new TreeMap<>(scHeroRankUpConfigByType); Map<Integer, SCHeroRankUpConfig> scHeroRankUpConfigByTypeTree = new TreeMap<>(scHeroRankUpConfigByType);
SCHeroRankUpConfig scHeroRankUpConfig = ((TreeMap<Integer, SCHeroRankUpConfig>) scHeroRankUpConfigByTypeTree).lowerEntry(hero.getStar()).getValue(); SCHeroRankUpConfig scHeroRankUpConfig = ((TreeMap<Integer, SCHeroRankUpConfig>) scHeroRankUpConfigByTypeTree).lowerEntry(hero.getStar()).getValue();
hero.setLevel(cUser,scHeroRankUpConfig.getOpenLevel()); cUser.getUserMissionManager().onGameEvent(cUser, GameEvent.HERO_LEVEL_UP,hero.getOriginalLevel(),scHeroRankUpConfig.getOpenLevel());
hero.setLevel(scHeroRankUpConfig.getOpenLevel());
hero.setStarBreakId(scHeroRankUpConfig.getId()); hero.setStarBreakId(scHeroRankUpConfig.getId());
scHeroRankUpConfigByType = STableManager.getFigureConfig(HeroStaticConfig.class).getScHeroRankUpConfigByShow(GlobalsDef.BREAK_TYPE,scHero.getStar()); scHeroRankUpConfigByType = STableManager.getFigureConfig(HeroStaticConfig.class).getScHeroRankUpConfigByShow(GlobalsDef.BREAK_TYPE,scHero.getStar());
@ -359,7 +361,8 @@ public class GMRequestHandler extends BaseHandler{
} }
heroTmp.upStar(maxStar-heroTmp.getStar()); heroTmp.upStar(maxStar-heroTmp.getStar());
SCHeroRankUpConfig scHeroRankUpConfig = scHeroRankUpConfigByType.get(maxStar-1); SCHeroRankUpConfig scHeroRankUpConfig = scHeroRankUpConfigByType.get(maxStar-1);
heroTmp.setLevel(cUser,scHeroRankUpConfig.getOpenLevel()); cUser.getUserMissionManager().onGameEvent(cUser, GameEvent.HERO_LEVEL_UP,heroTmp.getOriginalLevel(),scHeroRankUpConfig.getOpenLevel());
heroTmp.setLevel(scHeroRankUpConfig.getOpenLevel());
heroTmp.setStarBreakId(scHeroRankUpConfig.getId()); heroTmp.setStarBreakId(scHeroRankUpConfig.getId());
scHeroRankUpConfigByType = STableManager.getFigureConfig(HeroStaticConfig.class).getScHeroRankUpConfigByShow(GlobalsDef.BREAK_TYPE,scHero.getStar()); scHeroRankUpConfigByType = STableManager.getFigureConfig(HeroStaticConfig.class).getScHeroRankUpConfigByShow(GlobalsDef.BREAK_TYPE,scHero.getStar());
for(SCHeroRankUpConfig scHeroRankUpConfigBreak :scHeroRankUpConfigByType.values()){ for(SCHeroRankUpConfig scHeroRankUpConfigBreak :scHeroRankUpConfigByType.values()){

View File

@ -4,6 +4,7 @@ import com.ljsd.jieling.config.clazzStaticCfg.HeroStaticConfig;
import com.ljsd.jieling.core.GlobalsDef; import com.ljsd.jieling.core.GlobalsDef;
import com.ljsd.jieling.globals.BIReason; import com.ljsd.jieling.globals.BIReason;
import com.ljsd.jieling.logic.dao.Hero; import com.ljsd.jieling.logic.dao.Hero;
import com.ljsd.jieling.logic.mission.GameEvent;
import rpc.protocols.CommonProto; import rpc.protocols.CommonProto;
import rpc.protocols.Expedition; import rpc.protocols.Expedition;
import com.ljsd.jieling.util.ItemUtil; import com.ljsd.jieling.util.ItemUtil;
@ -40,7 +41,8 @@ public class Cmd_addhero extends GmRoleAbstract{
Map<Integer, SCHeroRankUpConfig> scHeroRankUpConfigByType = STableManager.getFigureConfig(HeroStaticConfig.class).getScHeroRankUpConfigByShow(GlobalsDef.UP_STAR_TYPE,scHero.getStar()); Map<Integer, SCHeroRankUpConfig> scHeroRankUpConfigByType = STableManager.getFigureConfig(HeroStaticConfig.class).getScHeroRankUpConfigByShow(GlobalsDef.UP_STAR_TYPE,scHero.getStar());
Map<Integer, SCHeroRankUpConfig> scHeroRankUpConfigByTypeTree = new TreeMap<>(scHeroRankUpConfigByType); Map<Integer, SCHeroRankUpConfig> scHeroRankUpConfigByTypeTree = new TreeMap<>(scHeroRankUpConfigByType);
SCHeroRankUpConfig scHeroRankUpConfig = ((TreeMap<Integer, SCHeroRankUpConfig>) scHeroRankUpConfigByTypeTree).lowerEntry(hero.getStar()).getValue(); SCHeroRankUpConfig scHeroRankUpConfig = ((TreeMap<Integer, SCHeroRankUpConfig>) scHeroRankUpConfigByTypeTree).lowerEntry(hero.getStar()).getValue();
hero.setLevel(getUser(),scHeroRankUpConfig.getOpenLevel()); getUser().getUserMissionManager().onGameEvent(getUser(), GameEvent.HERO_LEVEL_UP,hero.getOriginalLevel(),scHeroRankUpConfig.getOpenLevel());
hero.setLevel(scHeroRankUpConfig.getOpenLevel());
hero.setStarBreakId(scHeroRankUpConfig.getId()); hero.setStarBreakId(scHeroRankUpConfig.getId());
scHeroRankUpConfigByType = STableManager.getFigureConfig(HeroStaticConfig.class).getScHeroRankUpConfigByShow(GlobalsDef.BREAK_TYPE,scHero.getStar()); scHeroRankUpConfigByType = STableManager.getFigureConfig(HeroStaticConfig.class).getScHeroRankUpConfigByShow(GlobalsDef.BREAK_TYPE,scHero.getStar());

View File

@ -19,7 +19,7 @@ import org.slf4j.LoggerFactory;
import java.util.*; import java.util.*;
public class Hero extends MongoBase { public class Hero extends MongoBase implements Cloneable {
private static final Logger LOGGER = LoggerFactory.getLogger(Hero.class); private static final Logger LOGGER = LoggerFactory.getLogger(Hero.class);
private String id; private String id;
@ -31,15 +31,15 @@ public class Hero extends MongoBase {
private int star; private int star;
private Map<Integer,Integer> equipByPositionMap; private Map<Integer, Integer> equipByPositionMap;
private Map<Integer,Integer> soulEquipByPositionMap; private Map<Integer, Integer> soulEquipByPositionMap;
private int breakId; private int breakId;
private int starBreakId; private int starBreakId;
private int createTime ; private int createTime;
private int lastUpdateEnergyTime; private int lastUpdateEnergyTime;
@ -49,17 +49,18 @@ public class Hero extends MongoBase {
private int isLock; private int isLock;
private int createType ; private int createType;
private int changeId ; private int changeId;
private Set<String> jewelInfo = new HashSet<>(); private Set<String> jewelInfo = new HashSet<>();
private int skin; private int skin;
public Hero(){
public Hero() {
//绑定关系 //绑定关系
this.setRootCollection(User._COLLECTION_NAME); this.setRootCollection(User._COLLECTION_NAME);
} }
public Hero(int uid,int heroTid,int initStar,Hero hero) { public Hero(int uid, int heroTid, int initStar, Hero hero) {
this.setRootCollection(User._COLLECTION_NAME); this.setRootCollection(User._COLLECTION_NAME);
this.id = KeyGenUtils.produceIdByModule(UUIDEnum.HERO, uid); this.id = KeyGenUtils.produceIdByModule(UUIDEnum.HERO, uid);
this.templateId = heroTid; this.templateId = heroTid;
@ -67,35 +68,35 @@ public class Hero extends MongoBase {
SCHero hero1 = SCHero.getsCHero().get(heroTid); SCHero hero1 = SCHero.getsCHero().get(heroTid);
int initCfgStar = hero1.getStar(); int initCfgStar = hero1.getStar();
int maxStar = hero1.getMaxRank(); int maxStar = hero1.getMaxRank();
if(hero.getStar()<initCfgStar){ if (hero.getStar() < initCfgStar) {
this.star =initCfgStar; this.star = initCfgStar;
}else if(hero.getStar()>maxStar){ } else if (hero.getStar() > maxStar) {
this.star=maxStar; this.star = maxStar;
}else { } else {
this.star = hero.getStar(); this.star = hero.getStar();
} }
if(initCfgStar<hero.getStar()){ if (initCfgStar < hero.getStar()) {
Map<Integer, SCHeroRankUpConfig> scHeroRankUpConfigByType = STableManager.getFigureConfig(HeroStaticConfig.class).getScHeroRankUpConfigByShow(GlobalsDef.UP_STAR_TYPE,initCfgStar); Map<Integer, SCHeroRankUpConfig> scHeroRankUpConfigByType = STableManager.getFigureConfig(HeroStaticConfig.class).getScHeroRankUpConfigByShow(GlobalsDef.UP_STAR_TYPE, initCfgStar);
if(scHeroRankUpConfigByType!=null) { if (scHeroRankUpConfigByType != null) {
SCHeroRankUpConfig scHeroRankUpConfig = scHeroRankUpConfigByType.get(hero.getStar()-1); SCHeroRankUpConfig scHeroRankUpConfig = scHeroRankUpConfigByType.get(hero.getStar() - 1);
starBreakId = scHeroRankUpConfig.getId(); starBreakId = scHeroRankUpConfig.getId();
} }
} }
this.equipByPositionMap = new HashMap<>(); this.equipByPositionMap = new HashMap<>();
// this.soulEquipByPositionMap = hero.soulEquipByPositionMap; // this.soulEquipByPositionMap = hero.soulEquipByPositionMap;
this.soulEquipByPositionMap = new HashMap<>(); this.soulEquipByPositionMap = new HashMap<>();
this.breakId = hero.breakId; this.breakId = hero.breakId;
this.createTime = (int)(System.currentTimeMillis()/1000); this.createTime = (int) (System.currentTimeMillis() / 1000);
this.speed = hero.speed; this.speed = hero.speed;
this.especialEquipLevel = hero.especialEquipLevel; this.especialEquipLevel = hero.especialEquipLevel;
this.createType = 1; this.createType = 1;
} }
public Hero(int uid, int heroTid, int initStar){ public Hero(int uid, int heroTid, int initStar) {
this.setRootCollection(User._COLLECTION_NAME); this.setRootCollection(User._COLLECTION_NAME);
this.id = KeyGenUtils.produceIdByModule(UUIDEnum.HERO,uid); this.id = KeyGenUtils.produceIdByModule(UUIDEnum.HERO, uid);
SCHero scHero = SCHero.getsCHero().get(heroTid); SCHero scHero = SCHero.getsCHero().get(heroTid);
this.templateId = scHero.getId(); this.templateId = scHero.getId();
@ -104,24 +105,24 @@ public class Hero extends MongoBase {
this.equipByPositionMap = new HashMap<>(); this.equipByPositionMap = new HashMap<>();
this.soulEquipByPositionMap = new HashMap<>(); this.soulEquipByPositionMap = new HashMap<>();
this.especialEquipLevel = 1; this.especialEquipLevel = 1;
if(initStar!=scHero.getStar()){ if (initStar != scHero.getStar()) {
Map<Integer, SCHeroRankUpConfig> scHeroRankUpConfigByType = STableManager.getFigureConfig(HeroStaticConfig.class).getScHeroRankUpConfigByShow(GlobalsDef.UP_STAR_TYPE,scHero.getStar()); Map<Integer, SCHeroRankUpConfig> scHeroRankUpConfigByType = STableManager.getFigureConfig(HeroStaticConfig.class).getScHeroRankUpConfigByShow(GlobalsDef.UP_STAR_TYPE, scHero.getStar());
if(scHeroRankUpConfigByType!=null) { if (scHeroRankUpConfigByType != null) {
SCHeroRankUpConfig scHeroRankUpConfig = scHeroRankUpConfigByType.get(initStar-1); SCHeroRankUpConfig scHeroRankUpConfig = scHeroRankUpConfigByType.get(initStar - 1);
starBreakId = scHeroRankUpConfig.getId(); starBreakId = scHeroRankUpConfig.getId();
} }
} }
createTime = (int)(System.currentTimeMillis()/1000); createTime = (int) (System.currentTimeMillis() / 1000);
lastUpdateEnergyTime = createTime; lastUpdateEnergyTime = createTime;
breakId = 0; breakId = 0;
jewelInfo = new HashSet<>(2); jewelInfo = new HashSet<>(2);
} }
public void upStar(int upStar) throws Exception { public void upStar(int upStar) {
this.star += upStar; this.star += upStar;
updateString("star",star); updateString("star", star);
} }
@ -129,14 +130,13 @@ public class Hero extends MongoBase {
this.id = id; this.id = id;
} }
public void setLevel(User user,int level) throws Exception { public void setLevel(int level){
user.getUserMissionManager().onGameEvent(user, GameEvent.HERO_LEVEL_UP,this.level,level);
updateString("level",level); updateString("level",level);
this.level = level; this.level = level;
} }
public void setStar(int star) throws Exception { public void setStar(int star) {
updateString("star",star); updateString("star", star);
this.star = star; this.star = star;
} }
@ -145,7 +145,7 @@ public class Hero extends MongoBase {
} }
public void setSpeed(int speed) { public void setSpeed(int speed) {
updateString("speed",speed); updateString("speed", speed);
this.speed = speed; this.speed = speed;
} }
@ -159,6 +159,7 @@ public class Hero extends MongoBase {
/** /**
* 鸿鸿 * 鸿鸿
*
* @param heroManager * @param heroManager
* @return * @return
*/ */
@ -168,15 +169,15 @@ public class Hero extends MongoBase {
int maxLevel = scHero.getMaxLevel(); int maxLevel = scHero.getMaxLevel();
// 如果鸿蒙碑开启 返回鸿蒙系统中神将返回鸿蒙碑等级 // 如果鸿蒙碑开启 返回鸿蒙系统中神将返回鸿蒙碑等级
if (heroManager.getHongmengTablet() > 0){ if (heroManager.getHongmengTablet() > 0) {
// 存在共鸣或者使者 // 存在共鸣或者使者
if (heroManager.getResonances().values().contains(id) || heroManager.getHongmengGuards().values().contains(id)) { if (heroManager.getResonances().values().contains(id) || heroManager.getHongmengGuards().values().contains(id)) {
// 鸿蒙碑超过等级上限,返回鸿蒙碑等级 // 鸿蒙碑超过等级上限,返回鸿蒙碑等级
if (heroManager.getHongmengTablet() <= maxLevel){ if (heroManager.getHongmengTablet() <= maxLevel) {
return heroManager.getHongmengTablet(); return heroManager.getHongmengTablet();
} }
// 最高品质大于等于10的英雄返回鸿蒙碑等级否则返回上限等级 // 最高品质大于等于10的英雄返回鸿蒙碑等级否则返回上限等级
return scHero.getMaxRank() >= 10?heroManager.getHongmengTablet():maxLevel; return scHero.getMaxRank() >= 10 ? heroManager.getHongmengTablet() : maxLevel;
} }
} }
if (heroManager.getResonances().values().contains(id)) { if (heroManager.getResonances().values().contains(id)) {
@ -184,7 +185,7 @@ public class Hero extends MongoBase {
HongMengAddAttribute hongMengAddAttribute = heroManager.getResonanceAddition().get(HongMengAttributeEnum.LEVEL); HongMengAddAttribute hongMengAddAttribute = heroManager.getResonanceAddition().get(HongMengAttributeEnum.LEVEL);
if (hongMengAddAttribute != null) { if (hongMengAddAttribute != null) {
// 是否达到限制等级 // 是否达到限制等级
return hongMengAddAttribute.value >= maxLevel ? maxLevel:hongMengAddAttribute.value; return hongMengAddAttribute.value >= maxLevel ? maxLevel : hongMengAddAttribute.value;
} }
} }
return level; return level;
@ -192,9 +193,10 @@ public class Hero extends MongoBase {
/** /**
* *
*
* @return * @return
*/ */
public int getOriginalLevel (){ public int getOriginalLevel() {
return level; return level;
} }
@ -203,11 +205,11 @@ public class Hero extends MongoBase {
} }
public Map<Integer, Integer> getEquipByPositionMap() { public Map<Integer, Integer> getEquipByPositionMap() {
return equipByPositionMap==null?new HashMap<>():equipByPositionMap; return equipByPositionMap == null ? new HashMap<>() : equipByPositionMap;
} }
public Map<Integer, Integer> getEquipByHongmengPositionMap(HeroManager heroManager) { public Map<Integer, Integer> getEquipByHongmengPositionMap(HeroManager heroManager) {
if (!equipByPositionMap.isEmpty()){ if (!equipByPositionMap.isEmpty()) {
return equipByPositionMap; return equipByPositionMap;
} }
// 英雄在共鸣池中 // 英雄在共鸣池中
@ -217,62 +219,63 @@ public class Hero extends MongoBase {
if (hongMengByEquip != null && hongMengByEquip.value != -1) { if (hongMengByEquip != null && hongMengByEquip.value != -1) {
// 根据星级获取装备位置和信息 // 根据星级获取装备位置和信息
Map<Integer, Integer> map = SEquipConfig.starByPositionMap.get(hongMengByEquip.value); Map<Integer, Integer> map = SEquipConfig.starByPositionMap.get(hongMengByEquip.value);
return map==null?new HashMap<>():map; return map == null ? new HashMap<>() : map;
} }
} }
return equipByPositionMap; return equipByPositionMap;
} }
public void setEquipByPositionMap(Map<Integer, Integer> equipByPositionMap) throws Exception { public void setEquipByPositionMap(Map<Integer, Integer> equipByPositionMap) throws Exception {
updateString("equipByPositionMap",equipByPositionMap); updateString("equipByPositionMap", equipByPositionMap);
this.equipByPositionMap = equipByPositionMap; this.equipByPositionMap = equipByPositionMap;
} }
public void updateEquipPositionMap(int position,int equipId) throws Exception { public void updateEquipPositionMap(int position, int equipId) throws Exception {
updateString("equipByPositionMap." + position ,equipId); updateString("equipByPositionMap." + position, equipId);
this.equipByPositionMap.put(position,equipId); this.equipByPositionMap.put(position, equipId);
} }
public void updateMutliEquipPositionMap(Map<Integer,Integer> equipByPositionMapTmp) throws Exception { public void updateMutliEquipPositionMap(Map<Integer, Integer> equipByPositionMapTmp) throws Exception {
this.equipByPositionMap.putAll(equipByPositionMapTmp); this.equipByPositionMap.putAll(equipByPositionMapTmp);
updateString("equipByPositionMap" ,equipByPositionMap); updateString("equipByPositionMap", equipByPositionMap);
} }
public void removeEquip(int position){ public void removeEquip(int position) {
if (!equipByPositionMap.containsKey(position)){ if (!equipByPositionMap.containsKey(position)) {
return; return;
} }
removeString(getMongoKey()+".equipByPositionMap." + position); removeString(getMongoKey() + ".equipByPositionMap." + position);
this.equipByPositionMap.remove(position); this.equipByPositionMap.remove(position);
} }
public Map<Integer, Integer> getSoulEquipByPositionMap() { public Map<Integer, Integer> getSoulEquipByPositionMap() {
if(soulEquipByPositionMap == null){ if (soulEquipByPositionMap == null) {
Map<Integer,Integer> map = new HashMap<>(); Map<Integer, Integer> map = new HashMap<>();
updateString("soulEquipByPositionMap" ,map); updateString("soulEquipByPositionMap", map);
return map; return map;
}else { } else {
return soulEquipByPositionMap; return soulEquipByPositionMap;
} }
} }
public void updateSoulEquipPositionMap(int position,int equipId) { public void updateSoulEquipPositionMap(int position, int equipId) {
updateString("soulEquipByPositionMap." + position ,equipId); updateString("soulEquipByPositionMap." + position, equipId);
this.soulEquipByPositionMap.put(position,equipId); this.soulEquipByPositionMap.put(position, equipId);
} }
public void removeSoulEquip(int position){ public void removeSoulEquip(int position) {
removeString(getMongoKey()+".soulEquipByPositionMap." + position); removeString(getMongoKey() + ".soulEquipByPositionMap." + position);
this.soulEquipByPositionMap.remove(position); this.soulEquipByPositionMap.remove(position);
} }
/** /**
* breaId 鸿 * breaId 鸿
*
* @param heroManager * @param heroManager
* @return * @return
*/ */
public int getBreakIdByHongMeng(HeroManager heroManager){ public int getBreakIdByHongMeng(HeroManager heroManager) {
// 英雄在共鸣池中 // 英雄在共鸣池中
if (heroManager.getResonances().values().contains(id) || heroManager.getHongmengGuards().values().contains(id)) { if (heroManager.getResonances().values().contains(id) || heroManager.getHongmengGuards().values().contains(id)) {
return HeroLogic.getInstance().calRobotBreaByLevel(templateId, getLevel(heroManager)); return HeroLogic.getInstance().calRobotBreaByLevel(templateId, getLevel(heroManager));
@ -285,7 +288,7 @@ public class Hero extends MongoBase {
} }
public void setBreakId(int breakId) throws Exception { public void setBreakId(int breakId) throws Exception {
updateString("breakId",breakId); updateString("breakId", breakId);
this.breakId = breakId; this.breakId = breakId;
} }
@ -294,14 +297,13 @@ public class Hero extends MongoBase {
} }
public void setCreateTime(int createTime) throws Exception { public void setCreateTime(int createTime) throws Exception {
updateString("createTime",createTime); updateString("createTime", createTime);
this.createTime = createTime; this.createTime = createTime;
} }
public void setLastUpdateEnergyTime(int lastUpdateEnergyTime) throws Exception { public void setLastUpdateEnergyTime(int lastUpdateEnergyTime) throws Exception {
updateString("lastUpdateEnergyTime",lastUpdateEnergyTime); updateString("lastUpdateEnergyTime", lastUpdateEnergyTime);
this.lastUpdateEnergyTime = lastUpdateEnergyTime; this.lastUpdateEnergyTime = lastUpdateEnergyTime;
} }
@ -314,12 +316,13 @@ public class Hero extends MongoBase {
} }
public void setStarBreakId(int starBreakId) { public void setStarBreakId(int starBreakId) {
updateString("starBreakId",starBreakId); updateString("starBreakId", starBreakId);
this.starBreakId = starBreakId; this.starBreakId = starBreakId;
} }
public void updateEspecial(int especialEquipLevel){
public void updateEspecial(int especialEquipLevel) {
this.especialEquipLevel = especialEquipLevel; this.especialEquipLevel = especialEquipLevel;
updateString("especialEquipLevel",especialEquipLevel); updateString("especialEquipLevel", especialEquipLevel);
} }
@ -328,22 +331,26 @@ public class Hero extends MongoBase {
} }
public void setIsLock(int isLock) { public void setIsLock(int isLock) {
updateString("isLock",isLock); updateString("isLock", isLock);
this.isLock = isLock; this.isLock = isLock;
} }
public void setEspecialEquipLevel(int especialEquipLevel) {
this.especialEquipLevel = especialEquipLevel;
}
public int getEspecialEquipLevel() { public int getEspecialEquipLevel() {
return especialEquipLevel; return especialEquipLevel;
} }
public int getEspecialEquipLevelByHongmeng(HeroManager heroManager,String heroId) { public int getEspecialEquipLevelByHongmeng(HeroManager heroManager, String heroId) {
// 英雄在共鳴池中 // 英雄在共鳴池中
if (heroManager.getResonances().values().contains(heroId)) { if (heroManager.getResonances().values().contains(heroId)) {
// 法宝 // 法宝
HongMengAddAttribute hongMengAddAttribute = heroManager.getResonanceAddition().get(HongMengAttributeEnum.MAGIC_WEAPON); HongMengAddAttribute hongMengAddAttribute = heroManager.getResonanceAddition().get(HongMengAttributeEnum.MAGIC_WEAPON);
if (hongMengAddAttribute != null){ if (hongMengAddAttribute != null) {
// 对比本身和共鸣等级,选高的 // 对比本身和共鸣等级,选高的
return especialEquipLevel >= hongMengAddAttribute.value?especialEquipLevel:hongMengAddAttribute.value; return especialEquipLevel >= hongMengAddAttribute.value ? especialEquipLevel : hongMengAddAttribute.value;
} }
} }
return especialEquipLevel; return especialEquipLevel;
@ -353,18 +360,19 @@ public class Hero extends MongoBase {
return jewelInfo; return jewelInfo;
} }
public void addJewel(String jewelId){ public void addJewel(String jewelId) {
jewelInfo.add(jewelId); jewelInfo.add(jewelId);
updateString("jewelInfo",jewelInfo); updateString("jewelInfo", jewelInfo);
} }
public void removeJewel(String jewelId){
public void removeJewel(String jewelId) {
jewelInfo.remove(jewelId); jewelInfo.remove(jewelId);
updateString("jewelInfo",jewelInfo); updateString("jewelInfo", jewelInfo);
} }
public void setJewelInfo(Set<String> jewelInfo) { public void setJewelInfo(Set<String> jewelInfo) {
this.jewelInfo = jewelInfo; this.jewelInfo = jewelInfo;
updateString("jewelInfo",this.jewelInfo); updateString("jewelInfo", this.jewelInfo);
} }
public int getCreateType() { public int getCreateType() {
@ -373,13 +381,13 @@ public class Hero extends MongoBase {
public void setCreateType(int createType) { public void setCreateType(int createType) {
this.createType = createType; this.createType = createType;
updateString("createType",createType); updateString("createType", createType);
} }
public void setChangeId(int changeId) { public void setChangeId(int changeId) {
this.changeId = changeId; this.changeId = changeId;
updateString("changeId",changeId); updateString("changeId", changeId);
} }
public int getChangeId() { public int getChangeId() {
@ -392,7 +400,17 @@ public class Hero extends MongoBase {
public void setSkin(int skin) { public void setSkin(int skin) {
this.skin = skin; this.skin = skin;
updateString("skin",skin); updateString("skin", skin);
}
@Override
public Hero clone() {
Hero hero = null;
try {
hero = (Hero) super.clone();
} catch (CloneNotSupportedException e) {
e.printStackTrace();
}
return hero;
} }
} }

View File

@ -694,7 +694,8 @@ public class HeroLogic {
} }
if(!isBreak){ if(!isBreak){
hero.setLevel( user,targetLevel); user.getUserMissionManager().onGameEvent(user, GameEvent.HERO_LEVEL_UP,hero.getOriginalLevel(),targetLevel);
hero.setLevel(targetLevel);
}else{ }else{
hero.setBreakId(breakId); hero.setBreakId(breakId);
user.getUserMissionManager().onGameEvent(user,GameEvent.HERO_UP,1); user.getUserMissionManager().onGameEvent(user,GameEvent.HERO_UP,1);
@ -2355,7 +2356,7 @@ public class HeroLogic {
itemNum.add(item.getItemNum()); itemNum.add(item.getItemNum());
}); });
ReportUtil.onReportEvent(user,ReportEventEnum.HERO_COMPOSITION.getType(),String.valueOf(hero.getTemplateId()),hero.getLevel(user.getHeroManager()),hero.getStar(),itemId,itemNum); ReportUtil.onReportEvent(user,ReportEventEnum.HERO_COMPOSITION.getType(),String.valueOf(hero.getTemplateId()),hero.getLevel(user.getHeroManager()),hero.getStar(),itemId,itemNum);
hero.setLevel(user,1); hero.setLevel(1);
hero.setBreakId(0); hero.setBreakId(0);
HeroInfoProto.HeroReturnResponse build = HeroInfoProto.HeroReturnResponse.newBuilder().setDrop(drop).build(); HeroInfoProto.HeroReturnResponse build = HeroInfoProto.HeroReturnResponse.newBuilder().setDrop(drop).build();
MessageUtil.sendMessage(session,1,responseMsgId,build,true); MessageUtil.sendMessage(session,1,responseMsgId,build,true);