back_recharge
wangyuan 2020-05-09 11:39:57 +08:00
parent d00b5f8499
commit 8ea7539cdf
9 changed files with 206 additions and 23 deletions

View File

@ -51778,6 +51778,24 @@ public final class Family {
* <code>optional .com.ljsd.jieling.protocols.Drop drop = 3;</code>
*/
com.ljsd.jieling.protocols.CommonProto.DropOrBuilder getDropOrBuilder();
// optional int32 historyMax = 4;
/**
* <code>optional int32 historyMax = 4;</code>
*
* <pre>
*
* </pre>
*/
boolean hasHistoryMax();
/**
* <code>optional int32 historyMax = 4;</code>
*
* <pre>
*
* </pre>
*/
int getHistoryMax();
}
/**
* Protobuf type {@code com.ljsd.jieling.protocols.ChallengeDeathPathResponse}
@ -51861,6 +51879,11 @@ public final class Family {
bitField0_ |= 0x00000004;
break;
}
case 32: {
bitField0_ |= 0x00000008;
historyMax_ = input.readInt32();
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
@ -51961,10 +51984,35 @@ public final class Family {
return drop_;
}
// optional int32 historyMax = 4;
public static final int HISTORYMAX_FIELD_NUMBER = 4;
private int historyMax_;
/**
* <code>optional int32 historyMax = 4;</code>
*
* <pre>
*
* </pre>
*/
public boolean hasHistoryMax() {
return ((bitField0_ & 0x00000008) == 0x00000008);
}
/**
* <code>optional int32 historyMax = 4;</code>
*
* <pre>
*
* </pre>
*/
public int getHistoryMax() {
return historyMax_;
}
private void initFields() {
fightData_ = com.ljsd.jieling.protocols.CommonProto.FightData.getDefaultInstance();
damage_ = 0;
drop_ = com.ljsd.jieling.protocols.CommonProto.Drop.getDefaultInstance();
historyMax_ = 0;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
@ -51987,6 +52035,9 @@ public final class Family {
if (((bitField0_ & 0x00000004) == 0x00000004)) {
output.writeMessage(3, drop_);
}
if (((bitField0_ & 0x00000008) == 0x00000008)) {
output.writeInt32(4, historyMax_);
}
getUnknownFields().writeTo(output);
}
@ -52008,6 +52059,10 @@ public final class Family {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(3, drop_);
}
if (((bitField0_ & 0x00000008) == 0x00000008)) {
size += com.google.protobuf.CodedOutputStream
.computeInt32Size(4, historyMax_);
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
@ -52140,6 +52195,8 @@ public final class Family {
dropBuilder_.clear();
}
bitField0_ = (bitField0_ & ~0x00000004);
historyMax_ = 0;
bitField0_ = (bitField0_ & ~0x00000008);
return this;
}
@ -52188,6 +52245,10 @@ public final class Family {
} else {
result.drop_ = dropBuilder_.build();
}
if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
to_bitField0_ |= 0x00000008;
}
result.historyMax_ = historyMax_;
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
@ -52213,6 +52274,9 @@ public final class Family {
if (other.hasDrop()) {
mergeDrop(other.getDrop());
}
if (other.hasHistoryMax()) {
setHistoryMax(other.getHistoryMax());
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
@ -52507,6 +52571,55 @@ public final class Family {
return dropBuilder_;
}
// optional int32 historyMax = 4;
private int historyMax_ ;
/**
* <code>optional int32 historyMax = 4;</code>
*
* <pre>
*
* </pre>
*/
public boolean hasHistoryMax() {
return ((bitField0_ & 0x00000008) == 0x00000008);
}
/**
* <code>optional int32 historyMax = 4;</code>
*
* <pre>
*
* </pre>
*/
public int getHistoryMax() {
return historyMax_;
}
/**
* <code>optional int32 historyMax = 4;</code>
*
* <pre>
*
* </pre>
*/
public Builder setHistoryMax(int value) {
bitField0_ |= 0x00000008;
historyMax_ = value;
onChanged();
return this;
}
/**
* <code>optional int32 historyMax = 4;</code>
*
* <pre>
*
* </pre>
*/
public Builder clearHistoryMax() {
bitField0_ = (bitField0_ & ~0x00000008);
historyMax_ = 0;
onChanged();
return this;
}
// @@protoc_insertion_point(builder_scope:com.ljsd.jieling.protocols.ChallengeDeathPathResponse)
}
@ -53760,13 +53873,14 @@ public final class Family {
" \001(\005\022\026\n\016challengeCount\030\002 \001(\005\0228\n\005infos\030\003 " +
"\003(\0132).com.ljsd.jieling.protocols.DeathPa" +
"thInfo\"+\n\031ChallengeDeathPathRequest\022\016\n\006p" +
"athId\030\001 \001(\005\"\226\001\n\032ChallengeDeathPathRespon",
"athId\030\001 \001(\005\"\252\001\n\032ChallengeDeathPathRespon",
"se\0228\n\tfightData\030\001 \001(\0132%.com.ljsd.jieling" +
".protocols.FightData\022\016\n\006damage\030\002 \001(\005\022.\n\004" +
"drop\030\003 \001(\0132 .com.ljsd.jieling.protocols." +
"Drop\"`\n\025CarGrapRecordResponse\022G\n\020carChal" +
"lengeItem\030\001 \003(\0132-.com.ljsd.jieling.proto" +
"cols.CarGrapRecordItemB\002H\001"
"Drop\022\022\n\nhistoryMax\030\004 \001(\005\"`\n\025CarGrapRecor" +
"dResponse\022G\n\020carChallengeItem\030\001 \003(\0132-.co" +
"m.ljsd.jieling.protocols.CarGrapRecordIt" +
"emB\002H\001"
};
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
@ -54234,7 +54348,7 @@ public final class Family {
internal_static_com_ljsd_jieling_protocols_ChallengeDeathPathResponse_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_com_ljsd_jieling_protocols_ChallengeDeathPathResponse_descriptor,
new java.lang.String[] { "FightData", "Damage", "Drop", });
new java.lang.String[] { "FightData", "Damage", "Drop", "HistoryMax", });
internal_static_com_ljsd_jieling_protocols_CarGrapRecordResponse_descriptor =
getDescriptor().getMessageTypes().get(77);
internal_static_com_ljsd_jieling_protocols_CarGrapRecordResponse_fieldAccessorTable = new

View File

@ -1,9 +1,6 @@
package com.ljsd.jieling.core;
import com.ljsd.jieling.core.function.ArenaFunction;
import com.ljsd.jieling.core.function.ChampionFunction;
import com.ljsd.jieling.core.function.EndlessFunction;
import com.ljsd.jieling.core.function.GuildBossFunction;
import com.ljsd.jieling.core.function.*;
import com.ljsd.jieling.protocols.MessageTypeProto;
import java.util.HashMap;
@ -63,7 +60,7 @@ public enum FunctionIdEnum {
WorkShopRebuildEquip(104,null,MessageTypeProto.MessageType.WORKSHOP_REBUILD_REQUEST_VALUE),
Expedition(64,null),
Achieve(65,null),
Car_Delay(73,null),
Car_Delay(73,new CarDelayFunction()),
;
private int functionType;

View File

@ -1,16 +1,72 @@
package com.ljsd.jieling.core.function;
import com.ljsd.jieling.core.FunctionManager;
import com.ljsd.jieling.db.redis.RedisKey;
import com.ljsd.jieling.db.redis.RedisUtil;
import com.ljsd.jieling.globals.Global;
import com.ljsd.jieling.logic.dao.GuilidManager;
import com.ljsd.jieling.logic.dao.TimeControllerOfFunction;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.root.GuildInfo;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.family.GuildFightLogic;
import com.ljsd.jieling.logic.mail.MailLogic;
import config.SErrorCodeEerverConfig;
import config.SWorldBossRewardConfig;
import org.springframework.data.redis.core.ZSetOperations;
import util.StringUtil;
import util.TimeUtils;
import java.util.*;
public class CarDelayFunction implements FunctionManager {
@Override
public void startAction(TimeControllerOfFunction timeControllerOfFunction) throws Exception {
List<String> delKeys = new ArrayList<>();
String key = RedisUtil.getInstence().getKey(RedisKey.CAR_DEALY_RANK, "");
delKeys.add(key);
Set<String> zset = RedisUtil.getInstence().getZset(key, 0, -1);
zset.forEach(item->{
delKeys.add(RedisUtil.getInstence().getKey(RedisKey.CAR_CHALLENGE_SB,item));
});
RedisUtil.getInstence().del(delKeys.toArray(new String[0]));
}
@Override
public void closeAction() throws Exception {
Map<Integer, TreeMap<Integer, String>> rewardByTypeAndRankMap = SWorldBossRewardConfig.rewardByTypeAndRankMap;
TreeMap<Integer, String> personRewardConfigTreeMap = rewardByTypeAndRankMap.get(1);
TreeMap<Integer, String> guildRewardConfigTreeMap = rewardByTypeAndRankMap.get(2);
Set<ZSetOperations.TypedTuple<String>> personRangeWithScores = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.CAR_DEALY_RANK, "", 0, -1);
int rank=0;
String personTitle = SErrorCodeEerverConfig.getI18NMessage("family_fight_rank_personreward_title");
int nowTime = TimeUtils.nowInt();
for(ZSetOperations.TypedTuple<String> item : personRangeWithScores){
rank++;
String value = item.getValue();
int uid = Integer.parseInt(value);
String rewardByRank = personRewardConfigTreeMap.floorEntry(rank).getValue();
String personContent = SErrorCodeEerverConfig.getI18NMessage("family_fight_rank_personreward_txt",new Object[]{rank});
MailLogic.getInstance().sendMail(uid,personTitle,personContent,rewardByRank,nowTime, Global.MAIL_EFFECTIVE_TIME);
}
String guildTitle = SErrorCodeEerverConfig.getI18NMessage("family_fight_rank_familyreward_title");
Set<ZSetOperations.TypedTuple<String>> guildRangeWithScores = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.CAR_DEALY_GUILD_RANK, "", 0, -1);
for(ZSetOperations.TypedTuple<String> item : guildRangeWithScores){
rank++;
String value = item.getValue();
int guildId = Integer.parseInt(value);
String rewardByRank = guildRewardConfigTreeMap.floorEntry(rank).getValue();
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(guildId);
Collection<Set<Integer>> values = guildInfo.getMembers().values();
String guildContent = SErrorCodeEerverConfig.getI18NMessage("family_fight_rank_familyreward_txt",new Object[]{rank});
for(Set<Integer> uids : values){
for(Integer uid:uids){
MailLogic.getInstance().sendMail(uid,guildTitle,guildContent,rewardByRank,nowTime, Global.MAIL_EFFECTIVE_TIME);
}
}
}
}
}

View File

@ -256,9 +256,9 @@ public class RedisKey {
public static final String DEATH_PATH_TOTAL_GUILD_RANK = "DEATH_PATH_TOTAL_GUILD_RANK";
public final static String CAR_CHALLENEG_SB = "CAR_CHALLENEG_SB"; //车迟玩法挑战记录
public final static String CAR_CHALLENGE_SB = "CAR_CHALLENGE_SB"; //车迟玩法挑战记录
public final static String CAR_CHALLENEG_RECORD = "CAR_CHALLENEG_RECORD"; //车迟玩法挑战记录
public final static String CAR_CHALLENGE_RECORD = "CAR_CHALLENGE_RECORD"; //车迟玩法挑战记录

View File

@ -8,7 +8,6 @@ import com.ljsd.jieling.exception.ErrorCodeException;
import com.ljsd.jieling.logic.dao.GuilidManager;
import com.ljsd.jieling.logic.dao.TeamPosHeroInfo;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.VipInfo;
import com.ljsd.jieling.logic.dao.root.GuildInfo;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.family.GuildFightLogic;
@ -90,11 +89,11 @@ public class FastChallengeHandler extends BaseHandler<FightInfoProto.FastFightCh
}break;
case 2:{
Integer mapValue = RedisUtil.getInstence().getMapValue(RedisKey.CAR_CHALLENEG_SB, String.valueOf(uid), String.valueOf(challeageId), Integer.class);
Integer mapValue = RedisUtil.getInstence().getMapValue(RedisKey.CAR_CHALLENGE_SB, String.valueOf(uid), String.valueOf(challeageId), Integer.class);
if(mapValue!=null){
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE);
}
RedisUtil.getInstence().putMapEntry(RedisKey.CAR_CHALLENEG_SB, String.valueOf(uid), String.valueOf(challeageId), 1);
RedisUtil.getInstence().putMapEntry(RedisKey.CAR_CHALLENGE_SB, String.valueOf(uid), String.valueOf(challeageId), 1);
PVPFightEvent pvpFightEvent = new PVPFightEvent(uid,GlobalsDef.CAR_DELAY_TEAM, battleRound,"", GameFightType.CarPersonChallenge,challeageId,GlobalsDef.CAR_DELAY_TEAM);
FightResult fightResult = FightDispatcher.dispatcher(pvpFightEvent);
fightData = fightResult.getFightData();
@ -116,8 +115,8 @@ public class FastChallengeHandler extends BaseHandler<FightInfoProto.FastFightCh
content = SErrorCodeEerverConfig.getI18NMessage("worldboss_battle_lose",new Object[]{challengeName,gainScore});
challengeContent = SErrorCodeEerverConfig.getI18NMessage("worldboss_grab_lose",new Object[]{user.getPlayerInfoManager().getNickName(),gainScore});
}
String key = RedisUtil.getInstence().getKey(RedisKey.CAR_CHALLENEG_RECORD, String.valueOf(uid));
String challenegeKey = RedisUtil.getInstence().getKey(RedisKey.CAR_CHALLENEG_RECORD, String.valueOf(challeageId));
String key = RedisUtil.getInstence().getKey(RedisKey.CAR_CHALLENGE_RECORD, String.valueOf(uid));
String challenegeKey = RedisUtil.getInstence().getKey(RedisKey.CAR_CHALLENGE_RECORD, String.valueOf(challeageId));
RedisUtil.getInstence().zsetAddOne(key,content + "|" + challeageId,(int)(System.currentTimeMillis()/1000));
RedisUtil.getInstence().zsetAddOne(challenegeKey,challengeContent + "|" + uid,(int)(System.currentTimeMillis()/1000));
guildInfo.addCarFightSb(uid);

View File

@ -29,8 +29,8 @@ public class GetCarGrapRecordHandler extends BaseHandler{
instance.set(Calendar.SECOND,0);
long timeInMillis = instance.getTimeInMillis();
int leatestTime = (int)(timeInMillis/1000);
RedisUtil.getInstence().removeZSetRangeByScore(RedisKey.CAR_CHALLENEG_RECORD,String.valueOf(iSession.getUid()),0,leatestTime);
Set<ZSetOperations.TypedTuple<String>> zsetreverseRangeWithScores = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.CAR_CHALLENEG_RECORD, String.valueOf(iSession.getUid()), 0, -1);
RedisUtil.getInstence().removeZSetRangeByScore(RedisKey.CAR_CHALLENGE_RECORD,String.valueOf(iSession.getUid()),0,leatestTime);
Set<ZSetOperations.TypedTuple<String>> zsetreverseRangeWithScores = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.CAR_CHALLENGE_RECORD, String.valueOf(iSession.getUid()), 0, -1);
Family.CarGrapRecordResponse.Builder builder = Family.CarGrapRecordResponse.newBuilder();
for(ZSetOperations.TypedTuple<String> item : zsetreverseRangeWithScores ){
int time = item.getScore().intValue();

View File

@ -78,7 +78,7 @@ public class GetCarChallengeListHandler extends BaseHandler {
myscore = RedisUtil.getInstence().getZSetScore(RedisKey.CAR_DEALY_RANK, "", String.valueOf(uid)).intValue();
}
Family.GetCarChallenegListResponse.Builder builder = Family.GetCarChallenegListResponse.newBuilder().setMyRank(myRank).setMyScore(myscore);
Map<Integer, Integer> records = RedisUtil.getInstence().getMapValues(RedisKey.CAR_CHALLENEG_SB, String.valueOf(uid), Integer.class, Integer.class);
Map<Integer, Integer> records = RedisUtil.getInstence().getMapValues(RedisKey.CAR_CHALLENGE_SB, String.valueOf(uid), Integer.class, Integer.class);
for(ZsetTypedTupleWithRank typedTupleWithRankitem: infos){
ZSetOperations.TypedTuple<String> item = typedTupleWithRankitem.getItem();
int challenegUid = Integer.parseInt(item.getValue());

View File

@ -244,6 +244,7 @@ public class GlobalDataManaager implements IManager {
new FightMainEventHandler();
new BuyGoodsDirectHandler();
ChampionshipLogic.minuteCheck(true);
GuildFightLogic.minuteCheckForCarFight();
} catch (Exception e) {
LOGGER.error("e",e);
}

View File

@ -2,8 +2,11 @@ package config;
import manager.STableManager;
import manager.Table;
import util.StringUtil;
import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
@Table(name ="WorldBossRewardConfig")
public class SWorldBossRewardConfig implements BaseConfig {
@ -14,10 +17,21 @@ public class SWorldBossRewardConfig implements BaseConfig {
private int[][] reward;
private int type;
public static Map<Integer, TreeMap<Integer,String>> rewardByTypeAndRankMap = new HashMap<>();
@Override
public void init() throws Exception {
Map<Integer, SWorldBossRewardConfig> config = STableManager.getConfig(SWorldBossRewardConfig.class);
Map<Integer, TreeMap<Integer,String>> rewardByTypeAndRankMapTmp = new HashMap<>();
config.forEach((id,item)->{
rewardByTypeAndRankMapTmp.putIfAbsent(item.getType(),new TreeMap<>());
rewardByTypeAndRankMapTmp.get(item.getType()).put(item.getSection()[0], StringUtil.parseArrayToString(item.getReward()));
});
rewardByTypeAndRankMap = rewardByTypeAndRankMapTmp;
}
@ -33,5 +47,7 @@ public class SWorldBossRewardConfig implements BaseConfig {
return reward;
}
public int getType() {
return type;
}
}