Merge branch 'master' into equip_develop

# Conflicts:
#	serverlogic/src/main/java/com/ljsd/jieling/logic/player/PlayerLogic.java
back_recharge
lvxinran 2020-07-07 19:01:08 +08:00
commit 7acbce59c5
14 changed files with 199 additions and 48 deletions

2
.gitignore vendored
View File

@ -16,4 +16,4 @@ luafight/LogError/*.json
luafight/BattleRecord/*.txt
luafight/BattleRecord/*.json
serverlogic/src/main/com.ljsd.jieling.thrift
conf/server/*.txt
conf/server/*.txt

View File

@ -39,6 +39,7 @@ dependencies {
compile("com.fasterxml.jackson.core:jackson-databind:2.3.3")
compile group: 'com.googlecode.protobuf-java-format', name: 'protobuf-java-format', version: '1.2'
compile group: 'com.google.code.gson', name: 'gson', version: '2.2.4'
compile group: 'cn.thinkingdata', name: 'thinkingdatasdk', version: '1.5.1'
// compile("org.luaj:luaj-jse:3.0.1")
compile("org.apache.thrift:libthrift:0.9.2")
compile("com.alibaba:fastjson:1.2.47")

View File

@ -71,22 +71,22 @@ public class ReliveExpeditionHeroRequest extends BaseHandler<Expedition.ReliveEx
}
Set<String> ids = new HashSet<>();
// 更新队伍血量
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(1001);
Iterator<TeamPosHeroInfo> iterator = teamPosHeroInfos.iterator();
while (iterator.hasNext()){
TeamPosHeroInfo teamPosHeroInfo = iterator.next();
Hero hero = user.getHeroManager().getHero(teamPosHeroInfo.getHeroId());
if (hero == null) {
continue;
}
ids.add(hero.getId());
}
//List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(1001);
// Iterator<TeamPosHeroInfo> iterator = teamPosHeroInfos.iterator();
// while (iterator.hasNext()){
// TeamPosHeroInfo teamPosHeroInfo = iterator.next();
// Hero hero = user.getHeroManager().getHero(teamPosHeroInfo.getHeroId());
// if (hero == null) {
// continue;
// }
// ids.add(hero.getId());
// }
expeditionManager.getHeroHPWithChange().clear();
//更新节点
Expedition.ExpeditionNodeInfoIndication.Builder builder = Expedition.ExpeditionNodeInfoIndication.newBuilder();
builder.addAllHeroInfo(ExpeditionLogic.getInstance().getAllHeroInfo(user,ids));
builder.addAllHeroInfo(ExpeditionLogic.getInstance().getAllHeroInfo(user,new HashSet<>()));
MessageUtil.sendIndicationMessage(iSession, 1, MessageTypeProto.MessageType.EXPEDITION_NOINFO_INDICATION_VALUE, builder.build(), true);
} else {

View File

@ -0,0 +1,58 @@
package com.ljsd.jieling.handler.arena;
import com.google.protobuf.GeneratedMessage;
import com.ljsd.jieling.exception.ErrorCode;
import com.ljsd.jieling.exception.ErrorCodeException;
import com.ljsd.jieling.globals.BIReason;
import com.ljsd.jieling.handler.BaseHandler;
import com.ljsd.jieling.logic.dao.ArenaManager;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.protocols.ArenaInfoProto;
import com.ljsd.jieling.protocols.CommonProto;
import com.ljsd.jieling.protocols.MessageTypeProto;
import com.ljsd.jieling.util.ItemUtil;
import config.SArenaBattleReward;
import manager.STableManager;
/**
* Description: des
* Author: zsx
* CreateDate: 2020/7/6 21:19
*/
public class TakeArenaBattleRewardRequestHandler extends BaseHandler<ArenaInfoProto.TakeArenaBattleRewardRequest> {
@Override
public MessageTypeProto.MessageType getMessageCode() {
return null;
}
@Override
public GeneratedMessage processWithProto(int uid, ArenaInfoProto.TakeArenaBattleRewardRequest proto) throws Exception {
int missionId = proto.getMissionId();
//check cfg
SArenaBattleReward sArenaBattleReward = STableManager.getConfig(SArenaBattleReward.class).get(missionId);
if(sArenaBattleReward==null){
throw new ErrorCodeException(ErrorCode.CFG_NULL);
}
User user = UserManager.getUser(uid);
ArenaManager arenaManager = user.getArenaManager();
//幂等
boolean contains = arenaManager.getHadTakeReward().contains(missionId);
if(contains){
throw new ErrorCodeException(ErrorCode.HAD_TAKE_REWARD);
}
//check condition
boolean b = sArenaBattleReward.getBattleTimes() > arenaManager.getFailNums() + arenaManager.getSuccessNums();
if(b){
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE);
}
arenaManager.getHadTakeReward().add(missionId);
//drop
int[][] reward = sArenaBattleReward.getReward();
CommonProto.Drop.Builder drop = ItemUtil.drop(user, reward, BIReason.EXPEDITION_BOX_REWARD);
return ArenaInfoProto.TakeArenaBattleRewardResponse.newBuilder().setDrop(drop).build();
}
}

