心愿抽卡,数数上报
parent
18df433074
commit
58e103510c
|
@ -106,10 +106,12 @@ public enum ReportEventEnum {
|
|||
START_DEMON_INVASION(72,"start_demon_invasion",CommonEventHandler.getInstance(),new String[]{"stage_id_travel","boss_ids","combat_results"}),
|
||||
// 通过逍遥游
|
||||
COMPLETE_TRAVEL(73,"complete_travel",CommonEventHandler.getInstance(),new String[]{"stage_id_travel"}),
|
||||
// 新将来袭
|
||||
// 踏碎凌霄
|
||||
TA_SUI_LING_XIAO(74,"tasuilingxiao_boss",CommonEventHandler.getInstance(),new String[]{"boss_id","damage_num","reward_nums_list"}),
|
||||
//山河社稷图
|
||||
HARD_STAGE(75 ,"Sunvo_figure",CommonEventHandler.getInstance(),new String[]{"Sunvo_figure_type","Sunvo_figure_id","combat_results","get_star"}),
|
||||
//心愿抽卡活动
|
||||
CHOICE_DRAW_CARD(76 ,"wish_summon",CommonEventHandler.getInstance(),new String[]{"hero_id","summon_type","cost_item_id","cost_amount","hero_id_quality_list"}),
|
||||
|
||||
VIP_LEVEL_UP(100,"", new VipLevelUpEventHandler(),new String[]{""});
|
||||
|
||||
|
|
|
@ -8,11 +8,14 @@ import com.ljsd.jieling.db.redis.RedisUtil;
|
|||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.globals.GlobalItemType;
|
||||
import com.ljsd.jieling.handler.activity.BlessInfoConfig;
|
||||
import com.ljsd.jieling.jbean.ActivityManager;
|
||||
import com.ljsd.jieling.jbean.ActivityMission;
|
||||
import com.ljsd.jieling.jbean.ActivityProgressInfo;
|
||||
import com.ljsd.jieling.jbean.LuckWheelMission;
|
||||
import com.ljsd.jieling.ktbeans.ReportEventEnum;
|
||||
import com.ljsd.jieling.ktbeans.ReportUtil;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.activity.event.*;
|
||||
import com.ljsd.jieling.logic.dao.PlayerManager;
|
||||
|
@ -1553,12 +1556,15 @@ public class ActivityLogic implements IEventHandler{
|
|||
throw new ErrorCodeException(ErrorCode.REFRESH_WHEL_TIME_NOT, "抽奖次数不足");
|
||||
}
|
||||
CommonProto.Drop.Builder drop = null;
|
||||
|
||||
int[] markReward = new int[]{0,0};
|
||||
int[][] markRewards = new int[num][];
|
||||
// 单抽
|
||||
if (num == 1){
|
||||
// 验证免费特权
|
||||
boolean check = PlayerLogic.getInstance().checkAndUpdate(user, setting.getFreeTimes(), num);
|
||||
if (check){
|
||||
drop = getDrawReward(user, activityId, num);
|
||||
drop = getDrawReward(user, activityId, num, markRewards);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1571,7 +1577,8 @@ public class ActivityLogic implements IEventHandler{
|
|||
boolean itemCost = ItemUtil.itemCost(user, cost, BIReason.CHOICE_DRAW_CARD, 0);
|
||||
// 道具抽奖
|
||||
if (itemCost){
|
||||
drop = getDrawReward(user, activityId, num);
|
||||
drop = getDrawReward(user, activityId, num, markRewards);
|
||||
markReward = new int[]{item[0][0],item[0][1]};
|
||||
}
|
||||
// 妖晶抽奖
|
||||
else {
|
||||
|
@ -1587,24 +1594,48 @@ public class ActivityLogic implements IEventHandler{
|
|||
if (!itemCost2){
|
||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||
}
|
||||
|
||||
markReward = new int[]{item[1][0],item[1][1]};
|
||||
//特权次数消耗
|
||||
PlayerLogic.getInstance().checkAndUpdate(user, setting.getDiamondMaxTimes(), num);
|
||||
drop = getDrawReward(user, activityId, num);
|
||||
drop = getDrawReward(user, activityId, num, markRewards);
|
||||
}
|
||||
}
|
||||
|
||||
// 特权消耗
|
||||
PlayerLogic.getInstance().checkAndUpdate(user, setting.getMaxTimes(), num);
|
||||
|
||||
// 事件分发
|
||||
Poster.getPoster().dispatchEvent(new ChoiceDrawCardEvent(user.getId(),activityId,num));
|
||||
|
||||
// 数数上报
|
||||
int choiceRewardId = user.getActivityManager().getActivityMissionMap().get(activityId).getChoiceRewardId();
|
||||
List<String> list = rewardArrayToList(markRewards);
|
||||
ReportUtil.onReportEvent(user, ReportEventEnum.CHOICE_DRAW_CARD.getType(), choiceRewardId, num, markReward[0], markReward[1], list);
|
||||
// 返回奖励信息
|
||||
build.setDrop(drop);
|
||||
MessageUtil.sendMessage(user.getId(),1, MessageTypeProto.MessageType.choiceDrawCardResponse_VALUE,build.build(),true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 奖励数组转list
|
||||
* @param markRewards
|
||||
* @return
|
||||
*/
|
||||
public List<String> rewardArrayToList(int[][] markRewards){
|
||||
List<String> result = new ArrayList<>(markRewards.length);
|
||||
for (int[] random : markRewards) {
|
||||
if (random == null) {
|
||||
continue;
|
||||
}
|
||||
SItem item = SItem.getsItemMap().get(random[0]);
|
||||
if (item == null) {
|
||||
result.add(random[0] +"-id错误"+random[1]);
|
||||
} else if(item.getItemType()== GlobalItemType.CARD) {
|
||||
result.add(random[0] + "-" + item.getQuantity());
|
||||
}else{
|
||||
result.add(random[0] + "#" + random[1]);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 心愿 获取奖励
|
||||
* @param user
|
||||
|
@ -1613,9 +1644,7 @@ public class ActivityLogic implements IEventHandler{
|
|||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
private CommonProto.Drop.Builder getDrawReward(User user,int activityId,int num) throws Exception {
|
||||
// 奖励信息
|
||||
int[][] reward = new int[num][];
|
||||
private CommonProto.Drop.Builder getDrawReward(User user,int activityId,int num,int[][] reward) throws Exception {
|
||||
// 活动信息
|
||||
ActivityMission mission = user.getActivityManager().getActivityMissionMap().get(activityId);
|
||||
// 累计得抽奖次数
|
||||
|
|
Loading…
Reference in New Issue