Merge branch 'master' of http://60.1.1.230/backend/jieling_server into dev_champion

back_recharge
zhangshanxue 2020-07-08 19:27:40 +08:00
commit 2498e48c1a
41 changed files with 879 additions and 425 deletions

2
.gitignore vendored
View File

@ -16,4 +16,4 @@ luafight/LogError/*.json
luafight/BattleRecord/*.txt luafight/BattleRecord/*.txt
luafight/BattleRecord/*.json luafight/BattleRecord/*.json
serverlogic/src/main/com.ljsd.jieling.thrift 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("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.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: '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.luaj:luaj-jse:3.0.1")
compile("org.apache.thrift:libthrift:0.9.2") compile("org.apache.thrift:libthrift:0.9.2")
compile("com.alibaba:fastjson:1.2.47") compile("com.alibaba:fastjson:1.2.47")

View File

@ -32,72 +32,72 @@ import java.util.concurrent.ConcurrentLinkedQueue;
//todo 对用户频繁访问加限流处理。 //todo 对用户频繁访问加限流处理。
public class HandlerLogicThread extends Thread{ public class HandlerLogicThread extends Thread{
private static final Logger LOGGER = LoggerFactory.getLogger(HandlerLogicThread.class); private static final Logger LOGGER = LoggerFactory.getLogger(HandlerLogicThread.class);
private static Set<Integer> whiteMsg = new HashSet<>(); // private static Set<Integer> whiteMsg = new HashSet<>();
static { // static {
whiteMsg.add(MessageTypeProto.MessageType.MAP_ENTER_REQUEST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.MAP_ENTER_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.MAP_START_EXPLORE_REQUEST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.MAP_START_EXPLORE_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.MAP_UDPATE_REQUEST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.MAP_UDPATE_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.EVENT_UPDATE_REQUEST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.EVENT_UPDATE_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.MAP_FAST_FIGHT_REQUEST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.MAP_FAST_FIGHT_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.FIGHT_START_REQUEST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.FIGHT_START_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.FIGHT_END_REQUEST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.FIGHT_END_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.MAP_OUT_REQUEST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.MAP_OUT_REQUEST_VALUE);
//
whiteMsg.add(MessageTypeProto.MessageType.MAP_TOWER_CALL_CHIEF_REQUEST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.MAP_TOWER_CALL_CHIEF_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.MAP_TOWER_USEBOMB_REQUEST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.MAP_TOWER_USEBOMB_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.MAP_TOWER_USEBUFF_REQUEST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.MAP_TOWER_USEBUFF_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.ENDLESS_MAP_RESET_REQUEST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.ENDLESS_MAP_RESET_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.ENDLESS_MAP_SIGN_REQUEST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.ENDLESS_MAP_SIGN_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.ENDLESS_EXECUTION_REFRESH_REQUEST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.ENDLESS_EXECUTION_REFRESH_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.ENDLESS_OUT_CONSUME_REQUEST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.ENDLESS_OUT_CONSUME_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.ENDLESS_MAP_HERO_INFO_REQUEST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.ENDLESS_MAP_HERO_INFO_REQUEST_VALUE);
//
whiteMsg.add(MessageTypeProto.MessageType.LOGIN_REQUEST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.LOGIN_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.GET_PLAYERINFO_REQUEST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.GET_PLAYERINFO_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.GET_ITEMINFO_REQUEST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.GET_ITEMINFO_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.GET_ALL_EQUIP_REQUEST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.GET_ALL_EQUIP_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.GET_ALL_POKEMON_REQUEST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.GET_ALL_POKEMON_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.GET_HEROINFO_REQUEST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.GET_HEROINFO_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.GET_TEAMPOS_INFO_REQUEST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.GET_TEAMPOS_INFO_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.GET_WORKSHOP_INFO_REQUEST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.GET_WORKSHOP_INFO_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.GET_ALL_MAIL_INFO_REQUEST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.GET_ALL_MAIL_INFO_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.GET_ALL_LEVE_DIFFICULTT_REQUEST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.GET_ALL_LEVE_DIFFICULTT_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.GET_ALL_ACTIVITY_REQUEST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.GET_ALL_ACTIVITY_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.GET_FUNCTIONOFTIME_REQUEST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.GET_FUNCTIONOFTIME_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.GET_SECRETBOX_REQUEST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.GET_SECRETBOX_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.ADVENTURE_INFO_REQUEST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.ADVENTURE_INFO_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.GET_FRIEND_INFO_REQUEST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.GET_FRIEND_INFO_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.GET_STARE_INFOS_REQUEST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.GET_STARE_INFOS_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.ARENA_INFO_REQUEST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.ARENA_INFO_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.GET_RINGFIRE_INFO_REQUEST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.GET_RINGFIRE_INFO_REQUEST_VALUE);
//
whiteMsg.add(MessageTypeProto.MessageType.BUY_STORE_ITEM_REQUEST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.BUY_STORE_ITEM_REQUEST_VALUE);
//
whiteMsg.add(MessageTypeProto.MessageType.GET_MISSION_REQUEST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.GET_MISSION_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.REFRESH_ITEM_NUM_REQUEST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.REFRESH_ITEM_NUM_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.STORE_GOODS_REFRESH_REQUEST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.STORE_GOODS_REFRESH_REQUEST_VALUE);
//日后删除 // //日后删除
whiteMsg.add(MessageTypeProto.MessageType.GET_CHAT_MESSAGE_REQUEST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.GET_CHAT_MESSAGE_REQUEST_VALUE);
//
whiteMsg.add(MessageTypeProto.MessageType.BLESS_INFO_REQUEST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.BLESS_INFO_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.SERVER_FIVE_REQEUST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.SERVER_FIVE_REQEUST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.SERVER_ZERO_REQUEST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.SERVER_ZERO_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.FAMILY_FIGHT_ROUND_INFO_REQUEST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.FAMILY_FIGHT_ROUND_INFO_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.FAMILY_GET_INFO_REQUEST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.FAMILY_GET_INFO_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.FAMILY_GET_MEMBER_REQUEST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.FAMILY_GET_MEMBER_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.FAMILY_GET_APPLY_REQUEST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.FAMILY_GET_APPLY_REQUEST_VALUE);
//
whiteMsg.add(MessageTypeProto.MessageType.ADVENTURE_BOSSHURT_REQEUST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.ADVENTURE_BOSSHURT_REQEUST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.USER_FORCE_CHANGE_REQUEST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.USER_FORCE_CHANGE_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.ENDLESS_SET_SKIPFIGHT_REQUEST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.ENDLESS_SET_SKIPFIGHT_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.GET_QUESTION_REQUEST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.GET_QUESTION_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.MAIN_LEVEL_GET_INFO_REQUEST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.MAIN_LEVEL_GET_INFO_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.EXPEDITION_GET_EXPEDITION_REQUEST_VALUE); // whiteMsg.add(MessageTypeProto.MessageType.EXPEDITION_GET_EXPEDITION_REQUEST_VALUE);
//
//
//
} // }
public ConcurrentLinkedQueue<PacketNetData> handlerLinkedQueue = new ConcurrentLinkedQueue(); public ConcurrentLinkedQueue<PacketNetData> handlerLinkedQueue = new ConcurrentLinkedQueue();
public ConcurrentLinkedQueue<AyyncWorker> ayyncWorkerConcurrentLinkedQueue = new ConcurrentLinkedQueue(); public ConcurrentLinkedQueue<AyyncWorker> ayyncWorkerConcurrentLinkedQueue = new ConcurrentLinkedQueue();
@ -146,11 +146,11 @@ public class HandlerLogicThread extends Thread{
MessageUtil.sendErrorResponse(session,-1,msgId+1,"funciton not"); MessageUtil.sendErrorResponse(session,-1,msgId+1,"funciton not");
return; return;
} }
b = checkIsPermit(msgId, session); // b = checkIsPermit(msgId, session);
if(!b){ // if(!b){
MessageUtil.sendErrorResponse(session,-1,msgId+1,"在地图探索中,不可以操作"); // MessageUtil.sendErrorResponse(session,-1,msgId+1,"在地图探索中,不可以操作");
return; // return;
} // }
} }
if (msgId != MessageTypeProto.MessageType.GET_CHAT_MESSAGE_REQUEST_VALUE) { if (msgId != MessageTypeProto.MessageType.GET_CHAT_MESSAGE_REQUEST_VALUE) {
@ -212,24 +212,15 @@ public class HandlerLogicThread extends Thread{
} }
private boolean checkIsPermit(int msgId, ISession session) throws Exception { // private boolean checkIsPermit(int msgId, ISession session) throws Exception {
int uid = session.getUid(); // int uid = session.getUid();
User user = UserManager.getUser(uid); // User user = UserManager.getUser(uid);
int curMapId = 0; // int curMapId = 0;
//todo 暂时删除 // //todo 暂时删除
// int curMapId = user.getMapManager().getCurMapId(); //// int curMapId = user.getMapManager().getCurMapId();
//
if(curMapId!=0 && msgId == MessageTypeProto.MessageType.TEAM_POS_SAVE_REQUEST_VALUE){ // return true;
SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(curMapId); // }
if(sChallengeConfig.getType()==4){
return true;
}
}
if(curMapId!=0 && !whiteMsg.contains(msgId)){
return false;
}
return true;
}
private boolean checkFunctionIsOpen(int msgId, ISession session ) { private boolean checkFunctionIsOpen(int msgId, ISession session ) {

View File

@ -43,5 +43,6 @@ public interface VipPrivilegeType {
int UNLOCK_GUILD_BOSS_SWEEP = 1002; //公会boss扫荡 int UNLOCK_GUILD_BOSS_SWEEP = 1002; //公会boss扫荡
int EXPEDITION_RELIVE = 1003; //猎妖之路免费复活次数 int EXPEDITION_RELIVE = 1003; //猎妖之路免费复活次数
int SIGN_AGAIN = 1005; //每日签到充值后再领一次 int SIGN_AGAIN = 1005; //每日签到充值后再领一次
int ADVENTURE_ADD_TIME = 2002;//挂机时常增加
} }

View File

@ -141,6 +141,7 @@ public interface BIReason {
int EXCEPTION_TREASURE_REWARD = 77;//天空密境积分奖励 int EXCEPTION_TREASURE_REWARD = 77;//天空密境积分奖励
int PROUD_REWARD = 78;//膜拜获得金币奖励 int PROUD_REWARD = 78;//膜拜获得金币奖励
int EQUIP_UNLOAD_REWARD = 79;
int ADVENTURE_UPLEVEL_CONSUME = 1000;//秘境升级 int ADVENTURE_UPLEVEL_CONSUME = 1000;//秘境升级
int SECRETBOX_CONSUME = 1001;//秘盒抽卡 int SECRETBOX_CONSUME = 1001;//秘盒抽卡
@ -258,6 +259,8 @@ public interface BIReason {
int TRIAL_ADD_HP_CONSUME = 1062;//试炼回春散消耗 int TRIAL_ADD_HP_CONSUME = 1062;//试炼回春散消耗
int DAILY_SCORE_CONSUME = 1063;//删除日常任务积分 int DAILY_SCORE_CONSUME = 1063;//删除日常任务积分
int EQUIP_WEAR_CONSUME = 1064;
} }

View File

@ -102,9 +102,8 @@ public class HeroNodeGetInfoRequestHandler extends BaseHandler<Expedition.HeroNo
for(Map.Entry<Integer,Integer> item : heroNotBufferAttribute.entrySet()){ for(Map.Entry<Integer,Integer> item : heroNotBufferAttribute.entrySet()){
inner.addSpecialEffects(CommonProto.SpecialEffects.newBuilder().setPropertyId(item.getKey()).setPropertyValue(item.getValue()).build()); inner.addSpecialEffects(CommonProto.SpecialEffects.newBuilder().setPropertyId(item.getKey()).setPropertyValue(item.getValue()).build());
} }
Map<String, PropertyItem> equipMap = user.getExpeditionManager().getEquipMap(); for(Integer equipId : hero.getEquipByPositionMap().values()){
for(String equipId : hero.getEquipByPositionMap().values()){ inner.addEquip(CBean2Proto.getEquipProto(equipId));
inner.addEquip(CBean2Proto.getEquipProto(equipMap.get(equipId)));
} }
inner.setForce(HeroLogic.getInstance().calForce(heroNotBufferAttribute)); inner.setForce(HeroLogic.getInstance().calForce(heroNotBufferAttribute));
inner.setHero(CBean2Proto.getHero(hero)); inner.setHero(CBean2Proto.getHero(hero));

View File

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

View File

@ -6,6 +6,8 @@ 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.handler.map.MapLogic; import com.ljsd.jieling.handler.map.MapLogic;
import com.ljsd.jieling.handler.map.MapManager; import com.ljsd.jieling.handler.map.MapManager;
import com.ljsd.jieling.ktbeans.ReportEventEnum;
import com.ljsd.jieling.ktbeans.ReportUtil;
import com.ljsd.jieling.logic.GlobalDataManaager; import com.ljsd.jieling.logic.GlobalDataManaager;
import com.ljsd.jieling.logic.activity.ActivityLogic; import com.ljsd.jieling.logic.activity.ActivityLogic;
import com.ljsd.jieling.logic.activity.event.Poster; import com.ljsd.jieling.logic.activity.event.Poster;
@ -177,6 +179,7 @@ public class GetPlayerInfoHandler extends BaseHandler{
.addAllDailyChallengeInfo(playerInfoManager.getDailyPass()) .addAllDailyChallengeInfo(playerInfoManager.getDailyPass())
.setExpeditionLeve(user.getExpeditionManager().getExpeditionLeve()) .setExpeditionLeve(user.getExpeditionManager().getExpeditionLeve())
.build(); .build();
ReportUtil.onReportEvent(user, ReportEventEnum.APP_LOGIN.getType());
try { try {
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GET_PLAYERINFO_RESPONSE_VALUE, getPlayerInfoResponse, true); MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GET_PLAYERINFO_RESPONSE_VALUE, getPlayerInfoResponse, true);

View File

@ -6,6 +6,7 @@ import com.ljsd.jieling.exception.ErrorCodeException;
import com.ljsd.jieling.globals.BIReason; import com.ljsd.jieling.globals.BIReason;
import com.ljsd.jieling.handler.BaseHandler; import com.ljsd.jieling.handler.BaseHandler;
import com.ljsd.jieling.logic.dao.Equip; import com.ljsd.jieling.logic.dao.Equip;
import com.ljsd.jieling.logic.dao.Item;
import com.ljsd.jieling.logic.dao.UserManager; import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.root.User; import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.hero.HeroLogic; import com.ljsd.jieling.logic.hero.HeroLogic;
@ -58,8 +59,6 @@ public class ComplexEquipHandler extends BaseHandler<HeroInfoProto.ComplexEquipR
if (equipId == 0) { if (equipId == 0) {
throw new ErrorCodeException(ErrorCode.CFG_NULL); throw new ErrorCodeException(ErrorCode.CFG_NULL);
} }
Set<String> equipByIDs = ItemLogic.getEquipByID(user, equipId);
SEquipStarsConfig sEquipStarsConfig = STableManager.getConfig(SEquipStarsConfig.class).get(needStar); SEquipStarsConfig sEquipStarsConfig = STableManager.getConfig(SEquipStarsConfig.class).get(needStar);
if (null == sEquipStarsConfig) { if (null == sEquipStarsConfig) {
throw new ErrorCodeException(ErrorCode.CFG_NULL); throw new ErrorCodeException(ErrorCode.CFG_NULL);
@ -68,58 +67,43 @@ public class ComplexEquipHandler extends BaseHandler<HeroInfoProto.ComplexEquipR
if (null == sTargetEquipStarsConfig) { if (null == sTargetEquipStarsConfig) {
throw new ErrorCodeException(ErrorCode.CFG_NULL); throw new ErrorCodeException(ErrorCode.CFG_NULL);
} }
int needcount = sEquipStarsConfig.getRankupCount(); int needCount = sEquipStarsConfig.getRankupCount();
if (equipByIDs.size() / needcount < proto.getNum()) { // //check cost
//数据不够
throw new ErrorCodeException(ErrorCode.UNKNOWN);
}
//check cost
Map<Integer, Integer> consumeMap = new HashMap<>(); Map<Integer, Integer> consumeMap = new HashMap<>();
for (int i = 0; i < proto.getNum(); i++) { int[][] sumConsume = sEquipStarsConfig.getRankupResources();
int[][] sumConsume = sTargetEquipStarsConfig.getRankupResources(); for(int[] consumeArray:sumConsume){
HeroLogic.getInstance().combinedAttribute(sumConsume, consumeMap); consumeMap.put(consumeArray[0],consumeArray[1]*proto.getNum());
} }
consumeMap.put(equipId,needCount*proto.getNum());
boolean enough = ItemUtil.itemCost(user, consumeMap, BIReason.COMPLEX_EQUIP_CONSUME, 0); boolean enough = ItemUtil.itemCost(user, consumeMap, BIReason.COMPLEX_EQUIP_CONSUME, 0);
if (!enough) { if (!enough) {
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH); throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
} }
//
//drop // //drop
int[][] dropItems = new int[1][]; int[][] dropItems = new int[1][];
dropItems[0] = new int[2]; dropItems[0] = new int[2];
dropItems[0][0] = targetEquip; dropItems[0][0] = targetEquip;
dropItems[0][1] = proto.getNum(); dropItems[0][1] = proto.getNum();
CommonProto.Drop.Builder drop = ItemUtil.drop(user, dropItems, BIReason.COMPLEX_EQUIP); CommonProto.Drop.Builder drop = ItemUtil.drop(user, dropItems, BIReason.COMPLEX_EQUIP);
HeroInfoProto.ComplexEquipResponse.Builder response = HeroInfoProto.ComplexEquipResponse.newBuilder(); HeroInfoProto.ComplexEquipResponse.Builder response = HeroInfoProto.ComplexEquipResponse.newBuilder();
//remove hero
int i = 1;
for (String id : equipByIDs) {
if (i > proto.getNum() * needcount) {
break;
}
response.addEquipIds(id);
user.getEquipManager().remove(id);
i++;
}
response.setDrop(drop); response.setDrop(drop);
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.EQUIP_COMPLEX_RESPONSE_VALUE, response.build(), true); MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.EQUIP_COMPLEX_RESPONSE_VALUE, response.build(), true);
} else { } else {
Map<Integer, Map<Integer, Integer>> euipTppes = STableManager.getFigureConfig(ItemStaticConfig.class).getEuipTppes();
Map<Integer, Integer> integerIntegerMap = new TreeMap<>(euipTppes.getOrDefault(proto.getType(), new HashMap<>()));
Set<String> equipadds =new HashSet<>(); Map<Integer, Map<Integer, Integer>> equipComplexConfig = STableManager.getFigureConfig(ItemStaticConfig.class).getEuipTppes();
Map<Integer, Integer> consumeMap = new HashMap<>();
List< CommonProto.Equip> equips = new LinkedList<>(); Map<Integer, Integer> typeComplexMap = new TreeMap<>(equipComplexConfig.getOrDefault(proto.getType(), new HashMap<>()));
Set<String> newids = new HashSet<>();
Map<Integer, Integer> consumeMapTem = new HashMap<>(); Map<Integer,Integer> consumeMap = new HashMap<>();
for (Map.Entry<Integer, Integer> entry : integerIntegerMap.entrySet()) { Map<Integer,Integer> countMap = new HashMap<>();
for (Map.Entry<Integer, Integer> entry : typeComplexMap.entrySet()) {
//star conf //star conf
int targetstar = entry.getKey()+1; int targetStar = entry.getKey()+1;
SEquipStarsConfig sTargetEquipStarsConfig = STableManager.getConfig(SEquipStarsConfig.class).get(targetstar); SEquipStarsConfig sTargetEquipStarsConfig = STableManager.getConfig(SEquipStarsConfig.class).get(targetStar);
if (null == sTargetEquipStarsConfig) { if (null == sTargetEquipStarsConfig) {
break; break;
} }
@ -128,7 +112,7 @@ public class ComplexEquipHandler extends BaseHandler<HeroInfoProto.ComplexEquipR
throw new ErrorCodeException(ErrorCode.CFG_NULL); throw new ErrorCodeException(ErrorCode.CFG_NULL);
} }
int targetEquipId = STableManager.getFigureConfig(ItemStaticConfig.class).getEquipByStar(proto.getType(), targetstar); int targetEquipId = STableManager.getFigureConfig(ItemStaticConfig.class).getEquipByStar(proto.getType(), targetStar);
if (targetEquipId == 0) { if (targetEquipId == 0) {
break; break;
} }
@ -138,54 +122,67 @@ public class ComplexEquipHandler extends BaseHandler<HeroInfoProto.ComplexEquipR
} }
TreeSet<String> equipByIDs = ItemLogic.getEquipByID(user, equipId); int equipByIDs = ItemLogic.getEquipByID(user, equipId);
int canConNum =equipByIDs.size()/sEquipStarsConfig.getRankupCount(); int canConNum =(countMap.getOrDefault(equipId,0)+equipByIDs)/sEquipStarsConfig.getRankupCount();
if(canConNum<=0){ if(canConNum<=0){
continue; continue;
} }
//check cost //check cost
boolean enough; boolean enough;
int needcount=0; int equipNeedCount=0;
//进行合成
Map<Integer, Integer> consumeMapTem = new HashMap<>();
for (int i = 0; i < canConNum; i++) { for (int i = 0; i < canConNum; i++) {
int[][] sumConsume = sEquipStarsConfig.getRankupResources(); int[][] sumConsume = sEquipStarsConfig.getRankupResources();
HeroLogic.getInstance().combinedAttribute(sumConsume, consumeMapTem); //数组变map
enough = ItemUtil.checkCost(user, consumeMapTem); Map<Integer, Integer> consumeOnce = new HashMap<>();
for(int[] item : sumConsume){
consumeOnce.put(item[0],consumeMapTem.getOrDefault(item[0],0)+item[1]+consumeMap.getOrDefault(item[0],0));
}
enough = ItemUtil.checkCost(user, consumeOnce);
if (!enough) { if (!enough) {
break; break;
} }
for(int[] consume:sumConsume){
//生成装备 混合消耗 consumeMapTem.put(consume[0],consumeMapTem.getOrDefault(consume[0],0)+consume[1]);
Equip equip = new Equip(user.getId(),targetEquipId); }
user.getEquipManager().addEquip(user,equip); countMap.put(targetEquipId,countMap.getOrDefault(targetEquipId,0)+1);
newids.add(equip.getId());//后面合成可能会被删除 equipNeedCount += sEquipStarsConfig.getRankupCount();
// HeroLogic.getInstance().combinedAttribute(sumConsume, consumeMap);
needcount += sEquipStarsConfig.getRankupCount();
HeroLogic.getInstance().combinedAttribute(sumConsume, consumeMap);
} }
//消耗装备 //消耗装备
int i = 1; int needEquipMax = countMap.getOrDefault(equipId,0)+equipByIDs;
for (String id : equipByIDs.descendingSet()) { if(equipNeedCount>needEquipMax){
if (i > needcount) { throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
break; }else if(equipNeedCount<=countMap.getOrDefault(equipId,0)){
int less = countMap.getOrDefault(equipId, 0) - equipNeedCount;
if(less==0){
countMap.remove(equipId);
}else{
countMap.put(equipId,less);
} }
if(!newids.contains(id)){ }else{
equipadds.add(id); consumeMapTem.put(equipId,consumeMapTem.getOrDefault(equipId,0)+equipNeedCount-countMap.getOrDefault(equipId,0));
}else { countMap.remove(equipId);
newids.remove(id); }
} for(Map.Entry<Integer, Integer> consumeEntry:consumeMapTem.entrySet()){
user.getEquipManager().remove(id); consumeMap.put(consumeEntry.getKey(),consumeMap.getOrDefault(consumeEntry.getKey(),0)+consumeEntry.getValue());
i++;
} }
} }
for (String id:newids) { int[][] createArray = new int[countMap.size()][];
equips.add(CBean2Proto.getEquipProto( user.getEquipManager().getEquipMap().get(id))); int index = 0 ;
for(Map.Entry<Integer, Integer> createEntry:countMap.entrySet()){
createArray[index] = new int[]{createEntry.getKey(),createEntry.getValue()};
index++;
} }
ItemUtil.itemCost(user, consumeMap, BIReason.COMPLEX_EQUIP_CONSUME, 0); ItemUtil.itemCost(user, consumeMap, BIReason.COMPLEX_EQUIP_CONSUME, 0);
CommonProto.Drop.Builder drop = CommonProto.Drop.newBuilder().addAllEquipId(equips); CommonProto.Drop.Builder drop = ItemUtil.drop(user,createArray,BIReason.COMPLEX_EQUIP);
HeroInfoProto.ComplexEquipResponse.Builder response = HeroInfoProto.ComplexEquipResponse.newBuilder(); HeroInfoProto.ComplexEquipResponse.Builder response = HeroInfoProto.ComplexEquipResponse.newBuilder();
response.addAllEquipIds(equipadds);
response.setDrop(drop); response.setDrop(drop);
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.EQUIP_COMPLEX_RESPONSE_VALUE, response.build(), true); MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.EQUIP_COMPLEX_RESPONSE_VALUE, response.build(), true);
} }

View File

@ -23,6 +23,8 @@ import com.ljsd.jieling.handler.mission.CheckMissionReturn;
import com.ljsd.jieling.handler.mission.Mission; import com.ljsd.jieling.handler.mission.Mission;
import com.ljsd.jieling.ktbeans.KTGameType; import com.ljsd.jieling.ktbeans.KTGameType;
import com.ljsd.jieling.ktbeans.KtEventUtils; import com.ljsd.jieling.ktbeans.KtEventUtils;
import com.ljsd.jieling.ktbeans.ReportEventEnum;
import com.ljsd.jieling.ktbeans.ReportUtil;
import com.ljsd.jieling.ktbeans.parmsBean.ParamEventBean; import com.ljsd.jieling.ktbeans.parmsBean.ParamEventBean;
import com.ljsd.jieling.logic.GlobalDataManaager; import com.ljsd.jieling.logic.GlobalDataManaager;
import com.ljsd.jieling.logic.OnlineUserManager; import com.ljsd.jieling.logic.OnlineUserManager;
@ -2092,7 +2094,8 @@ public class MapLogic {
} }
SMainLevelConfig sMainLevelConfig = SMainLevelConfig.config.get(fightId); SMainLevelConfig sMainLevelConfig = SMainLevelConfig.config.get(fightId);
KtEventUtils.onKtEvent(user,ParamEventBean.UserGameType,KTGameType.STORY.getIndex(),fightId); // KtEventUtils.onKtEvent(user,ParamEventBean.UserGameType,KTGameType.STORY.getIndex(),fightId);
ReportUtil.onReportEvent(user, ReportEventEnum.ENTER_STAGE.getType(),String.valueOf(fightId));
user.getTeamPosManager().setCurTeamPosId(teamId); user.getTeamPosManager().setCurTeamPosId(teamId);
String fightInfo = fightId + "#" + teamId; String fightInfo = fightId + "#" + teamId;
String key = RedisKey.getKey(RedisKey.LEVE_DIFFICULTY_INFO, String.valueOf(uid), false); String key = RedisKey.getKey(RedisKey.LEVE_DIFFICULTY_INFO, String.valueOf(uid), false);
@ -2143,6 +2146,8 @@ public class MapLogic {
// String rankKey = RedisKey.getKey(RedisKey.MAINLEVEL_RANK, "", false); // String rankKey = RedisKey.getKey(RedisKey.MAINLEVEL_RANK, "", false);
// RedisUtil.getInstence().zsetAddOne(rankKey, String.valueOf(user.getId()), sMainLevelConfig.getVirtureId()); // RedisUtil.getInstence().zsetAddOne(rankKey, String.valueOf(user.getId()), sMainLevelConfig.getVirtureId());
RankContext.getRankEnum(RankEnum.MAIN_LEVEL_RANK.getType()).addRank(uid,"",sMainLevelConfig.getVirtureId(),user.getPlayerInfoManager().getMaxForce()); RankContext.getRankEnum(RankEnum.MAIN_LEVEL_RANK.getType()).addRank(uid,"",sMainLevelConfig.getVirtureId(),user.getPlayerInfoManager().getMaxForce());
ReportUtil.onReportEvent(user, ReportEventEnum.PASS_STAGE.getType(),String.valueOf(fightId),"",sMainLevelConfig.getReward());
} }
@ -3075,18 +3080,23 @@ public class MapLogic {
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE); throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
} }
} }
int[] openRules = sDailyChallengeConfig.getOpenRules(); int[][] openRules = sDailyChallengeConfig.getOpenRules();
boolean open = true; boolean open = true;
switch (openRules[0]){ for(int[] rule:openRules){
case 1: switch (rule[0]){
open = playerInfoManager.getLevel()>=openRules[1]; case 1:
break; open = playerInfoManager.getLevel()>=rule[1];
case 2: break;
open = SMainLevelConfig.biggerThanFight(user.getMainLevelManager().getFightId(),openRules[1]); case 2:
break; open = SMainLevelConfig.biggerThanFight(user.getMainLevelManager().getFightId(),rule[1]);
} break;
if(!open){ case 3:
throw new ErrorCodeException(ErrorCode.DAILY_NO_OPEN); open = playerInfoManager.getMaxForce()>=rule[1];
break;
}
if(!open){
throw new ErrorCodeException(ErrorCode.DAILY_NO_OPEN);
}
} }
@ -3169,20 +3179,20 @@ public class MapLogic {
User user = UserManager.getUser(session.getUid()); User user = UserManager.getUser(session.getUid());
MapManager mapManager = user.getMapManager(); MapManager mapManager = user.getMapManager();
AbstractMap map = getMap(user); AbstractMap map = getMap(user);
CommonProto.Drop.Builder drop = null;
//是否在试炼副本中 //是否在试炼副本中
MapInfoProto.GetTrialBoxRewardResponse.Builder response = null;
if(map instanceof TowerMap){ if(map instanceof TowerMap){
int curXY = mapManager.getCurXY(); int curXY = mapManager.getCurXY();
int floor = mapManager.getTrialInfo().getFloor(); int floor = mapManager.getTrialInfo().getFloor();
TreeMap<Integer, STrialConfig> sTrialConfigMap = (TreeMap<Integer,STrialConfig>)STrialConfig.sTrialConfigMap; TreeMap<Integer, STrialConfig> sTrialConfigMap = (TreeMap<Integer,STrialConfig>)STrialConfig.sTrialConfigMap;
STrialConfig sTrialConfig = sTrialConfigMap.ceilingEntry(floor).getValue(); STrialConfig sTrialConfig = sTrialConfigMap.ceilingEntry(floor).getValue();
drop = getBoxReward(sTrialConfig.getBoxPosition(),sTrialConfig.getBoxReward(),user,curXY,type); response = getBoxReward(sTrialConfig.getBoxPosition(),sTrialConfig.getBoxReward(),user,curXY,type);
} }
if(drop==null){ if(response==null){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE); throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
} }
MapInfoProto.GetTrialBoxRewardResponse response = MapInfoProto.GetTrialBoxRewardResponse.newBuilder().setBoxDrop(drop).build(); MessageUtil.sendMessage(session,1,messageType.getNumber(),response.build(),true);
MessageUtil.sendMessage(session,1,messageType.getNumber(),response,true);
} }
/** /**
@ -3194,25 +3204,49 @@ public class MapLogic {
* @return * @return
* @throws Exception * @throws Exception
*/ */
private CommonProto.Drop.Builder getBoxReward(int[][] boxPosition,int[][][] boxReward,User user,int curXY,int type) throws Exception { private MapInfoProto.GetTrialBoxRewardResponse.Builder getBoxReward(int[][] boxPosition,int[][][] boxReward,User user,int curXY,int type) throws Exception {
MapManager mapManager = user.getMapManager(); MapManager mapManager = user.getMapManager();
MapInfoProto.GetTrialBoxRewardResponse.Builder response= MapInfoProto.GetTrialBoxRewardResponse.newBuilder();
CommonProto.Drop.Builder drop= null; CommonProto.Drop.Builder drop= null;
Map<Integer, Cell> mapInfo = mapManager.getMapInfo();
if(type==1){ if(type==1){
List<int[][]> reward = Arrays.asList(boxReward); List<int[][]> reward = Arrays.asList(boxReward);
drop = ItemUtil.drop(user,reward,BIReason.MAP_EVENET_REWARD); drop = ItemUtil.drop(user,reward,BIReason.MAP_EVENET_REWARD);
for(int[] position:boxPosition){ for(int[] position:boxPosition){
int xyPos = CellUtil.xy2Pos(position[0], position[1]); int xyPos = CellUtil.xy2Pos(position[0], position[1]);
Cell cell = mapManager.getMapInfo().get(xyPos); Cell cell = mapInfo.get(xyPos);
if(cell!=null&&cell.getPointId()==STrialSetting.sTrialSetting.getBoxPointId()) { if(cell!=null&&cell.getPointId()==STrialSetting.sTrialSetting.getBoxPointId()) {
cell.setPointId(0); cell.setPointId(0);
mapManager.addOrUpdateCell(cell.getCellId(), cell); mapManager.addOrUpdateCell(cell.getCellId(), cell);
} }
} }
List<Cell> deleteCell = new ArrayList<>();
//判断添加buff
for(Cell cell:mapInfo.values()){
if(MapPointConfig.getScMapEventMap().get(cell.getPointId()).getStyle()!=9){//9为地图点buff类型
continue;
}
int optionId = STableManager.getConfig(SEventPointConfig.class).get(cell.getEventId()).getOption()[0];
SOptionConfig sOptionConfig = SOptionConfig.sOptionConfigMap.get(optionId);
List<Integer> buffIds = mapManager.getTrialInfo().getBuffIds();
for(int[] values:sOptionConfig.getBehaviorTypeValues()){
for(int value:values){
buffIds.add(value);
}
}
deleteCell.add(cell);
mapManager.updateTrialBuffIds(buffIds);
response.addBuffIds(sOptionConfig.getBehaviorTypeValues()[0][0]);
}
for(Cell cell:deleteCell){
BehaviorUtil.destoryApointXY(user,cell.getCellId());
}
}else{ }else{
for(int i = 0 ; i<boxPosition.length;i++){ for(int i = 0 ; i<boxPosition.length;i++){
int xyPos = CellUtil.xy2Pos(boxPosition[i][0], boxPosition[i][1]); int xyPos = CellUtil.xy2Pos(boxPosition[i][0], boxPosition[i][1]);
Cell cell = mapManager.getMapInfo().get(xyPos); Cell cell = mapInfo.get(xyPos);
if(xyPos==curXY){ if(xyPos==curXY){
if(cell!=null&&cell.getPointId()==STrialSetting.sTrialSetting.getBoxPointId()) { if(cell!=null&&cell.getPointId()==STrialSetting.sTrialSetting.getBoxPointId()) {
cell.setPointId(0); cell.setPointId(0);
@ -3226,7 +3260,8 @@ public class MapLogic {
} }
} }
} }
return drop; response.setBoxDrop(drop);
return response;
} }
public void getMiniGameEvent(ISession session, MessageTypeProto.MessageType messageType) throws Exception { public void getMiniGameEvent(ISession session, MessageTypeProto.MessageType messageType) throws Exception {

View File

@ -59,7 +59,7 @@ public class BombGame extends ColorGame {
public MapInfoProto.MapGameUpdateResponse updateGame(User user, Object... params) throws Exception { public MapInfoProto.MapGameUpdateResponse updateGame(User user, Object... params) throws Exception {
MapGameInfo mapGameInfo = user.getMapManager().getTrialInfo().getMapGameInfo(); MapGameInfo mapGameInfo = user.getMapManager().getTrialInfo().getMapGameInfo();
if(mapGameInfo==null){ if(mapGameInfo==null){
return null; throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
} }
Set<Integer> operationInfo = mapGameInfo.getOperationInfo(); Set<Integer> operationInfo = mapGameInfo.getOperationInfo();
if(operationInfo.size()==3){ if(operationInfo.size()==3){
@ -74,7 +74,7 @@ public class BombGame extends ColorGame {
CommonProto.Drop.Builder drop = null; CommonProto.Drop.Builder drop = null;
//是否抽到炸弹 //是否已经抽取过该位置
if(operationInfo.contains((int)params[0]-1)){ if(operationInfo.contains((int)params[0]-1)){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE); throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
} }
@ -88,11 +88,11 @@ public class BombGame extends ColorGame {
}else{ }else{
user.getMapManager().updateMapGameInfo(null); user.getMapManager().updateMapGameInfo(null);
} }
MapInfoProto.MapGameUpdateResponse response = MapInfoProto.MapGameUpdateResponse.newBuilder().setDrop(drop) MapInfoProto.MapGameUpdateResponse.Builder response = MapInfoProto.MapGameUpdateResponse.newBuilder().setGameStatus(gameStatus).setResultId(resultId);
.setGameStatus(gameStatus) if(drop!=null){
.setResultId(resultId).build(); response.setDrop(drop);
}
return response; return response.build();
} }
//乱序数组 //乱序数组
private int [] shuffle(int [] arr) { private int [] shuffle(int [] arr) {

View File

@ -31,7 +31,7 @@ public abstract class ColorGame implements MapGame {
if(configs==null||configs.isEmpty()){ if(configs==null||configs.isEmpty()){
return new ArrayList<>(); return new ArrayList<>();
} }
List<STrialGameConfig> collect = configs.stream().filter(config -> config.getUnlockLv() < level).collect(Collectors.toList()); List<STrialGameConfig> collect = configs.stream().filter(config -> config.getUnlockLv() <= level).collect(Collectors.toList());
return collect; return collect;
} }
} }

View File

@ -19,9 +19,9 @@ public class Cmd_fixequip extends GmAbstract{
user.getEquipManager().getEquipMap().values().forEach(equip -> equip.setHeroId("")); user.getEquipManager().getEquipMap().values().forEach(equip -> equip.setHeroId(""));
Map<String, PropertyItem> equipMap = user.getEquipManager().getEquipMap(); Map<String, PropertyItem> equipMap = user.getEquipManager().getEquipMap();
user.getHeroManager().getHeroMap().values().forEach(hero -> { user.getHeroManager().getHeroMap().values().forEach(hero -> {
Map<Integer, String> equipByPositionMap = hero.getEquipByPositionMap(); Map<Integer, Integer> equipByPositionMap = hero.getEquipByPositionMap();
Set<Integer> removeHeroEquip = new HashSet<>(); Set<Integer> removeHeroEquip = new HashSet<>();
for(Map.Entry<Integer,String> item : equipByPositionMap.entrySet()){ for(Map.Entry<Integer,Integer> item : equipByPositionMap.entrySet()){
if(!equipMap.containsKey(item.getValue())){ if(!equipMap.containsKey(item.getValue())){
removeHeroEquip.add(item.getKey()); removeHeroEquip.add(item.getKey());
} }

View File

@ -0,0 +1,14 @@
package com.ljsd.jieling.ktbeans;
import java.util.Map;
/**
* @author lvxinran
* @date 2020/7/7
* @discribe
*/
public interface IReportEvent {
Map<String,Object> getEventProperties(ReportEventEnum eventEnum,Object... param);
}

View File

@ -0,0 +1,100 @@
package com.ljsd.jieling.ktbeans;
import com.ljsd.jieling.ktbeans.reportEvent.CommonEventHandler;
import java.util.HashMap;
import java.util.Map;
/**
* @author lvxinran
* @date 2020/7/7
* @discribe
*/
public enum ReportEventEnum {
CREATE_ACCOUNT(1,"create_account", new CommonEventHandler(),new String[]{""}),
APP_LOGIN(2,"app_login", new CommonEventHandler(),new String[]{""}),
CREATE_ROLE(3,"create_role ", new CommonEventHandler(),new String[]{"role_name"}),
GUILD(4,"guild", new CommonEventHandler(),new String[]{"step_id","step_name","rewards_list","guild_start_time"}),
LEVEL_UP(5,"level_up", new CommonEventHandler(),new String[]{"promotion_level","improved_level"}),
MISSION_START(6,"mission_start", new CommonEventHandler(),new String[]{"mission_id","mission_name"}),
MISSION_COMPLETE(7,"mission_complete", new CommonEventHandler(),new String[]{"mission_id","mission_name","reward_list","mission_start_time"}),
JOIN_ACTIVITY(8,"join_activity", new CommonEventHandler(),new String[]{"activity_id","activity_name"}),
COMPLETE_ACTIVITY(9,"complete_activity", new CommonEventHandler(),new String[]{"activity_id","activity_name","reward_list"}),
ENTER_STAGE(10,"enter_stage", new CommonEventHandler(),new String[]{"stage_id","stage_name"}),
PASS_STAGE(11,"pass_stage", new CommonEventHandler(),new String[]{"stage_id","stage_name"}),
GET_HERO(12,"get_hero", new CommonEventHandler(),new String[]{"hero_id","quality","get_type"}),
HERO_STRENGTHEN(13,"hero_strengthen", new CommonEventHandler(),new String[]{"hero_id","old_quality","new_quality","strengthen_type","cost_item_list"}),
GET_EQUIP(14,"get_equip", new CommonEventHandler(),new String[]{"equip_id","quality","get_type"}),
EQUIP_STRENGTHEN(15,"equip_strengthen", new CommonEventHandler(),new String[]{"equip_id","old_quality","new_quality","strengthen_type","cost_item_list"}),
GET_ITEM(16,"get_item", new CommonEventHandler(),new String[]{"get_amount","get_entrance","item_id","item_name","price"}),
COST_ITEM(17,"cost_item", new CommonEventHandler(),new String[]{"cost_amount","cost_entrance","item_id","item_name"}),
GET_COINS(18,"get_coins", new CommonEventHandler(),new String[]{"get_amount","get_entrance","price"}),
COST_COINS(19,"cost_coins", new CommonEventHandler(),new String[]{"cost_amount","cost_entrance"}),
GET_AMULET(20,"get_amulet", new CommonEventHandler(),new String[]{"get_amount","get_entrance","price"}),
COST_AMULET(21,"cost_amulet", new CommonEventHandler(),new String[]{"cost_amount","cost_entrance"}),
GET_DIAMOND(22,"get_diamond", new CommonEventHandler(),new String[]{"get_amount","get_entrance","price"}),
COST_DIAMOND(23,"cost_diamond", new CommonEventHandler(),new String[]{"cost_amount","cost_entrance"}),
CREATE_GUILD(24,"create_guild", new CommonEventHandler(),new String[]{"guild_id","guild_name","guild_level","guild_people_num","guild_fighting_capacity"}),
JOIN_GUILD(25,"join_guild", new CommonEventHandler(),new String[]{"guild_id","guild_name","guild_level","guild_people_num","guild_fighting_capacity","guild_create_time"}),
QUIT_GUILD(26,"quit_guild", new CommonEventHandler(),new String[]{"guild_id","guild_name","guild_level","guild_people_num","guild_fighting_capacity","guild_create_time"}),
CREATE_ORDER(27,"create_order", new CommonEventHandler(),new String[]{"order_id","order_money_amount","Bundle_id","entrance","item_id","item_name","goods_id","item_list"}),
ORDER_COMPLETE(28,"order_complete", new CommonEventHandler(),new String[]{"order_id","order_money_amount","Bundle_id","entrance","item_id","item_name","goods_id","item_list"}),
CHECK_RANKING(29,"check_ranking", new CommonEventHandler(),new String[]{"ranking_type"}),
ASK_FOR_BEING_FRIENDS(30,"ask_for_being_friends", new CommonEventHandler(),new String[]{"target_id","target_name","target_level","entrance"}),
ALLOW_FRIENDS_ASK(31,"allow_friends_ask", new CommonEventHandler(),new String[]{"target_id","target_name","target_level","entrance"}),
SEND_MESSAGE(32,"send_message", new CommonEventHandler(),new String[]{"message_type","message_content"}),
OPEN_MAIL(33,"open_mail", new CommonEventHandler(),new String[]{""});
private int type;
private String eventName;
private IReportEvent eventHandler;
private String[] param;
ReportEventEnum(int type, String eventName, IReportEvent eventHandler,String[] param){
this.type = type;
this.eventName = eventName;
this.eventHandler = eventHandler;
this.param = param;
}
private static Map<Integer,ReportEventEnum> enumMap = new HashMap<>();
public static ReportEventEnum getReport(int type) {
if(enumMap.get(type)!=null){
return enumMap.get(type);
}
ReportEventEnum[] values = ReportEventEnum.values();
ReportEventEnum targetEnum = null;
for(ReportEventEnum value:values){
if(value.getType()!=type){
continue;
}
targetEnum = value;
}
if(targetEnum==null){
return null;
}
enumMap.put(type,targetEnum);
return targetEnum;
}
public int getType() {
return type;
}
public String getEventName() {
return eventName;
}
public IReportEvent getEventHandler() {
return eventHandler;
}
public String[] getParam() {
return param;
}
}

View File

@ -0,0 +1,84 @@
package com.ljsd.jieling.ktbeans;
import java.util.HashMap;
import java.util.Map;
/**
* @author lvxinran
* @date 2020/7/7
* @discribe
*/
public class ReportUserEvent {
protected Map<String, Object> baseInfo = new HashMap<>();
protected Map<String, Object> eventInfo = new HashMap<>();
protected String eventName = "";
public ReportUserEvent setAccount_id(String accountId){
baseInfo.put("#account_id",accountId);
return this;
}
public ReportUserEvent setServer_id(String server_id){
baseInfo.put("server_id",server_id);
return this;
}
public ReportUserEvent setAccount(String account){
baseInfo.put("account",account);
return this;
}
public ReportUserEvent setRole_id(String role_id){
baseInfo.put("role_id",role_id);
return this;
}
public ReportUserEvent setRole_name(String role_name){
baseInfo.put("role_name",role_name);
return this;
}
public ReportUserEvent setGuild_name(String guild_name){
baseInfo.put("guild_name",guild_name);
return this;
}
public ReportUserEvent setGuild_id(String guild_id){
baseInfo.put("guild_id",guild_id);
return this;
}
public ReportUserEvent setGuild_level(int guild_level){
baseInfo.put("guild_level",guild_level);
return this;
}
public ReportUserEvent setVip_level(int vip_level){
baseInfo.put("vip_level",vip_level);
return this;
}public ReportUserEvent setCoins_amount(int coins_amount){
baseInfo.put("coins_amount",coins_amount);
return this;
}
public ReportUserEvent setDiamond_amount(int diamond_amount){
baseInfo.put("diamond_amount",diamond_amount);
return this;
}
public ReportUserEvent setFighting_capacity(int fighting_capacity){
baseInfo.put("fighting_capacity",fighting_capacity);
return this;
}
public Map<String, Object> getBaseInfo() {
return baseInfo;
}
public String getEventName() {
return eventName;
}
public Map<String, Object> getEventInfo() {
return eventInfo;
}
public void setEventInfo(Map<String, Object> eventInfo) {
this.eventInfo = eventInfo;
}
public void setEventName(String eventName) {
this.eventName = eventName;
}
}

View File

@ -0,0 +1,84 @@
package com.ljsd.jieling.ktbeans;
import cn.thinkingdata.tga.javasdk.ThinkingDataAnalytics;
import com.ljsd.GameApplication;
import com.ljsd.jieling.exception.ErrorCode;
import com.ljsd.jieling.exception.ErrorCodeException;
import com.ljsd.jieling.logic.dao.GuilidManager;
import com.ljsd.jieling.logic.dao.Item;
import com.ljsd.jieling.logic.dao.root.GuildInfo;
import com.ljsd.jieling.logic.dao.root.User;
import java.util.Map;
/**
* @author lvxinran
* @date 2020/7/7
* @discribe
*/
public class ReportUtil {
private static final String LOG_PATH = "";
private static ThinkingDataAnalytics ta = new ThinkingDataAnalytics(new ThinkingDataAnalytics.LoggerConsumer(LOG_PATH));
private static final int COIN_ID = 14;
private static final int DIAMOND_ID = 16;
//对外接口只有一个
public static void onReportEvent(User user,int type,Object... param) throws Exception {
ReportUserEvent reportUserEvent = userToReportBean(user);
//根据事件类型获取对应处理
ReportEventEnum report = ReportEventEnum.getReport(type);
if(report==null){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
//设置事件属性
Map<String, Object> eventProperties = report.getEventHandler().getEventProperties(report,param);
reportUserEvent.setEventInfo(eventProperties);
//设置事件名称
reportUserEvent.setEventName(report.getEventName());
//执行
doReport(reportUserEvent);
}
private static ReportUserEvent userToReportBean(User user){
ReportUserEvent reportUserEvent = new ReportUserEvent();
setBaseData(user,reportUserEvent);
return reportUserEvent;
}
private static void setBaseData(User user ,ReportUserEvent reportUserEvent){
int guildId = user.getPlayerInfoManager().getGuildId();
GuildInfo guildInfo = null;
if(guildId!=0){
guildInfo = GuilidManager.guildInfoMap.get(guildId);
}
Item coin = user.getItemManager().getItem(COIN_ID);
Item diamond = user.getItemManager().getItem(DIAMOND_ID);
reportUserEvent.setAccount_id(user.getPlayerInfoManager().getOpenId())
.setServer_id(String.valueOf(GameApplication.serverId))
.setAccount(user.getPlayerInfoManager().getOpenId())
.setRole_id(String.valueOf(user.getId()))
.setRole_name(user.getPlayerInfoManager().getNickName())
.setGuild_id(String.valueOf(guildId))
.setGuild_name(guildInfo==null?"":guildInfo.getName())
.setGuild_level(guildInfo==null?0:guildInfo.getLevel())
.setVip_level(user.getPlayerInfoManager().getVipLevel())
.setCoins_amount(coin==null?0:coin.getItemNum())
.setDiamond_amount(diamond==null?0:diamond.getItemNum())
.setFighting_capacity(user.getPlayerInfoManager().getMaxForce());
}
private static void doReport(ReportUserEvent reportUserEvent){
try {
//todo 访客id
ta.setSuperProperties(reportUserEvent.getBaseInfo());
ta.track("1000001","1000001",reportUserEvent.getEventName(),reportUserEvent.getEventInfo());
ta.flush();
} catch (Exception e) {
//异常处理
System.out.println("except:"+e);
}
}
}

View File

@ -44,8 +44,8 @@ public class ParamEventBean {
public ParamEventBean() { public ParamEventBean() {
} }
public ParamEventBean(int eveentType){ public ParamEventBean(int eventType){
add(eventTypeStringMap.get(eveentType)); add(eventTypeStringMap.get(eventType));
} }
public List<String> getEvent_s() { public List<String> getEvent_s() {

View File

@ -0,0 +1,28 @@
package com.ljsd.jieling.ktbeans.reportEvent;
import com.ljsd.jieling.ktbeans.IReportEvent;
import com.ljsd.jieling.ktbeans.ReportEventEnum;
import java.util.HashMap;
import java.util.Map;
/**
* @author lvxinran
* @date 2020/7/7
* @discribe
*/
public class CommonEventHandler implements IReportEvent {
@Override
public Map<String, Object> getEventProperties(ReportEventEnum eventEnum, Object... param) {
Map<String, Object> resultMap = new HashMap<>();
if(param.length<1){
return null;
}
String[] paramName= eventEnum.getParam();
int length = Math.min(paramName.length,param.length);
for(int i = 0 ; i <length;i++){
resultMap.put(paramName[i],param[i]);
}
return resultMap;
}
}

View File

@ -6,6 +6,8 @@ import com.ljsd.jieling.globals.BIReason;
import com.ljsd.jieling.globals.Global; import com.ljsd.jieling.globals.Global;
import com.ljsd.jieling.jbean.*; import com.ljsd.jieling.jbean.*;
import com.ljsd.jieling.ktbeans.KtEventUtils; import com.ljsd.jieling.ktbeans.KtEventUtils;
import com.ljsd.jieling.ktbeans.ReportEventEnum;
import com.ljsd.jieling.ktbeans.ReportUtil;
import com.ljsd.jieling.ktbeans.parmsBean.ParamEventBean; import com.ljsd.jieling.ktbeans.parmsBean.ParamEventBean;
import com.ljsd.jieling.logic.OnlineUserManager; import com.ljsd.jieling.logic.OnlineUserManager;
import com.ljsd.jieling.logic.activity.event.ActivityStateChangeEvent; import com.ljsd.jieling.logic.activity.event.ActivityStateChangeEvent;
@ -161,7 +163,8 @@ public abstract class AbstractActivity implements IActivity, IEventHandler {
sendActivityProgress(session, activityMission, Collections.singleton(missionId)); sendActivityProgress(session, activityMission, Collections.singleton(missionId));
} }
} }
KtEventUtils.onKtEvent(user, ParamEventBean.UserActivityEvent, id, missionId); // KtEventUtils.onKtEvent(user, ParamEventBean.UserActivityEvent, id, missionId);
ReportUtil.onReportEvent(user, ReportEventEnum.COMPLETE_ACTIVITY.getType(),String.valueOf(id),String.valueOf(missionId),reward);
PlayerInfoProto.TakeActivityRewardResponse build = PlayerInfoProto.TakeActivityRewardResponse.newBuilder().setDrop(drop).build(); PlayerInfoProto.TakeActivityRewardResponse build = PlayerInfoProto.TakeActivityRewardResponse.newBuilder().setDrop(drop).build();
MessageUtil.sendMessage(session, 1, rewardResponseValue, build, true); MessageUtil.sendMessage(session, 1, rewardResponseValue, build, true);
return true; return true;

View File

@ -13,6 +13,8 @@ import com.ljsd.jieling.jbean.ActivityManager;
import com.ljsd.jieling.jbean.ActivityMission; import com.ljsd.jieling.jbean.ActivityMission;
import com.ljsd.jieling.jbean.ActivityProgressInfo; import com.ljsd.jieling.jbean.ActivityProgressInfo;
import com.ljsd.jieling.jbean.LuckWheelMission; import com.ljsd.jieling.jbean.LuckWheelMission;
import com.ljsd.jieling.ktbeans.ReportEventEnum;
import com.ljsd.jieling.ktbeans.ReportUtil;
import com.ljsd.jieling.logic.OnlineUserManager; import com.ljsd.jieling.logic.OnlineUserManager;
import com.ljsd.jieling.logic.activity.event.*; import com.ljsd.jieling.logic.activity.event.*;
import com.ljsd.jieling.logic.dao.*; import com.ljsd.jieling.logic.dao.*;
@ -320,6 +322,7 @@ public class ActivityLogic implements IEventHandler{
} }
abstractActivity.initActivity(user); abstractActivity.initActivity(user);
ReportUtil.onReportEvent(user, ReportEventEnum.JOIN_ACTIVITY.getType(),String.valueOf(openActivityId));
int activityOpenState = getActivityOpenState(user, openActivityId); int activityOpenState = getActivityOpenState(user, openActivityId);
abstractActivity.setOpenState(user,activityOpenState); abstractActivity.setOpenState(user,activityOpenState);
if(activityOpenState == ActivityType.UNOPEN_STATE){ if(activityOpenState == ActivityType.UNOPEN_STATE){
@ -362,6 +365,7 @@ public class ActivityLogic implements IEventHandler{
if (null==abstractActivity) { if (null==abstractActivity) {
continue; continue;
} }
ReportUtil.onReportEvent(user, ReportEventEnum.JOIN_ACTIVITY.getType(),String.valueOf(activityId));
abstractActivity.initActivity(user); abstractActivity.initActivity(user);
// if(!initOtherActivity(user, sGlobalActivity)){ // if(!initOtherActivity(user, sGlobalActivity)){
initAllActivityMission(activityManager.getActivityMissionMap(),activityId); initAllActivityMission(activityManager.getActivityMissionMap(),activityId);

View File

@ -9,6 +9,7 @@ import com.ljsd.jieling.jbean.ActivityProgressInfo;
import com.ljsd.jieling.logic.activity.event.IEvent; import com.ljsd.jieling.logic.activity.event.IEvent;
import com.ljsd.jieling.logic.activity.event.Poster; import com.ljsd.jieling.logic.activity.event.Poster;
import com.ljsd.jieling.logic.activity.event.RandomCardEvent; import com.ljsd.jieling.logic.activity.event.RandomCardEvent;
import com.ljsd.jieling.logic.activity.event.RandomMustCardEvent;
import com.ljsd.jieling.logic.dao.UserManager; import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.root.User; import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.mail.MailLogic; import com.ljsd.jieling.logic.mail.MailLogic;
@ -18,6 +19,7 @@ import com.ljsd.jieling.logic.rank.rankImpl.AbstractRank;
import com.ljsd.jieling.network.session.ISession; import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.util.ItemUtil; import com.ljsd.jieling.util.ItemUtil;
import config.*; import config.*;
import manager.STableManager;
import org.springframework.data.redis.core.ZSetOperations; import org.springframework.data.redis.core.ZSetOperations;
import util.TimeUtils; import util.TimeUtils;
@ -38,6 +40,7 @@ public class LimitRandomCardActivity extends AbstractActivity {
public LimitRandomCardActivity(int id) { public LimitRandomCardActivity(int id) {
super(id); super(id);
Poster.getPoster().listenEvent(this,RandomCardEvent.class); Poster.getPoster().listenEvent(this,RandomCardEvent.class);
Poster.getPoster().listenEvent(this, RandomMustCardEvent.class);
} }
@Override @Override
@ -47,27 +50,37 @@ public class LimitRandomCardActivity extends AbstractActivity {
@Override @Override
public void onEvent(IEvent event) throws Exception { public void onEvent(IEvent event) throws Exception {
if(! (event instanceof RandomCardEvent) ){ if(event instanceof RandomCardEvent){
return; RandomCardEvent cardEvent =(RandomCardEvent) event;
} if(cardEvent.getType()!=3){
RandomCardEvent cardEvent =(RandomCardEvent) event; return;
if(cardEvent.getType()!=3){ }
return; if(UserManager.getUser(cardEvent.getUid()).getActivityManager().getActivityMissionMap().get(id)==null){
} return;
if(UserManager.getUser(cardEvent.getUid()).getActivityManager().getActivityMissionMap().get(id)==null){ }
return; AbstractRank randomRank= RankContext.getRankEnum(RankEnum.RANDOM_CARD_RANK.getType());
} int scoreById = Double.valueOf(randomRank.getScoreById(((RandomCardEvent) event).getUid(),String.valueOf(id))).intValue();
AbstractRank randomRank= RankContext.getRankEnum(RankEnum.RANDOM_CARD_RANK.getType()); if(scoreById==-1){
int scoreById = Double.valueOf(randomRank.getScoreById(((RandomCardEvent) event).getUid(),String.valueOf(id))).intValue(); scoreById=0;
if(scoreById==-1){ }
scoreById=0; randomRank.addRank(cardEvent.getUid(),String.valueOf(id),scoreById+cardEvent.getScore());
} Predicate<int[]> pre = a-> (SCHero.getHeroByPieceId(a[0])!=null&&SCHero.getHeroByPieceId(a[0]).getNatural()>=13);
randomRank.addRank(cardEvent.getUid(),String.valueOf(id),scoreById+cardEvent.getScore());
Predicate<int[]> pre = a-> (SCHero.getHeroByPieceId(a[0])!=null&&SCHero.getHeroByPieceId(a[0]).getNatural()>=13);
Consumer<int[]> consumer = a->RankContext.getRankEnum(RankEnum.RANDOM_CARD_PERFECT_RANK.getType()).addRank(cardEvent.getUid(),String.valueOf(id), TimeUtils.now()/1000,a[0],a[1]); Consumer<int[]> consumer = a->RankContext.getRankEnum(RankEnum.RANDOM_CARD_PERFECT_RANK.getType()).addRank(cardEvent.getUid(),String.valueOf(id), TimeUtils.now()/1000,a[0],a[1]);
Stream.of(cardEvent.getHeros()).filter(pre).forEach(consumer); Stream.of(cardEvent.getHeros()).filter(pre).forEach(consumer);
update(UserManager.getUser(cardEvent.getUid()),cardEvent.getScore()); update(UserManager.getUser(cardEvent.getUid()),cardEvent.getScore());
}else if(event instanceof RandomMustCardEvent){
RandomMustCardEvent cardEvent =(RandomMustCardEvent) event;
Map<Integer, SLotterySetting> config = STableManager.getConfig(SLotterySetting.class);
SLotterySetting sLotterySetting = config.get(cardEvent.getType());
int activityId = sLotterySetting.getActivityId();
if(activityId!=id){
return;
}
Map<Integer, ActivityMission> activityMissionMap = UserManager.getUser(cardEvent.getUid()).getActivityManager().getActivityMissionMap();
ActivityMission activityMission = activityMissionMap.get(id);
activityMission.setV(0);
}
} }
@ -135,11 +148,7 @@ public class LimitRandomCardActivity extends AbstractActivity {
@Override @Override
void updateProgressWithUser(User user, ActivityMission activityMission, int count) { void updateProgressWithUser(User user, ActivityMission activityMission, int count) {
//150分赠一次 super.updateProgressWithUser(user, activityMission, count);
// int[] onceArrayValue = SSpecialConfig.getOnceArrayValue(SSpecialConfig.TIME_LIMIT_RECRUITMENT_FREEINTEGRAL);
// if((activityMission.getV()+count)/onceArrayValue[0]-activityMission.getV()/onceArrayValue[0]>0){
// user.getPlayerInfoManager().updateVipPrivilage(onceArrayValue[1],-1);
// }
activityMission.setV(activityMission.getV()+count); activityMission.setV(activityMission.getV()+count);
} }

View File

@ -0,0 +1,32 @@
package com.ljsd.jieling.logic.activity.event;
/**
* @author lvxinran
* @date 2020/7/8
* @discribe
*/
public class RandomMustCardEvent implements IEvent {
private int type;
private int uid;
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public int getUid() {
return uid;
}
public void setUid(int uid) {
this.uid = uid;
}
public RandomMustCardEvent(int type, int uid) {
this.type = type;
this.uid = uid;
}
}

View File

@ -13,6 +13,7 @@ import org.slf4j.LoggerFactory;
import java.util.*; import java.util.*;
@Deprecated
public class Equip extends PropertyItem implements Cloneable{ public class Equip extends PropertyItem implements Cloneable{
private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(Equip.class); private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(Equip.class);

View File

@ -28,7 +28,7 @@ public class Hero extends MongoBase {
private int star; private int star;
private Map<Integer,String> equipByPositionMap; private Map<Integer,Integer> equipByPositionMap;
private Map<Integer,Integer> soulEquipByPositionMap; private Map<Integer,Integer> soulEquipByPositionMap;
@ -60,12 +60,28 @@ public class Hero extends MongoBase {
this.id = KeyGenUtils.produceIdByModule(UUIDEnum.HERO, uid); this.id = KeyGenUtils.produceIdByModule(UUIDEnum.HERO, uid);
this.templateId = heroTid; this.templateId = heroTid;
this.level = initStar; this.level = initStar;
int[] heroStar = SItem.getsItemMap().get(heroTid).getHeroStar(); SCHero hero1 = SCHero.getsCHero().get(heroTid);
this.star =heroStar[1] ; 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.equipByPositionMap = new HashMap<>();
this.soulEquipByPositionMap = hero.soulEquipByPositionMap; this.soulEquipByPositionMap = hero.soulEquipByPositionMap;
this.breakId = hero.breakId; this.breakId = hero.breakId;
this.starBreakId = hero.starBreakId;
this.createTime = (int)(System.currentTimeMillis()/1000); this.createTime = (int)(System.currentTimeMillis()/1000);
this.speed = hero.speed; this.speed = hero.speed;
this.especialEquipLevel = hero.especialEquipLevel; this.especialEquipLevel = hero.especialEquipLevel;
@ -85,10 +101,10 @@ public class Hero extends MongoBase {
this.especialEquipLevel = 1; this.especialEquipLevel = 1;
if(initStar!=scHero.getStar()){ if(initStar!=scHero.getStar()){
Map<Integer, SCHeroRankUpConfig> scHeroRankUpConfigByType = STableManager.getFigureConfig(HeroStaticConfig.class).getScHeroRankUpConfigByShow(GlobalsDef.UP_STAR_TYPE,scHero.getStar()); Map<Integer, SCHeroRankUpConfig> scHeroRankUpConfigByType = STableManager.getFigureConfig(HeroStaticConfig.class).getScHeroRankUpConfigByShow(GlobalsDef.UP_STAR_TYPE,scHero.getStar());
if(scHeroRankUpConfigByType!=null) { if(scHeroRankUpConfigByType!=null) {
SCHeroRankUpConfig scHeroRankUpConfig = scHeroRankUpConfigByType.get(initStar-1); SCHeroRankUpConfig scHeroRankUpConfig = scHeroRankUpConfigByType.get(initStar-1);
starBreakId = scHeroRankUpConfig.getId(); starBreakId = scHeroRankUpConfig.getId();
} }
} }
createTime = (int)(System.currentTimeMillis()/1000); createTime = (int)(System.currentTimeMillis()/1000);
@ -144,31 +160,31 @@ public class Hero extends MongoBase {
return star; return star;
} }
public Map<Integer, String> getEquipByPositionMap() { public Map<Integer, Integer> getEquipByPositionMap() {
return equipByPositionMap==null?new HashMap<>():equipByPositionMap; return equipByPositionMap==null?new HashMap<>():equipByPositionMap;
} }
public void setEquipByPositionMap(Map<Integer, String> equipByPositionMap) throws Exception { public void setEquipByPositionMap(Map<Integer, Integer> equipByPositionMap) throws Exception {
updateString("equipByPositionMap",equipByPositionMap); updateString("equipByPositionMap",equipByPositionMap);
this.equipByPositionMap = equipByPositionMap; this.equipByPositionMap = equipByPositionMap;
} }
public void updateEquipPositionMap(int position,String equipId) throws Exception { public void updateEquipPositionMap(int position,int equipId) throws Exception {
updateString("equipByPositionMap." + position ,equipId); updateString("equipByPositionMap." + position ,equipId);
this.equipByPositionMap.put(position,equipId); this.equipByPositionMap.put(position,equipId);
} }
public void updateMutliEquipPositionMap(Map<Integer,String> equipByPositionMapTmp) throws Exception { public void updateMutliEquipPositionMap(Map<Integer,Integer> equipByPositionMapTmp) throws Exception {
this.equipByPositionMap.putAll(equipByPositionMapTmp); this.equipByPositionMap.putAll(equipByPositionMapTmp);
updateString("equipByPositionMap" ,equipByPositionMap); updateString("equipByPositionMap" ,equipByPositionMap);
} }
public void removeEquip(int position){ public void removeEquip(int position){
String value = this.equipByPositionMap.get(position); if (!equipByPositionMap.containsKey(position)){
if (value!=null){ return;
removeString(getMongoKey()+".equipByPositionMap." + position);
this.equipByPositionMap.remove(position);
} }
removeString(getMongoKey()+".equipByPositionMap." + position);
this.equipByPositionMap.remove(position);
} }

View File

@ -16,10 +16,10 @@ public class StoreInfo extends MongoBase {
private Map<Integer,Integer> itemNumMap; private Map<Integer,Integer> itemNumMap;
public StoreInfo(int id,long startTime,long endTime,Map<Integer,Integer> itemNumMap ){ public StoreInfo(int id,long lastRefreshTime,long startTime,long endTime,Map<Integer,Integer> itemNumMap ){
// this.setRootCollection(User._COLLECTION_NAME); // this.setRootCollection(User._COLLECTION_NAME);
this.id = id; this.id = id;
this.lastRefreshTime = System.currentTimeMillis(); this.lastRefreshTime = lastRefreshTime;
this.startTime = startTime; this.startTime = startTime;
this.endTime = endTime; this.endTime = endTime;
this.itemNumMap = itemNumMap; this.itemNumMap = itemNumMap;

View File

@ -33,10 +33,9 @@ public class StoreManager extends MongoBase {
} }
} }
public StoreInfo newStoreInfo(int id,long startTime,long endTime,Map<Integer,Integer> itemNumMap) throws Exception { public void newStoreInfo(int id,long lastRefreshTime,long startTime,long endTime,Map<Integer,Integer> itemNumMap) throws Exception {
StoreInfo storeInfo = new StoreInfo(id,startTime,endTime,itemNumMap); StoreInfo storeInfo = new StoreInfo(id,lastRefreshTime,startTime,endTime,itemNumMap);
addStoreInfo(storeInfo); addStoreInfo(storeInfo);
return storeInfo;
} }
} }

View File

@ -6,6 +6,8 @@ import com.ljsd.jieling.core.GlobalsDef;
import com.ljsd.jieling.db.mongo.MongoUtil; import com.ljsd.jieling.db.mongo.MongoUtil;
import com.ljsd.jieling.globals.BIReason; import com.ljsd.jieling.globals.BIReason;
import com.ljsd.jieling.ktbeans.KtEventUtils; import com.ljsd.jieling.ktbeans.KtEventUtils;
import com.ljsd.jieling.ktbeans.ReportEventEnum;
import com.ljsd.jieling.ktbeans.ReportUtil;
import com.ljsd.jieling.ktbeans.parmsBean.ParamEventBean; import com.ljsd.jieling.ktbeans.parmsBean.ParamEventBean;
import com.ljsd.jieling.logic.OnlineUserManager; import com.ljsd.jieling.logic.OnlineUserManager;
import com.ljsd.jieling.logic.activity.ActivityLogic; import com.ljsd.jieling.logic.activity.ActivityLogic;
@ -140,7 +142,8 @@ public class UserManager {
playerManager.setMaxForce(force); playerManager.setMaxForce(force);
user.getExpeditionManager().setExpeditionLeve(1); user.getExpeditionManager().setExpeditionLeve(1);
// user.getExpeditionManager().setForceSnap(force); // user.getExpeditionManager().setForceSnap(force);
KtEventUtils.onKtEvent(user, ParamEventBean.UserRegister); // KtEventUtils.onKtEvent(user, ParamEventBean.UserRegister);
ReportUtil.onReportEvent(user, ReportEventEnum.CREATE_ACCOUNT.getType());
} }

View File

@ -100,7 +100,7 @@ public class ExpeditionLogic {
manager.clearHeroToTemp(); manager.clearHeroToTemp();
manager.getHeroMap().clear(); manager.getHeroMap().clear();
manager.clearEquipToTemp(); manager.clearEquipToTemp();
manager.clearEquip(); // manager.clearEquip();
manager.getEffectItems().clear(); manager.getEffectItems().clear();
manager.setFreshTime((int)(openTimeOfFuntionCacheByType.getStartTime()/1000)); manager.setFreshTime((int)(openTimeOfFuntionCacheByType.getStartTime()/1000));
checkAndResetTreasure(user); checkAndResetTreasure(user);
@ -480,10 +480,10 @@ public class ExpeditionLogic {
} }
int ints = staffsSet.size()+1;//默认品质 int ints = staffsSet.size()+1;//默认品质
try { try {
ints = MathUtils.randomFromWeight(cfg.getHolyProbability()); ints = MathUtils.randomFromWeight(cfg.getHolyProbability());
}catch (Exception e){ }catch (Exception e){
break; break;
// e.printStackTrace(); // e.printStackTrace();
} }
Map<Integer, Integer> type2holy2weight = STableManager.getFigureConfig(CommonStaticConfig.class).getType2holy2weight(ints); Map<Integer, Integer> type2holy2weight = STableManager.getFigureConfig(CommonStaticConfig.class).getType2holy2weight(ints);
int i1 = ranndomFromWeight(type2holy2weight); int i1 = ranndomFromWeight(type2holy2weight);
@ -747,7 +747,7 @@ public class ExpeditionLogic {
} }
SExpeditionHolyConfig orDefault = effectItems.getOrDefault(sExpeditionHolyConfig.geteffect(), null); SExpeditionHolyConfig orDefault = effectItems.getOrDefault(sExpeditionHolyConfig.geteffect(), null);
if(null!=orDefault&&sExpeditionHolyConfig.gettype()<=orDefault.gettype()){ if(null!=orDefault&&sExpeditionHolyConfig.gettype()<=orDefault.gettype()){
continue; continue;
} }
effectItems.put(sExpeditionHolyConfig.geteffect(),sExpeditionHolyConfig); effectItems.put(sExpeditionHolyConfig.geteffect(),sExpeditionHolyConfig);
} }
@ -863,21 +863,18 @@ public class ExpeditionLogic {
//random tempid //random tempid
Hero newHero = new Hero(uid,tempid,finalstar,hero); Hero newHero = new Hero(uid,tempid,finalstar,hero);
EquipManager equipManager = user.getEquipManager(); for (Map.Entry<Integer, Integer> next : hero.getEquipByPositionMap().entrySet()) {
for (Map.Entry<Integer, String> next : hero.getEquipByPositionMap().entrySet()) { int equipId = next.getValue();
String equipId = next.getValue(); // if (equip == null) {
PropertyItem equip = equipManager.getEquipMap().get(equipId); // continue;
if (equip == null) { // }
continue; //// if(isTemp){
} //// user.getExpeditionManager().addEquipToTemp(user, newequip);
Equip newequip = new Equip(uid, equip.getEquipId()); //// }else {
// if(isTemp){ // user.getExpeditionManager().addEquip(user, newequip);
// user.getExpeditionManager().addEquipToTemp(user, newequip); // // }
// }else {
user.getExpeditionManager().addEquip(user, newequip);
// }
newHero.updateEquipPositionMap(next.getKey(), newequip.getId()); newHero.updateEquipPositionMap(next.getKey(), equipId);
} }
@ -889,11 +886,11 @@ public class ExpeditionLogic {
Jewel j = (Jewel) propertyItem; Jewel j = (Jewel) propertyItem;
Jewel newequip = new Jewel(user.getId(), j.getEquipId()); Jewel newequip = new Jewel(user.getId(), j.getEquipId());
// if(isTemp){ // if(isTemp){
// user.getExpeditionManager().addEquipToTemp(user, newequip); // user.getExpeditionManager().addEquipToTemp(user, newequip);
// }else { // }else {
user.getExpeditionManager().addEquip(user, newequip); user.getExpeditionManager().addEquip(user, newequip);
// } // }
newHero.addJewel(newequip.getId()); newHero.addJewel(newequip.getId());
} }
if(isTemp){ if(isTemp){
@ -919,9 +916,30 @@ public class ExpeditionLogic {
//random ids //random ids
TreeSet<Integer> tempid = new TreeSet<>(); TreeSet<Integer> tempid = new TreeSet<>();
Set<Integer> tempType = new HashSet<>();
int i=0;
while (tempid.size()<size){ while (tempid.size()<size){
if(i>1000){
LOGGER.error("getRandomTidException:条件不匹配");
break;
}
int i1 = ranndomFromWeight(cfg); 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); tempid.add(i1);
tempType.add(propertyName);
i++;
} }
return tempid; return tempid;

View File

@ -65,36 +65,42 @@ public class CombatLogic {
public Map<Integer,Integer> bufferOneHeroAttrAfterEat(Map<Integer,Integer> value,int foodId){ public Map<Integer,Integer> bufferOneHeroAttrAfterEat(Map<Integer,Integer> value,int foodId) {
SFoodsConfig sFoodsConfig = STableManager.getConfig(SFoodsConfig.class).get(foodId); List<Integer> foodIds = new ArrayList<>();
if(value.get(HeroAttributeEnum.CurHP.getPropertyId()) == 0 || sFoodsConfig.getContiue()!=0){ foodIds.add(foodId);
return value; return bufferOneHeroAttrAfterEat(value,foodIds);
} }
for(int[] effectPara : sFoodsConfig.getEffectPara()){ public Map<Integer,Integer> bufferOneHeroAttrAfterEat(Map<Integer,Integer> value,List<Integer> foodIds){
int effectId = effectPara[0]; Map<Integer,Integer> effectValueMap = new HashMap<>();
int effectValue = effectPara[1]; for(int foodId:foodIds){
SPropertyConfig sPropertyConfig = SPropertyConfig.getsPropertyConfigByPID(effectId); SFoodsConfig sFoodsConfig = STableManager.getConfig(SFoodsConfig.class).get(foodId);
if( sPropertyConfig.getStyle() == GlobalsDef.PERCENT_TYPE){ if(value.get(HeroAttributeEnum.CurHP.getPropertyId()) == 0 || sFoodsConfig.getContiue()!=0){
if(effectId == HeroAttributeEnum.CurHpExtra.getPropertyId()){ return value;
effectId = HeroAttributeEnum.CurHP.getPropertyId(); }
effectValue = value.get(HeroAttributeEnum.Hp.getPropertyId()) * effectValue/10000; for(int[] effectPara : sFoodsConfig.getEffectPara()){
}else{ int effectId = effectPara[0];
if(sPropertyConfig.getTargetPropertyId()!=0){ int effectValue = effectPara[1];
effectId = sPropertyConfig.getTargetPropertyId(); SPropertyConfig sPropertyConfig = SPropertyConfig.getsPropertyConfigByPID(effectId);
effectValue = value.get(effectId) * effectValue/10000; if( sPropertyConfig.getStyle() == GlobalsDef.PERCENT_TYPE){
if(effectId == HeroAttributeEnum.CurHpExtra.getPropertyId()){
effectId = HeroAttributeEnum.CurHP.getPropertyId();
effectValue = value.get(HeroAttributeEnum.Hp.getPropertyId()) * effectValue/10000;
}else{
if(sPropertyConfig.getTargetPropertyId()!=0){
effectId = sPropertyConfig.getTargetPropertyId();
effectValue = Double.valueOf(value.get(effectId) /10000d* effectValue).intValue();
}
} }
} }
effectValueMap.put(effectId,effectValueMap.getOrDefault(effectId,0)+effectValue);
} }
}
if(!value.containsKey(effectId)){ for(Map.Entry<Integer,Integer> entry:effectValueMap.entrySet()){
value.put(effectId,effectValue); int finalValue = value.get(entry.getKey()) + entry.getValue();
continue;
}
int finalValue = value.get(effectId) + effectValue;
if(finalValue < 0){ if(finalValue < 0){
finalValue = 0; finalValue = 0;
} }
if(effectId == HeroAttributeEnum.CurHP.getPropertyId()){ if(entry.getKey() == HeroAttributeEnum.CurHP.getPropertyId()){
Integer maxValue = value.get(HeroAttributeEnum.Hp.getPropertyId()); Integer maxValue = value.get(HeroAttributeEnum.Hp.getPropertyId());
if(finalValue>maxValue){ if(finalValue>maxValue){
finalValue = maxValue; finalValue = maxValue;
@ -103,7 +109,7 @@ public class CombatLogic {
finalValue =1; finalValue =1;
} }
} }
value.put( effectId,finalValue ); value.put(entry.getKey(),finalValue );
} }
return value; return value;
} }
@ -910,7 +916,8 @@ public class CombatLogic {
Map<Integer, Integer> fightStateInfo = user.getMainLevelManager().getFightStateInfo(); Map<Integer, Integer> fightStateInfo = user.getMainLevelManager().getFightStateInfo();
SGameSetting gameSetting = STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting(); SGameSetting gameSetting = STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting();
int adventureRefresh = gameSetting.getAdventureRefresh(); int adventureRefresh = gameSetting.getAdventureRefresh();
int adventureOffline = gameSetting.getAdventureOffline()*60*60/adventureRefresh; int vipTimeAdd = PlayerLogic.getInstance().getMaxCountByPrivilegeType(user, VipPrivilegeType.ADVENTURE_ADD_TIME);
int adventureOffline = (gameSetting.getAdventureOffline()+vipTimeAdd)*60*60/adventureRefresh;
Map<Integer, Integer> baseItemMap = new HashMap<>(); Map<Integer, Integer> baseItemMap = new HashMap<>();
Map<Integer, Integer> baseCardMap = new HashMap<>(); Map<Integer, Integer> baseCardMap = new HashMap<>();
Map<Integer, Integer> baseEquipMap = new HashMap<>(); Map<Integer, Integer> baseEquipMap = new HashMap<>();

View File

@ -218,9 +218,8 @@ public class FightUtil {
for(Map.Entry<Integer,Integer> tempProperty:trailHero.getProperty().entrySet()){ for(Map.Entry<Integer,Integer> tempProperty:trailHero.getProperty().entrySet()){
propertyMap.put(tempProperty.getKey(),tempProperty.getValue()); propertyMap.put(tempProperty.getKey(),tempProperty.getValue());
} }
for(int buffId:buffIds){ CombatLogic.getInstance().bufferOneHeroAttrAfterEat(propertyMap,buffIds);
CombatLogic.getInstance().bufferOneHeroAttrAfterEat(propertyMap,buffId);
}
}else{ }else{
propertyMap = trailHero.getProperty(); propertyMap = trailHero.getProperty();
} }

View File

@ -12,6 +12,8 @@ import com.ljsd.jieling.exception.ErrorCodeException;
import com.ljsd.jieling.globals.BIReason; import com.ljsd.jieling.globals.BIReason;
import com.ljsd.jieling.globals.Global; import com.ljsd.jieling.globals.Global;
import com.ljsd.jieling.ktbeans.ReportEventEnum;
import com.ljsd.jieling.ktbeans.ReportUtil;
import com.ljsd.jieling.logic.activity.event.*; import com.ljsd.jieling.logic.activity.event.*;
import com.ljsd.jieling.logic.activity.eventhandler.HeroFiveStarGetEventHandler; import com.ljsd.jieling.logic.activity.eventhandler.HeroFiveStarGetEventHandler;
import com.ljsd.jieling.logic.activity.eventhandler.LeveGiftEventHander; import com.ljsd.jieling.logic.activity.eventhandler.LeveGiftEventHander;
@ -128,13 +130,13 @@ public class HeroLogic{
int uid = iSession.getUid(); int uid = iSession.getUid();
User user = UserManager.getUser(uid); User user = UserManager.getUser(uid);
List<CommonProto.Equip> equipList = new ArrayList<>(); List<CommonProto.Equip> equipList = new ArrayList<>();
if(type==1){ // if(type==1){
Map<String, PropertyItem> equipMap = user.getEquipManager().getEquipMap(); // Map<String, PropertyItem> equipMap = user.getEquipManager().getEquipMap();
for(PropertyItem equipInfo: equipMap.values()){ // for(PropertyItem equipInfo: equipMap.values()){
if(equipInfo instanceof Equip) // if(equipInfo instanceof Equip)
equipList.add(CBean2Proto.getEquipProto(equipInfo)); // equipList.add(CBean2Proto.getEquipProto(equipInfo));
} // }
} // }
//宝器 //宝器
if(type==4){ if(type==4){
Map<String, PropertyItem> equipMap = user.getEquipManager().getEquipMap(); Map<String, PropertyItem> equipMap = user.getEquipManager().getEquipMap();
@ -142,6 +144,8 @@ public class HeroLogic{
if(equipInfo instanceof Jewel) if(equipInfo instanceof Jewel)
equipList.add(CBean2Proto.getEquipProto(equipInfo)); equipList.add(CBean2Proto.getEquipProto(equipInfo));
} }
}else {
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
} }
@ -358,7 +362,6 @@ public class HeroLogic{
} }
heroManager.updateRandomPoolByType(mergePool,randomPoolByType.get(mergePool)); heroManager.updateRandomPoolByType(mergePool,randomPoolByType.get(mergePool));
int result = sLotteryRewardConfig.getId(); int result = sLotteryRewardConfig.getId();
System.out.print(result+"、");
return result; return result;
} }
@ -882,6 +885,7 @@ public class HeroLogic{
String message = SErrorCodeEerverConfig.getI18NMessage("lamp_rankup_hero_content", new Object[]{user.getPlayerInfoManager().getNickName(), scHero.getReadingName(),targetHero.getStar()}); String message = SErrorCodeEerverConfig.getI18NMessage("lamp_rankup_hero_content", new Object[]{user.getPlayerInfoManager().getNickName(), scHero.getReadingName(),targetHero.getStar()});
ChatLogic.getInstance().sendSysChatMessage(message,Global.DILIGENT,targetHero.getTemplateId(),0,0,0,0,0); ChatLogic.getInstance().sendSysChatMessage(message,Global.DILIGENT,targetHero.getTemplateId(),0,0,0,0,0);
} }
ReportUtil.onReportEvent(user, ReportEventEnum.HERO_STRENGTHEN.getType(),String.valueOf(targetHero.getTemplateId()),String.valueOf(oldStar),String.valueOf(targetHero.getStar()),"");
} }
private void rankUpHeroExecute(Hero hero,int starCount,int unlockEspecialEquipStar) throws Exception { private void rankUpHeroExecute(Hero hero,int starCount,int unlockEspecialEquipStar) throws Exception {
//是否解锁法宝 //是否解锁法宝
@ -1066,20 +1070,21 @@ public class HeroLogic{
skillList.addAll( tempHero.getPassiveSkills(1,hero.getBreakId())); skillList.addAll( tempHero.getPassiveSkills(1,hero.getBreakId()));
skillList.addAll( tempHero.getPassiveSkills(2,hero.getStarBreakId())); skillList.addAll( tempHero.getPassiveSkills(2,hero.getStarBreakId()));
Map<Integer, String> equipByPositionMap = hero.getEquipByPositionMap(); //装备没有技能不用计算
if(!equipByPositionMap.isEmpty()){ // Map<Integer, Integer> equipByPositionMap = hero.getEquipByPositionMap();
Map<String, PropertyItem> equipMap = hero.getCreateType()==1?user.getExpeditionManager().getEquipMap():user.getEquipManager().getEquipMap(); // if(!equipByPositionMap.isEmpty()){
for(Integer position : equipSkillPositionTemaplge){ // Map<String, PropertyItem> equipMap = hero.getCreateType()==1?user.getExpeditionManager().getEquipMap():user.getEquipManager().getEquipMap();
String equipId = equipByPositionMap.get(position); // for(Integer position : equipSkillPositionTemaplge){
if(StringUtil.isEmpty(equipId)){ // Integer equipId = equipByPositionMap.get(position);
continue; // if(equipId==null){
} // continue;
int skillId = equipMap.get(equipId).getSkill(); // }
if(skillId!=0){ // int skillId = equipMap.get(equipId).getSkill();
skillList.add(skillId); // if(skillId!=0){
} // skillList.add(skillId);
} // }
} // }
// }
//魂印 //魂印
Map<Integer, Integer> soulEquipByPositionMap = hero.getSoulEquipByPositionMap(); Map<Integer, Integer> soulEquipByPositionMap = hero.getSoulEquipByPositionMap();
Map<Integer, SEquipConfig> config = STableManager.getConfig(SEquipConfig.class); Map<Integer, SEquipConfig> config = STableManager.getConfig(SEquipConfig.class);
@ -1306,22 +1311,17 @@ public class HeroLogic{
//装备总战力评分 //装备总战力评分
int equipForce=0; int equipForce=0;
boolean needRemove = false; boolean needRemove = false;
Iterator<Map.Entry<Integer, String>> iterator = hero.getEquipByPositionMap().entrySet().iterator(); Iterator<Map.Entry<Integer, Integer>> iterator = hero.getEquipByPositionMap().entrySet().iterator();
Map<Integer,Integer> suiteNumByIdMap = new HashMap<>(); Map<Integer,Integer> suiteNumByIdMap = new HashMap<>();
while (iterator.hasNext()){ while (iterator.hasNext()){
Map.Entry<Integer, String> next = iterator.next(); Map.Entry<Integer, Integer> next = iterator.next();
String equipId = next.getValue(); SEquipConfig sEquipConfig = STableManager.getConfig(SEquipConfig.class).get(next.getValue());
PropertyItem equip = equipMap.get(equipId); int[][] property = sEquipConfig.getProperty();
if(equip == null){ Map<Integer,Integer> propertyValueByIdMap = new HashMap<>();
needRemove = true; for(int[] prop:property){
continue; propertyValueByIdMap.put(prop[0],prop[1]);
} }
Map<Integer, Integer> propertyValueByIdMap = equip.getPropertyValueByIdMap();
Map<Integer, Integer> secondValueByIdMap = equip.getSecondValueByIdMap();
// LOGGER.info("cal equip = {}",equip.getEquipId());
combinedAttribute(propertyValueByIdMap,heroAllAttribute); combinedAttribute(propertyValueByIdMap,heroAllAttribute);
combinedAttribute(secondValueByIdMap,heroAllAttribute);
SEquipConfig sEquipConfig = STableManager.getConfig(SEquipConfig.class).get(equip.getEquipId());
equipForce+=sEquipConfig.getScore(); equipForce+=sEquipConfig.getScore();
suiteNumByIdMap.put(sEquipConfig.getSuiteID(),suiteNumByIdMap.getOrDefault(sEquipConfig.getSuiteID(),0)+1); suiteNumByIdMap.put(sEquipConfig.getSuiteID(),suiteNumByIdMap.getOrDefault(sEquipConfig.getSuiteID(),0)+1);
} }
@ -1340,11 +1340,11 @@ public class HeroLogic{
AyyncWorker ayyncWorker = new AyyncWorker(user,true,user1 -> { AyyncWorker ayyncWorker = new AyyncWorker(user,true,user1 -> {
Map<String, Hero> heroMap = user1.getHeroManager().getHeroMap(); Map<String, Hero> heroMap = user1.getHeroManager().getHeroMap();
for(Hero heroTmp : heroMap.values()){ for(Hero heroTmp : heroMap.values()){
Iterator<Map.Entry<Integer, String>> iterator1 = heroTmp.getEquipByPositionMap().entrySet().iterator(); Iterator<Map.Entry<Integer, Integer>> iterator1 = heroTmp.getEquipByPositionMap().entrySet().iterator();
boolean isUpate = false; boolean isUpate = false;
while (iterator1.hasNext()){ while (iterator1.hasNext()){
Map.Entry<Integer, String> next = iterator1.next(); Map.Entry<Integer, Integer> next = iterator1.next();
String equipId = next.getValue(); Integer equipId = next.getValue();
PropertyItem equip = equipMap.get(equipId); PropertyItem equip = equipMap.get(equipId);
if(equip == null){ if(equip == null){
iterator1.remove(); iterator1.remove();
@ -1735,31 +1735,31 @@ public class HeroLogic{
} }
} }
public boolean checkEquipForWear(Hero hero,EquipManager equipManager,List<String> equipIds, Map<Integer,String> equipInfos ){ //新版穿装备
private boolean checkEquipForWear(Hero hero,User user,List<String> equipIds, Map<Integer,Integer> equipInfos ) throws Exception {
if(equipIds == null || equipIds.isEmpty()){ if(equipIds == null || equipIds.isEmpty()){
return false; return false;
} }
Map<String, PropertyItem> equipMap = equipManager.getEquipMap(); if(hero==null){
return false;
}
for(String equipId : equipIds){ for(String equipId : equipIds){
PropertyItem equip =equipMap.get(equipId); int equip = Integer.parseInt(equipId);
if( null == equip || null == hero ){ SEquipConfig sEquipConfig = STableManager.getConfig(SEquipConfig.class).get(equip);
return false;
}
if(!StringUtil.isEmpty(equip.getHeroId()) && !equip.getHeroId().equals(hero.getId())){
return false;
}
int equipIdTid = equip.getEquipId();
SEquipConfig sEquipConfig = STableManager.getConfig(SEquipConfig.class).get(equipIdTid);
int position = sEquipConfig.getPosition(); int position = sEquipConfig.getPosition();
boolean itemCost = ItemUtil.itemCost(user, new int[][]{{equip, 1}}, BIReason.EQUIP_WEAR_CONSUME, 1);
if(!itemCost){
return false;
}
int professionLimit = sEquipConfig.getProfessionLimit(); int professionLimit = sEquipConfig.getProfessionLimit();
SCHero scHero = SCHero.getsCHero().get(hero.getTemplateId()); SCHero scHero = SCHero.getsCHero().get(hero.getTemplateId());
if(professionLimit!=0 && scHero.getProfession()!= professionLimit){ if(professionLimit!=0 && scHero.getProfession()!= professionLimit){
return false; return false;
} }
equipInfos.put(position,equipId); equipInfos.put(position,equip);
}
if(equipInfos.size()!=equipIds.size()){
return false;
} }
return true; return true;
@ -1774,18 +1774,26 @@ public class HeroLogic{
Hero hero = user.getHeroManager().getHeroMap().get(heroId); Hero hero = user.getHeroManager().getHeroMap().get(heroId);
EquipManager equipManager = user.getEquipManager(); EquipManager equipManager = user.getEquipManager();
if(type==1){ if(type==1){
Map<Integer,String> equipInfoTmp = new HashMap<>(6); Map<Integer,Integer> equipInfoTmp = new HashMap<>(4);
if(!checkEquipForWear(hero,user.getEquipManager(),equipIds,equipInfoTmp)){ if(!checkEquipForWear(hero,user,equipIds,equipInfoTmp)){
throw new ErrorCodeException(ErrorCode.HERO_EQUIP_ERR); throw new ErrorCodeException(ErrorCode.HERO_EQUIP_ERR);
} }
hero.getEquipByPositionMap().forEach((Integer position,String equipId) -> { List<Integer> equipUnload = new ArrayList<>(4);
if(equipInfoTmp.containsKey(position) && !equipId.equals(equipInfoTmp.get(position))){ for(Map.Entry<Integer,Integer> entry :hero.getEquipByPositionMap().entrySet()){
equipManager.getEquipMap().get(equipId).setHeroId(""); if(!equipInfoTmp.containsKey(entry.getKey()) ) {
continue;
} }
}); equipUnload.add(entry.getValue());
}
int[][] unloadArray = new int[equipUnload.size()][];
for(int i = 0 ; i <unloadArray.length;i++){
unloadArray[i] = new int[]{equipUnload.get(i),1};
}
if(unloadArray.length!=0){
ItemUtil.drop(user, unloadArray, BIReason.EQUIP_UNLOAD_REWARD);
}
hero.updateMutliEquipPositionMap(equipInfoTmp); hero.updateMutliEquipPositionMap(equipInfoTmp);
user.getUserMissionManager().onGameEvent(user,GameEvent.WEAR_EQUIP,equipInfoTmp.size()); user.getUserMissionManager().onGameEvent(user,GameEvent.WEAR_EQUIP,equipInfoTmp.size());
equipIds.forEach(equipId->equipManager.getEquipMap().get(equipId).setHeroId(heroId));
}else if(type ==2){ }else if(type ==2){
for(String jId:equipIds){ for(String jId:equipIds){
wearJewel(hero,equipManager,jId); wearJewel(hero,equipManager,jId);
@ -1807,7 +1815,7 @@ public class HeroLogic{
private void wearJewel(Hero hero,EquipManager equipManager,String equipId)throws Exception{ private void wearJewel(Hero hero,EquipManager equipManager,String equipId)throws Exception{
Jewel equip =(Jewel)equipManager.getEquipMap().get(equipId); Jewel equip =(Jewel)equipManager.getEquipMap().get(equipId);
if( null == equip || null == hero ||hero.getJewelInfo().contains(equipId)){ if( null == equip || null == hero ){
throw new ErrorCodeException(ErrorCode.HERO_EQUIP_ERR); throw new ErrorCodeException(ErrorCode.HERO_EQUIP_ERR);
} }
@ -1842,25 +1850,32 @@ public class HeroLogic{
if( hero == null || equipIds.isEmpty()){ if( hero == null || equipIds.isEmpty()){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE); throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
} }
Map<String, PropertyItem> equipMap = user.getEquipManager().getEquipMap();
if(type==1){ if(type==1){
List<Integer> positions = new ArrayList<>(); List<Integer> positions = new ArrayList<>();
for(String equipId : equipIds){ for(String equipId : equipIds){
PropertyItem equip = equipMap.get(equipId); //
if(null == equip || StringUtil.isEmpty(equip.getHeroId())){ int equipIdTid =Integer.parseInt(equipId);
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
int equipIdTid = equip.getEquipId();
SEquipConfig sEquipConfig = STableManager.getConfig(SEquipConfig.class).get(equipIdTid); SEquipConfig sEquipConfig = STableManager.getConfig(SEquipConfig.class).get(equipIdTid);
int position = sEquipConfig.getPosition(); int position = sEquipConfig.getPosition();
Integer currEquip = hero.getEquipByPositionMap().get(position);
if(currEquip == null || currEquip != equipIdTid){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
positions.add(position); positions.add(position);
} }
equipIds.forEach(equidId->equipMap.get(equidId).setHeroId("")); if(positions.size()==0){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
for(Integer position : positions){
hero.removeEquip(position);
} }
int[][] dropEquip = new int[positions.size()][];
for(int i = 0 ; i <dropEquip.length;i++){
int currEquip= hero.getEquipByPositionMap().get(positions.get(i));
dropEquip[i] = new int[]{currEquip,1};
hero.removeEquip(positions.get(i));
}
ItemUtil.drop(user,dropEquip,BIReason.EQUIP_UNLOAD_REWARD);
}else if(type==2){ }else if(type==2){
Map<String, PropertyItem> equipMap = user.getEquipManager().getEquipMap();
for(String equipId:equipIds){ for(String equipId:equipIds){
if(!hero.getJewelInfo().contains(equipId)||equipMap.get(equipId)==null){ if(!hero.getJewelInfo().contains(equipId)||equipMap.get(equipId)==null){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE); throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);

View File

@ -581,17 +581,23 @@ public class ItemLogic {
} }
/** /**
* 穿 * 穿
* @param user * @param user
* @param equipid * @param equipid
* @return * @return
*/ */
public static TreeSet<String> getEquipByID(User user, int equipid) { public static int getEquipByID(User user, int equipId) throws Exception {
TreeSet<String> equiplist = new TreeSet<>(); Item item = user.getItemManager().getItemMap().get(equipId);
user.getEquipManager().getEquipMap().entrySet().stream().filter(stringEquipEntry -> if(item==null){
StringUtil.isEmpty(stringEquipEntry.getValue().getHeroId()) && stringEquipEntry.getValue().getEquipId() == equipid return 0;
).forEach(stringEquipEntry -> equiplist.add(stringEquipEntry.getKey())); }
return equiplist;
// TreeSet<String> equiplist = new TreeSet<>();
// user.getEquipManager().getEquipMap().entrySet().stream().filter(stringEquipEntry ->
// StringUtil.isEmpty(stringEquipEntry.getValue().getHeroId()) && stringEquipEntry.getValue().getEquipId() == equipid
// ).forEach(stringEquipEntry -> equiplist.add(stringEquipEntry.getKey()));
return item.getItemNum();
} }

View File

@ -11,6 +11,8 @@ import com.ljsd.jieling.handler.map.MapLogic;
import com.ljsd.jieling.handler.map.MapMission; import com.ljsd.jieling.handler.map.MapMission;
import com.ljsd.jieling.jbean.ActivityMission; import com.ljsd.jieling.jbean.ActivityMission;
import com.ljsd.jieling.ktbeans.KtEventUtils; import com.ljsd.jieling.ktbeans.KtEventUtils;
import com.ljsd.jieling.ktbeans.ReportEventEnum;
import com.ljsd.jieling.ktbeans.ReportUtil;
import com.ljsd.jieling.ktbeans.parmsBean.ParamEventBean; import com.ljsd.jieling.ktbeans.parmsBean.ParamEventBean;
import com.ljsd.jieling.logic.activity.ActivityType; import com.ljsd.jieling.logic.activity.ActivityType;
import com.ljsd.jieling.logic.activity.event.MissingRoomBestEvent; import com.ljsd.jieling.logic.activity.event.MissingRoomBestEvent;
@ -361,8 +363,9 @@ public class MissionLoigc {
CommonProto.Drop.Builder drop = ItemUtil.drop(user, new int[]{rewardGroup}, 1.0f, 0, BIReason.TAKE_MISSION_REWARD); CommonProto.Drop.Builder drop = ItemUtil.drop(user, new int[]{rewardGroup}, 1.0f, 0, BIReason.TAKE_MISSION_REWARD);
PlayerInfoProto.TakeMissionRewardResponse build = PlayerInfoProto.TakeMissionRewardResponse.newBuilder().setDrop(drop).build(); PlayerInfoProto.TakeMissionRewardResponse build = PlayerInfoProto.TakeMissionRewardResponse.newBuilder().setDrop(drop).build();
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.TAKE_MISSION_REWARD_RESPONSE_VALUE,build,true); MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.TAKE_MISSION_REWARD_RESPONSE_VALUE,build,true);
KtEventUtils.onKtEvent(user, ParamEventBean.UserTaskEvent,type,missionId); // KtEventUtils.onKtEvent(user, ParamEventBean.UserTaskEvent,type,missionId);
Repot37EventUtil.onKtEvent(user, Repot37EventUtil.Report37EventType.TASK_FINISH_EVEMT,missionId,""); // Repot37EventUtil.onKtEvent(user, Repot37EventUtil.Report37EventType.TASK_FINISH_EVEMT,missionId,"");
ReportUtil.onReportEvent(user, ReportEventEnum.MISSION_COMPLETE.getType(),missionId,GameMisionType.BLOODYMISSION.toString(),rewardGroup);
return; return;
} }
if(type == GameMisionType.VIPMISSION.getType()){ //vip 任务 if(type == GameMisionType.VIPMISSION.getType()){ //vip 任务
@ -440,10 +443,11 @@ public class MissionLoigc {
if(missionStateChangeInfos!=null && !missionStateChangeInfos.isEmpty()){ if(missionStateChangeInfos!=null && !missionStateChangeInfos.isEmpty()){
CommonProto.Drop.Builder drop = ItemUtil.drop(user, missionStateChangeInfos.get(0).getRewwardGroups(), BIReason.TAKE_MISSION_REWARD); CommonProto.Drop.Builder drop = ItemUtil.drop(user, missionStateChangeInfos.get(0).getRewwardGroups(), BIReason.TAKE_MISSION_REWARD);
user.getUserMissionManager().onGameEvent(user,GameEvent.DAILY_TASK_TYPE,missionId); user.getUserMissionManager().onGameEvent(user,GameEvent.DAILY_TASK_TYPE,missionId);
ReportUtil.onReportEvent(user, ReportEventEnum.MISSION_COMPLETE.getType(),String.valueOf(missionId),type,missionStateChangeInfos.get(0).getRewwardGroups());
PlayerInfoProto.TakeMissionRewardResponse build = PlayerInfoProto.TakeMissionRewardResponse.newBuilder().setDrop(drop).build(); PlayerInfoProto.TakeMissionRewardResponse build = PlayerInfoProto.TakeMissionRewardResponse.newBuilder().setDrop(drop).build();
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.TAKE_MISSION_REWARD_RESPONSE_VALUE,build,true); MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.TAKE_MISSION_REWARD_RESPONSE_VALUE,build,true);
KtEventUtils.onKtEvent(user, ParamEventBean.UserTaskEvent,type,missionId); // KtEventUtils.onKtEvent(user, ParamEventBean.UserTaskEvent,type,missionId);
Repot37EventUtil.onKtEvent(user, Repot37EventUtil.Report37EventType.TASK_FINISH_EVEMT,missionId,""); // Repot37EventUtil.onKtEvent(user, Repot37EventUtil.Report37EventType.TASK_FINISH_EVEMT,missionId,"");
}else{ }else{
//MessageUtil.sendErrorResponse(session,0, MessageTypeProto.MessageType.TAKE_MISSION_REWARD_RESPONSE_VALUE,"mission can not get reward"); //MessageUtil.sendErrorResponse(session,0, MessageTypeProto.MessageType.TAKE_MISSION_REWARD_RESPONSE_VALUE,"mission can not get reward");
throw new ErrorCodeException(ErrorCode.newDefineCode("mission can not get reward")); throw new ErrorCodeException(ErrorCode.newDefineCode("mission can not get reward"));

View File

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

View File

@ -20,6 +20,7 @@ import java.util.concurrent.TimeUnit;
* @discribe * @discribe
*/ */
public class ForceCurrRank extends AbstractRank implements IEventHandler{ public class ForceCurrRank extends AbstractRank implements IEventHandler{
private static int TRANSPORT_SIZE = 100;
public ForceCurrRank(int type, String redisKey) { public ForceCurrRank(int type, String redisKey) {
super(type, redisKey); super(type, redisKey);
@ -62,11 +63,13 @@ public class ForceCurrRank extends AbstractRank implements IEventHandler{
int size = infoQueue.size(); int size = infoQueue.size();
List<UserMainTeamForceEvent> eventList = new ArrayList<>(size); List<UserMainTeamForceEvent> eventList = new ArrayList<>(size);
if(size<100){ //看队列长度和每次最多传输多少比较,找最小
for(int i = 0 ; i < size;i++){ int transport = Math.min(size,TRANSPORT_SIZE);
eventList.add(infoQueue.poll());
} for(int i = 0 ; i < transport;i++){
eventList.add(infoQueue.poll());
} }
Set<Integer> changeId = new HashSet<>(); Set<Integer> changeId = new HashSet<>();
eventList.forEach(n->changeId.add(n.getUid())); eventList.forEach(n->changeId.add(n.getUid()));
changeId.forEach(i-> { changeId.forEach(i-> {

View File

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

View File

@ -269,7 +269,7 @@ public class StoreLogic implements IEventHandler {
return; return;
} }
Map<Integer, Integer> itemNumMap = getStoreItem(sStoreTypeConfig.getId(),sStoreTypeConfig,user); Map<Integer, Integer> itemNumMap = getStoreItem(sStoreTypeConfig.getId(),sStoreTypeConfig,user);
storeManager.newStoreInfo(sStoreTypeConfig.getId(),startTime,endTime,itemNumMap); storeManager.newStoreInfo(sStoreTypeConfig.getId(),System.currentTimeMillis(),startTime,endTime,itemNumMap);
sendStoreUpdateIndication(user.getId(),storeManager.getStoreInfoMap().get(sStoreTypeConfig.getId())); sendStoreUpdateIndication(user.getId(),storeManager.getStoreInfoMap().get(sStoreTypeConfig.getId()));
} }
@ -298,7 +298,7 @@ public class StoreLogic implements IEventHandler {
endTime = ToolsUtil.getTimeLong(sStoreTypeConfig.getStartTimeLong(),sStoreTypeConfig.getEndTimeLong(), ActivityType.OPEN_TYPE_SERVER,userCreateTime, 2); endTime = ToolsUtil.getTimeLong(sStoreTypeConfig.getStartTimeLong(),sStoreTypeConfig.getEndTimeLong(), ActivityType.OPEN_TYPE_SERVER,userCreateTime, 2);
} }
Map<Integer, Integer> itemNumMap = getStoreItem(sStoreTypeConfig.getId(),sStoreTypeConfig,user); Map<Integer, Integer> itemNumMap = getStoreItem(sStoreTypeConfig.getId(),sStoreTypeConfig,user);
storeManager.newStoreInfo(sStoreTypeConfig.getId(),startTime,endTime,itemNumMap); storeManager.newStoreInfo(sStoreTypeConfig.getId(),System.currentTimeMillis(),startTime,endTime,itemNumMap);
sendStoreUpdateIndication(user.getId(),storeManager.getStoreInfoMap().get(sStoreTypeConfig.getId())); sendStoreUpdateIndication(user.getId(),storeManager.getStoreInfoMap().get(sStoreTypeConfig.getId()));
} }
@ -319,7 +319,7 @@ public class StoreLogic implements IEventHandler {
Map<Integer, Integer> itemNumMap = new LinkedHashMap<>(); Map<Integer, Integer> itemNumMap = new LinkedHashMap<>();
int rewardId = getRewardId(storeType,sort,user); int rewardId = getRewardId(storeType,sort,user);
itemNumMap.put(rewardId, 0); itemNumMap.put(rewardId, 0);
storeManager.newStoreInfo(sStoreTypeConfig.getId(),startTime,endTime,itemNumMap); storeManager.newStoreInfo(sStoreTypeConfig.getId(),System.currentTimeMillis(),startTime,endTime,itemNumMap);
}else{ }else{
Map<Integer, Integer> itemNumMap = storeInfo.getItemNumMap(); Map<Integer, Integer> itemNumMap = storeInfo.getItemNumMap();
int rewardId = getRewardId(storeType,sort,user); int rewardId = getRewardId(storeType,sort,user);
@ -337,13 +337,20 @@ public class StoreLogic implements IEventHandler {
Map<Integer, SStoreTypeConfig> sstoreTypeConfigMap = SStoreTypeConfig.getsStoreTypeConfigMap(); Map<Integer, SStoreTypeConfig> sstoreTypeConfigMap = SStoreTypeConfig.getsStoreTypeConfigMap();
for ( Map.Entry<Integer, SStoreTypeConfig> entry :sstoreTypeConfigMap.entrySet()){ for ( Map.Entry<Integer, SStoreTypeConfig> entry :sstoreTypeConfigMap.entrySet()){
SStoreTypeConfig sStoreTypeConfig = entry.getValue(); SStoreTypeConfig sStoreTypeConfig = entry.getValue();
long refreshTimeDelay = System.currentTimeMillis();
//如果有免费次数,在初始化时候把相对时间减去
if(sStoreTypeConfig.getIfManualRefresh()[0]!=0){
refreshTimeDelay-=sStoreTypeConfig.getIfManualRefresh()[0]*sStoreTypeConfig.getIfManualRefresh()[1]*TimeUtils.HOUR;
}
if(sStoreTypeConfig.getStoreOpenRule() == 8){ if(sStoreTypeConfig.getStoreOpenRule() == 8){
TimeControllerOfFunction openTimeOfFuntionCacheByType = GlobalDataManaager.getInstance().getOpenTimeOfFuntionCacheByType(FunctionIdEnum.getFunctionIdEnumByType(sStoreTypeConfig.getOpenLevel()[1])); TimeControllerOfFunction openTimeOfFuntionCacheByType = GlobalDataManaager.getInstance().getOpenTimeOfFuntionCacheByType(FunctionIdEnum.getFunctionIdEnumByType(sStoreTypeConfig.getOpenLevel()[1]));
if(openTimeOfFuntionCacheByType!=null ){ if(openTimeOfFuntionCacheByType!=null ){
StoreInfo storeInfo = storeManager.getStoreInfoMap().get(sStoreTypeConfig.getId()); StoreInfo storeInfo = storeManager.getStoreInfoMap().get(sStoreTypeConfig.getId());
if(storeInfo == null || storeInfo.getStartTime()!=openTimeOfFuntionCacheByType.getStartTime()){ if(storeInfo == null || storeInfo.getStartTime()!=openTimeOfFuntionCacheByType.getStartTime()){
Map<Integer, Integer> itemNumMap = getStoreItem(sStoreTypeConfig.getId(),sStoreTypeConfig,user); Map<Integer, Integer> itemNumMap = getStoreItem(sStoreTypeConfig.getId(),sStoreTypeConfig,user);
storeManager.newStoreInfo(sStoreTypeConfig.getId(),openTimeOfFuntionCacheByType.getStartTime(),openTimeOfFuntionCacheByType.getEndTime(),itemNumMap); storeManager.newStoreInfo(sStoreTypeConfig.getId(),refreshTimeDelay,openTimeOfFuntionCacheByType.getStartTime(),openTimeOfFuntionCacheByType.getEndTime(),itemNumMap);
} }
} }
} }
@ -360,7 +367,7 @@ public class StoreLogic implements IEventHandler {
if (!sStoreTypeConfig.getEndTime().equals("0")){ if (!sStoreTypeConfig.getEndTime().equals("0")){
endTime = TimeUtils.parseTimeToMiles(sStoreTypeConfig.getEndTime(), TimeUtils.Stand_CeHua_Data_format); endTime = TimeUtils.parseTimeToMiles(sStoreTypeConfig.getEndTime(), TimeUtils.Stand_CeHua_Data_format);
} }
storeManager.newStoreInfo(sStoreTypeConfig.getId(),startTime,endTime,itemNumMap); storeManager.newStoreInfo(sStoreTypeConfig.getId(),refreshTimeDelay,startTime,endTime,itemNumMap);
} }
} }

View File

@ -79,11 +79,7 @@ public class CBean2Proto {
return itemProto; return itemProto;
} }
public static CommonProto.Hero getHero(Hero hero){ Map<Integer, String> equipByPositionMap = hero.getEquipByPositionMap(); public static CommonProto.Hero getHero(Hero hero){
List<String> equipList = new ArrayList<>();
if(equipByPositionMap!=null && !equipByPositionMap.isEmpty()){
equipList.addAll(equipByPositionMap.values());
}
List<CommonProto.SoulPos> soulPoss = new ArrayList<>(); List<CommonProto.SoulPos> soulPoss = new ArrayList<>();
Map<Integer, Integer> soulEquipMap = hero.getSoulEquipByPositionMap(); Map<Integer, Integer> soulEquipMap = hero.getSoulEquipByPositionMap();
if(soulEquipMap!=null&&!soulEquipMap.isEmpty()){ if(soulEquipMap!=null&&!soulEquipMap.isEmpty()){
@ -103,7 +99,7 @@ public class CBean2Proto {
.setBreakId(hero.getBreakId()) .setBreakId(hero.getBreakId())
.setStarBreakId(hero.getStarBreakId()) .setStarBreakId(hero.getStarBreakId())
.setCreateTime(hero.getCreateTime()) .setCreateTime(hero.getCreateTime())
.addAllEquipIdList(equipList) .addAllEquipIdList(hero.getEquipByPositionMap().values())
.setEspecialEquipLevel(hero.getEspecialEquipLevel()) .setEspecialEquipLevel(hero.getEspecialEquipLevel())
.addAllSoulPos(soulPoss) .addAllSoulPos(soulPoss)
.setLockState(hero.getIsLock()) .setLockState(hero.getIsLock())
@ -165,8 +161,11 @@ public class CBean2Proto {
return equipProto.build(); return equipProto.build();
} }
public static CommonProto.Equip getEquipProto(int equipId) {
return CommonProto.Equip.newBuilder().setEquipId(equipId).build();
}
public static CommonProto.Drop getDrop(TemporaryItems temporaryItems) { public static CommonProto.Drop getDrop(TemporaryItems temporaryItems) {
CommonProto.Drop.Builder drop = CommonProto.Drop.newBuilder(); CommonProto.Drop.Builder drop = CommonProto.Drop.newBuilder();
for (Item item : temporaryItems.items.values()) { for (Item item : temporaryItems.items.values()) {
drop.addItemlist(getItem(item,-1)); drop.addItemlist(getItem(item,-1));

View File

@ -16,6 +16,8 @@ import com.ljsd.jieling.handler.map.MapManager;
import com.ljsd.jieling.handler.map.TemporaryItems; import com.ljsd.jieling.handler.map.TemporaryItems;
import com.ljsd.jieling.jbean.ActivityMission; import com.ljsd.jieling.jbean.ActivityMission;
import com.ljsd.jieling.ktbeans.KtEventUtils; import com.ljsd.jieling.ktbeans.KtEventUtils;
import com.ljsd.jieling.ktbeans.ReportEventEnum;
import com.ljsd.jieling.ktbeans.ReportUtil;
import com.ljsd.jieling.ktbeans.parmsBean.ParamEventBean; import com.ljsd.jieling.ktbeans.parmsBean.ParamEventBean;
import com.ljsd.jieling.logic.OnlineUserManager; import com.ljsd.jieling.logic.OnlineUserManager;
import com.ljsd.jieling.logic.activity.ActivityType; import com.ljsd.jieling.logic.activity.ActivityType;
@ -202,7 +204,7 @@ public class ItemUtil {
* @return * @return
* @throws Exception * @throws Exception
*/ */
public static CommonProto.Drop.Builder drop(User user, int[] dropGroupIds,float dropRatio, int isMapping,int reason) throws Exception { public static CommonProto.Drop.Builder drop(User user, int[] dropGroupIds,float dropRatio, int isMapping,int reason) throws Exception {
CommonProto.Drop.Builder dropBuilder = CommonProto.Drop.newBuilder(); CommonProto.Drop.Builder dropBuilder = CommonProto.Drop.newBuilder();
Map<Integer, Integer> itemMap = new HashMap<>(); Map<Integer, Integer> itemMap = new HashMap<>();
Map<Integer, Integer> cardMap = new HashMap<>(); Map<Integer, Integer> cardMap = new HashMap<>();
@ -493,10 +495,10 @@ public class ItemUtil {
switch (itemType) { switch (itemType) {
case GlobalItemType.SOUL_MARK: case GlobalItemType.SOUL_MARK:
case GlobalItemType.ITEM: case GlobalItemType.ITEM:
case GlobalItemType.EQUIP:
return itemMap; return itemMap;
case GlobalItemType.CARD: case GlobalItemType.CARD:
return cardMap; return cardMap;
case GlobalItemType.EQUIP:
case GlobalItemType.ESPECIAL_EQUIP: case GlobalItemType.ESPECIAL_EQUIP:
case GlobalItemType.JEWEL: case GlobalItemType.JEWEL:
return equipMap; return equipMap;
@ -674,6 +676,7 @@ public class ItemUtil {
} }
playerInfoManager.setExp(curExp); playerInfoManager.setExp(curExp);
if (playerInfoManager.getLevel() > oldLevel) { if (playerInfoManager.getLevel() > oldLevel) {
ReportUtil.onReportEvent(user, ReportEventEnum.LEVEL_UP.getType(),1,playerInfoManager.getLevel());
user.getUserMissionManager().onGameEvent(user, GameEvent.USER_LEVELUP,oldLevel+1,playerInfoManager.getLevel()); user.getUserMissionManager().onGameEvent(user, GameEvent.USER_LEVELUP,oldLevel+1,playerInfoManager.getLevel());
} }
@ -738,22 +741,6 @@ public class ItemUtil {
sendToFront.add(CBean2Proto.getItem(item,-1)); sendToFront.add(CBean2Proto.getItem(item,-1));
LOGGER.info("the uid={},the curMapId={},add item={},addItemNum={},totalItemNum={}",user.getId(),user.getMapManager().getCurMapId(),entry.getKey(),entry.getValue(),item.getItemNum()); LOGGER.info("the uid={},the curMapId={},add item={},addItemNum={},totalItemNum={}",user.getId(),user.getMapManager().getCurMapId(),entry.getKey(),entry.getValue(),item.getItemNum());
} }
Set<PropertyItem> equips = temporaryItems.equips;
for (Map.Entry<Integer, Integer> entry : equipMap.entrySet()) {
SEquipConfig sEquipConfig = STableManager.getConfig(SEquipConfig.class).get(entry.getKey());
if (sEquipConfig == null) {
continue;
}
Integer nums = entry.getValue();
for(int i=0;i<nums;i++){
Equip equip = new Equip(user.getId(), entry.getKey());
equips.add(equip);
equipProtoList.add(CBean2Proto.getEquipProto(equip));
}
LOGGER.info("the uid={},the curMapId={},add equip={},equipNum={},totalEquipNum={}",user.getId(),user.getMapManager().getCurMapId(),entry.getKey(),nums,equips.size());
}
mapManager.setTemporaryItems(temporaryItems); mapManager.setTemporaryItems(temporaryItems);
if (dropBuilder != null) { if (dropBuilder != null) {
dropBuilder.addAllItemlist(itemProtoList); dropBuilder.addAllItemlist(itemProtoList);
@ -1145,7 +1132,8 @@ public class ItemUtil {
if(SItem.getsItemMap().get(scHero.getId()).getQuantity()>=5) if(SItem.getsItemMap().get(scHero.getId()).getQuantity()>=5)
Poster.getPoster().dispatchEvent(new HeroFiveStarGetEvent(user.getId(),scHero.getStar())); Poster.getPoster().dispatchEvent(new HeroFiveStarGetEvent(user.getId(),scHero.getStar()));
} }
KtEventUtils.onKtEvent(user, ParamEventBean.UserItemEvent,reason,GlobalsDef.addReason,cardId,1,heroStar[1]); // KtEventUtils.onKtEvent(user, ParamEventBean.UserItemEvent,reason,GlobalsDef.addReason,cardId,1,heroStar[1]);
ReportUtil.onReportEvent(user,ReportEventEnum.GET_HERO.getType(),String.valueOf(cardId),String.valueOf(hero.getStar()),String.valueOf(reason));
} }
/** /**
@ -1232,6 +1220,7 @@ public class ItemUtil {
switch (itemType) { switch (itemType) {
case GlobalItemType.ITEM: case GlobalItemType.ITEM:
case GlobalItemType.SOUL_MARK: case GlobalItemType.SOUL_MARK:
case GlobalItemType.EQUIP:
putcountMap(itemId,itemNum,itemMap); putcountMap(itemId,itemNum,itemMap);
break; break;
default: default:

View File

@ -12,7 +12,7 @@ public class SDailyChallengeConfig implements BaseConfig {
private int type; private int type;
private int[] openRules; private int[][] openRules;
private int[] reward; private int[] reward;
@ -35,7 +35,7 @@ public class SDailyChallengeConfig implements BaseConfig {
return type; return type;
} }
public int[] getOpenRules() { public int[][] getOpenRules() {
return openRules; return openRules;
} }