zhangshanxue 2020-06-01 23:59:58 +08:00
commit 7b6bbefa22
9 changed files with 97 additions and 9 deletions

View File

@ -0,0 +1,54 @@
--战斗外数据管理、
OutDataManager = {}
local this = OutDataManager
--
local function _Split(input, delimiter)
input = tostring(input)
delimiter = tostring(delimiter)
if (delimiter=='') then return false end
local pos,arr = 0, {}
-- for each divider found
for st,sp in function() return string.find(input, delimiter, pos, true) end do
table.insert(arr, string.sub(input, pos, st - 1))
pos = sp + 1
end
table.insert(arr, string.sub(input, pos))
return arr
end
local datalist = {}
-- 分割字符串为2维数组
local function _SplitToDic(dataStr)
local ar2 = {}
if not dataStr or dataStr == "" then return ar2 end
local strs = _Split(dataStr, "|")
for i, s in ipairs(strs) do
local ss = _Split(s, "#")
local key = tonumber(ss[1])
local value = tonumber(ss[2])
ar2[key] = value
end
return ar2
end
-- 初始化
function this.Init(fightData)
datalist[0] = _SplitToDic(fightData.playerData.outData)
for i = 1, #fightData.enemyData do
if not datalist[1] then
datalist[1] = {}
end
datalist[1][i] = _SplitToDic(fightData.enemyData[i].outData)
end
end
-- 获取战斗外数据
function this.GetOutData(camp, id)
if camp == 0 then
return datalist[camp][id]
else
return datalist[camp][BattleLogic.CurOrder][id]
end
end
return this

View File

