公会副本提交
parent
c6a0354f81
commit
146c394e7a
|
@ -223,7 +223,7 @@ function BattleMain.Execute(args, fightData, optionData)
|
||||||
Random.SetSeed(args.seed)
|
Random.SetSeed(args.seed)
|
||||||
BattleLogic.Init(fightData, optionData, _maxRound)
|
BattleLogic.Init(fightData, optionData, _maxRound)
|
||||||
BattleLogic.Type = _type
|
BattleLogic.Type = _type
|
||||||
if _type == 9 or _type == 10 or _type == 11 then
|
if _type == 9 or _type == 10 or _type == 11 or _type == 14 then
|
||||||
AddRecord(fightData)
|
AddRecord(fightData)
|
||||||
end
|
end
|
||||||
BattleLogic.StartOrder()
|
BattleLogic.StartOrder()
|
||||||
|
@ -235,16 +235,18 @@ function BattleMain.Execute(args, fightData, optionData)
|
||||||
isError = true
|
isError = true
|
||||||
errorCache = "error:\n"..debug.traceback(err).."\n"
|
errorCache = "error:\n"..debug.traceback(err).."\n"
|
||||||
end) then
|
end) then
|
||||||
local resultList = {}
|
local resultList = {0, 0, 0, 0, 0, 0}
|
||||||
if BattleLogic.Result == 1 then --胜利记录我方剩余血量
|
if BattleLogic.Result == 1 then --胜利记录我方剩余血量
|
||||||
local arr = RoleManager.Query(function (r) return r.camp == 0 end, true)
|
local arr = RoleManager.Query(function (r) return r.camp == 0 end, true)
|
||||||
for i=1, #arr do
|
for i=1, #arr do
|
||||||
resultList[i] = arr[i]:GetRoleData(RoleDataName.Hp)
|
local pos = arr[i].position
|
||||||
|
resultList[pos] = arr[i]:GetRoleData(RoleDataName.Hp)
|
||||||
end
|
end
|
||||||
elseif BattleLogic.Result == 0 then --失败记录敌方剩余血量
|
elseif BattleLogic.Result == 0 then --失败记录敌方剩余血量
|
||||||
local arr = RoleManager.Query(function (r) return r.camp == 1 end, true)
|
local arr = RoleManager.Query(function (r) return r.camp == 1 end, true)
|
||||||
for i=1, #arr do
|
for i=1, #arr do
|
||||||
resultList[i] = arr[i]:GetRoleData(RoleDataName.Hp)
|
local pos = arr[i].position
|
||||||
|
resultList[pos] = arr[i]:GetRoleData(RoleDataName.Hp)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -274,7 +276,7 @@ function BattleMain.Execute(args, fightData, optionData)
|
||||||
resultList.result = BattleLogic.Result
|
resultList.result = BattleLogic.Result
|
||||||
end
|
end
|
||||||
|
|
||||||
if _type == 10 or _type == 11 then -- 公会boss和车迟斗法boss返回伤害值
|
if _type == 10 or _type == 11 or _type == 14 then -- 公会boss和车迟斗法boss返回伤害值
|
||||||
local playerDamage=0
|
local playerDamage=0
|
||||||
for k,v in pairs(BattleRecord)do
|
for k,v in pairs(BattleRecord)do
|
||||||
if v.camp == 0 then
|
if v.camp == 0 then
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.ljsd.jieling.config.clazzStaticCfg;
|
package com.ljsd.jieling.config.clazzStaticCfg;
|
||||||
|
|
||||||
|
import config.SGuildCheckpointRank;
|
||||||
import config.SRaceTowerRewardConfig;
|
import config.SRaceTowerRewardConfig;
|
||||||
import manager.AbstractClassStaticConfig;
|
import manager.AbstractClassStaticConfig;
|
||||||
import manager.STableManager;
|
import manager.STableManager;
|
||||||
|
@ -17,10 +18,12 @@ import java.util.Set;
|
||||||
public class RewardStaticConfig extends AbstractClassStaticConfig {
|
public class RewardStaticConfig extends AbstractClassStaticConfig {
|
||||||
|
|
||||||
private static Map<Integer,SRaceTowerRewardConfig> raceRewardConfigMap;
|
private static Map<Integer,SRaceTowerRewardConfig> raceRewardConfigMap;
|
||||||
|
private static Map<Integer,Map<Integer,SGuildCheckpointRank>> guildChallengeConfigMap;
|
||||||
@Override
|
@Override
|
||||||
public void registConfigs(Set<String> registConfigs) {
|
public void registConfigs(Set<String> registConfigs) {
|
||||||
registConfigs.add(SRaceTowerRewardConfig.class.getAnnotation(Table.class).name());
|
registConfigs.add(SRaceTowerRewardConfig.class.getAnnotation(Table.class).name());
|
||||||
|
registConfigs.add(SGuildCheckpointRank.class.getAnnotation(Table.class).name());
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,9 +38,28 @@ public class RewardStaticConfig extends AbstractClassStaticConfig {
|
||||||
}
|
}
|
||||||
raceRewardConfigMap = raceRewardConfigMapTemp;
|
raceRewardConfigMap = raceRewardConfigMapTemp;
|
||||||
|
|
||||||
|
Map<Integer,Map<Integer,SGuildCheckpointRank>> guildChallengeConfigMapTemp = new HashMap<>();
|
||||||
|
for(SGuildCheckpointRank value:STableManager.getConfig(SGuildCheckpointRank.class).values()){
|
||||||
|
guildChallengeConfigMapTemp.putIfAbsent(value.getGuildCheckpoint(), new HashMap<>());
|
||||||
|
|
||||||
|
int min = value.getMinRank();
|
||||||
|
|
||||||
|
int max = value.getMaxRank();
|
||||||
|
|
||||||
|
for(int i = min;i<=max;i++){
|
||||||
|
guildChallengeConfigMapTemp.get(value.getGuildCheckpoint()).put(i,value);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
guildChallengeConfigMap = guildChallengeConfigMapTemp;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Map<Integer, SRaceTowerRewardConfig> getRaceRewardConfigMap() {
|
public static Map<Integer, SRaceTowerRewardConfig> getRaceRewardConfigMap() {
|
||||||
return raceRewardConfigMap;
|
return raceRewardConfigMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Map<Integer, Map<Integer, SGuildCheckpointRank>> getGuildChallengeConfigMap() {
|
||||||
|
return guildChallengeConfigMap;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -265,6 +265,7 @@ public interface BIReason {
|
||||||
|
|
||||||
int DAILY_SCORE_CONSUME = 1063;//删除日常任务积分
|
int DAILY_SCORE_CONSUME = 1063;//删除日常任务积分
|
||||||
int EQUIP_WEAR_CONSUME = 1064;
|
int EQUIP_WEAR_CONSUME = 1064;
|
||||||
|
int GUILD_CHALLENGE_BUFF_BUY_CONSUME = 1065;//公会副本购买buff
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.ljsd.jieling.handler.family.guildChallenge;
|
||||||
|
|
||||||
|
import com.ljsd.jieling.handler.BaseHandler;
|
||||||
|
import com.ljsd.jieling.logic.family.GuildChallengeLogic;
|
||||||
|
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||||
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
|
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lvxinran
|
||||||
|
* @date 2020/8/21
|
||||||
|
* @discribe
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class GuildChallengeBuyBuffHandler extends BaseHandler {
|
||||||
|
@Override
|
||||||
|
public MessageTypeProto.MessageType getMessageCode() {
|
||||||
|
return MessageTypeProto.MessageType.GUILD_CHALLENGE_BUY_BUFF_REQUEST;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||||
|
GuildChallengeLogic.getInstance().buyBuff(iSession, MessageTypeProto.MessageType.GUILD_CHALLENGE_BUY_BUFF_RESPONSE);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.ljsd.jieling.handler.family.guildChallenge;
|
||||||
|
|
||||||
|
import com.ljsd.jieling.handler.BaseHandler;
|
||||||
|
import com.ljsd.jieling.logic.family.GuildChallengeLogic;
|
||||||
|
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||||
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
|
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lvxinran
|
||||||
|
* @date 2020/8/21
|
||||||
|
* @discribe
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class GuildSendChallengeMessageHandler extends BaseHandler {
|
||||||
|
@Override
|
||||||
|
public MessageTypeProto.MessageType getMessageCode() {
|
||||||
|
return MessageTypeProto.MessageType.GUILD_CHALLENGE_SEND_MESSAGE_REQUEST;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||||
|
GuildChallengeLogic.getInstance().sendChallengeMessage(iSession,MessageTypeProto.MessageType.GUILD_CHALLENGE_SEND_MESSAGE_RESPONSE);
|
||||||
|
}
|
||||||
|
}
|
|
@ -48,6 +48,8 @@ public class GuildMyInfo extends MongoBase {
|
||||||
public void clearOfLevelGuild(){
|
public void clearOfLevelGuild(){
|
||||||
path.clear();
|
path.clear();
|
||||||
curPos = STableManager.getFigureConfig(CommonStaticConfig.class).getInitPos();
|
curPos = STableManager.getFigureConfig(CommonStaticConfig.class).getInitPos();
|
||||||
|
guildChallengeDamage = 0;
|
||||||
|
lastMonsterId = 0;
|
||||||
setCurPos(curPos);
|
setCurPos(curPos);
|
||||||
//更新的是new ArrayList<>() 再加上指令更新优化 大key的存在 原path将更新不进去
|
//更新的是new ArrayList<>() 再加上指令更新优化 大key的存在 原path将更新不进去
|
||||||
//setPath(new ArrayList<>());
|
//setPath(new ArrayList<>());
|
||||||
|
|
|
@ -60,6 +60,12 @@ public class GuildInfo extends MongoBase {
|
||||||
|
|
||||||
private int bossHpRemain;
|
private int bossHpRemain;
|
||||||
|
|
||||||
|
private int buffIndex;
|
||||||
|
|
||||||
|
private int buffOverTime;
|
||||||
|
|
||||||
|
private int nextChallengeMessageTime;
|
||||||
|
|
||||||
public GuildInfo() {
|
public GuildInfo() {
|
||||||
setRootCollection(_COLLECTION_NAME);
|
setRootCollection(_COLLECTION_NAME);
|
||||||
}
|
}
|
||||||
|
@ -288,4 +294,33 @@ public class GuildInfo extends MongoBase {
|
||||||
this.bossHpRemain = bossHpRemain;
|
this.bossHpRemain = bossHpRemain;
|
||||||
updateString("bossHpRemain",bossHpRemain);
|
updateString("bossHpRemain",bossHpRemain);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getBuffIndex() {
|
||||||
|
return buffIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBuffIndex(int buffIndex) {
|
||||||
|
this.buffIndex = buffIndex;
|
||||||
|
updateString("buffIndex",buffIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getBuffOverTime() {
|
||||||
|
return buffOverTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBuffOverTime(int buffOverTime) {
|
||||||
|
this.buffOverTime = buffOverTime;
|
||||||
|
updateString("buffOverTime",buffOverTime);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getNextChallengeMessageTime() {
|
||||||
|
return nextChallengeMessageTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNextChallengeMessageTime(int nextChallengeMessageTime) {
|
||||||
|
this.nextChallengeMessageTime = nextChallengeMessageTime;
|
||||||
|
updateString("nextChallengeMessageTime",nextChallengeMessageTime);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
package com.ljsd.jieling.logic.family;
|
package com.ljsd.jieling.logic.family;
|
||||||
|
|
||||||
|
import com.ljsd.jieling.config.clazzStaticCfg.RewardStaticConfig;
|
||||||
|
import com.ljsd.jieling.db.redis.RedisKey;
|
||||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||||
import com.ljsd.jieling.exception.ErrorCode;
|
import com.ljsd.jieling.exception.ErrorCode;
|
||||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||||
|
import com.ljsd.jieling.globals.BIReason;
|
||||||
|
import com.ljsd.jieling.globals.Global;
|
||||||
import com.ljsd.jieling.logic.dao.GuildMyInfo;
|
import com.ljsd.jieling.logic.dao.GuildMyInfo;
|
||||||
import com.ljsd.jieling.logic.dao.GuilidManager;
|
import com.ljsd.jieling.logic.dao.GuilidManager;
|
||||||
import com.ljsd.jieling.logic.dao.UserManager;
|
import com.ljsd.jieling.logic.dao.UserManager;
|
||||||
|
@ -12,6 +16,7 @@ import com.ljsd.jieling.logic.fight.FightDispatcher;
|
||||||
import com.ljsd.jieling.logic.fight.GameFightType;
|
import com.ljsd.jieling.logic.fight.GameFightType;
|
||||||
import com.ljsd.jieling.logic.fight.PVEFightEvent;
|
import com.ljsd.jieling.logic.fight.PVEFightEvent;
|
||||||
import com.ljsd.jieling.logic.fight.result.FightResult;
|
import com.ljsd.jieling.logic.fight.result.FightResult;
|
||||||
|
import com.ljsd.jieling.logic.mail.MailLogic;
|
||||||
import com.ljsd.jieling.logic.player.PlayerLogic;
|
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||||
import com.ljsd.jieling.logic.rank.RankContext;
|
import com.ljsd.jieling.logic.rank.RankContext;
|
||||||
import com.ljsd.jieling.logic.rank.RankEnum;
|
import com.ljsd.jieling.logic.rank.RankEnum;
|
||||||
|
@ -22,13 +27,15 @@ import com.ljsd.jieling.protocols.Family;
|
||||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||||
import com.ljsd.jieling.util.ItemUtil;
|
import com.ljsd.jieling.util.ItemUtil;
|
||||||
import com.ljsd.jieling.util.MessageUtil;
|
import com.ljsd.jieling.util.MessageUtil;
|
||||||
|
import config.SErrorCodeEerverConfig;
|
||||||
import config.SGuildCheckpointConfig;
|
import config.SGuildCheckpointConfig;
|
||||||
|
import config.SGuildCheckpointRank;
|
||||||
|
import config.SRaceTowerRewardConfig;
|
||||||
import manager.STableManager;
|
import manager.STableManager;
|
||||||
|
import org.springframework.data.redis.core.ZSetOperations;
|
||||||
|
import util.TimeUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -48,7 +55,7 @@ public class GuildChallengeLogic {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Map<Integer,Object> lockMap = new ConcurrentHashMap<>();
|
private Map<Integer,Object> lockMap = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -71,8 +78,8 @@ public class GuildChallengeLogic {
|
||||||
GuildMyInfo guildMyInfo = user.getGuildMyInfo();
|
GuildMyInfo guildMyInfo = user.getGuildMyInfo();
|
||||||
|
|
||||||
|
|
||||||
//如果boss不同 则不刷新次数
|
//如果boss 则不刷新次数
|
||||||
if(currBossId!=0&&currBossId==guildMyInfo.getLastMonsterId()){
|
if(currBossId!=0&&currBossId!=guildMyInfo.getLastMonsterId()){
|
||||||
int[] privilege = config.getPrivilege();
|
int[] privilege = config.getPrivilege();
|
||||||
for(int clearPrivilege:privilege){
|
for(int clearPrivilege:privilege){
|
||||||
user.getPlayerInfoManager().clearVipCount(clearPrivilege);
|
user.getPlayerInfoManager().clearVipCount(clearPrivilege);
|
||||||
|
@ -85,7 +92,10 @@ public class GuildChallengeLogic {
|
||||||
Family.GetGuildChallengeInfoResponse response = Family.GetGuildChallengeInfoResponse.newBuilder()
|
Family.GetGuildChallengeInfoResponse response = Family.GetGuildChallengeInfoResponse.newBuilder()
|
||||||
.setCanSweep(canSweep)
|
.setCanSweep(canSweep)
|
||||||
.setCurBoss(currBossId)
|
.setCurBoss(currBossId)
|
||||||
.setBlood(bossHpRemain==0?10000:(int)(bossHpRemain*10000/config.getMonsterHp())).build();
|
.setBlood(bossHpRemain==0?10000:(int)(bossHpRemain*10000/config.getMonsterHp()))
|
||||||
|
.setBuffTime(guildInfo.getBuffOverTime()> TimeUtils.nowInt()?guildInfo.getBuffOverTime():0)
|
||||||
|
.setBuffCount(guildInfo.getBuffOverTime()> TimeUtils.nowInt()?guildInfo.getBuffIndex():0)
|
||||||
|
.build();
|
||||||
|
|
||||||
MessageUtil.sendMessage(session,1,messageType.getNumber(),response,true);
|
MessageUtil.sendMessage(session,1,messageType.getNumber(),response,true);
|
||||||
|
|
||||||
|
@ -118,15 +128,15 @@ public class GuildChallengeLogic {
|
||||||
SGuildCheckpointConfig config = STableManager.getConfig(SGuildCheckpointConfig.class).get(bossId);
|
SGuildCheckpointConfig config = STableManager.getConfig(SGuildCheckpointConfig.class).get(bossId);
|
||||||
int[] privilege = config.getPrivilege();
|
int[] privilege = config.getPrivilege();
|
||||||
boolean check = PlayerLogic.getInstance().check(user, privilege[0], 1);
|
boolean check = PlayerLogic.getInstance().check(user, privilege[0], 1);
|
||||||
// if(!check){
|
if(!check){
|
||||||
// throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||||
// }
|
}
|
||||||
//锁住
|
//锁住
|
||||||
synchronized (lockMap.get(guildId)){
|
synchronized (lockMap.get(guildId)){
|
||||||
guildInfo = GuilidManager.guildInfoMap.get(guildId);
|
guildInfo = GuilidManager.guildInfoMap.get(guildId);
|
||||||
GuildMyInfo guildMyInfo = user.getGuildMyInfo();
|
GuildMyInfo guildMyInfo = user.getGuildMyInfo();
|
||||||
//先清除特权
|
//先清除特权
|
||||||
if(guildInfo.getCurrBossId()!=0&&guildInfo.getCurrBossId()== guildMyInfo.getLastMonsterId()){
|
if(guildInfo.getCurrBossId()!=0&&guildInfo.getCurrBossId()!= guildMyInfo.getLastMonsterId()){
|
||||||
for(int clearPrivilege:privilege){
|
for(int clearPrivilege:privilege){
|
||||||
user.getPlayerInfoManager().clearVipCount(clearPrivilege);
|
user.getPlayerInfoManager().clearVipCount(clearPrivilege);
|
||||||
}
|
}
|
||||||
|
@ -136,6 +146,13 @@ public class GuildChallengeLogic {
|
||||||
}else{
|
}else{
|
||||||
if(type==0){
|
if(type==0){
|
||||||
PVEFightEvent pveFightEvent = new PVEFightEvent(uid, 1501, 5, "", GameFightType.GuildChallenge, config.getMonsterId(), 3);
|
PVEFightEvent pveFightEvent = new PVEFightEvent(uid, 1501, 5, "", GameFightType.GuildChallenge, config.getMonsterId(), 3);
|
||||||
|
int buffIndex = guildInfo.getBuffIndex();
|
||||||
|
int buffOverTime = guildInfo.getBuffOverTime();
|
||||||
|
if(buffOverTime>TimeUtils.nowInt()&&buffIndex!=0){
|
||||||
|
List<Integer> buffList = new ArrayList<>();
|
||||||
|
buffList.add(config.getAttributePromote()[buffIndex-1]);
|
||||||
|
pveFightEvent.setBuffIds(buffList);
|
||||||
|
}
|
||||||
if(guildInfo.getBossHpRemain()!=0){
|
if(guildInfo.getBossHpRemain()!=0){
|
||||||
List<Integer> hp = new ArrayList<>();
|
List<Integer> hp = new ArrayList<>();
|
||||||
for(int i = 0 ; i <6;i++){
|
for(int i = 0 ; i <6;i++){
|
||||||
|
@ -169,14 +186,26 @@ public class GuildChallengeLogic {
|
||||||
damage = damageInt;
|
damage = damageInt;
|
||||||
}else{
|
}else{
|
||||||
//扫荡
|
//扫荡
|
||||||
guildInfo.setBossHpRemain(guildInfo.getBossHpRemain()- guildMyInfo.getGuildChallengeDamage());
|
int remain = guildInfo.getBossHpRemain() - guildMyInfo.getGuildChallengeDamage();
|
||||||
|
if(remain>=0){
|
||||||
|
guildInfo.setBossHpRemain(remain);
|
||||||
|
}else{
|
||||||
|
guildInfo.setCurrBossId(guildInfo.getCurrBossId() + 1);
|
||||||
|
guildInfo.setBossHpRemain(0);
|
||||||
|
}
|
||||||
damage = guildMyInfo.getGuildChallengeDamage();
|
damage = guildMyInfo.getGuildChallengeDamage();
|
||||||
}
|
}
|
||||||
drop = ItemUtil.drop(user, new int[]{config.getReward()}, 1, 0, 1);
|
drop = ItemUtil.drop(user, new int[]{config.getReward()}, 1, 0, 1);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(!error.isEmpty()){
|
||||||
|
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||||
|
}
|
||||||
if(kill==1){
|
if(kill==1){
|
||||||
|
//异步发奖
|
||||||
|
Runnable runnable = () -> sendRankReward(guildId,bossId);
|
||||||
|
runnable.run();
|
||||||
drop = ItemUtil.drop(user, new int[]{config.getReward(),config.getKillReward()}, 1, 0, 1);
|
drop = ItemUtil.drop(user, new int[]{config.getReward(),config.getKillReward()}, 1, 0, 1);
|
||||||
}
|
}
|
||||||
double blood = guildInfo.getBossHpRemain();
|
double blood = guildInfo.getBossHpRemain();
|
||||||
|
@ -194,18 +223,124 @@ public class GuildChallengeLogic {
|
||||||
long score = Double.valueOf(rank.getScoreById(user.getId(), guildId+":"+bossId)).longValue();
|
long score = Double.valueOf(rank.getScoreById(user.getId(), guildId+":"+bossId)).longValue();
|
||||||
rank.addRank(uid,guildId+":"+bossId,score==-1?damage:score+damage);
|
rank.addRank(uid,guildId+":"+bossId,score==-1?damage:score+damage);
|
||||||
|
|
||||||
if(!error.isEmpty()){
|
|
||||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
|
||||||
}
|
|
||||||
Family.GuildChallengeResponse.Builder response = Family.GuildChallengeResponse.newBuilder();
|
Family.GuildChallengeResponse.Builder response = Family.GuildChallengeResponse.newBuilder();
|
||||||
|
|
||||||
response.setDrop(drop);
|
response.setDrop(drop);
|
||||||
|
|
||||||
if(fightData!=null){
|
if(fightData!=null){
|
||||||
response.setFightData(fightData);
|
response.setFightData(fightData);
|
||||||
}
|
}
|
||||||
|
|
||||||
response.setKill(kill);
|
response.setKill(kill);
|
||||||
|
|
||||||
response.setDamage((int)damage);
|
response.setDamage((int)damage);
|
||||||
|
|
||||||
PlayerLogic.getInstance().checkAndUpdate(user,config.getPrivilege()[0],1);
|
PlayerLogic.getInstance().checkAndUpdate(user,config.getPrivilege()[0],1);
|
||||||
|
|
||||||
MessageUtil.sendMessage(session,1,messageType.getNumber(),response.build(),true);
|
MessageUtil.sendMessage(session,1,messageType.getNumber(),response.build(),true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 购买buff
|
||||||
|
*/
|
||||||
|
public void buyBuff(ISession session, MessageTypeProto.MessageType messageType) throws Exception {
|
||||||
|
int uid = session.getUid();
|
||||||
|
User user = UserManager.getUser(uid);
|
||||||
|
int guildId = user.getPlayerInfoManager().getGuildId();
|
||||||
|
if(guildId==0){
|
||||||
|
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||||
|
}
|
||||||
|
if(!lockMap.containsKey(guildId)){
|
||||||
|
lockMap.put(guildId,new Object());
|
||||||
|
}
|
||||||
|
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(guildId);
|
||||||
|
SGuildCheckpointConfig config = STableManager.getConfig(SGuildCheckpointConfig.class).get(guildInfo.getCurrBossId());
|
||||||
|
int[] attributePromote = config.getAttributePromote();
|
||||||
|
int maxCount = attributePromote.length;
|
||||||
|
if(guildInfo.getBuffIndex()>=maxCount){
|
||||||
|
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||||
|
}
|
||||||
|
int[][] attributePromotePrice = config.getAttributePromotePrice();
|
||||||
|
boolean itemCost = ItemUtil.itemCost(user, new int[][]{{attributePromotePrice[0][0], attributePromotePrice[1][guildInfo.getBuffIndex()]}}, BIReason.GUILD_CHALLENGE_BUFF_BUY_CONSUME, 1);
|
||||||
|
if(!itemCost){
|
||||||
|
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||||
|
}
|
||||||
|
|
||||||
|
synchronized (lockMap.get(guildId)){
|
||||||
|
int time;
|
||||||
|
if(guildInfo.getBuffOverTime() > TimeUtils.nowInt()){
|
||||||
|
time = guildInfo.getBuffOverTime() + 3600;
|
||||||
|
}else{
|
||||||
|
//跨过5点刷新
|
||||||
|
if(TimeUtils.isOverAppointRefreshTime(TimeUtils.now(), (guildInfo.getBuffOverTime()-1) * 1000L, 5)){
|
||||||
|
guildInfo.setBuffIndex(0);
|
||||||
|
}
|
||||||
|
time = TimeUtils.nowInt() + 3600;
|
||||||
|
}
|
||||||
|
guildInfo.setBuffIndex(guildInfo.getBuffIndex()+1);
|
||||||
|
int fiveTime = (int)(TimeUtils.getLastOrUnderHour(TimeUtils.now(), 5, 0, false)/1000);
|
||||||
|
guildInfo.setBuffOverTime(Math.min(time,fiveTime));
|
||||||
|
}
|
||||||
|
Family.GuildChallengeBuyBuffIndication indication = Family.GuildChallengeBuyBuffIndication.newBuilder()
|
||||||
|
.setBuffTime(guildInfo.getBuffOverTime()> TimeUtils.nowInt()?guildInfo.getBuffOverTime():0)
|
||||||
|
.setBuffCount(guildInfo.getBuffOverTime()> TimeUtils.nowInt()?guildInfo.getBuffIndex():0)
|
||||||
|
.build();
|
||||||
|
GuildLogic.sendIndicationToMember(guildInfo, MessageTypeProto.MessageType.GUILD_CHALLENGE_BUY_BUFF_INDICATION,indication);
|
||||||
|
MessageUtil.sendMessage(session,1,messageType.getNumber(),null,true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendChallengeMessage(ISession session, MessageTypeProto.MessageType messageType) throws Exception{
|
||||||
|
|
||||||
|
User user = UserManager.getUser(session.getUid());
|
||||||
|
int guildId = user.getPlayerInfoManager().getGuildId();
|
||||||
|
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(guildId);
|
||||||
|
int memberType = GuildLogic.getMemberType(session.getUid(), guildInfo.getMembers());
|
||||||
|
if(memberType==3){
|
||||||
|
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(guildInfo.getNextChallengeMessageTime()<TimeUtils.nowInt()){
|
||||||
|
guildInfo.setNextChallengeMessageTime(TimeUtils.nowInt()+TimeUtils.SECONDS_HOUR);
|
||||||
|
}
|
||||||
|
|
||||||
|
Family.GuildChallengeMessageResponse response = Family.GuildChallengeMessageResponse.newBuilder()
|
||||||
|
.setNextTime(guildInfo.getNextChallengeMessageTime())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
|
||||||
|
MessageUtil.sendMessage(session,1,messageType.getNumber(),response,true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendRankReward(int guildId,int bossId){
|
||||||
|
AbstractRank rank = RankContext.getRankEnum(RankEnum.GUILD_CHALLENGE_RANK.getType());
|
||||||
|
Map<Integer, SGuildCheckpointRank> configMap = RewardStaticConfig.getGuildChallengeConfigMap().get(bossId);
|
||||||
|
if (configMap==null||configMap.isEmpty()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Set<ZSetOperations.TypedTuple<String>> rankInfos = rank.getRankByKey(guildId + ":" + bossId, 0, configMap.size());
|
||||||
|
if(rankInfos.size()<1){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try{
|
||||||
|
int index = 1;
|
||||||
|
for(ZSetOperations.TypedTuple<String> rankInfo:rankInfos){
|
||||||
|
String title = SErrorCodeEerverConfig.getI18NMessage("GuildRanking_mail_gonghui_title");
|
||||||
|
String content = SErrorCodeEerverConfig.getI18NMessage("GuildRanking_mail_gonghui_txt", new Object[]{index});
|
||||||
|
|
||||||
|
SGuildCheckpointRank config = configMap.get(index);
|
||||||
|
if(config==null){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String mailReward = ItemUtil.getMailReward(config.getRankingReward());
|
||||||
|
MailLogic.getInstance().sendMail(Integer.parseInt(rankInfo.getValue()), title, content, mailReward, TimeUtils.nowInt(), Global.MAIL_EFFECTIVE_TIME);
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
// 排行不清除
|
||||||
|
// RedisUtil.getInstence().del(RedisKey.getKey(rank.getRedisKey(),"",false));
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ public class FightEvent {
|
||||||
private GameFightType fightType;
|
private GameFightType fightType;
|
||||||
private Map<String, Integer> attackBloodMap;
|
private Map<String, Integer> attackBloodMap;
|
||||||
private List<Integer> monsterRemainHp;
|
private List<Integer> monsterRemainHp;
|
||||||
|
private List<Integer> buffIds;
|
||||||
|
|
||||||
public FightEvent(int attackUid, int teamId,int mostTime,String frams, GameFightType fightType) {
|
public FightEvent(int attackUid, int teamId,int mostTime,String frams, GameFightType fightType) {
|
||||||
this.attackUid = attackUid;
|
this.attackUid = attackUid;
|
||||||
|
@ -60,4 +61,12 @@ public class FightEvent {
|
||||||
public void setMonsterRemainHp(List<Integer> monsterRemainHp) {
|
public void setMonsterRemainHp(List<Integer> monsterRemainHp) {
|
||||||
this.monsterRemainHp = monsterRemainHp;
|
this.monsterRemainHp = monsterRemainHp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Integer> getBuffIds() {
|
||||||
|
return buffIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBuffIds(List<Integer> buffIds) {
|
||||||
|
this.buffIds = buffIds;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,14 @@ import java.util.Map;
|
||||||
|
|
||||||
public class FightUtil {
|
public class FightUtil {
|
||||||
|
|
||||||
public static CommonProto.FightTeamInfo makePersonFightData(User player,int teamId,Map<String, Integer> attackBloodMap){
|
public static CommonProto.FightTeamInfo makePersonFightData(User player,int teamId,Map<String, Integer> attackBloodMap,List<Integer> buffIds){
|
||||||
|
if(buffIds!=null){
|
||||||
|
Map<Integer,List<Integer>> map = new HashMap<>();
|
||||||
|
for(int i = 1;i <=4;i++){
|
||||||
|
map.put(i,buffIds);
|
||||||
|
}
|
||||||
|
return getFightTeamInfoWithSomeBuff(player,teamId,attackBloodMap,map);
|
||||||
|
}
|
||||||
if(attackBloodMap ==null || attackBloodMap.isEmpty()){
|
if(attackBloodMap ==null || attackBloodMap.isEmpty()){
|
||||||
return BehaviorUtil.getFightTeamInfo(player,teamId,true);
|
return BehaviorUtil.getFightTeamInfo(player,teamId,true);
|
||||||
}
|
}
|
||||||
|
@ -91,7 +98,7 @@ public class FightUtil {
|
||||||
public static FightResult getFightForPVE(FightEvent fightEvent){
|
public static FightResult getFightForPVE(FightEvent fightEvent){
|
||||||
PVEFightEvent pveFightEvent = (PVEFightEvent)fightEvent;
|
PVEFightEvent pveFightEvent = (PVEFightEvent)fightEvent;
|
||||||
User userInMem = UserManager.getUserInMem(pveFightEvent.getAttackUid());
|
User userInMem = UserManager.getUserInMem(pveFightEvent.getAttackUid());
|
||||||
CommonProto.FightTeamInfo fightTeamInfo = makePersonFightData(userInMem, pveFightEvent.getTeamId(),pveFightEvent.getAttackBloodMap());
|
CommonProto.FightTeamInfo fightTeamInfo = makePersonFightData(userInMem, pveFightEvent.getTeamId(),pveFightEvent.getAttackBloodMap(),pveFightEvent.getBuffIds());
|
||||||
int fightSeed =getFightSeed();
|
int fightSeed =getFightSeed();
|
||||||
//怪物剩余血量
|
//怪物剩余血量
|
||||||
List<Integer> monsterRemainHp = pveFightEvent.getMonsterRemainHp();
|
List<Integer> monsterRemainHp = pveFightEvent.getMonsterRemainHp();
|
||||||
|
@ -125,7 +132,7 @@ public class FightUtil {
|
||||||
} else{
|
} else{
|
||||||
if(fightEvent.getFightType() == GameFightType.ArenaPersonFight ||fightEvent.getFightType() == GameFightType.CarPersonChallenge ){
|
if(fightEvent.getFightType() == GameFightType.ArenaPersonFight ||fightEvent.getFightType() == GameFightType.CarPersonChallenge ){
|
||||||
User defInMem = UserManager.getUserInMem(pvpFightEvent.getDefUid());
|
User defInMem = UserManager.getUserInMem(pvpFightEvent.getDefUid());
|
||||||
deffightTeamInfo = makePersonFightData(defInMem, pvpFightEvent.getDefTeamId(),null);
|
deffightTeamInfo = makePersonFightData(defInMem, pvpFightEvent.getDefTeamId(),null,null);
|
||||||
}else{
|
}else{
|
||||||
deffightTeamInfo = makeRobotFightData(pvpFightEvent.getDefUid());
|
deffightTeamInfo = makeRobotFightData(pvpFightEvent.getDefUid());
|
||||||
}
|
}
|
||||||
|
@ -137,7 +144,7 @@ public class FightUtil {
|
||||||
fightTeamInfo = makeRobotFightData(pvpFightEvent.getAttackUid());
|
fightTeamInfo = makeRobotFightData(pvpFightEvent.getAttackUid());
|
||||||
}else{
|
}else{
|
||||||
User userInMem = UserManager.getUserInMem(pvpFightEvent.getAttackUid());
|
User userInMem = UserManager.getUserInMem(pvpFightEvent.getAttackUid());
|
||||||
fightTeamInfo = makePersonFightData(userInMem, pvpFightEvent.getTeamId(),pvpFightEvent.getAttackBloodMap());
|
fightTeamInfo = makePersonFightData(userInMem, pvpFightEvent.getTeamId(),pvpFightEvent.getAttackBloodMap(),null);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
fightTeamInfo = makeRobotFightData(pvpFightEvent.getAttackUid());
|
fightTeamInfo = makeRobotFightData(pvpFightEvent.getAttackUid());
|
||||||
|
|
|
@ -298,7 +298,7 @@ public class HeroLogic{
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if(eventEnum == ReportEventEnum.SUMMON_HERO){
|
if(eventEnum == ReportEventEnum.SUMMON_HERO){
|
||||||
ReportUtil.onReportEvent(user,eventEnum.getType(),String.valueOf(resultRandom[0][0]),resultRandom[0][1]);
|
ReportUtil.onReportEvent(user,eventEnum.getType(),String.valueOf(resultRandom[0][0]),sLotterySetting.getPropertyType(),resultRandom[0][1]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<String> result = new ArrayList<>(resultRandom.length);
|
List<String> result = new ArrayList<>(resultRandom.length);
|
||||||
|
|
|
@ -33,7 +33,7 @@ public enum RankEnum {
|
||||||
EXPERT_RANK(21,RedisKey.EXPERT_RANK,GoldRank::new),//param1:活动进度 param2:无 param3:无
|
EXPERT_RANK(21,RedisKey.EXPERT_RANK,GoldRank::new),//param1:活动进度 param2:无 param3:无
|
||||||
FORCE_CURR_RANK(22,RedisKey.FORCE_CURR_RANK,ForceCurrRank::new),//param1:人物战力 param2:无 param3:无
|
FORCE_CURR_RANK(22,RedisKey.FORCE_CURR_RANK,ForceCurrRank::new),//param1:人物战力 param2:无 param3:无
|
||||||
SITUATION_RANK(24,RedisKey.SITUATION_RANK,SituationRank::new),//param1:通关次数 param2:无 param3:无
|
SITUATION_RANK(24,RedisKey.SITUATION_RANK,SituationRank::new),//param1:通关次数 param2:无 param3:无
|
||||||
GUILD_CHALLENGE_RANK(25,RedisKey.GUILD_CHALLENGE_RANK,GuildChallengeRank::new),//param1:伤害 param2:无 param3:无
|
GUILD_CHALLENGE_RANK(26,RedisKey.GUILD_CHALLENGE_RANK,GuildChallengeRank::new),//param1:伤害 param2:无 param3:无
|
||||||
;
|
;
|
||||||
|
|
||||||
private int type;
|
private int type;
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
package com.ljsd.jieling.logic.rank.rankImpl;
|
package com.ljsd.jieling.logic.rank.rankImpl;
|
||||||
|
|
||||||
|
import com.ljsd.jieling.exception.ErrorCode;
|
||||||
|
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||||
|
import com.ljsd.jieling.logic.dao.UserManager;
|
||||||
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
|
import com.ljsd.jieling.protocols.PlayerInfoProto;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author lvxinran
|
* @author lvxinran
|
||||||
* @date 2020/8/22
|
* @date 2020/8/22
|
||||||
|
@ -19,4 +25,15 @@ public class GuildChallengeRank extends AbstractRank {
|
||||||
public double getScore(double... data) {
|
public double getScore(double... data) {
|
||||||
return data[0];
|
return data[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PlayerInfoProto.RankResponse getRank(int uid, String rkey, int page, int rankEndLine) throws Exception {
|
||||||
|
User user = UserManager.getUser(uid);
|
||||||
|
int guildId = user.getPlayerInfoManager().getGuildId();
|
||||||
|
if(guildId==0){
|
||||||
|
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||||
|
}
|
||||||
|
rkey = guildId+":"+rkey;
|
||||||
|
return super.getRank(uid, rkey, page, rankEndLine);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,16 +22,12 @@ public class SGuildCheckpointConfig implements BaseConfig {
|
||||||
|
|
||||||
private int monsterId;
|
private int monsterId;
|
||||||
|
|
||||||
private int[][] attributePromote;
|
private int[] attributePromote;
|
||||||
|
|
||||||
private int[][] attributePromotePrice;
|
private int[][] attributePromotePrice;
|
||||||
|
|
||||||
private int[] privilege;
|
private int[] privilege;
|
||||||
|
|
||||||
private int[][] rankingReward;
|
|
||||||
|
|
||||||
private int[][] rewardNumber;
|
|
||||||
|
|
||||||
private int monsterHp;
|
private int monsterHp;
|
||||||
|
|
||||||
|
|
||||||
|
@ -69,7 +65,7 @@ public class SGuildCheckpointConfig implements BaseConfig {
|
||||||
return monsterId;
|
return monsterId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int[][] getAttributePromote() {
|
public int[] getAttributePromote() {
|
||||||
return attributePromote;
|
return attributePromote;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,14 +77,6 @@ public class SGuildCheckpointConfig implements BaseConfig {
|
||||||
return privilege;
|
return privilege;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int[][] getRankingReward() {
|
|
||||||
return rankingReward;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int[][] getRewardNumber() {
|
|
||||||
return rewardNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getMonsterHp() {
|
public int getMonsterHp() {
|
||||||
return monsterHp;
|
return monsterHp;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
package config;
|
||||||
|
|
||||||
|
import manager.STableManager;
|
||||||
|
import manager.Table;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Table(name ="GuildCheckpointRank")
|
||||||
|
public class SGuildCheckpointRank implements BaseConfig {
|
||||||
|
|
||||||
|
private int id;
|
||||||
|
|
||||||
|
private int guildCheckpoint;
|
||||||
|
|
||||||
|
private int maxRank;
|
||||||
|
|
||||||
|
private int minRank;
|
||||||
|
|
||||||
|
private int[][] rankingReward;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init() throws Exception {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getGuildCheckpoint() {
|
||||||
|
return guildCheckpoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMaxRank() {
|
||||||
|
return maxRank;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMinRank() {
|
||||||
|
return minRank;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[][] getRankingReward() {
|
||||||
|
return rankingReward;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue