大闹天宫招募
parent
9cc1fd8fc9
commit
0ef63cdd79
|
@ -67,6 +67,7 @@ public class HeroNodeGetInfoRequestHandler extends BaseHandler<Expedition.HeroNo
|
|||
|
||||
|
||||
Map<String, Hero> heroMapTemp = user.getExpeditionManager().getHeroMapTemp(nodeId);
|
||||
|
||||
if(heroMapTemp.size()==0){
|
||||
int poolId = sExpeditionNodeConfig.getPoolId();
|
||||
TreeSet<Integer> randomTid = ExpeditionLogic.getRandomTid(poolId, recruitTime);
|
||||
|
@ -82,11 +83,13 @@ public class HeroNodeGetInfoRequestHandler extends BaseHandler<Expedition.HeroNo
|
|||
throw new ErrorCodeException("招募节点英雄掉落失败");
|
||||
}
|
||||
|
||||
int level = 200;
|
||||
int star = 8;
|
||||
for (Integer integer:randomTid) {
|
||||
SExpeditionRecruitConfig sExpeditionRecruitConfig = STableManager.getConfig(SExpeditionRecruitConfig.class).get(integer);
|
||||
if(sExpeditionRecruitConfig!=null) {
|
||||
int i = sExpeditionRecruitConfig.getHeroId();
|
||||
ExpeditionLogic.createHero(i, uid, hero, nodeId);
|
||||
ExpeditionLogic.createRandomHero(i, uid, hero, nodeId,level,star);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
package com.ljsd.jieling.logic.dao;
|
||||
|
||||
import com.ljsd.common.mogodb.MongoBase;
|
||||
import com.ljsd.jieling.logic.activity.event.EquipEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.activity.event.RemoveHeroEvent;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import config.SExpeditionHolyConfig;
|
||||
import org.springframework.data.annotation.Transient;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
|
|
|
@ -12,12 +12,14 @@ import com.ljsd.jieling.util.UUIDEnum;
|
|||
import config.SCHero;
|
||||
import config.SCHeroRankUpConfig;
|
||||
import config.SEquipConfig;
|
||||
import config.SItem;
|
||||
import manager.STableManager;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class Hero extends MongoBase implements Comparable<Hero> {
|
||||
|
||||
|
@ -63,10 +65,10 @@ public class Hero extends MongoBase implements Comparable<Hero> {
|
|||
this.setRootCollection(User._COLLECTION_NAME);
|
||||
this.id = KeyGenUtils.produceIdByModule(UUIDEnum.HERO, uid);
|
||||
this.templateId = heroTid;
|
||||
this.level = initStar;
|
||||
this.level = initStar;//
|
||||
SCHero hero1 = SCHero.getsCHero().get(heroTid);
|
||||
int initCfgStar = hero1.getStar();
|
||||
int maxStar = hero1.getMaxRank();
|
||||
int maxStar = hero1.getMaxRank(); //最高星级
|
||||
if(hero.getStar()<initCfgStar){
|
||||
this.star =initCfgStar;
|
||||
}else if(hero.getStar()>maxStar){
|
||||
|
@ -92,6 +94,23 @@ public class Hero extends MongoBase implements Comparable<Hero> {
|
|||
this.especialEquipLevel = hero.especialEquipLevel;
|
||||
this.createType = 1;
|
||||
}
|
||||
//~~~~~
|
||||
public Hero(int uid,int heroTid,int level,int star,Hero hero) {
|
||||
this.setRootCollection(User._COLLECTION_NAME);
|
||||
this.id = KeyGenUtils.produceIdByModule(UUIDEnum.HERO, uid);
|
||||
this.templateId = heroTid;
|
||||
this.level = level;//
|
||||
this.star = star;
|
||||
|
||||
this.equipByPositionMap = new HashMap<>();
|
||||
// this.soulEquipByPositionMap = hero.soulEquipByPositionMap;
|
||||
this.soulEquipByPositionMap = new HashMap<>();
|
||||
this.breakId = hero.breakId;
|
||||
this.createTime = (int)(System.currentTimeMillis()/1000);
|
||||
this.speed = hero.speed;
|
||||
this.especialEquipLevel = hero.especialEquipLevel;
|
||||
this.createType = 1;
|
||||
}
|
||||
|
||||
public Hero(int uid, int heroTid, int initStar){
|
||||
this.setRootCollection(User._COLLECTION_NAME);
|
||||
|
|
|
@ -952,20 +952,26 @@ public class ExpeditionLogic {
|
|||
|
||||
for (Map.Entry<Integer, Integer> next : hero.getEquipByPositionMap().entrySet()) {
|
||||
int equipId = next.getValue();
|
||||
// if (equip == null) {
|
||||
// continue;
|
||||
// }
|
||||
//// if(isTemp){
|
||||
//// user.getExpeditionManager().addEquipToTemp(user, newequip);
|
||||
//// }else {
|
||||
// user.getExpeditionManager().addEquip(user, newequip);
|
||||
// // }
|
||||
|
||||
newHero.updateEquipPositionMap(next.getKey(), equipId);
|
||||
}
|
||||
|
||||
|
||||
Set<String> jewelInfo = hero.getJewelInfo();
|
||||
|
||||
addExpeditionJewel(jewelInfo,user,hero1,newHero);
|
||||
|
||||
updateExpenditionSoulEquip(hero.getSoulEquipByPositionMap(),user,newHero,tempid);
|
||||
|
||||
|
||||
if(isTemp){
|
||||
user.getExpeditionManager().addHeroToTemp(newHero,nodeId);
|
||||
}else {
|
||||
user.getExpeditionManager().addHero(newHero);
|
||||
}
|
||||
return newHero;
|
||||
}
|
||||
//添加宝物
|
||||
private static void addExpeditionJewel(Set<String> jewelInfo, User user, SCHero hero1, Hero newHero) throws Exception {
|
||||
for (String jewel : jewelInfo) {
|
||||
PropertyItem propertyItem = user.getEquipManager().getEquipMap().get(jewel);
|
||||
if (propertyItem == null) {
|
||||
|
@ -988,9 +994,10 @@ public class ExpeditionLogic {
|
|||
// }
|
||||
newHero.addJewel(newequip.getId());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Map<Integer, Integer> soulEquipByPositionMap = hero.getSoulEquipByPositionMap();
|
||||
//添加魂印
|
||||
private static void updateExpenditionSoulEquip(Map<Integer, Integer> soulEquipByPositionMap, User user, Hero newHero, int tempid){
|
||||
for (Map.Entry<Integer,Integer> entry:soulEquipByPositionMap.entrySet()) {
|
||||
SEquipConfig sEquipConfig = STableManager.getConfig(SEquipConfig.class).get(entry.getValue());
|
||||
if (sEquipConfig == null) {
|
||||
|
@ -1013,6 +1020,45 @@ public class ExpeditionLogic {
|
|||
}
|
||||
newHero.updateSoulEquipPositionMap(entry.getKey(),entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//~~~~~~~~
|
||||
public static Hero createRandomHero(int tempid,int uid,Hero hero,int nodeId,int level,int star)throws Exception{
|
||||
|
||||
boolean isTemp = nodeId != -1;
|
||||
User user = UserManager.getUser(uid);
|
||||
SExpeditionSetting sExpeditionSetting = STableManager.getConfig(SExpeditionSetting.class).get(1);
|
||||
if (sExpeditionSetting == null) {
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||
}
|
||||
//random star
|
||||
SCHero hero1 = SCHero.getsCHero().get(tempid);
|
||||
if (hero1 == null) {
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||
}
|
||||
|
||||
SCHeroRankUpConfig scHeroRankUpConfig = STableManager.getConfig(SCHeroRankUpConfig.class).get(star);
|
||||
if (null != scHeroRankUpConfig && level > scHeroRankUpConfig.getOpenLevel()) {
|
||||
level = scHeroRankUpConfig.getOpenLevel();
|
||||
}
|
||||
|
||||
|
||||
//random tempid
|
||||
Hero newHero = new Hero(uid,tempid,level,star,hero);
|
||||
|
||||
|
||||
for (Map.Entry<Integer, Integer> next : hero.getEquipByPositionMap().entrySet()) {
|
||||
int equipId = next.getValue();
|
||||
newHero.updateEquipPositionMap(next.getKey(), equipId);
|
||||
}
|
||||
|
||||
|
||||
Set<String> jewelInfo = hero.getJewelInfo();
|
||||
|
||||
addExpeditionJewel(jewelInfo,user,hero1,newHero);
|
||||
|
||||
updateExpenditionSoulEquip(hero.getSoulEquipByPositionMap(),user,newHero,tempid);
|
||||
|
||||
|
||||
if(isTemp){
|
||||
|
@ -1023,6 +1069,7 @@ public class ExpeditionLogic {
|
|||
return newHero;
|
||||
}
|
||||
|
||||
|
||||
public static TreeSet<Integer> getRandomTid(int type,int size)throws ErrorCodeException{
|
||||
|
||||
//select collections
|
||||
|
|
Loading…
Reference in New Issue