Merge branch 'refs/heads/master_zzxx_01' into master_zzxx

master_zzxx
grimm 2024-07-24 10:29:31 +08:00
commit b519ccf08d
4 changed files with 130 additions and 40 deletions

View File

@ -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);
}
}

View File

@ -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);
}
/**
*
*/

View File

@ -179,6 +179,16 @@ public class BuyGoodsNewLogic {
}
}
/**
* rmb
* @param orderId id
* @return truermb
*/
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
* psotherbuyotherbuy1
*
* 线gm
* 线
*
*
* 1gm
*/
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);

View File

@ -17,6 +17,7 @@ public interface GiftGoodsType {
int DailyPreferentialGift = 17 ;//每日特惠礼包
int RechargeSumDay = 18 ;//超值返利礼包(在积天豪礼活动里购买)
int WholeLife = 19 ;//【神尊特权】活动 购买后每日领取奖励
int voucher = 63;//代金券
}