五星英雄成长礼
parent
c369ac8d48
commit
28cb6035d4
|
@ -0,0 +1,18 @@
|
|||
package com.ljsd.jieling.logic.activity.event;
|
||||
|
||||
/**
|
||||
* Description: 五星英雄获得事件
|
||||
* Author: zsx
|
||||
* CreateDate: 2019/11/25 10:36
|
||||
*/
|
||||
public class HeroFiveStarGetEvent implements IEvent {
|
||||
private int uid;
|
||||
|
||||
public HeroFiveStarGetEvent(int uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public int getUid() {
|
||||
return uid;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package com.ljsd.jieling.logic.activity.eventhandler;
|
||||
|
||||
import com.ljsd.jieling.logic.activity.IEventHandler;
|
||||
import com.ljsd.jieling.logic.activity.event.HeroFiveStarGetEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.IEvent;
|
||||
import com.ljsd.jieling.logic.dao.RechargeInfo;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.store.BuyGoodsLogic;
|
||||
|
||||
/**
|
||||
* Description: des
|
||||
* Author: zsx
|
||||
* CreateDate: 2019/11/25 10:46
|
||||
*/
|
||||
public class HeroFiveStarGetEventHandler implements IEventHandler {
|
||||
|
||||
@Override
|
||||
public void onEvent(IEvent event) throws Exception {
|
||||
if (!(event instanceof HeroFiveStarGetEvent))
|
||||
return;
|
||||
|
||||
User user = UserManager.getUser(((HeroFiveStarGetEvent) event).getUid());
|
||||
RechargeInfo rechargeInfo = user.getPlayerInfoManager().getRechargeInfo();
|
||||
rechargeInfo.addTypeBagMap(5,System.currentTimeMillis());
|
||||
|
||||
BuyGoodsLogic.sendGiftGooodsIndication(user.getId());
|
||||
}
|
||||
}
|
|
@ -27,6 +27,13 @@ public class RechargeInfo extends MongoBase{
|
|||
|
||||
private Map<Integer,Integer> goodseSendDailyMap = new HashMap<>();
|
||||
|
||||
//特殊类型控制触发开启的商品表 如五星妖灵师类型5
|
||||
private Map<Integer,Long> typeBagMap = new HashMap<>();
|
||||
|
||||
@Transient
|
||||
private Map<Integer,Long> cacheSendedTypes = new HashMap<>();
|
||||
|
||||
|
||||
public RechargeInfo(){
|
||||
|
||||
}
|
||||
|
@ -173,4 +180,25 @@ public class RechargeInfo extends MongoBase{
|
|||
this.soulCrystalAmt += soulCrystalAmt;
|
||||
updateString("soulCrystalAmt",soulCrystalAmt);
|
||||
}
|
||||
|
||||
public Map<Integer, Long> getTypeBagMap() {
|
||||
return typeBagMap;
|
||||
}
|
||||
|
||||
public void addTypeBagMap(Integer type, Long createTime) {
|
||||
this.typeBagMap.put(type, createTime);
|
||||
updateString("typeBagMap",typeBagMap);
|
||||
}
|
||||
public void removeTypeBagMap(Integer type) {
|
||||
this.typeBagMap.remove(type);
|
||||
updateString("typeBagMap",typeBagMap);
|
||||
}
|
||||
|
||||
public Map<Integer, Long> getCacheSendedTypes() {
|
||||
return cacheSendedTypes;
|
||||
}
|
||||
|
||||
public void setCacheSendedTypes(Map<Integer, Long> cacheSendedTypes) {
|
||||
this.cacheSendedTypes = cacheSendedTypes;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,8 +11,9 @@ import com.ljsd.jieling.exception.ErrorCode;
|
|||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.globals.Global;
|
||||
import com.ljsd.jieling.logic.activity.event.HeroUpStarEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.activity.IEventHandler;
|
||||
import com.ljsd.jieling.logic.activity.event.*;
|
||||
import com.ljsd.jieling.logic.activity.eventhandler.HeroFiveStarGetEventHandler;
|
||||
import com.ljsd.jieling.logic.dao.*;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.fight.CombatLogic;
|
||||
|
@ -37,10 +38,14 @@ import java.rmi.server.ExportException;
|
|||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class HeroLogic {
|
||||
public class HeroLogic{
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(HeroLogic.class);
|
||||
|
||||
private HeroLogic(){}
|
||||
private HeroLogic(){
|
||||
//英雄事件监听
|
||||
Poster.getPoster().listenEvent(new HeroFiveStarGetEventHandler(), HeroFiveStarGetEvent.class);
|
||||
}
|
||||
|
||||
|
||||
public static List<Integer> transTemplate = new ArrayList<>();
|
||||
public static List<Integer> equipSkillPositionTemaplge = new ArrayList<>(6);
|
||||
|
@ -100,6 +105,7 @@ public class HeroLogic {
|
|||
private static final String VERTICAL = "|";
|
||||
private static final String DIVISION = "#";
|
||||
|
||||
|
||||
/**
|
||||
* 获取装备、法宝信息、魂印
|
||||
* @param iSession
|
||||
|
@ -711,6 +717,9 @@ public class HeroLogic {
|
|||
// recyleHeroBySystem(user,removeHeroIds);
|
||||
targetHero.upStar( 1 );
|
||||
Poster.getPoster().dispatchEvent(new HeroUpStarEvent(user.getId(),targetHero.getStar()));
|
||||
if(targetHero.getStar()==5){
|
||||
Poster.getPoster().dispatchEvent(new HeroFiveStarGetEvent(user.getId()));
|
||||
}
|
||||
targetHero.setStarBreakId(scHeroRankUpConfig.getId());
|
||||
user.getUserMissionManager().onGameEvent(user,GameEvent.HERO_UP,2,targetHero.getTemplateId(),targetHero.getStar());
|
||||
MessageUtil.sendMessage(session,1,MessageTypeProto.MessageType.UP_HERO_STAR_RESPONSE_VALUE,baseBuilder.build(),true);
|
||||
|
|
|
@ -198,6 +198,20 @@ public class BuyGoodsLogic {
|
|||
PlayerInfoProto.DirectBuyIndication build = PlayerInfoProto.DirectBuyIndication.newBuilder().setDrop(drop).build();
|
||||
MessageUtil.sendIndicationMessage(session,1, MessageTypeProto.MessageType.DIRECT_BUY_GOODS_INDICATION_VALUE,build,true);
|
||||
}
|
||||
|
||||
if(sRechargeCommodityConfig.getTime()==4&&sRechargeCommodityConfig.getDiscountType().length==3){
|
||||
int[] discountType = sRechargeCommodityConfig.getDiscountType();
|
||||
int temptype = discountType[0];
|
||||
int tempvalue = discountType[1];
|
||||
if(temptype == 4&&tempvalue==5){
|
||||
rechargeInfo.removeTypeBagMap(tempvalue);
|
||||
List<CommonProto.GiftGoodsInfo> goodsBagInfo = new ArrayList<>(SRechargeCommodityConfig.rechargeCommodityConfigMap.size());
|
||||
BuyGoodsLogic.getGoodsBagInfo(uid, goodsBagInfo,false);
|
||||
PlayerInfoProto.AllGiftGoodsIndication build = PlayerInfoProto.AllGiftGoodsIndication.newBuilder().addAllGiftGoodsInfo(goodsBagInfo).build();
|
||||
MessageUtil.sendIndicationMessage(session,1, MessageTypeProto.MessageType.ALL_GIFTGOODS_INDICATION_VALUE,build,true);
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
String title = SErrorCodeEerverConfig.getI18NMessage("recharge_" + sRechargeCommodityConfig.getType() + "_title");
|
||||
String content = SErrorCodeEerverConfig.getI18NMessage("recharge_" + sRechargeCommodityConfig.getType() + "_txt");
|
||||
|
@ -273,6 +287,7 @@ public class BuyGoodsLogic {
|
|||
long now = TimeUtils.now();
|
||||
Map<Integer, Integer> buyGoodsTimes = rechargeInfo.getBuyGoodsTimes();
|
||||
Map<Integer, Long> levelBagMap = rechargeInfo.getLevelBagMap();
|
||||
Map<Integer, Long> typeBagMap = rechargeInfo.getTypeBagMap();
|
||||
Map<Integer,Integer> goodsOrder = new HashMap<>(6);
|
||||
Map<Integer,CommonProto.GiftGoodsInfo> giftGoodsInfoMap = new HashMap<>();
|
||||
long createTime = user.getPlayerInfoManager().getCreateTime();
|
||||
|
@ -317,6 +332,36 @@ public class BuyGoodsLogic {
|
|||
}
|
||||
endTime = startTime + value*3600*1000;
|
||||
}
|
||||
|
||||
if(type == 4){
|
||||
if(!typeBagMap.containsKey(value)){
|
||||
continue;
|
||||
}
|
||||
startTime = typeBagMap.get(value);
|
||||
|
||||
int addtime = discountType[2];
|
||||
int diffHour = (int) ((now - startTime) / 3600 / 1000);
|
||||
if (diffHour >= addtime) {
|
||||
continue;
|
||||
}
|
||||
endTime = startTime + addtime * 3600 * 1000;
|
||||
|
||||
if (rechargeInfo.getCacheSendedTypes().containsKey(5)) {
|
||||
long lasttime = rechargeInfo.getCacheSendedTypes().get(5);
|
||||
if(lasttime != startTime){
|
||||
needChange = true;
|
||||
int diffHourTemp = (int) ((now - lasttime) / 3600 / 1000);
|
||||
if (diffHourTemp < addtime) {
|
||||
startTime =0;
|
||||
}
|
||||
rechargeInfo.getCacheSendedTypes().put(5, System.currentTimeMillis());
|
||||
}
|
||||
}else {
|
||||
rechargeInfo.getCacheSendedTypes().put(5, System.currentTimeMillis());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}else{
|
||||
startTime = ToolsUtil.getTimeLong(sRechargeCommodityConfig.getStartTimeLong(),sRechargeCommodityConfig.getEndTimeLong(),sRechargeCommodityConfig.getTime(),createTime,1);
|
||||
endTime = ToolsUtil.getTimeLong(sRechargeCommodityConfig.getStartTimeLong(),sRechargeCommodityConfig.getEndTimeLong(),sRechargeCommodityConfig.getTime(),createTime,2);
|
||||
|
@ -365,7 +410,6 @@ public class BuyGoodsLogic {
|
|||
PlayerInfoProto.AllGiftGoodsIndication build = PlayerInfoProto.AllGiftGoodsIndication.newBuilder().addAllGiftGoodsInfo(goodsBagInfo).build();
|
||||
MessageUtil.sendIndicationMessage(session,1, MessageTypeProto.MessageType.ALL_GIFTGOODS_INDICATION_VALUE,build,true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void minuteCheckReharge() throws Exception {
|
||||
|
|
|
@ -14,6 +14,7 @@ import com.ljsd.jieling.handler.map.TemporaryItems;
|
|||
import com.ljsd.jieling.ktbeans.KtEventUtils;
|
||||
import com.ljsd.jieling.ktbeans.parmsBean.ParamEventBean;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.activity.event.HeroFiveStarGetEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.activity.event.UseItemEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.UserLevelEvent;
|
||||
|
@ -1187,6 +1188,9 @@ public class ItemUtil {
|
|||
}
|
||||
}
|
||||
user.getUserMissionManager().onGameEvent(user,GameEvent.GET_HERO,heroStar[0],heroStar[1]);
|
||||
if(scHero.getStar()==5){
|
||||
Poster.getPoster().dispatchEvent(new HeroFiveStarGetEvent(user.getId()));
|
||||
}
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserItemEvent,reason,GlobalsDef.addReason,cardId,1,heroStar[1]);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,9 @@ import util.TimeUtils;
|
|||
import util.StringUtil;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@Table(name ="RechargeCommodityConfig")
|
||||
public class SRechargeCommodityConfig implements BaseConfig {
|
||||
|
@ -56,18 +58,23 @@ public class SRechargeCommodityConfig implements BaseConfig {
|
|||
|
||||
public static Map<Integer, SRechargeCommodityConfig> rechargeCommodityConfigMap;
|
||||
public static Map<Integer, SRechargeCommodityConfig> rechargeLevelMap;
|
||||
private static Set<Integer> rchargeHeroGet;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
Map<Integer, SRechargeCommodityConfig> config = STableManager.getConfig(SRechargeCommodityConfig.class);
|
||||
Map<Integer, SRechargeCommodityConfig> rechargeLevelMapTmp = new HashMap<>();
|
||||
Set<Integer> rchargeHeroGetTemp = new HashSet<>();
|
||||
for(SRechargeCommodityConfig sRechargeCommodityConfig : config.values()){
|
||||
int[] discountType = sRechargeCommodityConfig.getDiscountType();
|
||||
if(discountType!=null && discountType.length>0 &&discountType[0] == 2){
|
||||
int level = discountType[1];
|
||||
rechargeLevelMapTmp.put(level,sRechargeCommodityConfig);
|
||||
}
|
||||
if(discountType!=null && discountType.length>0 &&discountType[0] == 4){
|
||||
rchargeHeroGetTemp.add(sRechargeCommodityConfig.getId());
|
||||
}
|
||||
|
||||
int time = sRechargeCommodityConfig.getTime();
|
||||
String startTime = sRechargeCommodityConfig.getStartTime();
|
||||
|
@ -91,6 +98,7 @@ public class SRechargeCommodityConfig implements BaseConfig {
|
|||
}
|
||||
rechargeCommodityConfigMap = config;
|
||||
rechargeLevelMap = rechargeLevelMapTmp;
|
||||
rchargeHeroGet = rchargeHeroGetTemp;
|
||||
|
||||
}
|
||||
|
||||
|
@ -190,4 +198,8 @@ public class SRechargeCommodityConfig implements BaseConfig {
|
|||
public int getLimitShow() {
|
||||
return limitShow;
|
||||
}
|
||||
|
||||
public static Set<Integer> getRchargeHeroGet() {
|
||||
return rchargeHeroGet;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue