bt版本2.0,gm修改器逻辑
parent
78e653ab65
commit
ad7a3184e3
|
@ -124,6 +124,8 @@ public interface GlobalsDef {
|
|||
|
||||
int GOD_LV_UNLOCK = 9;//神尊解锁
|
||||
int RENOWN_LV_UNLOCK = 10;//名望解锁
|
||||
int BRUSHING_LV_UNLOCK = 11;//刷冲特权
|
||||
int THE_ABSOLUTE_BEGINNING_LV_UNLOCK = 12;//太初特权
|
||||
|
||||
//特殊商店id
|
||||
int DAILY_GOODS_FAST_ID = 1004;//每日礼包一键购买的礼包ID
|
||||
|
|
|
@ -416,4 +416,6 @@ public interface BIReason {
|
|||
int HOME_EQUIP_STRONG_RESET_COST =1310;//家园装备强化重置消耗
|
||||
int HOME_EQUIP_STRONG_RESET_GAIN =1311;//家园装备强化重置获得
|
||||
|
||||
int GM_BUY_GOOD_COST = 1312;//gm修改器购买礼包消耗
|
||||
|
||||
}
|
|
@ -49,11 +49,10 @@ public interface GlobalItemType {
|
|||
int TRUE_RECHARGE_JUAN = 43;//真充券
|
||||
int RMB_CARD = 44;//现金卡
|
||||
int XIAN_RECHARGE_CARD = 45;//仙充卡
|
||||
|
||||
int DAY_TRUE_RECHARGE_JUAN = 46;//真充券,当日生效
|
||||
int DAY_RMB_CARD = 47;//现金卡,当日生效
|
||||
int DAY_XIAN_RECHARGE_CARD = 48;//仙充卡,当日生效
|
||||
|
||||
int LARGE_AMOUNT_RECHARGE_CARD = 49;//大额直充卡
|
||||
|
||||
//物品使用类型
|
||||
int NO_USE = 0 ; //不使用
|
||||
|
|
|
@ -3,7 +3,6 @@ package com.ljsd.jieling.handler;
|
|||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.logic.dao.Item;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
|
@ -12,19 +11,15 @@ import com.ljsd.jieling.logic.item.ItemLogic;
|
|||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.util.ItemMap;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import com.sun.javafx.collections.MappingChange;
|
||||
import config.SItem;
|
||||
import config.SMainLevelConfig;
|
||||
import config.SRewardGroup;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
|
|
@ -0,0 +1,131 @@
|
|||
package com.ljsd.jieling.handler.bt;
|
||||
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.bean.AbstractWelfareBag;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.rechargeHandler.RechargeHandler;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import config.SGMMaster;
|
||||
import config.SRechargeCommodityNewConfig;
|
||||
import manager.STableManager;
|
||||
import org.springframework.stereotype.Component;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author hj
|
||||
* @Date 2021/6/8 15:40
|
||||
* @Description: gm修改器购买物品
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Component
|
||||
public class GmBuyGoodHandler extends BaseHandler<PlayerInfoProto.GmBuyGoodRequest> {
|
||||
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.GmBuyGoodRequest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processWithProto(ISession iSession, PlayerInfoProto.GmBuyGoodRequest proto) throws Exception {
|
||||
// 用户信息
|
||||
User user = UserManager.getUser(iSession.getUid());
|
||||
int goodsId = proto.getGoodsId();
|
||||
// 礼包是否到达购买条件
|
||||
boolean canBuy = isCanBuy(user, goodsId);
|
||||
if (!canBuy){
|
||||
throw new ErrorCodeException(ErrorCode.BLOOD_BUY_SCORE_YET);
|
||||
}
|
||||
// 礼包配置是否存在
|
||||
SGMMaster master = STableManager.getConfig(SGMMaster.class).get(goodsId);
|
||||
if (master == null){
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL,"策划未未配置gm礼包id:"+goodsId);
|
||||
}
|
||||
// 道具是否足够
|
||||
boolean cost = ItemUtil.itemCost(user, master.getPrice(), BIReason.GM_BUY_GOOD_COST, 0);
|
||||
if (!cost){
|
||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||
}
|
||||
// 走礼包逻辑发送奖励
|
||||
BuyGoodsNewLogic.gmBuyGoods(user, goodsId);
|
||||
}
|
||||
|
||||
/**
|
||||
* gm礼包是否可买
|
||||
* 解锁条件 看策划表
|
||||
* @param user
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public static boolean isCanBuy(User user, int id){
|
||||
Map<Integer, SGMMaster> config = STableManager.getConfig(SGMMaster.class);
|
||||
SGMMaster master = config.get(id);
|
||||
if (master == null){
|
||||
return false;
|
||||
}
|
||||
boolean result = true;
|
||||
v:for (int[] value : master.getUnlock()) {
|
||||
switch (value[0]){
|
||||
case 1://等级
|
||||
int level = user.getPlayerInfoManager().getLevel();
|
||||
if (level < value[1]){
|
||||
result = false;
|
||||
break v;
|
||||
}
|
||||
break;
|
||||
case 2://关卡id
|
||||
int fightId = user.getMainLevelManager().getFightId();
|
||||
if (fightId < value[1]){
|
||||
result = false;
|
||||
break v;
|
||||
}
|
||||
break;
|
||||
case 3:// 本案(C列)对应类型全部兑换
|
||||
List<SGMMaster> masters = SGMMaster.getTypeMap().get(value[1]);
|
||||
if (master == null || masters.isEmpty()){
|
||||
result = false;
|
||||
break v;
|
||||
}
|
||||
for (SGMMaster sgmMaster : masters) {
|
||||
int packID = sgmMaster.getPackID();
|
||||
SRechargeCommodityNewConfig recharge = SRechargeCommodityNewConfig.getConfigById(packID);
|
||||
RechargeHandler rechargeHandler = BuyGoodsNewLogic.getRechargeHandler(recharge.getOtype());
|
||||
boolean status = rechargeHandler.refreshStatus(user, packID);
|
||||
if (!status){
|
||||
result = false;
|
||||
break v;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 4:// RMB累充xx可购买
|
||||
double rmb = user.getPlayerInfoManager().getNewRechargeInfo().getRr();
|
||||
if (rmb < value[1]){
|
||||
result = false;
|
||||
break v;
|
||||
}
|
||||
break;
|
||||
case 5:// 购买了其他礼包(rechargeID)开启
|
||||
SRechargeCommodityNewConfig recharge = SRechargeCommodityNewConfig.getConfigById(value[1]);
|
||||
RechargeHandler rechargeHandler = BuyGoodsNewLogic.getRechargeHandler(recharge.getOtype());
|
||||
boolean status = rechargeHandler.refreshStatus(user, value[1]);
|
||||
if (!status){
|
||||
result = false;
|
||||
break v;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -73,22 +73,7 @@ public class DoHeroChangeRequestHandler extends BaseHandler<HeroInfoProto.DoHer
|
|||
drop.addHero(CBean2Proto.getHero(newHero));
|
||||
//新头像
|
||||
SItem sItem = SItem.getsItemMap().get(hero.getChangeId());
|
||||
if(sItem != null){
|
||||
if(sItem.getExtraReward()!=null && sItem.getExtraReward().length>1){
|
||||
int[] drops = sItem.getExtraReward()[1];
|
||||
if(user.getItemManager().getItem(drops[0]) == null){
|
||||
int[][] extraDrops = new int[1][2];
|
||||
extraDrops[0] = new int[2];
|
||||
extraDrops[0][0] = drops[0];
|
||||
extraDrops[0][1] =1;
|
||||
if(sItem.getExtraReward()[0][0] == 0){
|
||||
ItemUtil.drop(user,extraDrops, BIReason.EXTRA_DROP_REWARD);
|
||||
}else{
|
||||
ItemUtil.drop(user,extraDrops,CommonProto.Drop.newBuilder(),BIReason.EXTRA_DROP_REWARD);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ItemUtil.extraDropAop(user,drop,sItem);
|
||||
return HeroInfoProto.DoHeroChangeResponse.newBuilder().setDrop(drop).build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -453,7 +453,7 @@ public class GlobalDataManaager implements IManager {
|
|||
FriendLogic.getInstance().refreshState(session);
|
||||
PlayerLogic.getInstance().sendTimingMail(user);
|
||||
user.getGuildMyInfo().setLastHurt(0);
|
||||
|
||||
// 每天零点清理玩家背包内的当日到期道具
|
||||
ItemLogic.getInstance().zeroCleanItem(user);
|
||||
// 四灵试炼,计算每天次数
|
||||
FourChallengeLogic.getInstance().addFourChallengeNum(user,user.getPlayerInfoManager().getLoginTime());
|
||||
|
|
|
@ -80,7 +80,6 @@ public class ActivityLogic implements IEventHandler{
|
|||
public void flushEveryDay(User user, PlayerInfoProto.FivePlayerUpdateIndication.Builder fBuilder) throws Exception {
|
||||
|
||||
//跟新签到天数
|
||||
|
||||
if (user.getPlayerInfoManager().getSignTotay() == 1) {
|
||||
user.getPlayerInfoManager().setSign(user.getPlayerInfoManager().getSign() + 1);
|
||||
user.getPlayerInfoManager().setSignTotay(0);
|
||||
|
@ -97,11 +96,8 @@ public class ActivityLogic implements IEventHandler{
|
|||
ActivityLogic.getInstance().webPayHandlerLogin(user);
|
||||
//更新每日累计充值
|
||||
ActivityLogic.getInstance().resumeActivity(user, ActivityType.RECHARGE_NUM);
|
||||
//更新首日充值st
|
||||
// user.getPlayerInfoManager().getNewRechargeInfo().setDailyFirst(0);
|
||||
//更新累计充值天数
|
||||
ActivityLogic.getInstance().resumeActivity(user, ActivityType.RECHARGE_SUM_DAY);
|
||||
|
||||
//更新新积天豪礼天数
|
||||
ActivityLogic.getInstance().resumeActivity(user, ActivityType.NEW_RECHARGE_SUM_DAY_6);
|
||||
ActivityLogic.getInstance().resumeActivity(user, ActivityType.NEW_RECHARGE_SUM_DAY_30);
|
||||
|
|
|
@ -59,7 +59,8 @@ public class AllPeopleWelfareActivity extends AbstractActivity {
|
|||
}
|
||||
|
||||
public static int getValue(){
|
||||
return (int)Optional.ofNullable(RedisUtil.getInstence().get(RedisKey.ALL_PEOPLE_WELFARE_BUY_COUNT)).orElse(0);
|
||||
String value = String.valueOf(RedisUtil.getInstence().get(RedisKey.ALL_PEOPLE_WELFARE_BUY_COUNT));
|
||||
return Optional.ofNullable(value).map(v->Integer.parseInt(v)).orElse(0);
|
||||
}
|
||||
|
||||
public static void addValue(int count){
|
||||
|
|
|
@ -3,11 +3,14 @@ package com.ljsd.jieling.logic.activity;
|
|||
import com.ljsd.jieling.jbean.ActivityMission;
|
||||
import com.ljsd.jieling.jbean.ActivityProgressInfo;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.activity.event.*;
|
||||
import com.ljsd.jieling.logic.activity.event.IEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.activity.event.RechargeRewardEvent;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import config.SActivityRewardConfig;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -25,11 +28,14 @@ public class RechargeRewardActivity extends AbstractActivity {
|
|||
public void onEvent(IEvent event) throws Exception{
|
||||
if (!(event instanceof RechargeRewardEvent))
|
||||
return;
|
||||
User user = UserManager.getUser(((RechargeRewardEvent) event).getUid());
|
||||
RechargeRewardEvent rewardEvent = (RechargeRewardEvent) event;
|
||||
User user = UserManager.getUser(rewardEvent.getUid());
|
||||
if (null == user) {
|
||||
return;
|
||||
}
|
||||
List<SActivityRewardConfig> rewardConfigList = SActivityRewardConfig.getsActivityRewardConfigByActivityId(id).stream().filter(n->n.getValues()[0][0]==((RechargeRewardEvent) event).getRechargeCount()).collect(Collectors.toList());
|
||||
List<SActivityRewardConfig> rewardConfigList = SActivityRewardConfig.getsActivityRewardConfigByActivityId(id).stream()
|
||||
.filter(n->n.getValues()[0][0]== rewardEvent.getRechargeCount())
|
||||
.collect(Collectors.toList());
|
||||
if(rewardConfigList == null || rewardConfigList.size() == 0){
|
||||
return ;
|
||||
}
|
||||
|
@ -43,7 +49,7 @@ public class RechargeRewardActivity extends AbstractActivity {
|
|||
return;
|
||||
}
|
||||
if(activityProgressInfoMap.get(rewrdId).getState() == 0){
|
||||
activityProgressInfoMap.get(rewrdId).setProgrss(((RechargeRewardEvent) event).getRechargeCount());
|
||||
activityProgressInfoMap.get(rewrdId).setProgrss(rewardEvent.getRechargeCount());
|
||||
activityProgressInfoMap.get(rewrdId).setState(2);
|
||||
}
|
||||
//更新进度
|
||||
|
|
|
@ -247,6 +247,25 @@ public class PlayerManager extends MongoBase {
|
|||
|
||||
private int equipStrongMark;//摘星阁装备强化道具回退标记
|
||||
|
||||
/**
|
||||
* bt 特权等级,key:UnlockType, value:等级
|
||||
*/
|
||||
private Map<Integer, Integer> btVipLevel = new HashMap<>();
|
||||
|
||||
public Map<Integer, Integer> getBtVipLevel() {
|
||||
return btVipLevel;
|
||||
}
|
||||
|
||||
public void setBtVipLevel(Map<Integer, Integer> btVipLevel) {
|
||||
this.btVipLevel = btVipLevel;
|
||||
updateString("btVipLevel", btVipLevel);
|
||||
}
|
||||
|
||||
public void putBtVipLevel(int key, int value) {
|
||||
this.btVipLevel.put(key,value);
|
||||
updateString("btVipLevel", btVipLevel);
|
||||
}
|
||||
|
||||
public int getEquipStrongMark() {
|
||||
return equipStrongMark;
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig;
|
|||
import com.ljsd.jieling.config.clazzStaticCfg.HeroStaticConfig;
|
||||
import com.ljsd.jieling.core.FunctionIdEnum;
|
||||
import com.ljsd.jieling.core.HandlerLogicThread;
|
||||
import com.ljsd.jieling.core.VipPrivilegeType;
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
|
@ -26,6 +27,7 @@ import com.ljsd.jieling.logic.dao.root.User;
|
|||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.logic.hero.HongMengFunctionEnum;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||
import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.PushRechargeType;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
|
@ -150,9 +152,7 @@ public class ItemLogic {
|
|||
*/
|
||||
public void useItem(ISession iSession, List<CommonProto.Item> itemList) throws Exception {
|
||||
int msgId = MessageTypeProto.MessageType.USER_AND_PRICE_ITEM_RESPONSE_VALUE;
|
||||
int uid = iSession.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
EquipManager equipManager=user.getEquipManager();
|
||||
User user = UserManager.getUser(iSession.getUid());
|
||||
if (itemList.size() == 0) {
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
|
@ -169,15 +169,16 @@ public class ItemLogic {
|
|||
for (CommonProto.Item item : itemList) {
|
||||
SItem sItem = SItem.getsItemMap().get(item.getItemId());
|
||||
if (item.getItemNum() > openBoxLimits) {
|
||||
LOGGER.info("useItem ==>uid={},itemNum={},openBoxLimits={}", uid, item.getItemNum(), openBoxLimits);
|
||||
LOGGER.info("useItem ==>uid={},itemNum={},openBoxLimits={}", user.getId(), item.getItemNum(), openBoxLimits);
|
||||
throw new ErrorCodeException(ErrorCode.ITEM_USE_ONE_MAX);
|
||||
}
|
||||
if (sItem.getUseType() == 2) { //n 选1
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
if (sItem.getUseType() == 0) {
|
||||
if (sItem.getUseType() == 2 || sItem.getUseType() == 0) {
|
||||
throw new ErrorCodeException(ErrorCode.ITEM_USE_NOT);
|
||||
}
|
||||
boolean max = checkGmRechargeCardMax(user, sItem.getItemType(), (int) item.getItemNum());
|
||||
if (!max){
|
||||
throw new ErrorCodeException(ErrorCode.FRIENDS_GET_MAX,"一元充值卡超过当日使用上限");
|
||||
}
|
||||
}
|
||||
StringBuilder cost = new StringBuilder();
|
||||
StringBuilder reward = new StringBuilder();
|
||||
|
@ -201,6 +202,21 @@ public class ItemLogic {
|
|||
sendUseAndPriceItemMessage(iSession, msgId, drop);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查bt功能一元充值卡使用上限
|
||||
* 可以继续使用:true,不能false
|
||||
* @param user
|
||||
* @param type
|
||||
* @param num
|
||||
* @return
|
||||
*/
|
||||
private boolean checkGmRechargeCardMax(User user, int type, int num){
|
||||
if (type != GlobalItemType.ONE_RMB_RECHARGE_CARD){
|
||||
return true;
|
||||
}
|
||||
return PlayerLogic.getInstance().checkAndUpdate(user, VipPrivilegeType.DAY_OF_ONE_GM_RECHARGE_MAX, num);
|
||||
}
|
||||
|
||||
private void useHeroSkin(ISession session, User user, CommonProto.Item item) throws Exception {
|
||||
Map<Integer, Integer> skinInfo = user.getHeroManager().getSkinInfo();
|
||||
SHeroSkin sHeroSkin = STableManager.getConfig(SHeroSkin.class).get(item.getItemId());
|
||||
|
|
|
@ -1474,6 +1474,9 @@ public class PlayerLogic {
|
|||
|
||||
public boolean checkAndUpdate(User user, int privilegeTypeId, int updateNum){
|
||||
boolean check = check(user, privilegeTypeId, updateNum);
|
||||
if (!check){
|
||||
return false;
|
||||
}
|
||||
|
||||
Map<Integer, VipInfo> vipInfo = user.getPlayerInfoManager().getVipInfo();
|
||||
if(privilegeTypeId == 0){
|
||||
|
@ -1572,6 +1575,10 @@ public class PlayerLogic {
|
|||
case GlobalsDef.RENOWN_LV_UNLOCK:
|
||||
cond = getRenownPrivilegeLv(user);
|
||||
break;
|
||||
case GlobalsDef.BRUSHING_LV_UNLOCK:
|
||||
case GlobalsDef.THE_ABSOLUTE_BEGINNING_LV_UNLOCK:
|
||||
cond = user.getPlayerInfoManager().getBtVipLevel().getOrDefault(sPrivilegeTypeConfig.getUnlockType(),0);
|
||||
break;
|
||||
default:{
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -141,7 +141,7 @@ public class BuyGoodsNewLogic {
|
|||
* @param goodsId
|
||||
* @throws Exception
|
||||
*/
|
||||
private void gmBuyGoods(User user, int goodsId) throws Exception {
|
||||
public static void gmBuyGoods(User user, int goodsId) throws Exception {
|
||||
SRechargeCommodityNewConfig sRechargeCommodityConfig = SRechargeCommodityNewConfig.getConfigById(goodsId);
|
||||
if(sRechargeCommodityConfig == null){
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||
|
@ -217,18 +217,18 @@ public class BuyGoodsNewLogic {
|
|||
//每日礼包一键购买之后,把所有单个的每日礼包的购买次数加一
|
||||
for (int gId : forbid) {
|
||||
AbstractWelfareBag countBag = rechargeHandler.getRechargeMap(user).get(gId);
|
||||
countBag.setBuyTimes(countBag.getBuyTimes()+1);
|
||||
countBag.addBuyTimes(1);
|
||||
}
|
||||
}
|
||||
int[][] dropByBag = bag.getDropByBag();
|
||||
//发货
|
||||
sendGoodsByType(user,config,dropByBag);
|
||||
|
||||
if(config.getAccumulativeRecharge() == 1){
|
||||
if(config.getAccumulativeRecharge() == 1 && !"gm_modifier".equals(orderId)){
|
||||
if(info.getMaxSingleR() < price){
|
||||
info.setMaxSingleR(price);
|
||||
}
|
||||
info.setRr(MathUtils.doubleAdd(price,info.getRr()));
|
||||
info.addRmb(price);
|
||||
info.setRechargeList(TimeUtils.now(),price);
|
||||
//处理月卡
|
||||
activeMonthCard(user,config.getId());
|
||||
|
@ -533,14 +533,14 @@ public class BuyGoodsNewLogic {
|
|||
LOGGER.info("********************购买礼包,新增特权id:{}", StringUtil.intArrToStringArr(openPrivilege));
|
||||
}
|
||||
|
||||
// int[] coverPrivilege = config.getCoverPrivilege();
|
||||
// 覆盖旧特权
|
||||
// if (coverPrivilege != null && coverPrivilege.length > 0){
|
||||
// for (int privilegeId : config.getCoverPrivilege()) {
|
||||
// user.getPlayerInfoManager().removeVipPriviliageId(privilegeId);
|
||||
// }
|
||||
// LOGGER.info("********************购买礼包,覆盖特权id:{}", StringUtil.intArrToStringArr(coverPrivilege));
|
||||
// }
|
||||
int[][] getbTVIPlevel = config.getbTVIPlevel();
|
||||
// btVIP等级提升
|
||||
if (getbTVIPlevel != null && getbTVIPlevel.length > 0){
|
||||
for (int[] vip : getbTVIPlevel) {
|
||||
user.getPlayerInfoManager().putBtVipLevel(vip[0],vip[1]);
|
||||
}
|
||||
LOGGER.info("********************bt vip等级提升:{}", StringUtil.parseArrayToString(getbTVIPlevel));
|
||||
}
|
||||
|
||||
// todo 修改推送,获取全部特权,直接覆盖刷新
|
||||
ISession session = OnlineUserManager.getSessionByUid(user.getId());
|
||||
|
@ -606,21 +606,23 @@ public class BuyGoodsNewLogic {
|
|||
}
|
||||
}
|
||||
}else{
|
||||
if(bag.getType() == RechargeType.push.getType() && !bag.isOpen()){
|
||||
if(bag.getType() == RechargeType.push.getType()){
|
||||
user.getPlayerInfoManager().getNewRechargeInfo().removePush(bag.getModId());
|
||||
return true;
|
||||
}
|
||||
if(bag.getType() == RechargeType.timeLimit.getType()){
|
||||
//活动类型特殊处理
|
||||
for(String[] s : configById.getCondition()){
|
||||
if(s[0].equals("3")){
|
||||
if(ActivityLogic.checkActivityOpen(user,Integer.parseInt(s[1]))){
|
||||
long[] time = ActivityLogic.getStartAndEndTime(user,Integer.parseInt(s[1]));
|
||||
bag.setStartTime(time[0]);
|
||||
bag.setEndTime(time[1]);
|
||||
bag.setOpen(true);
|
||||
result = true;
|
||||
}
|
||||
int anInt = Integer.parseInt(s[1]);
|
||||
if(!s[0].equals("3")){
|
||||
continue;
|
||||
}
|
||||
if(ActivityLogic.checkActivityOpen(user, anInt)){
|
||||
long[] time = ActivityLogic.getStartAndEndTime(user, anInt);
|
||||
bag.setStartTime(time[0]);
|
||||
bag.setEndTime(time[1]);
|
||||
bag.setOpen(true);
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.ljsd.jieling.logic.store.newRechargeInfo;
|
|||
|
||||
import com.ljsd.common.mogodb.MongoBase;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.bean.*;
|
||||
import util.MathUtils;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -104,7 +105,12 @@ public class NewRechargeInfo extends MongoBase {
|
|||
public void setRr(double rr) {
|
||||
this.rr = rr;
|
||||
updateString("rr",rr);
|
||||
}
|
||||
|
||||
public void addRmb(double rmb) {
|
||||
double add = MathUtils.doubleAdd(rmb, rr);
|
||||
this.rr = add;
|
||||
updateString("rr",rr);
|
||||
}
|
||||
|
||||
public double getMonthRr() {
|
||||
|
|
|
@ -7,6 +7,9 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class AbstractWelfareBag extends MongoBase{
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AbstractWelfareBag.class);
|
||||
|
||||
|
@ -14,7 +17,7 @@ public class AbstractWelfareBag extends MongoBase{
|
|||
private int type;
|
||||
private long startTime;
|
||||
private long endTime;
|
||||
private int limit;
|
||||
protected int limit;
|
||||
private int dailyUpdate;
|
||||
private int continueDays;
|
||||
private boolean open;
|
||||
|
@ -25,33 +28,9 @@ public class AbstractWelfareBag extends MongoBase{
|
|||
private int timeType;
|
||||
private boolean isUserBuyRefresh;
|
||||
|
||||
public AbstractWelfareBag(User user,SRechargeCommodityNewConfig config){
|
||||
public AbstractWelfareBag(SRechargeCommodityNewConfig config){
|
||||
this.setRootCollection(User._COLLECTION_NAME);
|
||||
setModId(config.getId());
|
||||
setType(config.getOtype());
|
||||
setLimit(config.getLimit());
|
||||
setTimeType(config.getTime());
|
||||
setDailyUpdate(config.getDailyUpdate());
|
||||
setContinueDays(config.getContiueDays());
|
||||
setPrivilege(config.getOpenPrivilege());
|
||||
if(!config.getOnSaleRule().equals("")){
|
||||
String[][] condition;
|
||||
String[] s = config.getOnSaleRule().split("\\|");
|
||||
condition = new String[s.length][3];
|
||||
int i = 0;
|
||||
for (String s0 : s) {
|
||||
String[] s1 = s0.split("#");
|
||||
if(s1[0].equals("7")){
|
||||
setUserBuyRefresh(true);
|
||||
}
|
||||
condition[i][0] = s1[0];
|
||||
condition[i][1] = s1[1];
|
||||
if(s1.length > 2){
|
||||
condition[i][2] = s1[2];
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public AbstractWelfareBag(int modId, int type, long startTime, long endTime, int limit, int dailyUpdate, int continueDays, boolean open, long lastBuyTime, int buyTimes, long refreshTime, int[] privilege, int timeType, String[][] condition, boolean isUserBuyRefresh,String mongoKey,int rootId) {
|
||||
|
@ -81,10 +60,10 @@ public class AbstractWelfareBag extends MongoBase{
|
|||
if (!checkBuy()){
|
||||
return false;
|
||||
}
|
||||
if(isUserBuyRefresh && getRefreshTime() == 0){
|
||||
if(isUserBuyRefresh() && getRefreshTime() == 0){
|
||||
setRefreshTime(TimeUtils.getTodayZero() + getDailyUpdate() * TimeUtils.DAY);
|
||||
}
|
||||
setBuyTimes(getBuyTimes()+1);
|
||||
addBuyTimes(1);
|
||||
setLastBuyTime(TimeUtils.getTodayZero());
|
||||
return true;
|
||||
}
|
||||
|
@ -94,7 +73,7 @@ public class AbstractWelfareBag extends MongoBase{
|
|||
}
|
||||
|
||||
public boolean checkBuy() {
|
||||
if(!open){
|
||||
if(!isOpen()){
|
||||
LOGGER.error("礼包:{}未开启",modId);
|
||||
return false;
|
||||
}
|
||||
|
@ -105,7 +84,7 @@ public class AbstractWelfareBag extends MongoBase{
|
|||
return true;
|
||||
}
|
||||
|
||||
public int[][] getDropByBag() throws Exception{
|
||||
public int[][] getDropByBag() {
|
||||
SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.getConfigById(modId);
|
||||
if (config == null) {
|
||||
LOGGER.info("getDropByBag modId={} ", modId);
|
||||
|
@ -142,27 +121,33 @@ public class AbstractWelfareBag extends MongoBase{
|
|||
if(!isOpen()){
|
||||
setRefreshTime(TimeUtils.getTodayZero());
|
||||
}
|
||||
if(getTimeType() == 7){//每周刷新
|
||||
setStartTime(TimeUtils.getCurWeekdayStartTime(1,0));
|
||||
setRefreshTime(TimeUtils.getCurWeekdayStartTime(1,0) + TimeUtils.WEEK);
|
||||
}else if(getTimeType() == 8){//每月刷新
|
||||
setStartTime(TimeUtils.getCurMonthStartTime(1));
|
||||
setRefreshTime(TimeUtils.getMonthStartTime(1,1));
|
||||
}else{
|
||||
for(String[] I : getCondition()){
|
||||
if(I[0].equals("4")){
|
||||
switch (getTimeType()){
|
||||
case 7:
|
||||
setStartTime(TimeUtils.getCurWeekdayStartTime(1,0));
|
||||
setRefreshTime(TimeUtils.getCurWeekdayStartTime(1,0) + TimeUtils.WEEK);
|
||||
break;
|
||||
case 8:
|
||||
setStartTime(TimeUtils.getCurMonthStartTime(1));
|
||||
setRefreshTime(TimeUtils.getMonthStartTime(1,1));
|
||||
break;
|
||||
default:
|
||||
if(getConditionType().contains(4)){
|
||||
setRefreshTime(TimeUtils.getTodayZero() + getDailyUpdate() * TimeUtils.DAY);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
if(isUserBuyRefresh()){//玩家购买刷新
|
||||
//玩家购买刷新
|
||||
if(isUserBuyRefresh()){
|
||||
setRefreshTime(0);
|
||||
}
|
||||
setBuyTimes(0);
|
||||
setLastBuyTime(0);
|
||||
}
|
||||
|
||||
public long getRefreshTime() {
|
||||
return refreshTime;
|
||||
}
|
||||
|
||||
public int getModId() { return modId; }
|
||||
|
||||
public void setModId(int modId) {
|
||||
|
@ -172,7 +157,7 @@ public class AbstractWelfareBag extends MongoBase{
|
|||
|
||||
public int getType() {
|
||||
SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.configMap.get(modId);
|
||||
if (config != null && config.getId() == 1120){
|
||||
if (config != null){
|
||||
return config.getOtype();
|
||||
}
|
||||
return type;
|
||||
|
@ -192,6 +177,14 @@ public class AbstractWelfareBag extends MongoBase{
|
|||
|
||||
public String[][] getCondition() { return SRechargeCommodityNewConfig.getConditon(modId); }
|
||||
|
||||
public Set<Integer> getConditionType(){
|
||||
HashSet<Integer> set = new HashSet<>();
|
||||
for (String[] value : getCondition()) {
|
||||
set.add(Integer.valueOf(value[0]));
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
||||
public long getStartTime() { return startTime; }
|
||||
|
||||
public void setStartTime(long startTime) {
|
||||
|
@ -208,7 +201,7 @@ public class AbstractWelfareBag extends MongoBase{
|
|||
|
||||
public int getDailyUpdate() {
|
||||
SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.configMap.get(modId);
|
||||
if (config != null && config.getId() == 1120){
|
||||
if (config != null){
|
||||
return config.getDailyUpdate();
|
||||
}
|
||||
return dailyUpdate;
|
||||
|
@ -221,13 +214,12 @@ public class AbstractWelfareBag extends MongoBase{
|
|||
|
||||
public int getLimit() {
|
||||
SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.getConfigById(modId);
|
||||
if (this instanceof PushWelfareBag || config == null){
|
||||
return limit;
|
||||
if (config != null){
|
||||
return config.getLimit();
|
||||
}
|
||||
return config.getLimit();
|
||||
return limit;
|
||||
}
|
||||
|
||||
|
||||
public void setLimit(int limit) {
|
||||
this.limit = limit;
|
||||
updateString("limit",limit);
|
||||
|
@ -240,21 +232,24 @@ public class AbstractWelfareBag extends MongoBase{
|
|||
updateString("buyTimes",buyTimes);
|
||||
}
|
||||
|
||||
public int getContinueDays() { return continueDays; }
|
||||
public void addBuyTimes(int num) {
|
||||
this.buyTimes += num;
|
||||
updateString("buyTimes",buyTimes);
|
||||
}
|
||||
|
||||
public int getContinueDays() {
|
||||
SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.configMap.get(modId);
|
||||
if (config != null){
|
||||
return config.getContiueDays();
|
||||
}
|
||||
return continueDays;
|
||||
}
|
||||
|
||||
public void setContinueDays(int continueDays) {
|
||||
this.continueDays = continueDays;
|
||||
updateString("continueDays",continueDays);
|
||||
}
|
||||
|
||||
public long getRefreshTime() {
|
||||
SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.configMap.get(modId);
|
||||
if (config != null && config.getId() == 1120){
|
||||
return lastBuyTime + config.getDailyUpdate()*24*60*60*1000L;
|
||||
}
|
||||
return refreshTime;
|
||||
}
|
||||
|
||||
public void setRefreshTime(long refreshTime) {
|
||||
this.refreshTime = refreshTime;
|
||||
updateString("refreshTime",refreshTime);
|
||||
|
@ -271,7 +266,7 @@ public class AbstractWelfareBag extends MongoBase{
|
|||
|
||||
public int[] getPrivilege() {
|
||||
SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.configMap.get(modId);
|
||||
if (config != null && config.getId() == 1120){
|
||||
if (config != null){
|
||||
return config.getOpenPrivilege();
|
||||
}
|
||||
return privilege;
|
||||
|
@ -284,7 +279,7 @@ public class AbstractWelfareBag extends MongoBase{
|
|||
|
||||
public int getTimeType() {
|
||||
SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.configMap.get(modId);
|
||||
if (config != null && config.getId() == 1120){
|
||||
if (config != null){
|
||||
return config.getTime();
|
||||
}
|
||||
return timeType;
|
||||
|
@ -296,18 +291,13 @@ public class AbstractWelfareBag extends MongoBase{
|
|||
}
|
||||
|
||||
public boolean isUserBuyRefresh() {
|
||||
SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.configMap.get(modId);
|
||||
if (config != null && config.getId() == 1120){
|
||||
String[] onSaleRule = config.getOnSaleRule().split("\\|");
|
||||
for (String saleRule : onSaleRule) {
|
||||
String[] rule = saleRule.split("#");
|
||||
if(rule[0].equals("7")){
|
||||
return true;
|
||||
}
|
||||
String[][] condition = getCondition();
|
||||
for (String[] rule : condition) {
|
||||
if(rule[0].equals("7")){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return isUserBuyRefresh;
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setUserBuyRefresh(boolean userBuyRefresh) {
|
||||
|
|
|
@ -2,8 +2,6 @@ package com.ljsd.jieling.logic.store.newRechargeInfo.bean;
|
|||
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.util.KeyGenUtils;
|
||||
import com.ljsd.jieling.util.UUIDEnum;
|
||||
import config.SRechargeCommodityNewConfig;
|
||||
import util.TimeUtils;
|
||||
|
||||
|
@ -13,37 +11,45 @@ import util.TimeUtils;
|
|||
public class PerpetualWelfareBag extends AbstractWelfareBag {
|
||||
|
||||
public PerpetualWelfareBag(User user, SRechargeCommodityNewConfig config) throws Exception{
|
||||
super(user,config);
|
||||
for(String[] I : getCondition()){
|
||||
if(I[0].equals("4")){
|
||||
if(config.getTime() == 1){//绝对时间
|
||||
setStartTime(TimeUtils.parseTimeToMiles(I[1],TimeUtils.Stand_CeHua_Data_format));
|
||||
}else if(config.getTime() == 2){//创角时间
|
||||
setStartTime(user.getPlayerInfoManager().getCreateTime()+Long.parseLong(I[1]));
|
||||
}else if(config.getTime() == 3){//开服时间
|
||||
setStartTime(GameApplication.serverConfig.getCacheOpenTime());
|
||||
}else if(config.getTime() == 9){//条件达成
|
||||
setStartTime(0);
|
||||
super(config);
|
||||
|
||||
for(String[] value : getCondition()){
|
||||
if(value[0].equals("4")){
|
||||
switch (config.getTime()){
|
||||
case 1://绝对时间
|
||||
setStartTime(TimeUtils.parseTimeToMiles(value[1],TimeUtils.Stand_CeHua_Data_format));
|
||||
break;
|
||||
case 2://创角时间
|
||||
setStartTime(user.getPlayerInfoManager().getCreateTime()+Long.parseLong(value[1]));
|
||||
break;
|
||||
case 3://开服时间
|
||||
setStartTime(GameApplication.serverConfig.getCacheOpenTime());
|
||||
break;
|
||||
case 9://条件达成
|
||||
setStartTime(0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
setEndTime(0);
|
||||
}
|
||||
}
|
||||
|
||||
if(getDailyUpdate() > 0){
|
||||
setStartTime(TimeUtils.getTodayZero());
|
||||
if(!isUserBuyRefresh()){
|
||||
setRefreshTime(getStartTime()+ getDailyUpdate() * TimeUtils.DAY);
|
||||
}
|
||||
}
|
||||
if(config.getTime() == 7){//自然周
|
||||
|
||||
//自然周
|
||||
if(config.getTime() == 7){
|
||||
setStartTime(TimeUtils.getCurWeekdayStartTime(1,0));
|
||||
setRefreshTime(TimeUtils.getCurWeekdayStartTime(1,0) + TimeUtils.WEEK);
|
||||
}else if(config.getTime() == 8){//自然月
|
||||
//TODO 不支持礼包每天刷新 用类型8有瑕疵 之后容错
|
||||
if(config.getId() == 1005 || config.getId() == 1006|| config.getId() == 1007){
|
||||
TimeUtils.getAppointTime(0);
|
||||
}else{
|
||||
setStartTime(TimeUtils.getCurMonthStartTime(1));
|
||||
}
|
||||
setRefreshTime(getStartTime() + TimeUtils.WEEK);
|
||||
}
|
||||
//自然月
|
||||
if(config.getTime() == 8){
|
||||
setStartTime(TimeUtils.getCurMonthStartTime(1));
|
||||
setRefreshTime(TimeUtils.getMonthStartTime(1,1));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package com.ljsd.jieling.logic.store.newRechargeInfo.bean;
|
||||
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.util.KeyGenUtils;
|
||||
import com.ljsd.jieling.util.UUIDEnum;
|
||||
import config.SRechargeCommodityNewConfig;
|
||||
import util.TimeUtils;
|
||||
|
||||
|
@ -12,9 +10,9 @@ import util.TimeUtils;
|
|||
public class PushWelfareBag extends AbstractWelfareBag {
|
||||
|
||||
public PushWelfareBag(User user, SRechargeCommodityNewConfig config){
|
||||
super(user,config);
|
||||
setStartTime(System.currentTimeMillis());
|
||||
setEndTime(System.currentTimeMillis() + getTime() * TimeUtils.HOUR);
|
||||
super(config);
|
||||
setStartTime(TimeUtils.now());
|
||||
setEndTime(getStartTime() + getTime() * TimeUtils.HOUR);
|
||||
setOpen(true);
|
||||
user.getPlayerInfoManager().getNewRechargeInfo().addPush(this);
|
||||
}
|
||||
|
@ -25,13 +23,17 @@ public class PushWelfareBag extends AbstractWelfareBag {
|
|||
|
||||
@Override
|
||||
public boolean buy() {
|
||||
setBuyTimes(getBuyTimes()+1);
|
||||
if(getLimit()<=getBuyTimes()){
|
||||
addBuyTimes(1);
|
||||
if(getLimit() <= getBuyTimes()){
|
||||
setOpen(false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public int getLimit() {
|
||||
return this.limit;
|
||||
}
|
||||
|
||||
private int getTime(){
|
||||
int i = 2;
|
||||
for(String[] s : getCondition()){
|
||||
|
|
|
@ -2,8 +2,6 @@ package com.ljsd.jieling.logic.store.newRechargeInfo.bean;
|
|||
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.util.KeyGenUtils;
|
||||
import com.ljsd.jieling.util.UUIDEnum;
|
||||
import config.SRechargeCommodityNewConfig;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -15,80 +13,49 @@ import util.TimeUtils;
|
|||
public class ReceiveWelfareBag extends AbstractWelfareBag {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ReceiveWelfareBag.class);
|
||||
|
||||
private long getRewardTime;
|
||||
|
||||
private boolean bought ;
|
||||
|
||||
public ReceiveWelfareBag(User user, SRechargeCommodityNewConfig config) throws Exception{
|
||||
super(user,config);
|
||||
for(String[] I : getCondition()){
|
||||
if(I[0].equals("4")){
|
||||
if(config.getTime() == 1){//绝对时间
|
||||
setStartTime(TimeUtils.parseTimeToMiles(I[1],TimeUtils.Stand_CeHua_Data_format));
|
||||
if(I[2].equals("0")){
|
||||
setEndTime(0);
|
||||
}else{
|
||||
setEndTime(TimeUtils.parseTimeToMiles(I[2],TimeUtils.Stand_CeHua_Data_format));
|
||||
}
|
||||
}else if(config.getTime() == 2){//创角时间
|
||||
setStartTime(user.getPlayerInfoManager().getCreateTime()+Long.parseLong(I[1]));
|
||||
if(I[2].equals("0")){
|
||||
setEndTime(0);
|
||||
}else{
|
||||
setEndTime(user.getPlayerInfoManager().getCreateTime()+Long.parseLong(I[2]));
|
||||
}
|
||||
}else if(config.getTime() == 3){//开服时间
|
||||
setStartTime(GameApplication.serverConfig.getCacheOpenTime()+Long.parseLong(I[1]));
|
||||
if(I[2].equals("0")){
|
||||
setEndTime(0);
|
||||
}else{
|
||||
setEndTime(GameApplication.serverConfig.getCacheOpenTime()+Long.parseLong(I[2]));
|
||||
}
|
||||
}else if(config.getTime() == 9){//条件达成
|
||||
setStartTime(0);
|
||||
super(config);
|
||||
for(String[] value : getCondition()){
|
||||
if(value[0].equals("4")){
|
||||
switch (config.getTime()){
|
||||
case 1://绝对时间
|
||||
setStartTime(TimeUtils.parseTimeToMiles(value[1],TimeUtils.Stand_CeHua_Data_format));
|
||||
setEndTime(TimeUtils.parseTimeToMiles(value[2],TimeUtils.Stand_CeHua_Data_format));
|
||||
break;
|
||||
case 2://创角时间
|
||||
setStartTime(user.getPlayerInfoManager().getCreateTime()+Long.parseLong(value[1]));
|
||||
setEndTime(user.getPlayerInfoManager().getCreateTime()+Long.parseLong(value[2]));
|
||||
break;
|
||||
case 3://开服时间
|
||||
setStartTime(GameApplication.serverConfig.getCacheOpenTime()+Long.parseLong(value[1]));
|
||||
setEndTime(GameApplication.serverConfig.getCacheOpenTime()+Long.parseLong(value[2]));
|
||||
break;
|
||||
case 9://条件达成
|
||||
setStartTime(0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if(value[2].equals("0")){
|
||||
setEndTime(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(getDailyUpdate()>0){
|
||||
if(getDailyUpdate() > 0){
|
||||
setRefreshTime(getStartTime() + getDailyUpdate() * TimeUtils.DAY);
|
||||
}
|
||||
}
|
||||
|
||||
public ReceiveWelfareBag(int modId, int type, long startTime, long endTime, int limit, int dailyUpdate, int continueDays, boolean open, long lastBuyTime, int buyTimes, long refreshTime, int[] privilege, int timeType, String[][] condition, boolean isUserBuyRefresh, boolean bought,long getRewardTime,String mongoKey,int rootId) {
|
||||
super( modId, type, startTime, endTime, limit, dailyUpdate, continueDays, open, lastBuyTime, buyTimes, refreshTime, privilege, timeType, condition, isUserBuyRefresh,mongoKey,rootId);
|
||||
super(modId, type, startTime, endTime, limit, dailyUpdate, continueDays, open, lastBuyTime, buyTimes, refreshTime, privilege, timeType, condition, isUserBuyRefresh,mongoKey,rootId);
|
||||
this.bought = bought;
|
||||
this.getRewardTime = getRewardTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean buy() {
|
||||
if (bought) {
|
||||
LOGGER.error("礼包:{}已经购买", getModId());
|
||||
return false;
|
||||
} else {
|
||||
setBought(true);
|
||||
setStartTime(TimeUtils.getTodayZero());
|
||||
if (getDailyUpdate() > 0) {
|
||||
setRefreshTime(getStartTime() + getDailyUpdate() * TimeUtils.DAY);
|
||||
}
|
||||
if (getEndTime() != 0) {
|
||||
setEndTime(TimeUtils.getTodayZero() + getContinueDays() * TimeUtils.DAY);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean buyAgo(){
|
||||
return bought;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refresh(){
|
||||
super.refresh();
|
||||
setStartTime(System.currentTimeMillis());
|
||||
setBought(false);
|
||||
setGetRewardTime(0);
|
||||
}
|
||||
|
||||
private boolean bought ;
|
||||
|
||||
public boolean isBought() {
|
||||
return bought;
|
||||
}
|
||||
|
@ -98,14 +65,29 @@ public class ReceiveWelfareBag extends AbstractWelfareBag {
|
|||
updateString("bought",bought);
|
||||
}
|
||||
|
||||
private long getRewardTime;
|
||||
|
||||
public long getGetRewardTime() {
|
||||
return getRewardTime;
|
||||
@Override
|
||||
public boolean buy() {
|
||||
if (bought) {
|
||||
LOGGER.error("礼包:{}已经购买", getModId());
|
||||
return false;
|
||||
}
|
||||
setBought(true);
|
||||
setStartTime(TimeUtils.getTodayZero());
|
||||
if (getDailyUpdate() > 0) {
|
||||
setRefreshTime(getStartTime() + getDailyUpdate() * TimeUtils.DAY);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setGetRewardTime(long getRewardTime) {
|
||||
this.getRewardTime = getRewardTime;
|
||||
updateString("getRewardTime",getRewardTime);
|
||||
@Override
|
||||
public boolean buyAgo(){
|
||||
return bought;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refresh(){
|
||||
super.refresh();
|
||||
setBought(false);
|
||||
setStartTime(TimeUtils.now());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,14 +11,15 @@ import util.TimeUtils;
|
|||
public class TimeLimitWelfareBag extends AbstractWelfareBag {
|
||||
|
||||
public TimeLimitWelfareBag(User user, SRechargeCommodityNewConfig config){
|
||||
super(user,config);
|
||||
for(String[] I : getCondition()){
|
||||
if(I[0].equals("3")){
|
||||
if(ActivityLogic.checkActivityOpen(user,Integer.parseInt(I[1]))){
|
||||
long[] result = ActivityLogic.getStartAndEndTime(user,Integer.parseInt(I[1]));
|
||||
super(config);
|
||||
for(String[] value : getCondition()){
|
||||
if(value[0].equals("3")){
|
||||
int anInt = Integer.parseInt(value[1]);
|
||||
if(ActivityLogic.checkActivityOpen(user,anInt)){
|
||||
setOpen(true);
|
||||
long[] result = ActivityLogic.getStartAndEndTime(user, anInt);
|
||||
setStartTime(result[0]);
|
||||
setEndTime(result[1]);
|
||||
setOpen(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -34,12 +35,10 @@ public class TimeLimitWelfareBag extends AbstractWelfareBag {
|
|||
|
||||
@Override
|
||||
public boolean buy() {
|
||||
SRechargeCommodityNewConfig commodityNewConfig = SRechargeCommodityNewConfig.getConfigById(getModId());
|
||||
if(super.buy()){
|
||||
setRefreshTime(TimeUtils.getTodayZero() + commodityNewConfig.getDailyUpdate() * TimeUtils.DAY);
|
||||
setRefreshTime(TimeUtils.getTodayZero() + getDailyUpdate() * TimeUtils.DAY);
|
||||
return true;
|
||||
}else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ import com.ljsd.jieling.logic.mission.GameEvent;
|
|||
import com.ljsd.jieling.logic.mission.MissionType;
|
||||
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||
import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.NewRechargeInfo;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.PushRechargeType;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import config.*;
|
||||
|
@ -645,6 +646,7 @@ public class ItemUtil {
|
|||
case GlobalItemType.DAY_TRUE_RECHARGE_JUAN:
|
||||
case GlobalItemType.DAY_RMB_CARD:
|
||||
case GlobalItemType.DAY_XIAN_RECHARGE_CARD:
|
||||
case GlobalItemType.LARGE_AMOUNT_RECHARGE_CARD:
|
||||
itemType = GlobalItemType.ITEM;
|
||||
break;
|
||||
default:
|
||||
|
@ -1461,15 +1463,21 @@ public class ItemUtil {
|
|||
dropBuilder.addAllHero(heroList);
|
||||
}
|
||||
|
||||
private static void extraDropAop(User user,CommonProto.Drop.Builder dropBuilder,SItem sItem) throws Exception {
|
||||
if(sItem.getExtraReward()!=null && sItem.getExtraReward().length>1){
|
||||
int[] drops = sItem.getExtraReward()[1];
|
||||
public static void extraDropAop(User user,CommonProto.Drop.Builder dropBuilder,SItem sItem) throws Exception {
|
||||
if (sItem == null){
|
||||
return;
|
||||
}
|
||||
int[][] extraReward = sItem.getExtraReward();
|
||||
if(extraReward != null && extraReward.length>1){
|
||||
// bt,使用物品记录累充
|
||||
boolean itemHandler = rmbItemHandler(user,sItem);
|
||||
if (itemHandler){
|
||||
return;
|
||||
}
|
||||
int[] drops = extraReward[1];
|
||||
if(user.getItemManager().getItem(drops[0]) == null){
|
||||
int[][] extraDrops = new int[1][2];
|
||||
extraDrops[0] = new int[2];
|
||||
extraDrops[0][0] = drops[0];
|
||||
extraDrops[0][1] =1;
|
||||
if(sItem.getExtraReward()[0][0] == 0){
|
||||
int[][] extraDrops = {{drops[0], 1}};
|
||||
if(extraReward[0][0] == 0){
|
||||
drop(user,extraDrops,BIReason.EXTRA_DROP_REWARD);
|
||||
}else{
|
||||
drop(user,extraDrops,dropBuilder,BIReason.EXTRA_DROP_REWARD);
|
||||
|
@ -1478,6 +1486,35 @@ public class ItemUtil {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* bt是否是记录累充人民币的类型
|
||||
* 真充券: 只获得对应金额的妖晶和名望经验
|
||||
* 现金卡: 计入游戏内所有累计充值的活动,不计入单笔充值和直购类活动
|
||||
* 仙充卡: 计入游戏内所有累计充值的活动和单笔充值活动,不计入直购类活动
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
private static boolean rmbItemHandler(User user, SItem sItem){
|
||||
boolean result = true;
|
||||
NewRechargeInfo info = user.getPlayerInfoManager().getNewRechargeInfo();
|
||||
int num = sItem.getExtraReward()[1][0];
|
||||
switch (sItem.getItemType()){
|
||||
case GlobalItemType.RMB_CARD:
|
||||
case GlobalItemType.DAY_RMB_CARD:
|
||||
info.addRmb(num);
|
||||
break;
|
||||
case GlobalItemType.XIAN_RECHARGE_CARD:
|
||||
case GlobalItemType.DAY_XIAN_RECHARGE_CARD:
|
||||
info.addRmb(num);
|
||||
Poster.getPoster().dispatchEvent(new RechargeRewardEvent(user.getId(),num));
|
||||
break;
|
||||
default:
|
||||
result = false;
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void addCard(User user,int cardId,List<CommonProto.Hero> heroList,int reason) throws Exception {
|
||||
HeroManager heroManager = user.getHeroManager();
|
||||
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||
|
@ -1683,14 +1720,14 @@ public class ItemUtil {
|
|||
int itemId = entry.getKey();
|
||||
int itemNum = entry.getValue();
|
||||
SItem sItem = SItem.getsItemMap().get(itemId);
|
||||
int[] rewardGroup = sItem.getRewardGroup();
|
||||
for (int i = 0; i < itemNum; i++){
|
||||
|
||||
for (int j = 0; j <sItem.getRewardGroup().length ; j++) {
|
||||
for (int j = 0; j < rewardGroup.length ; j++) {
|
||||
if (dropIds.length() == 0){
|
||||
dropIds = new StringBuilder();
|
||||
dropIds.append(sItem.getRewardGroup()[j]);
|
||||
dropIds.append(rewardGroup[j]);
|
||||
}else{
|
||||
dropIds.append("#").append(sItem.getRewardGroup()[j]);
|
||||
dropIds.append("#").append(rewardGroup[j]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
package config;
|
||||
|
||||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Table(name ="GMMaster")
|
||||
public class SGMMaster implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int type;
|
||||
|
||||
private int[][] price;
|
||||
|
||||
private int[][] unlock;
|
||||
|
||||
private int packID;
|
||||
|
||||
private static Map<Integer, List<SGMMaster>> typeMap = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
Map<Integer, SGMMaster> config = STableManager.getConfig(SGMMaster.class);
|
||||
Map<Integer, List<SGMMaster>> map = new HashMap<>();
|
||||
for (SGMMaster master : config.values()) {
|
||||
List<SGMMaster> list = map.get(master.getType());
|
||||
if (list == null){
|
||||
List<SGMMaster> masters = config.values().stream().filter(v -> v.getType() == master.getType()).collect(Collectors.toList());
|
||||
map.put(master.getType(), masters);
|
||||
}
|
||||
}
|
||||
typeMap.clear();
|
||||
typeMap = map;
|
||||
}
|
||||
|
||||
public static Map<Integer, List<SGMMaster>> getTypeMap() {
|
||||
return typeMap;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public int[][] getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public int[][] getUnlock() {
|
||||
return unlock;
|
||||
}
|
||||
|
||||
public int getPackID() {
|
||||
return packID;
|
||||
}
|
||||
|
||||
}
|
|
@ -27,7 +27,7 @@ public class SRechargeCommodityNewConfig implements BaseConfig {
|
|||
|
||||
private int[] openPrivilege;
|
||||
|
||||
private int[] coverPrivilege;
|
||||
private int[][] bTVIPlevel;
|
||||
|
||||
private int contiueDays;
|
||||
|
||||
|
@ -93,12 +93,9 @@ public class SRechargeCommodityNewConfig implements BaseConfig {
|
|||
tempConfigTypeMap.put(newConfig.getType(),list);
|
||||
}
|
||||
}
|
||||
// if(configMap == null){
|
||||
configMap = tempConfigMap;
|
||||
// System.out.println("重新加载Recharge");
|
||||
sdkconfigMap = tempSdkConfigMap;
|
||||
configTypeMap = tempConfigTypeMap;
|
||||
// }
|
||||
configMap = tempConfigMap;
|
||||
sdkconfigMap = tempSdkConfigMap;
|
||||
configTypeMap = tempConfigTypeMap;
|
||||
}
|
||||
|
||||
public static String[][] getConditon(int id){
|
||||
|
@ -108,6 +105,8 @@ public class SRechargeCommodityNewConfig implements BaseConfig {
|
|||
return configMap.get(id).getCondition();
|
||||
}
|
||||
|
||||
public String getOnSaleRule() { return onSaleRule; }
|
||||
|
||||
public String[][] initConditon(SRechargeCommodityNewConfig config){
|
||||
String[] s = config.getOnSaleRule().split("\\|");
|
||||
condition = new String[s.length][3];
|
||||
|
@ -150,8 +149,8 @@ public class SRechargeCommodityNewConfig implements BaseConfig {
|
|||
|
||||
public int[] getOpenPrivilege() { return openPrivilege; }
|
||||
|
||||
public int[] getCoverPrivilege() {
|
||||
return coverPrivilege;
|
||||
public int[][] getbTVIPlevel() {
|
||||
return bTVIPlevel;
|
||||
}
|
||||
|
||||
public int getContiueDays() { return contiueDays; }
|
||||
|
@ -164,8 +163,6 @@ public class SRechargeCommodityNewConfig implements BaseConfig {
|
|||
|
||||
public int getTime() { return time; }
|
||||
|
||||
public String getOnSaleRule() { return onSaleRule; }
|
||||
|
||||
public int getDailyUpdate() { return dailyUpdate; }
|
||||
|
||||
public int[] getMail() { return mail; }
|
||||
|
|
Loading…
Reference in New Issue