周卡月卡调整,修改,未完成
parent
6f63f03ab0
commit
651d94e41b
|
@ -120,6 +120,7 @@ public interface GlobalsDef {
|
|||
int VIP_UNLOCK_PRIVILEGE = 3;
|
||||
int RECHARGE_UNLOCK_PRIVILEGE = 4;
|
||||
int LIKABLE_UNLOCK=6;//好感度解锁类型
|
||||
int WEEKCARD_UNLOCK=8;//周卡解锁类型
|
||||
|
||||
//特殊商店id
|
||||
int DAILY_GOODS_FAST_ID = 1004;//每日礼包一键购买的礼包ID
|
||||
|
|
|
@ -991,37 +991,33 @@ public class PlayerManager extends MongoBase {
|
|||
}
|
||||
|
||||
public Map<Integer, Integer> getMonthCard() {
|
||||
Iterator<Map.Entry<Integer, Integer>> iterator = monthCard.entrySet().iterator();
|
||||
while (iterator.hasNext()){
|
||||
Map.Entry<Integer,Integer> map = iterator.next();
|
||||
Integer key = map.getKey();
|
||||
SMonthcardConfig config = STableManager.getConfig(SMonthcardConfig.class).get(key);
|
||||
if(null==config){
|
||||
iterator.remove();
|
||||
continue;
|
||||
}
|
||||
if(((int)(System.currentTimeMillis()/1000)-map.getValue())>24*60*60*config.getContiueDays()){
|
||||
iterator.remove();
|
||||
if(key== Global.MONTHCARDID){
|
||||
newRechargeInfo.setMonthRr(0);
|
||||
}else if(key ==Global.LMONTHCARDID){
|
||||
newRechargeInfo.setsMonthRr(0);
|
||||
}else if(key ==Global.SINCERECARDID){
|
||||
newRechargeInfo.setSinceremonth(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
updateString("monthCard",monthCard);
|
||||
// Iterator<Map.Entry<Integer, Integer>> iterator = monthCard.entrySet().iterator();
|
||||
// while (iterator.hasNext()){
|
||||
// Map.Entry<Integer,Integer> map = iterator.next();
|
||||
// Integer key = map.getKey();
|
||||
// SMonthcardConfig config = STableManager.getConfig(SMonthcardConfig.class).get(key);
|
||||
// if(null==config){
|
||||
// iterator.remove();
|
||||
// continue;
|
||||
// }
|
||||
// if(((int)(System.currentTimeMillis()/1000)-map.getValue())>24*60*60*config.getContiueDays()){
|
||||
// iterator.remove();
|
||||
// if(key== Global.MONTHCARDID){
|
||||
// newRechargeInfo.setMonthRr(0);
|
||||
// }else if(key ==Global.LMONTHCARDID){
|
||||
// newRechargeInfo.setsMonthRr(0);
|
||||
// }else if(key ==Global.SINCERECARDID){
|
||||
// newRechargeInfo.setSinceremonth(0);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// updateString("monthCard",monthCard);
|
||||
return monthCard;
|
||||
}
|
||||
|
||||
public void setMonthCard(Map<Integer, Integer> monthCard) {
|
||||
updateString("monthCard",monthCard);
|
||||
this.monthCard = monthCard;
|
||||
}
|
||||
public void putMonthCard(Integer id, Integer time) {
|
||||
this.monthCard.put(id, time);
|
||||
updateString("monthCard",this.monthCard);
|
||||
monthCard.put(id, time);
|
||||
updateString("monthCard",monthCard);
|
||||
}
|
||||
|
||||
public Set<Integer> getMonthCardDailyTake() {
|
||||
|
|
|
@ -44,7 +44,10 @@ import com.ljsd.jieling.logic.mission.MissionState;
|
|||
import com.ljsd.jieling.logic.mission.event.MissionEventDistributor;
|
||||
import com.ljsd.jieling.logic.mission.main.MissionStateChangeInfo;
|
||||
import com.ljsd.jieling.logic.mission.main.ServenMissionIdsType;
|
||||
import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.NewRechargeInfo;
|
||||
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.thrift.idl.*;
|
||||
import com.ljsd.jieling.thrift.pool.ClientAdapterPo;
|
||||
|
@ -1526,7 +1529,7 @@ public class PlayerLogic {
|
|||
if(mCount==-1){
|
||||
return true;
|
||||
}
|
||||
if((info.getCount()+checkNum>mCount)|| (info.getEffectTime()!=0&&TimeUtils.now()/1000>info.getEffectTime())){
|
||||
if((info.getCount()+checkNum>mCount)|| (info.getEffectTime()!=0&&TimeUtils.nowInt()>info.getEffectTime())){
|
||||
continue;
|
||||
}
|
||||
return true;
|
||||
|
@ -1608,7 +1611,7 @@ public class PlayerLogic {
|
|||
private int getMaxCountByPrivilege(User user,int privilegeId){
|
||||
SPrivilegeTypeConfig sPrivilegeTypeConfig = SPrivilegeTypeConfig.getsPrivilegeTypeConfigMap().get(privilegeId);
|
||||
Map<Integer, Map<Integer, Integer>> conditionMap = SPrivilegeTypeConfig.conditionMap.get(sPrivilegeTypeConfig.getUnlockType());
|
||||
int mCount = 0;
|
||||
int mCount;
|
||||
int cond = 0;
|
||||
switch (sPrivilegeTypeConfig.getUnlockType()){
|
||||
case GlobalsDef.LEVEL_UNLOCK_PRIVILEGE:
|
||||
|
@ -1623,15 +1626,21 @@ public class PlayerLogic {
|
|||
case GlobalsDef.LIKABLE_UNLOCK:
|
||||
cond = user.getHeroManager().GetAllLikableLv();
|
||||
break;
|
||||
case GlobalsDef.WEEKCARD_UNLOCK:
|
||||
int time = user.getPlayerInfoManager().getMonthCard().getOrDefault(1, 0);
|
||||
if (time != 0){
|
||||
cond = 1;
|
||||
}
|
||||
break;
|
||||
default:{
|
||||
break;
|
||||
}
|
||||
}
|
||||
TreeMap<Integer, Integer> condition = (TreeMap)conditionMap.get(privilegeId);
|
||||
if(sPrivilegeTypeConfig.getUnlockType()!=GlobalsDef.RECHARGE_UNLOCK_PRIVILEGE){
|
||||
mCount = condition.floorEntry(cond).getValue();
|
||||
}else{
|
||||
if(sPrivilegeTypeConfig.getUnlockType()==GlobalsDef.RECHARGE_UNLOCK_PRIVILEGE){
|
||||
mCount = condition.get(0);
|
||||
}else{
|
||||
mCount = condition.floorEntry(cond).getValue();
|
||||
}
|
||||
return mCount;
|
||||
}
|
||||
|
@ -1658,25 +1667,19 @@ public class PlayerLogic {
|
|||
public List<CommonProto.MonthCardInfo> getMonthCardInfo(User user) {
|
||||
List<CommonProto.MonthCardInfo> cardInfos = new LinkedList<>();
|
||||
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||
NewRechargeInfo rechargeInfo = playerInfoManager.getNewRechargeInfo();
|
||||
STableManager.getConfig(SMonthcardConfig.class).forEach((key, config) -> {
|
||||
int time = playerInfoManager.getMonthCard().getOrDefault(key,0);
|
||||
int state = playerInfoManager.getMonthCardDailyTake().contains(key)?1:0;
|
||||
double saveAmt = 0;
|
||||
switch (key){
|
||||
case 1:
|
||||
saveAmt = rechargeInfo.getMonthRr();
|
||||
break;
|
||||
case 2:
|
||||
saveAmt = rechargeInfo.getsMonthRr();
|
||||
break;
|
||||
case 3:
|
||||
saveAmt = rechargeInfo.getSinceremonth();
|
||||
break;
|
||||
default:break;
|
||||
|
||||
Map<Integer, SMonthcardConfig> monthcardConfigMap = STableManager.getConfig(SMonthcardConfig.class);
|
||||
for (SMonthcardConfig monthcardConfig : monthcardConfigMap.values()) {
|
||||
int time = playerInfoManager.getMonthCard().getOrDefault(monthcardConfig.getId(),0);
|
||||
int state = 0;
|
||||
SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.getConfigById(monthcardConfig.getPrice());
|
||||
RechargeHandler rechargeHandler = BuyGoodsNewLogic.getRechargeHandler(config.getOtype());
|
||||
AbstractWelfareBag bag = rechargeHandler.getRechargeMap(user).get(config.getId());
|
||||
if (bag != null && !bag.checkBuy()){
|
||||
state = playerInfoManager.getMonthCardDailyTake().contains(monthcardConfig.getId())?2:1;
|
||||
}
|
||||
cardInfos.add(CommonProto.MonthCardInfo.newBuilder().setId(key).setEndingTime(time).setState(state).setTotleAmt(saveAmt).build());
|
||||
});
|
||||
cardInfos.add(CommonProto.MonthCardInfo.newBuilder().setId(monthcardConfig.getId()).setEndingTime(time).setState(state).setTotleAmt(0).build());
|
||||
}
|
||||
return cardInfos;
|
||||
}
|
||||
|
||||
|
|
|
@ -235,8 +235,8 @@ public class BuyGoodsNewLogic {
|
|||
info.setRr(MathUtils.doubleAdd(price,info.getRr()));
|
||||
info.setRechargeList(TimeUtils.now(),price);
|
||||
//处理月卡
|
||||
user.getPlayerInfoManager().getMonthCard();
|
||||
activeMonthCard(user,price,config.getId());
|
||||
// user.getPlayerInfoManager().getMonthCard();
|
||||
activeMonthCard(user,config.getId());
|
||||
//活动
|
||||
user.getPlayerInfoManager().setRechargedaily(user.getPlayerInfoManager().getRechargedaily()+price);
|
||||
changeActivity(user,price,info);
|
||||
|
@ -484,10 +484,23 @@ public class BuyGoodsNewLogic {
|
|||
|
||||
/**
|
||||
* 激活月卡 //TODO 孟某某写的啥玩意 咋兼容老数据 后人注意这块 新加的月卡 策划大大讨论后从0开始计算
|
||||
* 2022-6-6 月卡重做
|
||||
*/
|
||||
public static void activeMonthCard(User user,double price,int goodId){
|
||||
Map<Integer, SMonthcardConfig> monthcardConfigMap = STableManager.getConfig(SMonthcardConfig.class);
|
||||
public static void activeMonthCard(User user,int goodId){
|
||||
SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.getConfigById(goodId);
|
||||
RechargeHandler rechargeHandler = getRechargeHandler(config.getOtype());
|
||||
AbstractWelfareBag bag = rechargeHandler.getRechargeMap(user).get(goodId);
|
||||
// 礼包信息
|
||||
if (bag == null){
|
||||
return;
|
||||
}
|
||||
long now = TimeUtils.now();
|
||||
// 时间验证
|
||||
if (now < bag.getStartTime() || now > bag.getRefreshTime()){
|
||||
return;
|
||||
}
|
||||
|
||||
Map<Integer, SMonthcardConfig> monthcardConfigMap = STableManager.getConfig(SMonthcardConfig.class);
|
||||
boolean sendneed =false;
|
||||
for (SMonthcardConfig monthcardConfig : monthcardConfigMap.values()) {
|
||||
if (goodId == monthcardConfig.getPrice()){
|
||||
|
|
Loading…
Reference in New Issue