新礼包
parent
972806ba8f
commit
27aa32bd23
|
@ -1084,7 +1084,7 @@ public class HeroLogic{
|
|||
// recyleHeroBySystem(user,removeHeroIds);
|
||||
rankUpHeroExecute(targetHero);
|
||||
Poster.getPoster().dispatchEvent(new HeroUpStarEvent(user.getId(),targetHero.getTemplateId(),targetHero.getStar()));
|
||||
if (targetHero.getStar()>=5&&targetHero.getStar()!=15){
|
||||
if (targetHero.getStar()==5&&targetHero.getStar()!=15){
|
||||
if (SItem.getsItemMap().get(scHero.getId()).getQuantity()>=5) {
|
||||
Poster.getPoster().dispatchEvent(new HeroFiveStarGetEvent(user.getId(), targetHero.getStar()));
|
||||
}
|
||||
|
|
|
@ -67,6 +67,7 @@ public class BuyGoodsNewLogic {
|
|||
* 登录刷新礼包
|
||||
*/
|
||||
public static boolean refreshWelfareState(User user) throws Exception {
|
||||
sendDailyMailReward(user);
|
||||
boolean needChange = false;
|
||||
List<AbstractWelfareBag> pAddList = new ArrayList<>();
|
||||
NewRechargeInfo info = user.getPlayerInfoManager().getNewRechargeInfo();
|
||||
|
@ -85,10 +86,12 @@ public class BuyGoodsNewLogic {
|
|||
}
|
||||
}else{
|
||||
//没有的话新初始化信息
|
||||
AbstractWelfareBag bag = rechargeHandler.initUnitWF(user, entry.getValue());
|
||||
pAddList.add(bag);
|
||||
if(refreshUnitWF(bag,user) && !needChange){
|
||||
needChange = true;
|
||||
if(entry.getValue().getOtype() != RechargeType.push.getType()){//推送不在此初始化
|
||||
AbstractWelfareBag bag = rechargeHandler.initUnitWF(user, entry.getValue());
|
||||
pAddList.add(bag);
|
||||
if(refreshUnitWF(bag,user) && !needChange){
|
||||
needChange = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -150,9 +153,6 @@ public class BuyGoodsNewLogic {
|
|||
return resultRes;
|
||||
}
|
||||
goodsId = config.getId();
|
||||
if(goodsId == 507){
|
||||
System.out.println();
|
||||
}
|
||||
double priceTemp =config.getPrice();
|
||||
int cfgType = SSpecialConfig.getIntegerValue(SSpecialConfig.EXCHANGE_FORCE_TYPE);
|
||||
double price = priceTemp==0?0: SExchangeRate.doubleIntegerHashMap.get(cfgType).get((int)priceTemp);
|
||||
|
@ -164,15 +164,6 @@ public class BuyGoodsNewLogic {
|
|||
NewRechargeInfo info = user.getPlayerInfoManager().getNewRechargeInfo();
|
||||
AbstractWelfareBag bag = null;
|
||||
RechargeHandler rechargeHandler = getRechargeHandler(config.getOtype());
|
||||
// if(config.getOtype() == RechargeType.perpetual.getType()){
|
||||
// bag = info.getPerpetualMap().get(goodsId);
|
||||
// }else if(config.getOtype() == RechargeType.timeLimit.getType()){
|
||||
// bag = info.getTimeLimitMap().get(goodsId);
|
||||
// }else if(config.getOtype() == RechargeType.receive.getType()){
|
||||
// bag = info.getReceiveMap().get(goodsId);
|
||||
// }else if(config.getOtype() == RechargeType.push.getType()){
|
||||
// bag = info.getPushMap().get(goodsId);
|
||||
// }
|
||||
bag = rechargeHandler.getRechargeMap(user).get(goodsId);
|
||||
String rewardStr="";
|
||||
if(bag == null || !bag.buy()){
|
||||
|
@ -579,6 +570,17 @@ public class BuyGoodsNewLogic {
|
|||
giftGoodsInfoList.add(buildGoodsInfo(bag));
|
||||
}
|
||||
}
|
||||
giftGoodsInfoList.sort(new Comparator<CommonProto.GiftGoodsInfo>() {
|
||||
@Override
|
||||
public int compare(CommonProto.GiftGoodsInfo o1, CommonProto.GiftGoodsInfo o2) {
|
||||
if(o1.getGoodsId() > o2.getGoodsId()){
|
||||
return 1;
|
||||
}else if(o1.getGoodsId() < o2.getGoodsId()){
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
return needChange;
|
||||
}
|
||||
|
||||
|
@ -587,7 +589,11 @@ public class BuyGoodsNewLogic {
|
|||
builder.setGoodsId(bag.getModId());
|
||||
builder.setBuyTimes(bag.getBuyTimes());
|
||||
builder.setStartTime((int)(bag.getStartTime()/1000));
|
||||
builder.setEndTime((int)(bag.getEndTime()/1000));
|
||||
if(bag.getType() == RechargeType.perpetual.getType() && bag.getRefreshTime() > 0){
|
||||
builder.setEndTime((int)(bag.getRefreshTime()/1000));
|
||||
}else{
|
||||
builder.setEndTime((int)(bag.getEndTime()/1000));
|
||||
}
|
||||
if(bag.getLimit() == 0){
|
||||
builder.setDynamicBuyTimes(1);
|
||||
}else{
|
||||
|
@ -683,4 +689,59 @@ public class BuyGoodsNewLogic {
|
|||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 每日礼包奖励发送
|
||||
*/
|
||||
public static void sendDailyMailReward(User user) throws Exception{
|
||||
NewRechargeInfo info = user.getPlayerInfoManager().getNewRechargeInfo();
|
||||
List<Integer> found1 = SRechargeCommodityNewConfig.getConfigListByType(GiftGoodsType.FOUND_ONE);
|
||||
List<Integer> found2 = SRechargeCommodityNewConfig.getConfigListByType(GiftGoodsType.FOUND_TWO);
|
||||
for(ReceiveWelfareBag bag : info.getReceiveMap().values()){
|
||||
for(int id :found1){
|
||||
if(bag.getModId() == id && canReward(bag)){
|
||||
sendReward(user.getId(),id,bag,GiftGoodsType.FOUND_ONE);
|
||||
}
|
||||
}
|
||||
for(int id :found2){
|
||||
if(bag.getModId() == id && canReward(bag)){
|
||||
sendReward(user.getId(),id,bag,GiftGoodsType.FOUND_TWO);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void sendReward(int uid,int id,ReceiveWelfareBag bag,int type) throws Exception{
|
||||
int nowTime = (int)(System.currentTimeMillis()/1000);
|
||||
int getDays = TimeUtils.differentDays(bag.getLastBuyTime(),bag.getGetRewardTime());
|
||||
int canget = TimeUtils.differentDays(bag.getGetRewardTime(),System.currentTimeMillis());
|
||||
getRewards(uid,id,getDays,canget,bag.getContinueDays());
|
||||
bag.setGetRewardTime(TimeUtils.getTodayZero());
|
||||
}
|
||||
|
||||
public static boolean canReward(ReceiveWelfareBag bag){
|
||||
if(!bag.isOpen()){
|
||||
return false;
|
||||
}
|
||||
if(!bag.isBought()){
|
||||
return false;
|
||||
}
|
||||
if(TimeUtils.differentDays(bag.getGetRewardTime(),System.currentTimeMillis())<1){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void getRewards(int uid,int type,int startDay,int cDay,int continueDays) throws Exception{
|
||||
int nowTime = (int)(System.currentTimeMillis()/1000);
|
||||
for(int i = 1;i<=cDay;i++){
|
||||
SLuxuryFund fund = SLuxuryFund.getByFoundIdAndDay(type,startDay+i);
|
||||
String reward = ItemUtil.getMailReward(fund.getreward());
|
||||
String title = SErrorCodeEerverConfig.getI18NMessage("recharge_"+type+"_daily_title");
|
||||
String content;
|
||||
content = SErrorCodeEerverConfig.getI18NMessageNeedConvert("recharge_"+type+"_daily_txt",
|
||||
new Object[]{continueDays-startDay-cDay},new int[]{0},"#");
|
||||
MailLogic.getInstance().sendMail(uid,title,content,reward,nowTime, Global.MAIL_EFFECTIVE_TIME);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,8 +69,10 @@ public class NewRechargeInfo extends MongoBase {
|
|||
|
||||
public List<Integer> getPushList(){
|
||||
List<Integer> list = new ArrayList<>();
|
||||
for(int i : pushMap.keySet()){
|
||||
list.add(i);
|
||||
for(PushWelfareBag bag : pushMap.values()){
|
||||
if(bag.isOpen()){
|
||||
list.add(bag.getModId());
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
|
|
@ -1253,7 +1253,7 @@ public class ItemUtil {
|
|||
}
|
||||
}
|
||||
user.getUserMissionManager().onGameEvent(user,GameEvent.GET_HERO,heroStar[0],heroStar[1]);
|
||||
if(scHero.getStar()>=5){
|
||||
if(scHero.getStar()==5){
|
||||
if(SItem.getsItemMap().get(scHero.getId()).getQuantity()>=5)
|
||||
Poster.getPoster().dispatchEvent(new HeroFiveStarGetEvent(user.getId(),scHero.getStar()));
|
||||
}
|
||||
|
|
|
@ -3,7 +3,9 @@ package config;
|
|||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="RechargeCommodityConfig")
|
||||
|
@ -56,20 +58,30 @@ public class SRechargeCommodityNewConfig implements BaseConfig {
|
|||
|
||||
public static Map<Integer,SRechargeCommodityNewConfig> configMap;
|
||||
public static Map<String,SRechargeCommodityNewConfig> sdkconfigMap;
|
||||
public static Map<Integer, List<Integer>> configTypeMap;
|
||||
|
||||
public void init() throws Exception {
|
||||
Map<Integer, SRechargeCommodityNewConfig> config = STableManager.getConfig(SRechargeCommodityNewConfig.class);
|
||||
Map<Integer,SRechargeCommodityNewConfig> tempConfigMap = new HashMap<>();
|
||||
Map<String,SRechargeCommodityNewConfig> tempSdkConfigMap = new HashMap<>();
|
||||
Map<Integer, List<Integer>> tempConfigTypeMap = new HashMap<>();
|
||||
for(SRechargeCommodityNewConfig newConfig : config.values()){
|
||||
tempConfigMap.put(newConfig.getId(),newConfig);
|
||||
tempSdkConfigMap.put(newConfig.getRechargeId(),newConfig);
|
||||
tempSdkConfigMap.put(newConfig.getRechargeId2(),newConfig);
|
||||
tempSdkConfigMap.put(newConfig.getRechargeId3(),newConfig);
|
||||
if(tempConfigTypeMap.containsKey(newConfig.getType())){
|
||||
tempConfigTypeMap.get(newConfig.getType()).add(newConfig.getId());
|
||||
}else{
|
||||
List<Integer> list = new ArrayList<>();
|
||||
list.add(newConfig.getId());
|
||||
tempConfigTypeMap.put(newConfig.getType(),list);
|
||||
}
|
||||
}
|
||||
if(configMap == null){
|
||||
configMap = tempConfigMap;
|
||||
sdkconfigMap = tempSdkConfigMap;
|
||||
configTypeMap = tempConfigTypeMap;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -77,6 +89,10 @@ public class SRechargeCommodityNewConfig implements BaseConfig {
|
|||
return configMap.get(id);
|
||||
}
|
||||
|
||||
public static List<Integer> getConfigListByType(int type){
|
||||
return configTypeMap.get(type);
|
||||
}
|
||||
|
||||
public int getId() { return id; }
|
||||
|
||||
public String getRechargeId() { return rechargeId; }
|
||||
|
|
Loading…
Reference in New Issue