View File

@ -2,10 +2,7 @@ package com.ljsd.jieling.logic.dao;
import com.ljsd.common.mogodb.MongoBase;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
public class ArenaManager extends MongoBase {
@ -26,7 +23,7 @@ public class ArenaManager extends MongoBase {
private List<ArenaEnemy> arenaEnemies;
private List<Integer> hadTakeReward;
public void updateChallenge(int fightResult){
if(fightResult == 1){
@ -89,12 +86,14 @@ public class ArenaManager extends MongoBase {
this.count=0;
this.flushTime=0;
this.flushNums=0;
hadTakeReward=new LinkedList<>();
updateString("season",season);
updateString("failNums",failNums);
updateString("successNums",successNums);
updateString("count",count);
updateString("flushTime",flushTime);
updateString("flushNums",flushNums);
updateString("hadTakeReward",hadTakeReward);
}
public int getTopMaxRank() {
@ -105,4 +104,13 @@ public class ArenaManager extends MongoBase {
this.topMaxRank = topMaxRank;
updateString("topMaxRank",topMaxRank);
}
public List<Integer> getHadTakeReward() {
if(null ==hadTakeReward){
hadTakeReward= new LinkedList<>();
}
updateString("hadTakeReward",hadTakeReward);
return hadTakeReward;
}
}

View File

@ -60,12 +60,28 @@ public class Hero extends MongoBase {
this.id = KeyGenUtils.produceIdByModule(UUIDEnum.HERO, uid);
this.templateId = heroTid;
this.level = initStar;
int[] heroStar = SItem.getsItemMap().get(heroTid).getHeroStar();
this.star =heroStar[1] ;
SCHero hero1 = SCHero.getsCHero().get(heroTid);
int initCfgStar = hero1.getStar();
int maxStar = hero1.getMaxRank();
if(hero.getStar()<initCfgStar){
this.star =initCfgStar;
}else if(hero.getStar()>maxStar){
this.star=maxStar;
}else {
this.star = hero.getStar();
}
if(initCfgStar!=hero.getStar()){
Map<Integer, SCHeroRankUpConfig> scHeroRankUpConfigByType = STableManager.getFigureConfig(HeroStaticConfig.class).getScHeroRankUpConfigByShow(GlobalsDef.UP_STAR_TYPE,initCfgStar);
if(scHeroRankUpConfigByType!=null) {
SCHeroRankUpConfig scHeroRankUpConfig = scHeroRankUpConfigByType.get(hero.getStar()-1);
starBreakId = scHeroRankUpConfig.getId();
}
}
this.equipByPositionMap = new HashMap<>();
this.soulEquipByPositionMap = hero.soulEquipByPositionMap;
this.breakId = hero.breakId;
this.starBreakId = hero.starBreakId;
this.createTime = (int)(System.currentTimeMillis()/1000);
this.speed = hero.speed;
this.especialEquipLevel = hero.especialEquipLevel;
@ -85,10 +101,10 @@ public class Hero extends MongoBase {
this.especialEquipLevel = 1;
if(initStar!=scHero.getStar()){
Map<Integer, SCHeroRankUpConfig> scHeroRankUpConfigByType = STableManager.getFigureConfig(HeroStaticConfig.class).getScHeroRankUpConfigByShow(GlobalsDef.UP_STAR_TYPE,scHero.getStar());
if(scHeroRankUpConfigByType!=null) {
SCHeroRankUpConfig scHeroRankUpConfig = scHeroRankUpConfigByType.get(initStar-1);
starBreakId = scHeroRankUpConfig.getId();
}
if(scHeroRankUpConfigByType!=null) {
SCHeroRankUpConfig scHeroRankUpConfig = scHeroRankUpConfigByType.get(initStar-1);
starBreakId = scHeroRankUpConfig.getId();
}
}
createTime = (int)(System.currentTimeMillis()/1000);

View File

@ -480,10 +480,10 @@ public class ExpeditionLogic {
}
int ints = staffsSet.size()+1;//默认品质
try {
ints = MathUtils.randomFromWeight(cfg.getHolyProbability());
ints = MathUtils.randomFromWeight(cfg.getHolyProbability());
}catch (Exception e){
break;
// e.printStackTrace();
// e.printStackTrace();
}
Map<Integer, Integer> type2holy2weight = STableManager.getFigureConfig(CommonStaticConfig.class).getType2holy2weight(ints);
int i1 = ranndomFromWeight(type2holy2weight);
@ -747,7 +747,7 @@ public class ExpeditionLogic {
}
SExpeditionHolyConfig orDefault = effectItems.getOrDefault(sExpeditionHolyConfig.geteffect(), null);
if(null!=orDefault&&sExpeditionHolyConfig.gettype()<=orDefault.gettype()){
continue;
continue;
}
effectItems.put(sExpeditionHolyConfig.geteffect(),sExpeditionHolyConfig);
}
@ -873,8 +873,8 @@ public class ExpeditionLogic {
// if(isTemp){
// user.getExpeditionManager().addEquipToTemp(user, newequip);
// }else {
user.getExpeditionManager().addEquip(user, newequip);
// }
user.getExpeditionManager().addEquip(user, newequip);
// }
newHero.updateEquipPositionMap(next.getKey(), equipId);
}
@ -888,11 +888,11 @@ public class ExpeditionLogic {
Jewel j = (Jewel) propertyItem;
Jewel newequip = new Jewel(user.getId(), j.getEquipId());
// if(isTemp){
// user.getExpeditionManager().addEquipToTemp(user, newequip);
// }else {
user.getExpeditionManager().addEquip(user, newequip);
// }
// if(isTemp){
// user.getExpeditionManager().addEquipToTemp(user, newequip);
// }else {
user.getExpeditionManager().addEquip(user, newequip);
// }
newHero.addJewel(newequip.getId());
}
if(isTemp){
@ -918,9 +918,30 @@ public class ExpeditionLogic {
//random ids
TreeSet<Integer> tempid = new TreeSet<>();
Set<Integer> tempType = new HashSet<>();
int i=0;
while (tempid.size()<size){
if(i>1000){
LOGGER.error("getRandomTidException:条件不匹配");
break;
}
int i1 = ranndomFromWeight(cfg);
SExpeditionRecruitConfig sExpeditionRecruitConfig = STableManager.getConfig(SExpeditionRecruitConfig.class).get(i1);
SCHero hero1 = SCHero.getsCHero().get(sExpeditionRecruitConfig.getHeroId());
i++;
if(hero1==null){
LOGGER.error("英雄配置不存在"+i1);
continue;
}
int propertyName = hero1.getPropertyName();
if(tempType.contains(propertyName)){
continue;
}
tempid.add(i1);
tempType.add(propertyName);
i++;
}
return tempid;

View File

@ -593,6 +593,18 @@ public class GuildLogic {
RedisUtil.getInstence().removeMapEntrys(RedisKey.USER_LEVEL_GUILD_INFO,"",String.valueOf(applyId));
Poster.getPoster().dispatchEvent(new GuildForceChangeEvent(targetUser.getId(),targetUser.getPlayerInfoManager().getGuildId(),1,targetUser.getPlayerInfoManager().getMaxForce()));
Family.GuildHelpInfoIndication.Builder builder = Family.GuildHelpInfoIndication.newBuilder();
for (Map.Entry<Integer, Integer> entry : targetUser.getGuildMyInfo().getGuidHelpInfo().entrySet()) {
builder.addGuildHelpInfo(CommonProto.GuildHelpInfo.newBuilder()
.setHadtakenum(targetUser.getGuildMyInfo().getGuidHelpHadTakeInfo().getOrDefault(entry.getKey(),0))
.setType(entry.getKey())
.setNum(entry.getValue()));
}
//notify all change
Family.GuildHelpInfoIndication build = builder.setUid(targetUser.getId()).setName(targetUser.getPlayerInfoManager().getNickName()).build();
GuildLogic.sendIndicationToMember(GuilidManager.guildInfoMap.get(guildInfo.getId()), MessageTypeProto.MessageType.GuildHelpInfoIndication,build);
// targetUser.getUserMissionManager().onGameEvent(targetUser, GameEvent.JOIN_FAMILY);
}finally {
RedisUtil.getInstence().releaseDistributedLock(RedisKey.OPERATE_FAMILY_APPLY_JOIN,Integer.toString(applyId), Integer.toString(applyId));
@ -1380,7 +1392,7 @@ public class GuildLogic {
RedisUtil.getInstence().putMapEntry(RedisKey.USER_LEVEL_GUILD_INFO,"",String.valueOf(user.getId()),guildId);
//删除战力
Poster.getPoster().dispatchEvent(new GuildForceChangeEvent(user.getId(),user.getPlayerInfoManager().getGuildId(),3,0-user.getPlayerInfoManager().getMaxForce()));
//notify all
//notify ALL
Family.GuildHelpInfoIndication.Builder build = Family.GuildHelpInfoIndication.newBuilder();
for (Map.Entry<Integer, Integer> entry : user.getGuildMyInfo().getGuidHelpInfo().entrySet()) {
//通知前端清除公会成员援助信息
@ -1436,4 +1448,5 @@ public class GuildLogic {
MailLogic.getInstance().sendMail(user.getId(),title,content,mailReward,(int) (TimeUtils.now()/1000), Global.MAIL_EFFECTIVE_TIME);
}
}

View File

@ -1705,9 +1705,9 @@ public class HeroLogic{
float score = sPropertyConfig.getScore();
result += propertyValue*score;
// LOGGER.info("the propertyId={} the value is ={},propertyValue={},score={}result ={},the value={}",propertyId,propertyValue*score,propertyValue,score,result,propertyValue*score);
// LOGGER.info("the propertyId={} the value is ={},propertyValue={},score={}result ={},the value={}",propertyId,propertyValue*score,propertyValue,score,result,propertyValue*score);
}
// System.out.println(result);
// System.out.println(result);
return (int)result;
}
@ -1813,7 +1813,7 @@ public class HeroLogic{
private void wearJewel(Hero hero,EquipManager equipManager,String equipId)throws Exception{
Jewel equip =(Jewel)equipManager.getEquipMap().get(equipId);
if( null == equip || null == hero ){
if( null == equip || null == hero ||hero.getJewelInfo().contains(equipId)){
throw new ErrorCodeException(ErrorCode.HERO_EQUIP_ERR);
}

View File

@ -246,7 +246,7 @@ public class PlayerLogic {
int vipLevel = playerInfoManager.getVipLevel();
playerInfoManager.setVipLevel(vipLevel+1);
user.getUserMissionManager().onGameEvent(user,GameEvent.VIP_LEVLUP,playerInfoManager.getVipLevel());
// CombatLogic.getInstance().getNewAdventureReward(user, true,TimeUtils.nowInt());
CombatLogic.getInstance().getNewAdventureReward(user, true,TimeUtils.nowInt());
List<CommonProto.UserMissionInfo> missionList = new ArrayList<>();
MissionLoigc.getVipMission(user,missionList);
CommonProto.VipBaseInfo vipInfoProto = CommonProto.VipBaseInfo.newBuilder()
@ -654,8 +654,8 @@ public class PlayerLogic {
for(String equipId : hero.getJewelInfo()){
builder.addEquip(CBean2Proto.getEquipProto(equipMap.get(equipId)));
}
for(Integer equipId : hero.getEquipByPositionMap().values()){
builder.addEquip(CBean2Proto.getEquipProto(equipId));
for(String equipId : hero.getEquipByPositionMap().values()){
builder.addEquip(CBean2Proto.getEquipProto(equipMap.get(equipId)));
}
builder.setForce(HeroLogic.getInstance().calForce(heroNotBufferAttribute));
builder.setHero(CBean2Proto.getHero(hero));

View File

@ -285,10 +285,10 @@ public class BuyGoodsLogic {
}else {
rechargeInfo.putDyGoodsCanBuyTimes(goodsId,dytime);
}
// List<CommonProto.GiftGoodsInfo> goodsBagInfo = new ArrayList<>(SRechargeCommodityConfig.rechargeCommodityConfigMap.size());
// BuyGoodsLogic.getGoodsBagInfo(uid, goodsBagInfo,false);
// PlayerInfoProto.AllGiftGoodsIndication build = PlayerInfoProto.AllGiftGoodsIndication.newBuilder().addAllGiftGoodsInfo(goodsBagInfo).build();
// MessageUtil.sendIndicationMessage(session,1, MessageTypeProto.MessageType.ALL_GIFTGOODS_INDICATION_VALUE,build,true);
List<CommonProto.GiftGoodsInfo> goodsBagInfo = new ArrayList<>(SRechargeCommodityConfig.rechargeCommodityConfigMap.size());
BuyGoodsLogic.getGoodsBagInfo(uid, goodsBagInfo,false);
PlayerInfoProto.AllGiftGoodsIndication build = PlayerInfoProto.AllGiftGoodsIndication.newBuilder().addAllGiftGoodsInfo(goodsBagInfo).build();
MessageUtil.sendIndicationMessage(session,1, MessageTypeProto.MessageType.ALL_GIFTGOODS_INDICATION_VALUE,build,true);
}
}

View File

@ -121,7 +121,7 @@ public class ThreadManager implements IManager {
scheduledFutureSets.add(scheduledExecutor.scheduleAtFixedRate(platConfigureTask, 10, SLEEP_INTEVAL_TIME, TimeUnit.SECONDS));
scheduledFutureSets.add( scheduledExecutor.scheduleAtFixedRate(new MinuteTask(), delayForMinute, 60, TimeUnit.SECONDS));
scheduledFutureSets.add( scheduledExecutor.scheduleAtFixedRate(new SecondsTask(), 0, 1, TimeUnit.SECONDS));
scheduledFutureSets.add( scheduledExecutor.scheduleAtFixedRate(new FetchBloodyEndDataThread(), 0, 1, TimeUnit.SECONDS));
// scheduledFutureSets.add( scheduledExecutor.scheduleAtFixedRate(new FetchBloodyEndDataThread(), 0, 1, TimeUnit.SECONDS));
scheduledFutureSets.add( scheduledExecutor.scheduleAtFixedRate(new Thread(){
public void run () {
long lastMilis = System.currentTimeMillis();

View File

@ -38,8 +38,8 @@ public class MessageUtil {
backMessage = new byte[0];
} else {
backMessage = generatedMessage.toByteArray();
if (backMessage.length != 0)
LOGGER.info("\r\n" + "uid:" + uid + ":\r\n" + JsonFormat.printToString(generatedMessage));
//if (backMessage.length != 0)
//LOGGER.info("\r\n" + "uid:" + uid + ":\r\n" + JsonFormat.printToString(generatedMessage));
}
int length = PackageConstant.UID_FIELD_LEN + PackageConstant.TOKEN_LEN

View File

@ -0,0 +1,34 @@
package config;
import manager.Table;
@Table(name ="ArenaBattleReward")
public class SArenaBattleReward implements BaseConfig {
private int id;
private int battleTimes;
private int[][] reward;
@Override
public void init() throws Exception {
}
public int getId() {
return id;
}
public int getBattleTimes() {
return battleTimes;
}
public int[][] getReward() {
return reward;
}
}