升星活动

mengchengzhen 2021-06-22 18:21:50 +08:00
parent 04001f09b6
commit 4bed1f51f9
5 changed files with 33 additions and 3 deletions

View File

@ -137,7 +137,7 @@ public class GetPlayerInfoHandler extends BaseHandler{
Map<Integer, Integer> heroHandBook = heroManager.getHeroHandBook();
List<CommonProto.EveryHeroHandBook> heroHandBookList = new ArrayList<>();
heroHandBook.forEach((k,v)->heroHandBookList.add(CommonProto.EveryHeroHandBook.newBuilder().setHeroId(k).setMaxStar(v).build()));
initHeroStar(user);
Set<Integer> equipHandBookSet = user.getEquipManager().getEquipHandBook().keySet();
int equipPool = user.getEquipManager().getSoulEquipPool();
List<CommonProto.GiftGoodsInfo> goodsBagInfo = new ArrayList<>(SRechargeCommodityNewConfig.configMap.size());
@ -235,5 +235,17 @@ public class GetPlayerInfoHandler extends BaseHandler{
}
}
/**
* map()
* @param user
*/
private void initHeroStar(User user){
if(user.getHeroManager().getHeroStarMap().size()>1){
return;
}
for(Hero hero : user.getHeroManager().getHeroMap().values()){
user.getHeroManager().addHeroStar(hero.getTemplateId(),hero.getStar());
}
}
}

View File

@ -52,7 +52,7 @@ public class HeroStarActivity extends AbstractActivity {
Map<Integer, ActivityProgressInfo> activityProgressInfoMap = activityMission.getActivityMissionMap();
List<SActivityRewardConfig> list = SActivityRewardConfig.getsActivityRewardConfigByActivityId(id);
int maxstar = user.getHeroManager().getHeroHandBook().get(heroId);
int maxstar = user.getHeroManager().getHeroStarMap().get(heroId);
for (SActivityRewardConfig sActivityRewardConfig : list) {
if (maxstar >= sActivityRewardConfig.getValues()[0][1]) {
ActivityProgressInfo activityProgressInfo = activityProgressInfoMap.getOrDefault(sActivityRewardConfig.getId(), null);
@ -60,6 +60,8 @@ public class HeroStarActivity extends AbstractActivity {
continue;
if(activityProgressInfo.getState()<1){
activityProgressInfo.setState(1);
}else{
continue;
}
activityMission.getActivityMissionMap().put(sActivityRewardConfig.getId(), activityProgressInfo);
}
@ -86,7 +88,7 @@ public class HeroStarActivity extends AbstractActivity {
Map<Integer, ActivityProgressInfo> activityProgressInfoMap = activityMission.getActivityMissionMap();
List<SActivityRewardConfig> list = SActivityRewardConfig.getsActivityRewardConfigByActivityId(id);
heroId = list.get(0).getValues()[0][0];
Integer maxstar = user.getHeroManager().getHeroHandBook().get(heroId);
Integer maxstar = user.getHeroManager().getHeroStarMap().get(heroId);
if(maxstar == null){
return;
}

View File

@ -5,6 +5,7 @@ public class FiveStarGetEvent implements IEvent {
private int heroid;
public FiveStarGetEvent(int uid,int heroid){
this.uid = uid;
this.heroid = heroid;
}

View File

@ -30,6 +30,7 @@ public class HeroManager extends MongoBase {
private Map<Integer,Integer> heroHandBook = new HashMap<>();
private Set<Integer> heroHandBookEnabled = new HashSet<>();
private Map<Integer,Integer> heroStarMap = new HashMap<>();
private Map<String,Hero> endlessHeroInfo = new HashMap<>();
@ -96,6 +97,7 @@ public class HeroManager extends MongoBase {
updateString("heroMap." + hero.getId(), hero);
heroMap.put(hero.getId(), hero);
addHeroHandBook(hero.getTemplateId(),hero.getStar());
addHeroStar(hero.getTemplateId(),hero.getStar());
}
public Hero getHero(String heroId) {
@ -136,6 +138,18 @@ public class HeroManager extends MongoBase {
return heroHandBook;
}
public void addHeroStar(int heroId,int star){
if(heroStarMap.getOrDefault(heroId,0) >= star){
return;
}
heroStarMap.put(heroId,Math.max(heroStarMap.getOrDefault(heroId,0),star));
updateString("heroStarMap." + heroId, star);
}
public Map<Integer,Integer> getHeroStarMap(){
return heroStarMap;
}
public int getFirstTenth() {
return firstTenth;
}

View File

@ -1150,6 +1150,7 @@ public class HeroLogic{
ItemUtil.itemCost(user,removeItemMap,BIReason.COMPLEX_EQUIP_CONSUME,0);
rankUpHeroExecute(targetHero);
user.getHeroManager().addHeroStar(targetHero.getTemplateId(),targetHero.getStar());
Poster.getPoster().dispatchEvent(new HeroUpStarEvent(user.getId(),targetHero.getTemplateId(),targetHero.getStar()));
targetHero.setStarBreakId(scHeroRankUpConfig.getId());