戒灵秘宝改成直购
parent
52117ad434
commit
b7fe433994
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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() == 0){
|
||||
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());
|
||||
|
|
|
@ -330,6 +330,9 @@ public class BuyGoodsLogic {
|
|||
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){
|
||||
PlayerLogic.getInstance().sendDayilyMail(user,goodsType);
|
||||
}else if(goodsType == GiftGoodsType.SUN_LONG ){
|
||||
user.getPlayerInfoManager().setHadBuyTreasure(1);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,4 +10,5 @@ public interface GiftGoodsType {
|
|||
int WEEKCARD = 7; //周卡
|
||||
int FOUND_ONE = 8; //豪华基金
|
||||
int FOUND_TWO = 9; //豪华基金
|
||||
int SUN_LONG = 11; //豪华基金
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue