Merge branch 'refs/heads/master_zzxx_01' into master_zzxx
commit
b519ccf08d
|
|
@ -0,0 +1,25 @@
|
|||
package com.ljsd.jieling.handler.assist;
|
||||
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.hero.AssistLogic;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import org.springframework.stereotype.Component;
|
||||
import rpc.protocols.HeroInfoProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
|
||||
/**
|
||||
* @author hj
|
||||
* 助阵一键上阵,下阵
|
||||
*/
|
||||
@Component
|
||||
public class AssistBatchUpDownHandler extends BaseHandler<HeroInfoProto.AssistBatchUpDownRequest> {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.AssistBatchUpDownRequest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processWithProto(ISession iSession, HeroInfoProto.AssistBatchUpDownRequest proto) throws Exception {
|
||||
AssistLogic.getInstance().assistBatchUpDown(iSession, proto);
|
||||
}
|
||||
}
|
||||
|
|
@ -122,6 +122,71 @@ public class AssistLogic {
|
|||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.AssistUpDownResponse_VALUE, null, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 一键上阵,下阵
|
||||
* @param iSession 缓存
|
||||
* @param proto 协议
|
||||
* @throws Exception 异常
|
||||
*/
|
||||
public void assistBatchUpDown(ISession iSession, HeroInfoProto.AssistBatchUpDownRequest proto) throws Exception {
|
||||
User user = UserManager.getUser(iSession.getUid());
|
||||
HeroManager heroManager = user.getHeroManager();
|
||||
Map<Integer, AssistBox> assistBoxMap = heroManager.getAssistBoxMap();
|
||||
int operate = proto.getOperate();
|
||||
List<CommonProto.AssistBox> boxsList = proto.getBoxsList();
|
||||
// 穿戴
|
||||
if (operate == 1){
|
||||
for (CommonProto.AssistBox box : boxsList) {
|
||||
int id = box.getId();
|
||||
String heroId = box.getHeroId();
|
||||
AssistBox assistBox = assistBoxMap.get(id);
|
||||
if (assistBox == null || assistBox.getState() == 0){
|
||||
throw new ErrorTableException(162);//格子未开启
|
||||
}
|
||||
if (heroManager.getAssistHeroIds().containsKey(heroId)){
|
||||
throw new ErrorTableException(163);//英雄已助阵
|
||||
}
|
||||
if (!StringUtil.isEmpty(assistBox.getHeroId())){
|
||||
throw new ErrorTableException(164);//格子有助阵
|
||||
}
|
||||
Hero hero = heroManager.getHero(heroId);
|
||||
if (hero == null){
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);//配置不存在
|
||||
}
|
||||
SCHero scHero = SCHero.getSCHero(hero.getTemplateId());
|
||||
if (scHero == null){
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);//配置不存在
|
||||
}
|
||||
SAssistanceConfig assistanceConfig = SAssistanceConfig.map.get(id);
|
||||
if (assistanceConfig == null){
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);//配置不存在
|
||||
}
|
||||
if (scHero.getPropertyName() != assistanceConfig.getProfessionLimit() || scHero.getNatural() != assistanceConfig.getQuality()){
|
||||
throw new ErrorTableException(167);//条件不满足
|
||||
}
|
||||
assistBox.setHeroId(heroId);
|
||||
assistBoxMap.put(id, assistBox);
|
||||
}
|
||||
|
||||
}
|
||||
// 卸下
|
||||
else {
|
||||
for (CommonProto.AssistBox box : boxsList) {
|
||||
int id = box.getId();
|
||||
AssistBox assistBox = assistBoxMap.get(id);
|
||||
if (assistBox == null || assistBox.getState() == 0){
|
||||
throw new ErrorTableException(162);//格子未开启
|
||||
}
|
||||
assistBox.setHeroId("");
|
||||
assistBoxMap.put(id, assistBox);
|
||||
}
|
||||
}
|
||||
heroManager.setAssistBoxMap(assistBoxMap);
|
||||
// 更新战力
|
||||
Poster.getPoster().dispatchEvent(new SaveHeroForceEvent(user.getId(),""));
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.AssistUpDownResponse_VALUE, null, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除英雄刷新助阵
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -179,6 +179,16 @@ public class BuyGoodsNewLogic {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否是rmb支付
|
||||
* @param orderId 订单id
|
||||
* @return 返回true表示是rmb支付
|
||||
*/
|
||||
private static boolean isRmb(String orderId){
|
||||
return !(orderId.equals(test_buy_order) || orderId.equals(support_order) || orderId.equals(vouchers_order)
|
||||
|| orderId.equals(money_order) || orderId.equals(gm_modifier));
|
||||
}
|
||||
|
||||
/**
|
||||
* 充值礼包 额外处理
|
||||
* @param user 用户
|
||||
|
|
@ -186,58 +196,47 @@ public class BuyGoodsNewLogic {
|
|||
* @param giftId 礼包id
|
||||
* @param amount 金额
|
||||
* @param list 额外掉落
|
||||
* ps:代金券(otherbuy),现金点券(otherbuy1)
|
||||
* 真实充值记录:人民币
|
||||
* 线上活动:人民币、测试、扶持、代金券、现金点卷、gm购买
|
||||
* 线下活动:人民币、测试、扶持、代金券、购买代金券
|
||||
* 额外掉落:人民币、测试、扶持
|
||||
* 充值任务:人民币、测试、扶持、购买代金券
|
||||
* 天天零点1折购买消耗:人民币、测试、扶持、代金券、现金点卷、gm购买、购买代金券
|
||||
*/
|
||||
private static void rechargeHandler(User user, String orderId, int giftId, int amount, List<int[][]> list) throws Exception {
|
||||
MissionEventDistributor.requestStart();
|
||||
// 其他礼包活动
|
||||
Poster.getPoster().dispatchEvent(new SuperBoxEvent(user.getId(),giftId,1,1));
|
||||
// 天天零点1折购买消耗
|
||||
Poster.getPoster().dispatchEvent(new EveryDayDiscountBuyCheckEvent(user.getId(),giftId,1));
|
||||
|
||||
SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.getConfigById(giftId);
|
||||
// 测试购买 || 扶持购买
|
||||
if (orderId.equals(test_buy_order) || orderId.equals(support_order)){
|
||||
// 单笔充值
|
||||
Poster.getPoster().dispatchEvent(new SingleRechargeEvent(user.getId(),amount));
|
||||
// 线下自动返利
|
||||
Poster.getPoster().dispatchEvent(new AutoRechargeBackEvent(user.getId(),giftId,orderId));
|
||||
// 额外掉落
|
||||
if (config.getGainCrystal() != null && config.getGainCrystal().length > 0){
|
||||
list.add(config.getGainCrystal());
|
||||
}
|
||||
// 天天任务
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.EVERY_DAY_UPDATE, MissionType.RECHARGE_ACCUMULATIVE_NUM, amount);
|
||||
}
|
||||
// 代金券购买
|
||||
else if (orderId.equals(vouchers_order)){
|
||||
// 单笔充值
|
||||
Poster.getPoster().dispatchEvent(new SingleRechargeEvent(user.getId(),amount));
|
||||
// 线下自动返利
|
||||
Poster.getPoster().dispatchEvent(new AutoRechargeBackEvent(user.getId(),giftId,orderId));
|
||||
}
|
||||
// 现金点券支付
|
||||
else if (orderId.equals(money_order)){
|
||||
// 单笔充值
|
||||
Poster.getPoster().dispatchEvent(new SingleRechargeEvent(user.getId(),amount));
|
||||
}
|
||||
// gm购买支付
|
||||
else if (orderId.equals(gm_modifier)){
|
||||
}
|
||||
// rmb支付 , test支付, 扶持支付
|
||||
else{
|
||||
// 记录真实充值
|
||||
// 真实充值记录
|
||||
if (isRmb(orderId)){
|
||||
user.getPlayerInfoManager().getNewRechargeInfo().addRealityRmb(amount);
|
||||
// 单笔充值
|
||||
}
|
||||
// 线上活动
|
||||
if (isRmb(orderId) || orderId.equals(test_buy_order) || orderId.equals(support_order)
|
||||
|| orderId.equals(money_order) || orderId.equals(gm_modifier) || orderId.equals(vouchers_order)){
|
||||
Poster.getPoster().dispatchEvent(new SuperBoxEvent(user.getId(),giftId,1,1));
|
||||
Poster.getPoster().dispatchEvent(new SingleRechargeEvent(user.getId(),amount));
|
||||
// 线下自动返利
|
||||
}
|
||||
// 线下活动
|
||||
if (orderId.equals(test_buy_order) || orderId.equals(support_order) || isRmb(orderId)
|
||||
|| orderId.equals(vouchers_order) || config.getType() == GiftGoodsType.voucher){
|
||||
Poster.getPoster().dispatchEvent(new AutoRechargeBackEvent(user.getId(),giftId,orderId));
|
||||
// 额外掉落
|
||||
}
|
||||
// 额外掉落
|
||||
if (orderId.equals(test_buy_order) || orderId.equals(support_order) || isRmb(orderId)){
|
||||
if (config.getGainCrystal() != null && config.getGainCrystal().length > 0){
|
||||
list.add(config.getGainCrystal());
|
||||
}
|
||||
// 天天任务
|
||||
}
|
||||
// 充值任务
|
||||
if (orderId.equals(test_buy_order) || orderId.equals(support_order) || isRmb(orderId) || config.getType() == GiftGoodsType.voucher){
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.EVERY_DAY_UPDATE, MissionType.RECHARGE_ACCUMULATIVE_NUM, amount);
|
||||
}
|
||||
// 天天零点1折购买消耗
|
||||
if (orderId.equals(test_buy_order) || orderId.equals(support_order) || isRmb(orderId) || config.getType() == GiftGoodsType.voucher
|
||||
|| orderId.equals(money_order) || orderId.equals(gm_modifier) || orderId.equals(vouchers_order)){
|
||||
Poster.getPoster().dispatchEvent(new EveryDayDiscountBuyCheckEvent(user.getId(),giftId,1));
|
||||
}
|
||||
ISession session = OnlineUserManager.getSessionByUid(user.getId());
|
||||
if (session != null){
|
||||
MissionEventDistributor.requestEnd(session,true);
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ public interface GiftGoodsType {
|
|||
int DailyPreferentialGift = 17 ;//每日特惠礼包
|
||||
int RechargeSumDay = 18 ;//超值返利礼包(在积天豪礼活动里购买)
|
||||
int WholeLife = 19 ;//【神尊特权】活动 购买后每日领取奖励
|
||||
int voucher = 63;//代金券
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue