back_recharge
lvxinran 2020-04-02 15:14:34 +08:00
commit 44f8aa82f2
15 changed files with 331 additions and 106 deletions

View File

@ -68,7 +68,10 @@ public interface Global {
int VIPSTORID = 20; //vip商店id
int LUXURYMONTHCARDID =11;//6豪华月卡
int LUXURYMONTHCARDID =11;//6豪华月卡 废弃 改版
int WEEKCARDID = 10; //月卡
int MONTHCARDID =1;//1月卡
int LMONTHCARDID =2;//2豪华月卡
}

View File

@ -167,6 +167,7 @@ public class GetPlayerInfoHandler extends BaseHandler{
.setAmount(rechargeInfo.getSaveAmt())
.setVipDaily(playerInfoManager.getHadTakeDailyBoxVip())
.setMissingRefreshCount(vipPrivilageValue)
.addAllMonthinfos(PlayerLogic.getInstance().getMonthCardInfo(user))
.build();
try {
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GET_PLAYERINFO_RESPONSE_VALUE, getPlayerInfoResponse, true);

View File

@ -1,21 +0,0 @@
package com.ljsd.jieling.handler.store;
import com.ljsd.jieling.handler.BaseHandler;
import com.ljsd.jieling.logic.store.StoreLogic;
import com.ljsd.jieling.netty.cocdex.PacketNetData;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.MessageTypeProto;
import org.springframework.stereotype.Component;
@Component
public class BuyTreasureHandler extends BaseHandler {
@Override
public MessageTypeProto.MessageType getMessageCode() {
return MessageTypeProto.MessageType.BUY_TREASURE_REQUEST;
}
@Override
public void process(ISession iSession, PacketNetData netData) throws Exception {
StoreLogic.buyTreasure(iSession);
}
}

View File

@ -0,0 +1,47 @@
package com.ljsd.jieling.handler.vip;
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.network.session.ISession;
import com.ljsd.jieling.protocols.CommonProto;
import com.ljsd.jieling.protocols.MessageTypeProto;
import com.ljsd.jieling.protocols.PlayerInfoProto;
import com.ljsd.jieling.util.ItemUtil;
import com.ljsd.jieling.util.MessageUtil;
import config.SMonthcardConfig;
import manager.STableManager;
/**
* Description: des
* Author: zsx
* CreateDate: 2020/3/30 14:00
*/
public class MonthTakeDailyHandler extends BaseHandler <PlayerInfoProto.TakeMothDilyRequest>{
@Override
public MessageTypeProto.MessageType getMessageCode() {
return MessageTypeProto.MessageType.MONTHCARD_TAKE_DAILY_REQUEST;
}
@Override
public void processWithProto(ISession iSession, PlayerInfoProto.TakeMothDilyRequest proto) throws Exception {
User user = UserManager.getUser(iSession.getUid());
SMonthcardConfig config = STableManager.getConfig(SMonthcardConfig.class).get(proto.getType());
if(null == config){
throw new ErrorCodeException(ErrorCode.CFG_NULL);
}
if(user.getPlayerInfoManager().getMonthCardDailyTake().contains(proto.getType())){
throw new ErrorCodeException(ErrorCode.newDefineCode("had taked the month daily reward"));
}
user.getPlayerInfoManager().addMonthCardDailyTake(proto.getType());
CommonProto.Drop.Builder drop = ItemUtil.drop(user, config.getBaseReward(), BIReason.TAKE_VIP_DAILY_REWARD);
PlayerInfoProto.TakeMothDilyResponse build = PlayerInfoProto.TakeMothDilyResponse.newBuilder().setDrop(drop).build();
MessageUtil.sendMessage(iSession, 1,MessageTypeProto.MessageType.MONTHCARD_TAKE_DAILY_RESPONSE_VALUE, build, true);
}
}

View File

@ -35,7 +35,7 @@ public class VipTakeDailyHandler extends BaseHandler<PlayerInfoProto.VipTakeDily
throw new ErrorCodeException(ErrorCode.CFG_NULL);
}
if(!playerInfoManager.getRechargeInfo().getBuyGoodsTimes().containsKey(Global.LUXURYMONTHCARDID)){
if(!playerInfoManager.getMonthCard().containsKey(Global.LMONTHCARDID)){
throw new ErrorCodeException(ErrorCode.newDefineCode("未激活豪华月卡"));
}

View File

@ -65,14 +65,16 @@ public class HotfixUtil implements IEventHandler {
}
LOGGER.debug("HotfixUtil->currVerion={},version={}", currVerion, version);
//TODO 应该只需要instrument 这个可以在应用启动前加 之后直接调用热更新逻辑 不用在运行的过程中动态加载代理
//拿到当前jvm的进程id
String pid = ManagementFactory.getRuntimeMXBean().getName().split("@")[0];
VirtualMachine vm = VirtualMachine.attach(pid);
//版本发生了变化,热更新
if (!version.equalsIgnoreCase(currVerion)) {
//TODO 应该只需要instrument 这个可以在应用启动前加 之后直接调用热更新逻辑 不用在运行的过程中动态加载代理
//拿到当前jvm的进程id
String pid = ManagementFactory.getRuntimeMXBean().getName().split("@")[0];
VirtualMachine vm = VirtualMachine.attach(pid);
List<ClassBean> list = hotfixBean.getClasses();
int i = 0;
for (ClassBean cl : list) {

View File

@ -4,12 +4,10 @@ import com.ljsd.jieling.exception.ErrorCode;
import com.ljsd.jieling.exception.ErrorCodeException;
import com.ljsd.jieling.globals.BIReason;
import com.ljsd.jieling.logic.OnlineUserManager;
import com.ljsd.jieling.logic.dao.ActivityMission;
import com.ljsd.jieling.logic.dao.ActivityProgressInfo;
import com.ljsd.jieling.logic.dao.PlayerManager;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.*;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.mission.GameEvent;
import com.ljsd.jieling.logic.store.GiftGoodsType;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.CommonProto;
import com.ljsd.jieling.protocols.MessageTypeProto;
@ -18,6 +16,7 @@ import com.ljsd.jieling.util.ItemUtil;
import com.ljsd.jieling.util.MessageUtil;
import com.ljsd.jieling.util.ToolsUtil;
import config.SGlobalActivity;
import config.SRechargeCommodityConfig;
import config.STreasureSunlongConfig;
import java.util.*;
@ -38,8 +37,22 @@ public class TreasureActivity extends AbstractActivity {
@Override
public void initActivity(User user) throws Exception {
user.getPlayerInfoManager().setHadBuyTreasure(0);
LOGGER.info("戒灵秘宝初始化...");
if(user.getPlayerInfoManager().getHadBuyTreasure() == 1){
LOGGER.info("戒灵秘宝初始化...reset buy");
user.getPlayerInfoManager().setHadBuyTreasure(0);
Map<Integer, Integer> buyGoodsTimes = user.getPlayerInfoManager().getRechargeInfo().getBuyGoodsTimes();
int id=0;
for(SRechargeCommodityConfig sRechargeCommodityConfig : SRechargeCommodityConfig.rechargeCommodityConfigMap.values()){
if(sRechargeCommodityConfig.getType() == GiftGoodsType.SUN_LONG){
id=sRechargeCommodityConfig.getId();
}
}
buyGoodsTimes.put(id,0);
user.getPlayerInfoManager().getRechargeInfo().setBuyGoodsTimes(buyGoodsTimes);
user.getPlayerInfoManager().getRechargeInfo().clearCacheSendId();
}
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(id);
user.getUserMissionManager().onGameEvent(user, GameEvent.TREASH_MONTH_REFRESH, sGlobalActivity.getId());
user.getUserMissionManager().onGameEvent(user, GameEvent.TREASH_WEEK_REFRESH, sGlobalActivity.getId());

View File

@ -82,7 +82,6 @@ public class ChampionshipLogic {
}
List<Object> arenaIds = new ArrayList<>(arenaRecodeds);
List<ArenaRecord> arenaRecords = RedisUtil.getInstence().getMapEntrys(RedisKey.CHAMPION_ARENA_RECORD, "", arenaIds, ArenaRecord.class);
Map<Integer, SArenaRobotConfig> config = STableManager.getConfig(SArenaRobotConfig.class);
ArenaInfoProto.ChampionViewFinalResponse.Builder builder = ArenaInfoProto.ChampionViewFinalResponse.newBuilder();
String selectIdForRedis = getSelectIdForRedis();
for (ArenaRecord arenaRecord : arenaRecords) {
@ -502,7 +501,7 @@ public class ChampionshipLogic {
public static void getChampionBetInfo(ISession session,int type) throws Exception {
int uid = session.getUid();
if(progress==-1){
if(progress==-1 || schedule==1){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
String selectIdForRedis = getSelectIdForRedis();
@ -1147,7 +1146,11 @@ public class ChampionshipLogic {
public static String getSelectIdForRedis(){
String key = RedisUtil.getInstence().getKey(RedisKey.CHAMPION_CUR_BETID, "");
return RedisUtil.getInstence().get(key).toString();
Object result = RedisUtil.getInstence().get(key);
if(result!=null){
return result.toString();
}
return "";
}
@ -1217,28 +1220,33 @@ public class ChampionshipLogic {
int[][] itemNum = STableManager.getFigureConfig(CommonStaticConfig.class).getsChampionshipSetting().getItemNum();
SGlobalSystemConfig sGlobalSystemConfig = STableManager.getConfig(SGlobalSystemConfig.class).get(functionId);
Map<String,Integer> sendIds = new HashMap<>();
OnlineUserManager.sessionMap.values().forEach(session->{
try {
sendIds.put(Integer.toString(session.getUid()),1);
User user = UserManager.getUser(session.getUid());
AyyncWorker ayyncWorker = new AyyncWorker(user, true, new AyncWorkerRunnable() {
@Override
public void work(User user) throws Exception {
if(!HandlerLogicThread.checkOpen(user, sGlobalSystemConfig)){
return;
}
ItemUtil.drop(user, itemNum, BIReason.CHAMPIION_BET_REWARD);
MongoUtil.getLjsdMongoTemplate().lastUpdate();
}
});
ProtocolsManager.getInstance().updateAyncWorker(ayyncWorker);
} catch (Exception e) {
e.printStackTrace();
}
});
RedisUtil.getInstence().putMapEntrys(RedisKey.CHAMPION_GUESSS_UIDS,"",sendIds);
snapPlayFightInfo();
selectBetTeam();
if(schedule==2){
OnlineUserManager.sessionMap.values().forEach(session->{
try {
sendIds.put(Integer.toString(session.getUid()),1);
User user = UserManager.getUser(session.getUid());
AyyncWorker ayyncWorker = new AyyncWorker(user, true, new AyncWorkerRunnable() {
@Override
public void work(User user) throws Exception {
if(!HandlerLogicThread.checkOpen(user, sGlobalSystemConfig)){
return;
}
ItemUtil.drop(user, itemNum, BIReason.CHAMPIION_BET_REWARD);
MongoUtil.getLjsdMongoTemplate().lastUpdate();
}
});
ProtocolsManager.getInstance().updateAyncWorker(ayyncWorker);
} catch (Exception e) {
e.printStackTrace();
}
});
RedisUtil.getInstence().putMapEntrys(RedisKey.CHAMPION_GUESSS_UIDS,"",sendIds);
selectBetTeam();
}
}
@ -1354,17 +1362,25 @@ public class ChampionshipLogic {
long now = TimeUtils.now();
long startTime = timeControllerOfFunction.getStartTime();
SChampionshipSetting sChampionshipSetting = STableManager.getFigureConfig(CommonStaticConfig.class).getsChampionshipSetting();
int duration = sChampionshipSetting.getPrepareTime() + sChampionshipSetting.getGuessTime() + sChampionshipSetting.getBattleTime() + sChampionshipSetting.getSettleTime();
int progressState=getProgress((int)((now - startTime)/1000%duration +1));
long round = (now - startTime) /1000/ duration + 1;
int durationSelect = sChampionshipSetting.getPrepareTime() + sChampionshipSetting.getBattleTime() + sChampionshipSetting.getSettleTime();
int durationFinal = durationSelect+ sChampionshipSetting.getGuessTime() ;
int progressState=getProgress((int)((now - startTime)/1000%durationSelect +1));
long round = (now - startTime) /1000/ durationSelect + 1;
roundTimes = (int) round;
long diff = round - (sChampionshipSetting.getTrialsGroup() - 1);
int progressTmp;
if(diff<=0){ //选拔赛
//竞猜阶段取消,改成直接战斗
progressState = progressState==1?2:progressState;
progressTmp =100 + roundTimes*10 + progressState;
schedule=1;
}else {//决赛
long passTIme = (now - startTime - (sChampionshipSetting.getTrialsGroup() - 1) * 1000L * durationSelect )/1000;
round = passTIme / durationFinal + sChampionshipSetting.getTrialsGroup() ;
roundTimes = (int) round ;
diff = round - (sChampionshipSetting.getTrialsGroup() - 1);
progressState=getProgress((int)(passTIme%durationFinal +1));
int totalWiner =sChampionshipSetting.getChampionshipPlayer()/ sChampionshipSetting.getTrialsGroup() * sChampionshipSetting.getTrialsGroupWinner();
if(diff>totalWiner || Math.pow(2,diff)>totalWiner){
schedule=2;
@ -1386,7 +1402,11 @@ public class ChampionshipLogic {
if(progressTmp == progress){
return;
}
endTime = (int)( startTime/1000 + (round-1)*duration + getDuratimeByProgressState(progressState));
if(schedule ==1) {
endTime = (int)( startTime/1000 + (round-1)*durationSelect + getDuratimeByProgressState(progressState));
}else{
endTime = (int)( startTime/1000 + (sChampionshipSetting.getTrialsGroup()-1)*durationSelect + (round-sChampionshipSetting.getTrialsGroup())*durationFinal + getDuratimeByProgressState(progressState));
}
progress = progressTmp;
if(isServerStart){
return;
@ -1400,7 +1420,7 @@ public class ChampionshipLogic {
}
});
}
if(progress%10%4==1){ //竞猜阶段 后台自动运行战斗
if(progress%10%4==1 || (schedule==1 && progress%10%4==2)){ //竞猜阶段 后台自动运行战斗
ThreadManager.getScheduledExecutor().execute(new Runnable() {
@Override
public void run() {
@ -1419,7 +1439,9 @@ public class ChampionshipLogic {
public void run() {
try {
scoreToRedis();
sendBetReward();
if(schedule==2){
sendBetReward();
}
} catch (Exception e) {
e.printStackTrace();
}
@ -1442,12 +1464,12 @@ public class ChampionshipLogic {
return sChampionshipSetting.getPrepareTime();
}
if(progressState == 1){
return sChampionshipSetting.getPrepareTime() + sChampionshipSetting.getGuessTime();
return sChampionshipSetting.getPrepareTime() +(schedule==2? sChampionshipSetting.getGuessTime():0);
}
if(progressState == 2){
return sChampionshipSetting.getPrepareTime() + sChampionshipSetting.getGuessTime() + sChampionshipSetting.getBattleTime();
}
return sChampionshipSetting.getPrepareTime() + sChampionshipSetting.getGuessTime() + sChampionshipSetting.getBattleTime() + sChampionshipSetting.getSettleTime();
return sChampionshipSetting.getPrepareTime() + (schedule==2? sChampionshipSetting.getGuessTime():0) + sChampionshipSetting.getBattleTime();
}
return sChampionshipSetting.getPrepareTime() + (schedule==2? sChampionshipSetting.getGuessTime():0) + sChampionshipSetting.getBattleTime() + sChampionshipSetting.getSettleTime();
}

View File

@ -2,14 +2,12 @@ package com.ljsd.jieling.logic.dao;
import com.ljsd.common.mogodb.MongoBase;
import com.ljsd.jieling.core.GlobalsDef;
import com.ljsd.jieling.core.VipPrivilegeType;
import com.ljsd.jieling.globals.BIReason;
import com.ljsd.jieling.globals.Global;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.mission.GameEvent;
import com.ljsd.jieling.logic.player.PlayerLogic;
import config.SMonthcardConfig;
import config.SPrivilegeTypeConfig;
import config.SVipLevelConfig;
import manager.STableManager;
import util.TimeUtils;
import java.util.*;
@ -68,6 +66,8 @@ public class PlayerManager extends MongoBase {
private Set<Integer> reds = new CopyOnWriteArraySet<>();
private RechargeInfo rechargeInfo;
private Map<Integer,Integer> monthCard = new HashMap<>();//月卡信息
private Set<Integer> monthCardDailyTake = new HashSet<>();
private int headFrame;
@ -578,4 +578,50 @@ public class PlayerManager extends MongoBase {
updateString("sex", sex);
this.sex = sex;
}
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){
rechargeInfo.setMonthSaveAmt(0);
}else if(key ==Global.LMONTHCARDID){
rechargeInfo.setSmonthSaveAmt(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);
}
public Set<Integer> getMonthCardDailyTake() {
return monthCardDailyTake;
}
public void addMonthCardDailyTake(Integer integer) {
this.monthCardDailyTake.add(integer);
updateString("monthCardDailyTake",monthCardDailyTake);
}
public void setMonthCardDailyTake(Set<Integer> monthCardDailyTake) {
this.monthCardDailyTake = monthCardDailyTake;
updateString("monthCardDailyTake",monthCardDailyTake);
}
}

View File

@ -11,6 +11,8 @@ public class RechargeInfo extends MongoBase{
private int saveAmt;//累计充值
private int soulCrystalAmt;//累计充值购买魂晶
private int monthSaveAmt ; //月卡累计总额
private int smonthSaveAmt ; //豪华月卡累计总额
private int isFirst;
private long createTime;
private int hadBuyFound;
@ -237,4 +239,22 @@ public class RechargeInfo extends MongoBase{
public Map<Integer, Long> getRefreshBagMap() {
return refreshBagMap;
}
public int getMonthSaveAmt() {
return monthSaveAmt;
}
public void setMonthSaveAmt(int monthSaveAmt) {
this.monthSaveAmt = monthSaveAmt;
updateString("monthSaveAmt",smonthSaveAmt);
}
public int getSmonthSaveAmt() {
return smonthSaveAmt;
}
public void setSmonthSaveAmt(int smonthSaveAmt) {
this.smonthSaveAmt = smonthSaveAmt;
updateString("smonthSaveAmt",smonthSaveAmt);
}
}

View File

@ -372,6 +372,7 @@ public class PlayerLogic {
if (!TimeUtils.isSameMonthFiveWithNow(user.getPlayerInfoManager().getOffLineTime())) {
user.getPlayerInfoManager().getPhoneBindInfo().setState(0);
}
user.getPlayerInfoManager().setMonthCardDailyTake(new HashSet<>());//刷新月卡信息
if(null!=fBuilder){
PhoneBindInfo phoneBindInfo = user.getPlayerInfoManager().getPhoneBindInfo();
fBuilder.setPlayerBindPhone(CommonProto.PlayerBindPhone.newBuilder().setPhoneNum(phoneBindInfo.getPhoneNum()).setState(phoneBindInfo.getState()).build());
@ -897,4 +898,18 @@ public class PlayerLogic {
}
return maxCount;
}
public List<CommonProto.MonthCardInfo> getMonthCardInfo(User user) {
List<CommonProto.MonthCardInfo> cardInfos = new LinkedList<>();
PlayerManager playerInfoManager = user.getPlayerInfoManager();
RechargeInfo rechargeInfo = playerInfoManager.getRechargeInfo();
STableManager.getConfig(SMonthcardConfig.class).forEach((integer, sMonthcardConfig) -> {
int state = playerInfoManager.getMonthCardDailyTake().contains(integer)?1:0;
int saveAmt = integer==1?rechargeInfo.getMonthSaveAmt():rechargeInfo.getSmonthSaveAmt();
int time = playerInfoManager.getMonthCard().getOrDefault(integer,0);
cardInfos.add(CommonProto.MonthCardInfo.newBuilder().setId(integer).setEndingTime(time).setState(state).setTotleAmt(saveAmt).build());
});
return cardInfos;
}
}

View File

@ -119,15 +119,39 @@ public class BuyGoodsLogic {
needSendMail = true;
}
if( (type == GiftGoodsType.MONTHCARD || type == GiftGoodsType.LUXURYMONTHCARD ) && nowTime<endTime-STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getNextAvailableTime()*3600){
resultRes.setResultCode(0);
resultRes.setResultMsg("不可以过早购买");
return resultRes;
}
//月卡不走购买逻辑
// if( (type == GiftGoodsType.MONTHCARD || type == GiftGoodsType.LUXURYMONTHCARD ) && nowTime<endTime-STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getNextAvailableTime()*3600){
// resultRes.setResultCode(0);
// resultRes.setResultMsg("不可以过早购买");
// return resultRes;
// }
endTime +=sRechargeCommodityConfig.getContiueDays() * 24 * 3600;
rechargeInfo.updateGoodsTypeDuration(sRechargeCommodityConfig.getId(),endTime);
}
if(sRechargeCommodityConfig.getAccumulativeRecharge() == 1){
int monthline = STableManager.getConfig(SMonthcardConfig.class).get(Global.MONTHCARDID).getPrice();
int lmonthline = STableManager.getConfig(SMonthcardConfig.class).get(Global.LMONTHCARDID).getPrice();
boolean sendneed =false;
if(rechargeInfo.getMonthSaveAmt()<monthline&&(price+rechargeInfo.getMonthSaveAmt())>=monthline){
sendneed=true;
user.getPlayerInfoManager().getMonthCard().put(Global.MONTHCARDID, (int) (System.currentTimeMillis() / 1000));
}
if(rechargeInfo.getSmonthSaveAmt()<lmonthline&&(price+rechargeInfo.getSmonthSaveAmt())>=lmonthline){
sendneed=true;
user.getPlayerInfoManager().getMonthCard().put(Global.LMONTHCARDID, (int) (System.currentTimeMillis() / 1000));
}
if(sendneed){
ISession session = OnlineUserManager.sessionMap.get(uid);
if(session!=null){
PlayerInfoProto.MonthCardIndication monthCardIndication = PlayerInfoProto.MonthCardIndication.newBuilder().addAllMonthinfos(PlayerLogic.getInstance().getMonthCardInfo(user)).build();
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.MONTHCARD_INDICATION_VALUE, monthCardIndication, true);
}
}
}
triggerEvent(user,sRechargeCommodityConfig,nowTime);
int[][] baseReward = sRechargeCommodityConfig.getBaseReward();
int length = baseReward.length;
@ -186,8 +210,11 @@ public class BuyGoodsLogic {
}
}
rechargeInfo.setSaveAmt(price+saveAmt);
user.getPlayerInfoManager().addRechargedaily(price);
user.getPlayerInfoManager().getMonthCard();
rechargeInfo.setMonthSaveAmt(price+rechargeInfo.getMonthSaveAmt());
rechargeInfo.setSmonthSaveAmt(price+rechargeInfo.getSmonthSaveAmt());
//TODO 用事件分发
ActivityLogic.getInstance().updateActivityMissionProgress(user, ActivityType.RechargeTotal,price);
ActivityLogic.getInstance().updateActivityMissionProgress(user, ActivityType.LUCKYCAT,price);
@ -208,6 +235,8 @@ public class BuyGoodsLogic {
}
PlayerInfoProto.RefreshRechargeIndication.Builder builder = PlayerInfoProto.RefreshRechargeIndication.newBuilder();
builder.setAmount(rechargeInfo.getSaveAmt());
builder.setMonthSaveAmt(rechargeInfo.getMonthSaveAmt());
builder.setSmonthSaveAmt(rechargeInfo.getSmonthSaveAmt());
MessageUtil.sendIndicationMessage(session,1, MessageTypeProto.MessageType.REFRESH_RECHARGE_INDICATION_VALUE,builder.build(),true);
}
@ -308,7 +337,9 @@ public class BuyGoodsLogic {
}
MessageUtil.sendIndicationMessage(OnlineUserManager.getSessionByUid(user.getId()), 1, MessageTypeProto.MessageType.PRIVILLEGE_ADD_INDICATION_VALUE, indication.build(), true);
}
if(goodsType == GiftGoodsType.LUXURYMONTHCARD){
if(user.getPlayerInfoManager().getMonthCard().containsKey(Global.LMONTHCARDID) ){
PlayerLogic.getInstance().sendDayilyMail(user,goodsType);
int starReward = user.getMapManager().getStarReward();
if(starReward == 0){
@ -329,8 +360,13 @@ public class BuyGoodsLogic {
String title = SErrorCodeEerverConfig.getI18NMessage("recharge_6_stars_title");
String content = SErrorCodeEerverConfig.getI18NMessage("recharge_6_stars_txt");
MailLogic.getInstance().sendMail(user.getId(),title,content,rewardStr.toString(),nowTime, Global.MAIL_EFFECTIVE_TIME);
}else if(goodsType == GiftGoodsType.MONTHCARD || goodsType == GiftGoodsType.WEEKCARD || goodsType == GiftGoodsType.FOUND_ONE || goodsType == GiftGoodsType.FOUND_TWO){
}
if(user.getPlayerInfoManager().getMonthCard().containsKey(Global.MONTHCARDID) || goodsType == GiftGoodsType.WEEKCARD || goodsType == GiftGoodsType.FOUND_ONE || goodsType == GiftGoodsType.FOUND_TWO){
PlayerLogic.getInstance().sendDayilyMail(user,goodsType);
}else if(goodsType == GiftGoodsType.SUN_LONG ){
user.getPlayerInfoManager().setHadBuyTreasure(1);
}
}
@ -522,7 +558,4 @@ public class BuyGoodsLogic {
user.getPlayerInfoManager().getRechargeInfo().setRefreshBagMap(refreshBagMap);
}
}

View File

@ -10,4 +10,5 @@ public interface GiftGoodsType {
int WEEKCARD = 7; //周卡
int FOUND_ONE = 8; //豪华基金
int FOUND_TWO = 9; //豪华基金
int SUN_LONG = 11; //豪华基金
}

View File

@ -660,30 +660,6 @@ public class StoreLogic implements IEventHandler {
return false;
}
public static void buyTreasure(ISession session) throws Exception {
User user = UserManager.getUser(session.getUid());
int msgId = MessageTypeProto.MessageType.BUY_TREASURE_RESPONSE_VALUE;
int hadBuyTreasure = user.getPlayerInfoManager().getHadBuyTreasure();
int[] treasurePrice = STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getTreasurePrice();
if(hadBuyTreasure == 1){
throw new ErrorCodeException(ErrorCode.newDefineCode("had bought"));
}
int[][] cost = new int[1][];
cost[0] = treasurePrice;
boolean enough = ItemUtil.itemCost(user, cost, BIReason.BUY_TREASURE_CONSUME, 0);
if(!enough){
throw new ErrorCodeException(ErrorCode.newDefineCode("not enough money"));
}
user.getPlayerInfoManager().setHadBuyTreasure(1);
MailLogic.getInstance().sendMail(session.getUid(),SErrorCodeEerverConfig.getI18NMessage("secret_extra_title"), SErrorCodeEerverConfig.getI18NMessage("secret_extra_txt"), SSpecialConfig.getStringValue(SSpecialConfig.SUNLONG_REWARD),(int)(TimeUtils.now()/1000), Global.MAIL_EFFECTIVE_TIME);
MailLogic.getInstance().sendMail(session.getUid(),SErrorCodeEerverConfig.getI18NMessage("secret_daily_title"),SErrorCodeEerverConfig.getI18NMessage("secret_daily_txt"),SSpecialConfig.getStringValue(SSpecialConfig.SUNLONG_INTEGRAL),(int)(TimeUtils.now()/1000), Global.MAIL_EFFECTIVE_TIME);
MessageUtil.sendMessage(session, 1,msgId, null, true);
}
public static void checkAllowOfFunction(FunctionRefreshEvent functionRefreshEvent) throws Exception {
if(functionRefreshEvent.getInvokeId()!=-1){
return;

View File

@ -0,0 +1,67 @@
package config;
import manager.STableManager;
import manager.Table;
import java.util.Map;
@Table(name ="MonthcardConfig")
public class SMonthcardConfig implements BaseConfig {
private int id;
private String name;
private int price;
private int[][] baseReward;
private int contiueDays;
private int time;
private String startTime;
private String endtime;
@Override
public void init() throws Exception {
}
public int getId() {
return id;
}
public String getName() {
return name;
}
public int getPrice() {
return price;
}
public int[][] getBaseReward() {
return baseReward;
}
public int getContiueDays() {
return contiueDays;
}
public int getTime() {
return time;
}
public String getStartTime() {
return startTime;
}
public String getEndtime() {
return endtime;
}
}