扭转乾坤活动提交
parent
ea3f3b6628
commit
ae79e8d410
|
@ -166,6 +166,8 @@ public interface BIReason {
|
|||
int WORLD_CHANGE_DROP =94;//跨服天梯
|
||||
int WORLD_PRO_DROP =95;//跨服天梯膜拜
|
||||
|
||||
int GOOD_LUCK_DROP = 96;//扭转乾坤获得
|
||||
|
||||
int ADVENTURE_UPLEVEL_CONSUME = 1000;//秘境升级
|
||||
int SECRETBOX_CONSUME = 1001;//秘盒抽卡
|
||||
int DECOMPOSE_ITEM_CONSUME = 1002;//分解道具消耗
|
||||
|
@ -308,6 +310,7 @@ public interface BIReason {
|
|||
int WORLD_ARENA = 1077;//跨服竞技场
|
||||
|
||||
int SHEJI_ACTIVITY_INIT_CONSUME = 1078;//社稷大典开始清除往期道具
|
||||
int GOOD_LUCK_CONSUME = 1079;//扭转乾坤消耗
|
||||
|
||||
int USE_HEADFRAME = 1088;// 使用头像框
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package com.ljsd.jieling.handler.activity;
|
||||
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.activity.ActivityLogic;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import org.springframework.stereotype.Component;
|
||||
import rpc.protocols.ActivityProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
|
||||
/**
|
||||
* @author lvxinran
|
||||
* @date 2021/1/21
|
||||
* @discribe
|
||||
*/
|
||||
@Component
|
||||
public class GoodLuckRandomHandler extends BaseHandler<ActivityProto.GoodLuckRequest> {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.GOOD_LUCK_REQUEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processWithProto(ISession iSession, ActivityProto.GoodLuckRequest proto) throws Exception {
|
||||
ActivityLogic.getInstance().goodLuckRandom(iSession,proto.getActivityId(), MessageTypeProto.MessageType.GOOD_LUCK_RESPONSE);
|
||||
}
|
||||
}
|
|
@ -33,6 +33,7 @@ import manager.STableManager;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.redis.core.ZSetOperations;
|
||||
import rpc.protocols.ActivityProto;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
|
@ -1400,4 +1401,29 @@ public class ActivityLogic implements IEventHandler{
|
|||
|
||||
MessageUtil.sendMessage(session,1,MessageTypeProto.MessageType.SPECICAL_MONSTER_CHOOSE_RESPONSE_VALUE,null,true);
|
||||
}
|
||||
|
||||
//扭转乾坤
|
||||
public void goodLuckRandom(ISession session, int activityId, MessageTypeProto.MessageType messageType) throws Exception {
|
||||
|
||||
SGoodLuck sGoodLuck = SGoodLuck.goodLuckMap.get(activityId);
|
||||
if(sGoodLuck==null){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
|
||||
if(!user.getActivityManager().getActivityMissionMap().containsKey(activityId)){
|
||||
throw new ErrorCodeException(ErrorCode.ACTIVITY_NOT_OPEN);
|
||||
}
|
||||
int[][] cost = sGoodLuck.getCost();
|
||||
boolean itemCost = ItemUtil.itemCost(user, cost, BIReason.GOOD_LUCK_CONSUME, 1);
|
||||
if(!itemCost){
|
||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||
}
|
||||
int[][] reward = sGoodLuck.getReward();
|
||||
int random = MathUtils.random(1, reward.length);
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, new int[][]{reward[random - 1]}, BIReason.GOOD_LUCK_DROP);
|
||||
ActivityProto.GoodLuckResponse.Builder response = ActivityProto.GoodLuckResponse.newBuilder().setIndex(random).setDrop(drop);
|
||||
|
||||
MessageUtil.sendMessage(session,1,messageType.getNumber(),response.build(),true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,6 +78,8 @@ public interface ActivityType {
|
|||
int ITEMS_STORE= 6000;//百宝商会
|
||||
int TRIAL_EXPERT = 70;//幻境达人
|
||||
int SHEJI_ACTIVITY = 60;//社稷大典
|
||||
int GOOD_LUCK= 61;//扭转乾坤
|
||||
|
||||
int SUB_ACTIVITY = 8000;//易经宝库
|
||||
int SKIN_RECHARGE_ACTIVITY = 71;
|
||||
int SPECIAL_MONSTER_RANDOM_ACTIVITY = 100;//灵兽限时抽卡
|
||||
|
|
|
@ -65,6 +65,8 @@ public enum ActivityTypeEnum {
|
|||
SPECIAL_MONSTER_GIFT_ACTIVITY(ActivityType.SPECIAL_MONSTER_GIFT_ACTIVITY,DefaultEmptyActivity::new),
|
||||
DEMON_TREASURE(ActivityType.DEMON_TREASURE,LimitRandomSpecialMonsterActivity::new),
|
||||
NEW_GENERAL_ATTACK(ActivityType.NEW_GENERAL_ATTACK,DefaultEmptyActivity::new),
|
||||
GOOD_LUCK(ActivityType.GOOD_LUCK,DefaultEmptyActivity::new),
|
||||
|
||||
;
|
||||
private int type;
|
||||
private Function<Integer, AbstractActivity> toActivityFunction;
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
package config;
|
||||
|
||||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="GoodLuck")
|
||||
public class SGoodLuck implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int activityId;
|
||||
|
||||
private int[][] cost;
|
||||
|
||||
private int[][] reward;
|
||||
|
||||
public static Map<Integer,SGoodLuck> goodLuckMap;
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
Map<Integer, SGoodLuck> config = STableManager.getConfig(SGoodLuck.class);
|
||||
Map<Integer,SGoodLuck> goodLuckMapTemp = new HashMap<>(config.size());
|
||||
for(Map.Entry<Integer, SGoodLuck> entry:config.entrySet()){
|
||||
goodLuckMapTemp.put(entry.getValue().getActivityId(),entry.getValue());
|
||||
}
|
||||
goodLuckMap = goodLuckMapTemp;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getActivityId() {
|
||||
return activityId;
|
||||
}
|
||||
|
||||
public int[][] getCost() {
|
||||
return cost;
|
||||
}
|
||||
|
||||
public int[][] getReward() {
|
||||
return reward;
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue