Merge branch 'master_test_hw' of http://60.1.1.230/backend/jieling_server into master_test_hw
commit
f6d885559b
|
@ -139,7 +139,7 @@ public class TimeUtils {
|
|||
|
||||
public static void main(String[] args) {
|
||||
|
||||
long lastHour = getNextWeekendStartTime(1,5);
|
||||
int lastHour = getOverTimeCount(1599602400000L,1600462810000L,5);
|
||||
|
||||
System.out.println(lastHour);
|
||||
}
|
||||
|
@ -1379,4 +1379,23 @@ public class TimeUtils {
|
|||
return (Integer.MAX_VALUE-now()/1000)/Math.pow(10,9);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 返回两个事件中间过了几个hour时
|
||||
* @param time1
|
||||
* @param time2
|
||||
* @param hour
|
||||
* @return
|
||||
*/
|
||||
public static int getOverTimeCount(long time1,long time2,int hour){
|
||||
long last = getLastOrUnderHour(time1, hour, 0, false);
|
||||
long under = getLastOrUnderHour(time2, hour, 0, true);
|
||||
if(last>under){
|
||||
return 0;
|
||||
}
|
||||
if(last==under){
|
||||
return 1;
|
||||
}
|
||||
return (int) Math.floor((under-last)/(HOUR*24D));
|
||||
}
|
||||
}
|
|
@ -221,10 +221,6 @@ public class EndlessMap extends AbstractMap{
|
|||
for (int i = 0 ; i <endteam.size();i++) {
|
||||
|
||||
String heroId= endteam.get(i).getHeroId();
|
||||
// Hero hero = user.getHeroManager().getHero(endteam.get(i).getHeroId());
|
||||
// Map<Integer, Integer> heroAllAttribute = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero,false,GlobalsDef.ENDLESS_TEAM);
|
||||
// int blood = (int)((heroAllAttribute.get(HeroAttributeEnum.Hp.getPropertyId())/10000d)* endlessHeroInfo.get(heroId));
|
||||
|
||||
bloodMap.put(heroId,(10000-endlessHeroInfo.get(heroId))/100);
|
||||
}
|
||||
pveFightEvent.setAttackBloodMap(bloodMap);
|
||||
|
|
|
@ -21,7 +21,7 @@ public class NewEightActivity extends AbstractActivity {
|
|||
@Override
|
||||
boolean takeRewardsProcess(ISession session, SActivityRewardConfig sActivityRewardConfig, ActivityProgressInfo activityProgressInfo) throws Exception {
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
if(TimeUtils.getSoFarWentDays(user.getPlayerInfoManager().getCreateTime(),System.currentTimeMillis())<sActivityRewardConfig.getValues()[0][0]-1){
|
||||
if(TimeUtils.getOverTimeCount(user.getPlayerInfoManager().getCreateTime(),System.currentTimeMillis(),5)<sActivityRewardConfig.getValues()[0][0]-1){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -89,8 +89,7 @@ public class NewWelfareActivity extends AbstractActivity {
|
|||
//0是领取最后奖励
|
||||
if(missionId==0){
|
||||
for(ActivityProgressInfo activityProgressInfo : activityProgressInfoMap.values()){
|
||||
//3状态专为第三个任务使用。。
|
||||
if(activityProgressInfo.getState() != 1&&activityProgressInfo.getState() != 3){
|
||||
if(activityProgressInfo.getState() != 1){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,6 +80,18 @@ public class GuildChallengeLogic {
|
|||
|
||||
double bossHpRemain = guildInfo.getBossHpRemain();
|
||||
GuildMyInfo guildMyInfo = user.getGuildMyInfo();
|
||||
if(!lockMap.containsKey(guildId)){
|
||||
lockMap.put(guildId,new Object());
|
||||
}
|
||||
synchronized (lockMap.get(guildId)){
|
||||
int size = STableManager.getConfig(SGuildCheckpointConfig.class).size();
|
||||
if(guildInfo.getBossHpRemain()==-1){
|
||||
if(size>currBossId){
|
||||
guildInfo.setCurrBossId(currBossId+1);
|
||||
guildInfo.setBossHpRemain(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int isRefresh = 0 ;
|
||||
//先清除特权
|
||||
|
@ -99,10 +111,18 @@ public class GuildChallengeLogic {
|
|||
if(guildMyInfo.getLastMonsterId()!=0&&currBossId==guildMyInfo.getLastMonsterId()&&guildMyInfo.getGuildChallengeDamage()>0){
|
||||
canSweep = 1;
|
||||
}
|
||||
int remainHp;
|
||||
if(bossHpRemain==0){
|
||||
remainHp = 0;
|
||||
}else if(bossHpRemain==-1){
|
||||
remainHp = -1;
|
||||
}else{
|
||||
remainHp = (int)(bossHpRemain*10000/config.getMonsterHp());
|
||||
}
|
||||
Family.GetGuildChallengeInfoResponse response = Family.GetGuildChallengeInfoResponse.newBuilder()
|
||||
.setCanSweep(canSweep)
|
||||
.setCurBoss(currBossId)
|
||||
.setBlood(bossHpRemain==0?10000:(int)(bossHpRemain*10000/config.getMonsterHp()))
|
||||
.setBlood(remainHp)
|
||||
.setBuffTime(guildInfo.getBuffOverTime()> TimeUtils.nowInt()?guildInfo.getBuffOverTime():0)
|
||||
.setBuffCount(guildInfo.getBuffOverTime()> TimeUtils.nowInt()?guildInfo.getBuffIndex():0)
|
||||
.setSweepDamage(guildMyInfo.getGuildChallengeDamage())
|
||||
|
@ -138,7 +158,8 @@ public class GuildChallengeLogic {
|
|||
int kill = 0;
|
||||
long damage = 0;
|
||||
GuildInfo guildInfo;
|
||||
SGuildCheckpointConfig config = STableManager.getConfig(SGuildCheckpointConfig.class).get(bossId);
|
||||
Map<Integer, SGuildCheckpointConfig> configMap = STableManager.getConfig(SGuildCheckpointConfig.class);
|
||||
SGuildCheckpointConfig config = configMap.get(bossId);
|
||||
if(config==null){
|
||||
throw new ErrorCodeException("配置不存在"+bossId);
|
||||
}
|
||||
|
@ -164,7 +185,7 @@ public class GuildChallengeLogic {
|
|||
buffList.add(config.getAttributePromote()[buffIndex-1]);
|
||||
pveFightEvent.setBuffIds(buffList);
|
||||
}
|
||||
if(guildInfo.getBossHpRemain()!=0){
|
||||
if(guildInfo.getBossHpRemain()!=0&&guildInfo.getBossHpRemain()!=-1){
|
||||
List<Integer> hp = new ArrayList<>();
|
||||
for(int i = 0 ; i <6;i++){
|
||||
if(i==1){
|
||||
|
@ -183,8 +204,12 @@ public class GuildChallengeLogic {
|
|||
if(checkResult[0]==1) {
|
||||
kill = 1;
|
||||
//重置boss血量
|
||||
guildInfo.setCurrBossId(guildInfo.getCurrBossId() + 1);
|
||||
guildInfo.setBossHpRemain(0);
|
||||
if(guildInfo.getCurrBossId()!=configMap.size()){
|
||||
guildInfo.setCurrBossId(guildInfo.getCurrBossId() + 1);
|
||||
guildInfo.setBossHpRemain(0);
|
||||
}else{
|
||||
guildInfo.setBossHpRemain(-1);
|
||||
}
|
||||
//加公会经验
|
||||
Map<Integer, SGuildLevelConfig> levelConfigMap = STableManager.getConfig(SGuildLevelConfig.class);
|
||||
if (guildInfo.getExp() + config.getLegionExp() >= levelConfigMap.get(guildInfo.getLevel()).getExp()) {
|
||||
|
@ -218,8 +243,12 @@ public class GuildChallengeLogic {
|
|||
} else {
|
||||
guildInfo.updateExp(guildInfo.getExp() + config.getLegionExp());
|
||||
}
|
||||
guildInfo.setCurrBossId(guildInfo.getCurrBossId() + 1);
|
||||
guildInfo.setBossHpRemain(0);
|
||||
if(guildInfo.getCurrBossId()!=configMap.size()){
|
||||
guildInfo.setCurrBossId(guildInfo.getCurrBossId() + 1);
|
||||
guildInfo.setBossHpRemain(0);
|
||||
}else{
|
||||
guildInfo.setBossHpRemain(-1);
|
||||
}
|
||||
kill=1;
|
||||
}
|
||||
damage = guildMyInfo.getGuildChallengeDamage();
|
||||
|
@ -233,33 +262,36 @@ public class GuildChallengeLogic {
|
|||
long score = Double.valueOf(rank.getScoreById(user.getId(), guildId+":"+bossId)).longValue();
|
||||
rank.addRank(uid,guildId+":"+bossId,score==-1?damage:score+damage);
|
||||
if(kill==1){
|
||||
GuildLogic.sendFamilyBaseUpdateIndication(guildInfo);
|
||||
Map<Integer, Set<Integer>> members = guildInfo.getMembers();
|
||||
for(Set<Integer> items : members.values()){
|
||||
for(Integer sendUid : items){
|
||||
if(!OnlineUserManager.sessionMap.containsKey(sendUid)){
|
||||
continue;
|
||||
//如果不是最后一个boss更特权
|
||||
if(guildInfo.getCurrBossId()!=configMap.size()){
|
||||
GuildLogic.sendFamilyBaseUpdateIndication(guildInfo);
|
||||
Map<Integer, Set<Integer>> members = guildInfo.getMembers();
|
||||
for(Set<Integer> items : members.values()){
|
||||
for(Integer sendUid : items){
|
||||
if(!OnlineUserManager.sessionMap.containsKey(sendUid)){
|
||||
continue;
|
||||
}
|
||||
AyyncWorker worker = new AyyncWorker(UserManager.getUser(sendUid),false,(user1)->{
|
||||
GuildMyInfo guildMyInfo = user1.getGuildMyInfo();
|
||||
if(guildMyInfo.getGuildChallengeDamage()==0){
|
||||
return;
|
||||
}
|
||||
if(guildMyInfo.getRefreshedBoss().contains(bossId)) {
|
||||
return;
|
||||
}
|
||||
int[] refreshPrivilege = config.getPrivilege();
|
||||
for(int clearPrivilege:refreshPrivilege){
|
||||
user1.getPlayerInfoManager().clearVipCount(clearPrivilege);
|
||||
}
|
||||
user1.getPlayerInfoManager().removeVipPriviliageId(3013);
|
||||
user1.getStoreManager().removeStoreItemInfo(7,10031);
|
||||
StoreLogic.sendStoreUpdateIndication(user1.getId(),user1.getStoreManager().getStoreInfoMap().get(7));
|
||||
guildMyInfo.setLastMonsterId(bossId+1);
|
||||
guildMyInfo.setGuildChallengeDamage(0);
|
||||
guildMyInfo.addRefreshedBoss(bossId);
|
||||
});
|
||||
ProtocolsManager.getInstance().updateAyncWorker(worker);
|
||||
}
|
||||
AyyncWorker worker = new AyyncWorker(UserManager.getUser(sendUid),false,(user1)->{
|
||||
GuildMyInfo guildMyInfo = user1.getGuildMyInfo();
|
||||
if(guildMyInfo.getGuildChallengeDamage()==0){
|
||||
return;
|
||||
}
|
||||
if(guildMyInfo.getRefreshedBoss().contains(bossId)) {
|
||||
return;
|
||||
}
|
||||
int[] refreshPrivilege = config.getPrivilege();
|
||||
for(int clearPrivilege:refreshPrivilege){
|
||||
user1.getPlayerInfoManager().clearVipCount(clearPrivilege);
|
||||
}
|
||||
user1.getPlayerInfoManager().removeVipPriviliageId(3013);
|
||||
user1.getStoreManager().removeStoreItemInfo(7,10031);
|
||||
StoreLogic.sendStoreUpdateIndication(user1.getId(),user1.getStoreManager().getStoreInfoMap().get(7));
|
||||
guildMyInfo.setLastMonsterId(bossId+1);
|
||||
guildMyInfo.setGuildChallengeDamage(0);
|
||||
guildMyInfo.addRefreshedBoss(bossId);
|
||||
});
|
||||
ProtocolsManager.getInstance().updateAyncWorker(worker);
|
||||
}
|
||||
}
|
||||
//异步发奖
|
||||
|
@ -270,9 +302,16 @@ public class GuildChallengeLogic {
|
|||
}else{
|
||||
drop = ItemUtil.drop(user, new int[]{config.getReward()}, 1, 0, 1);
|
||||
}
|
||||
double blood = guildInfo.getBossHpRemain();
|
||||
int remainHp;
|
||||
if(guildInfo.getBossHpRemain()==0){
|
||||
remainHp = 0;
|
||||
}else if(guildInfo.getBossHpRemain()==-1){
|
||||
remainHp = -1;
|
||||
}else{
|
||||
remainHp = (int)(guildInfo.getBossHpRemain()*10000D/config.getMonsterHp());
|
||||
}
|
||||
Family.GuildChallengeIndication.Builder indication = Family.GuildChallengeIndication.newBuilder()
|
||||
.setBlood(guildInfo.getBossHpRemain()==0?10000:(int)(blood*10000/config.getMonsterHp()))
|
||||
.setBlood(remainHp)
|
||||
.setCurBoss(guildInfo.getCurrBossId());
|
||||
|
||||
GuildLogic.sendIndicationToMemberWithoutUser(guildInfo, MessageTypeProto.MessageType.GUILD_CHALLENGE_INDICATION,indication.build(),uid);
|
||||
|
@ -391,8 +430,12 @@ public class GuildChallengeLogic {
|
|||
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);
|
||||
String uid = rankInfo.getValue();
|
||||
User user = UserManager.getUser(Integer.parseInt(uid));
|
||||
if (user.getPlayerInfoManager().getGuildId()==guildId){
|
||||
String mailReward = ItemUtil.getMailReward(config.getRankingReward());
|
||||
MailLogic.getInstance().sendMail(Integer.parseInt(uid), title, content, mailReward, TimeUtils.nowInt(), Global.MAIL_EFFECTIVE_TIME);
|
||||
}
|
||||
index++;
|
||||
}
|
||||
// 排行不清除
|
||||
|
|
|
@ -15,10 +15,8 @@ import com.ljsd.jieling.handler.map.MapLogic;
|
|||
import com.ljsd.jieling.hotfix.HotfixUtil;
|
||||
import com.ljsd.jieling.ktbeans.BeanBuilder.KtBeanBuilderUtils;
|
||||
import com.ljsd.jieling.ktbeans.KTRequestBeans.LoginParamType;
|
||||
import com.ljsd.jieling.ktbeans.ReportUtil;
|
||||
import com.ljsd.jieling.ktbeans.parmsBean.ParamEventBean;
|
||||
import com.ljsd.jieling.ktbeans.sendbeans.KTAppOnline;
|
||||
import com.ljsd.jieling.ktbeans.sendbeans.ReportServerEvent;
|
||||
import com.ljsd.jieling.logic.GlobalDataManaager;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.SituationLogic;
|
||||
|
@ -40,7 +38,6 @@ import com.ljsd.jieling.logic.question.QuestionLogic;
|
|||
import com.ljsd.jieling.logic.store.BuyGoodsLogic;
|
||||
import com.ljsd.jieling.logic.store.StoreLogic;
|
||||
import com.ljsd.jieling.network.server.ProtocolsManager;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import manager.STableManager;
|
||||
import org.slf4j.Logger;
|
||||
|
|
Loading…
Reference in New Issue