@ -26,9 +26,10 @@ public class CarDelayFunction implements FunctionManager {
List<String> delKeys = new ArrayList<>();
String key = RedisUtil.getInstence().getKey(RedisKey.CAR_DEALY_RANK, "");
String guildKey = RedisUtil.getInstence().getKey(RedisKey.CAR_DEALY_GUILD_RANK, "");
String userLevelGuild = RedisUtil.getInstence().getKey(RedisKey.USER_LEVEL_GUILD_INFO, "");
delKeys.add(key);
delKeys.add(guildKey);
delKeys.add(guildKey);
delKeys.add(userLevelGuild);
Set<String> guildSet = RedisUtil.getInstence().getZset(guildKey, 0, -1);
guildSet.forEach(guildId->{
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(Integer.parseInt(guildId));
@ -66,6 +67,13 @@ public class CarDelayFunction implements FunctionManager {
String guildTitle = SErrorCodeEerverConfig.getI18NMessage("family_fight_rank_familyreward_title");
Set<ZSetOperations.TypedTuple<String>> guildRangeWithScores = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.CAR_DEALY_GUILD_RANK, "", 0, -1);
rank=0;
Map<Integer, Integer> userLevelGuildMap = RedisUtil.getInstence().getMapValues(RedisKey.USER_LEVEL_GUILD_INFO, "", Integer.class, Integer.class);
Map<Integer,Set<Integer>> usersByGuildId = new HashMap<>();
userLevelGuildMap.forEach((userId,guildId)->{
usersByGuildId.putIfAbsent(guildId,new HashSet<>());
usersByGuildId.get(guildId).add(userId);
});
for(ZSetOperations.TypedTuple<String> item : guildRangeWithScores){
String value = item.getValue();
@ -77,6 +85,9 @@ public class CarDelayFunction implements FunctionManager {
}
rank++;
Collection<Set<Integer>> values = guildInfo.getMembers().values();
if(userLevelGuildMap.containsKey(guildId)){
values.add(usersByGuildId.get(guildId));
}
String guildContent = SErrorCodeEerverConfig.getI18NMessage("family_fight_rank_familyreward_txt",new Object[]{rank});
for(Set<Integer> uids : values){
for(Integer uid:uids){

View File

@ -262,6 +262,8 @@ public class RedisKey {
public final static String CAR_CHALLENGE_RECORD = "CAR_CHALLENGE_RECORD"; //车迟玩法挑战记录
public final static String USER_LEVEL_GUILD_INFO = "USER_LEVEL_GUILD_INFO"; //车迟玩法挑战记录
public static Set<String> familyKey = new HashSet<>();

View File

@ -77,7 +77,7 @@ public class FastChallengeHandler extends BaseHandler<FightInfoProto.FastFightCh
int challeageId = proto.getChalleageId();
int battleRound = sWorldBossSetting.getBattleRound();
CommonProto.FightData fightData= null;
boolean isNew = guildInfo.addCarFightSb(uid);
boolean isNew = !guildInfo.getCarFightSb().containsKey(uid);
switch (type){
case 1:{
int monsterId = STableManager.getConfig(SWorldBossConfig.class).get(GuildFightLogic.carDelayProgressIndication.getBossIndexId()).getMonsterId();
@ -86,8 +86,11 @@ public class FastChallengeHandler extends BaseHandler<FightInfoProto.FastFightCh
hurt = fightResult.getCheckResult()[1];
fightData = fightResult.getFightData();
gainScore = (int) (hurt*(sWorldBossSetting.getScorePercent()/10000F));
RankEnum.toRank(RankEnum.CAR_DEALY_RANK.getType()).incrementRankScore(uid,"",gainScore);
double myscore = gainScore;
if(isNew){
myscore+=TimeUtils.getDoubleTime();
}
RankEnum.toRank(RankEnum.CAR_DEALY_RANK.getType()).incrementRankScore(uid,"",myscore);
RankEnum.toRank(RankEnum.CAR_DEALY_GUILD_RANK.getType()).incrementRankScore(guildInfo.getId(),"",gainScore,isNew?1:0);
@ -133,7 +136,8 @@ public class FastChallengeHandler extends BaseHandler<FightInfoProto.FastFightCh
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE);
}
user.getGuildMyInfo().setCarPlayTime(TimeUtils.nowInt());
guildInfo.addCarFightSb(uid);
user.getGuildMyInfo().setCarPlayTime(TimeUtils.nowInt());
FightInfoProto.FastFightChallengeResponse build = FightInfoProto.FastFightChallengeResponse.newBuilder().setHurt(hurt).setScore(gainScore).setFightData(fightData).build();
MessageUtil.sendMessage(iSession,1, MessageTypeProto.MessageType.FAST_FIGHT_CHALLENGE_RESPONSE_VALUE,build,true);
}

View File

@ -36,6 +36,7 @@ public class GuildMyInfo extends MongoBase {
private long guildHelpSendTime;//公会求助信息时间 5分钟
private int carPlayTime; //车迟上次玩的时间
private int carPlayProgress; // 车迟玩的阶段
@ -267,4 +268,13 @@ public class GuildMyInfo extends MongoBase {
public int getCarPlayTime() {
return carPlayTime;
}
public int getCarPlayProgress() {
return carPlayProgress;
}
public void setCarPlayProgress(int carPlayProgress) {
this.carPlayProgress = carPlayProgress;
updateString("carPlayProgress",carPlayProgress);
}
}

View File

@ -798,7 +798,7 @@ public class ExpeditionLogic {
WorldBossTreasureStaticConfig worldBossTreasureStaticConfig = STableManager.getFigureConfig(WorldBossTreasureStaticConfig.class);
Map<Integer, Set<SWorldBossTreasureConfig>> idsByPeriods = worldBossTreasureStaticConfig.getIdsByPeriods();
Map<Integer,Integer> changeStateMap = new HashMap<>(rewardStatusMap);
idsByPeriods.get(worldTreasureReward.getScore()).forEach(item->changeStateMap.putIfAbsent(item.getId(),0));
idsByPeriods.get(worldTreasureReward.getRound()).forEach(item->changeStateMap.putIfAbsent(item.getId(),0));
sendTreasureRewardUpdate(session,0,changeStateMap);
}

View File

@ -149,6 +149,10 @@ public class GuildLogic {
}
}
builder.setCarDelayProgressIndication(GuildFightLogic.carDelayProgressIndication);
if(GuildFightLogic.carDelayProgressIndication.getProgress() != user.getGuildMyInfo().getCarPlayProgress()){
user.getGuildMyInfo().setCarPlayTime(0);
user.getGuildMyInfo().setCarPlayProgress(GuildFightLogic.carDelayProgressIndication.getProgress());
}
builder.setCarPlayTime(user.getGuildMyInfo().getCarPlayTime());
MessageUtil.sendMessage(session,1,msgId,builder.build(),true);
}
@ -586,6 +590,7 @@ public class GuildLogic {
RedisUtil.getInstence().putMapEntry(RedisKey.PLAYER_INFO_CACHE,"",String.valueOf(applyId),cache);
AyyncWorker ayyncWorker = new AyyncWorker(targetUser, true, new AynMissionWorker(GameEvent.JOIN_FAMILY));
ProtocolsManager.getInstance().updateAyncWorker(ayyncWorker);
RedisUtil.getInstence().removeMapEntrys(RedisKey.USER_LEVEL_GUILD_INFO,"",String.valueOf(applyId));
// targetUser.getUserMissionManager().onGameEvent(targetUser, GameEvent.JOIN_FAMILY);
}finally {
RedisUtil.getInstence().releaseDistributedLock(RedisKey.OPERATE_FAMILY_APPLY_JOIN,Integer.toString(applyId), Integer.toString(applyId));
@ -1354,6 +1359,8 @@ public class GuildLogic {
//TODO lock all 公会id清零之前调用
//退公会清除数据 补发奖励
sendGuildHelpRewardEmail(user);
int guildId = user.getPlayerInfoManager().getGuildId();
RedisUtil.getInstence().putMapEntry(RedisKey.USER_LEVEL_GUILD_INFO,"",String.valueOf(user.getId()),guildId);
//notify all
Family.GuildHelpInfoIndication.Builder build = Family.GuildHelpInfoIndication.newBuilder();

View File

@ -320,10 +320,10 @@ public class MissionLoigc {
}
public static void getAchieveMission(User user ,List<CommonProto.UserMissionInfo> missionList){
SGlobalSystemConfig sGlobalSystemConfig = STableManager.getConfig(SGlobalSystemConfig.class).get(FunctionIdEnum.Achieve.getFunctionType());
/* SGlobalSystemConfig sGlobalSystemConfig = STableManager.getConfig(SGlobalSystemConfig.class).get(FunctionIdEnum.Achieve.getFunctionType());
if (sGlobalSystemConfig!=null&&!HandlerLogicThread.checkOpen(user,sGlobalSystemConfig)) {
return;
}
}*/
UserMissionManager userMissionManager = user.getUserMissionManager();
AchieveMissionIdsType achievementMissionTypMap = userMissionManager.getAchievementMissionTypMap();

View File

@ -1122,7 +1122,7 @@ public class ItemUtil {
heroList.add(CBean2Proto.getHero(hero));
SCHero scHero = SCHero.getsCHero().get(hero.getTemplateId());
if (scHero.getStar() >= SSpecialConfig.getIntegerValue(SSpecialConfig.lamp_lottery_content_parm)) { //策划资质改成星级
String message = SErrorCodeEerverConfig.getI18NMessage("lamp_lottery_content", new Object[]{playerInfoManager.getNickName(), scHero.getNatural(), scHero.getReadingName()});
String message = SErrorCodeEerverConfig.getI18NMessage("lamp_lottery_content", new Object[]{playerInfoManager.getNickName(), scHero.getStar(), scHero.getReadingName()});
if (!message.isEmpty()){
ChatLogic.getInstance().sendSysChatMessage(message,Global.LUCKY_LUCK,hero.getTemplateId(),0,0,0,0,0);
}