新增挚礼月卡

xuexinpeng 2021-10-29 00:14:33 +08:00
parent d435e81ffc
commit cf11f25859
5 changed files with 40 additions and 5 deletions

View File

@ -76,4 +76,5 @@ public interface Global {
int MONTHCARDID =1;//1月卡
int LMONTHCARDID =2;//2豪华月卡
int SINCERECARDID =3;//3挚礼月卡
}

View File

@ -75,12 +75,12 @@ public class CrossYuxulundaoChallengeHandler extends BaseHandler<ArenaInfoProto.
int defUid = request.getChallengeUid();
int type = request.getChallengeType();
SMServerArenaSetting setting = STableManager.getConfig(SMServerArenaSetting.class).get(2);
//免费挑战
//免费挑战
/*int privId = setting.getPrivId()[0];
if (!PlayerLogic.getInstance().checkAndUpdate(user, privId, 1)) {
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}*/
if (type == 1) {
if (type == 1) {
//物品消耗挑战
int[] itemCost = setting.getCost();
int[][] comItemCost = new int[1][];
@ -90,8 +90,8 @@ public class CrossYuxulundaoChallengeHandler extends BaseHandler<ArenaInfoProto.
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
}
}else {
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
}
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
}
List<Integer> yuxuTeamId = Lists.newArrayList();
yuxuTeamId.add(GlobalsDef.CROSS_YU_XU_LUN_DAO_ONE);
yuxuTeamId.add(GlobalsDef.CROSS_YU_XU_LUN_DAO_TWO);
@ -373,6 +373,18 @@ public class CrossYuxulundaoChallengeHandler extends BaseHandler<ArenaInfoProto.
Map<Integer, List<TeamPosHeroInfo>> teamPosForHero = user.getTeamPosManager().getTeamPosForHero();
if(!teamPosForHero.containsKey(myteamId[i]) || teamPosForHero.get(myteamId[i]).size() == 0){
result[i] = 0;
CommonProto.FightTeamInfo defteamInfo = FightUtil.makeCrossPersonData(csPlayer, defTeamId[i], arenaRecord, crossArenaManager);
CommonProto.FightData build = CommonProto.FightData.newBuilder()
.addMonsterList(defteamInfo).build();
//数据互换
byte[] snapRecord = build.toByteArray();
if (i == 0) {
arenaRecord.setYxldFightData1(snapRecord);
} else if (i == 1) {
arenaRecord.setYxldFightData2(snapRecord);
} else if (i == 2) {
arenaRecord.setYxldFightData3(snapRecord);
}
if (GameApplication.serverId == csPlayer.getServerId()) {
User defuser = UserManager.getUser(csPlayer.getUserId());
int addforce = HeroLogic.getInstance().calTeamTotalForce(defuser, myteamId[i], false);

View File

@ -915,6 +915,8 @@ public class PlayerManager extends MongoBase {
newRechargeInfo.setMonthRr(0);
}else if(key ==Global.LMONTHCARDID){
newRechargeInfo.setsMonthRr(0);
}else if(key ==Global.SINCERECARDID){
newRechargeInfo.setSinceremonth(0);
}
}
}

View File

@ -406,11 +406,12 @@ public class BuyGoodsNewLogic {
}
/**
*
* //TODO 孟某某写的啥玩意 咋兼容老数据 后人注意这块 新加的月卡 策划大大讨论后从0开始计算
*/
public static void activeMonthCard(User user,double price,NewRechargeInfo info){
int monthline = STableManager.getConfig(SMonthcardConfig.class).get(Global.MONTHCARDID).getPrice();
int lmonthline = STableManager.getConfig(SMonthcardConfig.class).get(Global.LMONTHCARDID).getPrice();
int sinceremonthline = STableManager.getConfig(SMonthcardConfig.class).get(Global.SINCERECARDID).getPrice();
boolean sendneed =false;
if(info.getMonthRr()<monthline){
info.setMonthRr(MathUtils.doubleAdd(price,info.getMonthRr()));
@ -427,6 +428,14 @@ public class BuyGoodsNewLogic {
Poster.getPoster().dispatchEvent(new NewWelfareEvent(user, NewWelfareTypeEnum.RECHARGE_BUY.getType(),Global.LMONTHCARDID));
}
}
if(info.getSinceremonth() < sinceremonthline){
info.setSinceremonth(MathUtils.doubleAdd(price,info.getSinceremonth()));
if(info.getSinceremonth() >= sinceremonthline){
sendneed=true;
user.getPlayerInfoManager().putMonthCard(Global.SINCERECARDID, (int) (System.currentTimeMillis() / 1000));
}
}
if(sendneed){
ISession session = OnlineUserManager.sessionMap.get(user.getId());
if(session!=null){

View File

@ -16,6 +16,8 @@ public class NewRechargeInfo extends MongoBase {
private double monthRr ; //月卡累计总额
private double sMonthRr ; //豪华月卡累计总额
private double sinceremonth ; //挚礼月卡累计总额
private boolean isFirst;//是否首冲过
private long firstTime;//首冲时间
@ -121,6 +123,15 @@ public class NewRechargeInfo extends MongoBase {
updateString("sMonthRr",sMonthRr);
}
public double getSinceremonth() {
return sinceremonth;
}
public void setSinceremonth(double sinceremonth) {
this.sinceremonth = sinceremonth;
updateString("sinceremonth",sinceremonth);
}
public boolean getIsFirst() {
return isFirst;
}