限时抽卡排行
parent
2c5148e1ed
commit
e89ed8c7f0
|
|
@ -4,17 +4,20 @@ import com.ljsd.jieling.handler.map.MapLogic;
|
|||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import com.ljsd.jieling.protocols.PlayerInfoProto;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class TowerRankHandler extends BaseHandler {
|
||||
public class TowerRankHandler extends BaseHandler<PlayerInfoProto.RankRequest> {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.GET_TOWER_RANK_BY_PAGE_REQUEST;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
MapLogic.getInstance().getTowerRank(iSession,MessageTypeProto.MessageType.GET_TOWER_RANK_BY_PAGE_RESPONSE);
|
||||
public void processWithProto(ISession iSession, PlayerInfoProto.RankRequest proto) throws Exception {
|
||||
MapLogic.getInstance().getTowerRank(iSession,proto.getType(),MessageTypeProto.MessageType.GET_TOWER_RANK_BY_PAGE_RESPONSE);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package com.ljsd.jieling.handler.map;
|
||||
|
||||
import com.googlecode.protobuf.format.JsonFormat;
|
||||
import com.ljsd.fight.FightType;
|
||||
import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig;
|
||||
import com.ljsd.jieling.config.clazzStaticCfg.MapStaticConfig;
|
||||
|
|
@ -40,7 +39,6 @@ import com.ljsd.jieling.protocols.*;
|
|||
import com.ljsd.jieling.util.*;
|
||||
import config.*;
|
||||
import manager.STableManager;
|
||||
import org.luaj.vm2.LuaValue;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.redis.core.ZSetOperations;
|
||||
|
|
@ -2875,11 +2873,11 @@ public class MapLogic {
|
|||
* @param messageType
|
||||
* @throws Exception
|
||||
*/
|
||||
public void getTowerRank(ISession session,MessageTypeProto.MessageType messageType) throws Exception {
|
||||
public void getTowerRank(ISession session,int type,MessageTypeProto.MessageType messageType) throws Exception {
|
||||
// User user = UserManager.getUser(session.getUid());
|
||||
|
||||
int rankEndLine = SSpecialConfig.getIntegerValue(SSpecialConfig.TRIAL_RANKINGSHOWNUM);
|
||||
PlayerInfoProto.RankResponse rankResponse= RankContext.getRankEnum(1).getRank(session.getUid(), rankEndLine);
|
||||
PlayerInfoProto.RankResponse rankResponse= RankContext.getRankEnum(type).getRank(session.getUid(), rankEndLine);
|
||||
|
||||
|
||||
// Set<ZSetOperations.TypedTuple<String>> zsetreverseRangeWithScores = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.TOWER_RANK, "", 0, rankEndLine);
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ public interface ActivityType {
|
|||
int SOULEQUIP_EXPERT = 38;//魂印达人
|
||||
|
||||
int NEW_WELFARE = 42;//萌新福利
|
||||
int LIMIT_RANDOM_CARD = 43;//限时抽卡
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ public enum ActivityTypeEnum {
|
|||
LUCK_WHEEL(ActivityType.LUCK_WHEEL, LuckWheelNormalActivity::new),
|
||||
LUCK_WHEEL_ADVANCE(ActivityType.LUCK_WHEEL_ADVANCE, LuckWheelAdvancedActivity::new),
|
||||
NEW_WELFARE(ActivityType.NEW_WELFARE, NewWelfareActivity::new),
|
||||
LIMIT_RANDOM_CARD(ActivityType.LIMIT_RANDOM_CARD,LimitRandomCardActivity::new),
|
||||
;
|
||||
private int type;
|
||||
private Function<Integer, AbstractActivity> toActivityFunction;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,30 @@
|
|||
package com.ljsd.jieling.logic.activity;
|
||||
|
||||
import com.ljsd.jieling.logic.activity.event.IEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.RandomCardEvent;
|
||||
import com.ljsd.jieling.logic.rank.RankContext;
|
||||
import com.ljsd.jieling.logic.rank.RankEnum;
|
||||
|
||||
/**
|
||||
* @author lvxinran
|
||||
* @date 2019/11/27
|
||||
* @discribe
|
||||
*/
|
||||
public class LimitRandomCardActivity extends AbstractActivity {
|
||||
public LimitRandomCardActivity(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEvent(IEvent event) throws Exception {
|
||||
if(! (event instanceof RandomCardEvent) ){
|
||||
return;
|
||||
}
|
||||
RandomCardEvent cardEvent =(RandomCardEvent) event;
|
||||
if(cardEvent.getType()!=3){
|
||||
return;
|
||||
}
|
||||
RankContext.getRankEnum(RankEnum.RANDOM_CARD_RANK.getType()).addRank(cardEvent.getUid(),cardEvent.getScore());
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
package com.ljsd.jieling.logic.activity.event;
|
||||
|
||||
/**
|
||||
* @author lvxinran
|
||||
* @date 2019/11/27
|
||||
* @discribe
|
||||
*/
|
||||
public class RandomCardEvent implements IEvent {
|
||||
private int uid;
|
||||
private int type;
|
||||
private int score;
|
||||
|
||||
public RandomCardEvent(int uid,int type, int score) {
|
||||
this.uid = uid;
|
||||
this.type = type;
|
||||
this.score = score;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public int getScore() {
|
||||
return score;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public void setScore(int score) {
|
||||
this.score = score;
|
||||
}
|
||||
|
||||
public int getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(int uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
}
|
||||
|
|
@ -184,8 +184,10 @@ public class HeroLogic{
|
|||
if(type==11&&heroManager.getFirstTenth()==0){
|
||||
heroManager.updateFirstTenth();
|
||||
}
|
||||
if(sLotterySetting.getLotteryType()==3&&!ActivityLogic.getInstance().getActivityStatusByType(user,sLotterySetting.getActivityId())){
|
||||
throw new ErrorCodeException(ErrorCode.ACTIVITY_NOT_OPEN);
|
||||
if(sLotterySetting.getLotteryType()==3){
|
||||
if(!ActivityLogic.getInstance().getActivityStatusByType(user,sLotterySetting.getActivityId())){
|
||||
throw new ErrorCodeException(ErrorCode.ACTIVITY_NOT_OPEN);
|
||||
}
|
||||
}
|
||||
//筛选卡池
|
||||
int pooId =0;
|
||||
|
|
@ -290,7 +292,7 @@ public class HeroLogic{
|
|||
dropHeroAndItem[j++] = tenTimesMustGetItem[i];
|
||||
}
|
||||
}
|
||||
|
||||
// Poster.getPoster().dispatchEvent();
|
||||
CommonProto.Drop.Builder drop = ItemUtil.dropPer(user, dropHeroAndItem,BIReason.HERO_RANDOM);
|
||||
builder.setDrop(drop);
|
||||
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.HERO_RAND_RESPONSE_VALUE, builder.build(), true);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
package com.ljsd.jieling.logic.rank;
|
||||
|
||||
/**
|
||||
* @author lvxinran
|
||||
* @date 2019/11/27
|
||||
* @discribe
|
||||
*/
|
||||
public class RandomCardRank extends AbstractRank {
|
||||
RandomCardRank(int type, String redisKey) {
|
||||
super(type, redisKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getDataByScore(double score) {
|
||||
return new int[]{Double.valueOf(score).intValue()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getScore(double... data) {
|
||||
return data[0];
|
||||
}
|
||||
}
|
||||
|
|
@ -14,7 +14,8 @@ import java.util.function.BiFunction;
|
|||
*/
|
||||
public enum RankEnum {
|
||||
TOWER_RANK(1,RedisKey.TOWER_RANK,TowerRank::new),
|
||||
FORCE_RANK(2,RedisKey.FORCE_RANK,ForceRank::new)
|
||||
FORCE_RANK(2,RedisKey.FORCE_RANK,ForceRank::new),
|
||||
RANDOM_CARD_RANK(10,RedisKey.RANDOM_CARD_RANK,RandomCardRank::new)
|
||||
;
|
||||
private int type;
|
||||
private String redisKey;
|
||||
|
|
|
|||
Loading…
Reference in New Issue