Merge branch 'master' of http://60.1.1.230/backend/jieling_server into dev_champion
commit
2498e48c1a
|
@ -16,4 +16,4 @@ luafight/LogError/*.json
|
|||
luafight/BattleRecord/*.txt
|
||||
luafight/BattleRecord/*.json
|
||||
serverlogic/src/main/com.ljsd.jieling.thrift
|
||||
conf/server/*.txt
|
||||
conf/server/*.txt
|
|
@ -39,6 +39,7 @@ dependencies {
|
|||
compile("com.fasterxml.jackson.core:jackson-databind:2.3.3")
|
||||
compile group: 'com.googlecode.protobuf-java-format', name: 'protobuf-java-format', version: '1.2'
|
||||
compile group: 'com.google.code.gson', name: 'gson', version: '2.2.4'
|
||||
compile group: 'cn.thinkingdata', name: 'thinkingdatasdk', version: '1.5.1'
|
||||
// compile("org.luaj:luaj-jse:3.0.1")
|
||||
compile("org.apache.thrift:libthrift:0.9.2")
|
||||
compile("com.alibaba:fastjson:1.2.47")
|
||||
|
|
|
@ -32,72 +32,72 @@ import java.util.concurrent.ConcurrentLinkedQueue;
|
|||
//todo 对用户频繁访问加限流处理。
|
||||
public class HandlerLogicThread extends Thread{
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(HandlerLogicThread.class);
|
||||
private static Set<Integer> whiteMsg = new HashSet<>();
|
||||
// private static Set<Integer> whiteMsg = new HashSet<>();
|
||||
|
||||
static {
|
||||
whiteMsg.add(MessageTypeProto.MessageType.MAP_ENTER_REQUEST_VALUE);
|
||||
whiteMsg.add(MessageTypeProto.MessageType.MAP_START_EXPLORE_REQUEST_VALUE);
|
||||
whiteMsg.add(MessageTypeProto.MessageType.MAP_UDPATE_REQUEST_VALUE);
|
||||
whiteMsg.add(MessageTypeProto.MessageType.EVENT_UPDATE_REQUEST_VALUE);
|
||||
whiteMsg.add(MessageTypeProto.MessageType.MAP_FAST_FIGHT_REQUEST_VALUE);
|
||||
whiteMsg.add(MessageTypeProto.MessageType.FIGHT_START_REQUEST_VALUE);
|
||||
whiteMsg.add(MessageTypeProto.MessageType.FIGHT_END_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_USEBOMB_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_SIGN_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_MAP_HERO_INFO_REQUEST_VALUE);
|
||||
|
||||
whiteMsg.add(MessageTypeProto.MessageType.LOGIN_REQUEST_VALUE);
|
||||
whiteMsg.add(MessageTypeProto.MessageType.GET_PLAYERINFO_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_POKEMON_REQUEST_VALUE);
|
||||
whiteMsg.add(MessageTypeProto.MessageType.GET_HEROINFO_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_ALL_MAIL_INFO_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_FUNCTIONOFTIME_REQUEST_VALUE);
|
||||
whiteMsg.add(MessageTypeProto.MessageType.GET_SECRETBOX_REQUEST_VALUE);
|
||||
whiteMsg.add(MessageTypeProto.MessageType.ADVENTURE_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.ARENA_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.GET_MISSION_REQUEST_VALUE);
|
||||
whiteMsg.add(MessageTypeProto.MessageType.REFRESH_ITEM_NUM_REQUEST_VALUE);
|
||||
whiteMsg.add(MessageTypeProto.MessageType.STORE_GOODS_REFRESH_REQUEST_VALUE);
|
||||
//日后删除
|
||||
whiteMsg.add(MessageTypeProto.MessageType.GET_CHAT_MESSAGE_REQUEST_VALUE);
|
||||
|
||||
whiteMsg.add(MessageTypeProto.MessageType.BLESS_INFO_REQUEST_VALUE);
|
||||
whiteMsg.add(MessageTypeProto.MessageType.SERVER_FIVE_REQEUST_VALUE);
|
||||
whiteMsg.add(MessageTypeProto.MessageType.SERVER_ZERO_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_MEMBER_REQUEST_VALUE);
|
||||
whiteMsg.add(MessageTypeProto.MessageType.FAMILY_GET_APPLY_REQUEST_VALUE);
|
||||
|
||||
whiteMsg.add(MessageTypeProto.MessageType.ADVENTURE_BOSSHURT_REQEUST_VALUE);
|
||||
whiteMsg.add(MessageTypeProto.MessageType.USER_FORCE_CHANGE_REQUEST_VALUE);
|
||||
whiteMsg.add(MessageTypeProto.MessageType.ENDLESS_SET_SKIPFIGHT_REQUEST_VALUE);
|
||||
whiteMsg.add(MessageTypeProto.MessageType.GET_QUESTION_REQUEST_VALUE);
|
||||
whiteMsg.add(MessageTypeProto.MessageType.MAIN_LEVEL_GET_INFO_REQUEST_VALUE);
|
||||
whiteMsg.add(MessageTypeProto.MessageType.EXPEDITION_GET_EXPEDITION_REQUEST_VALUE);
|
||||
|
||||
|
||||
|
||||
}
|
||||
// static {
|
||||
// whiteMsg.add(MessageTypeProto.MessageType.MAP_ENTER_REQUEST_VALUE);
|
||||
// whiteMsg.add(MessageTypeProto.MessageType.MAP_START_EXPLORE_REQUEST_VALUE);
|
||||
// whiteMsg.add(MessageTypeProto.MessageType.MAP_UDPATE_REQUEST_VALUE);
|
||||
// whiteMsg.add(MessageTypeProto.MessageType.EVENT_UPDATE_REQUEST_VALUE);
|
||||
// whiteMsg.add(MessageTypeProto.MessageType.MAP_FAST_FIGHT_REQUEST_VALUE);
|
||||
// whiteMsg.add(MessageTypeProto.MessageType.FIGHT_START_REQUEST_VALUE);
|
||||
// whiteMsg.add(MessageTypeProto.MessageType.FIGHT_END_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_USEBOMB_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_SIGN_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_MAP_HERO_INFO_REQUEST_VALUE);
|
||||
//
|
||||
// whiteMsg.add(MessageTypeProto.MessageType.LOGIN_REQUEST_VALUE);
|
||||
// whiteMsg.add(MessageTypeProto.MessageType.GET_PLAYERINFO_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_POKEMON_REQUEST_VALUE);
|
||||
// whiteMsg.add(MessageTypeProto.MessageType.GET_HEROINFO_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_ALL_MAIL_INFO_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_FUNCTIONOFTIME_REQUEST_VALUE);
|
||||
// whiteMsg.add(MessageTypeProto.MessageType.GET_SECRETBOX_REQUEST_VALUE);
|
||||
// whiteMsg.add(MessageTypeProto.MessageType.ADVENTURE_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.ARENA_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.GET_MISSION_REQUEST_VALUE);
|
||||
// whiteMsg.add(MessageTypeProto.MessageType.REFRESH_ITEM_NUM_REQUEST_VALUE);
|
||||
// whiteMsg.add(MessageTypeProto.MessageType.STORE_GOODS_REFRESH_REQUEST_VALUE);
|
||||
// //日后删除
|
||||
// whiteMsg.add(MessageTypeProto.MessageType.GET_CHAT_MESSAGE_REQUEST_VALUE);
|
||||
//
|
||||
// whiteMsg.add(MessageTypeProto.MessageType.BLESS_INFO_REQUEST_VALUE);
|
||||
// whiteMsg.add(MessageTypeProto.MessageType.SERVER_FIVE_REQEUST_VALUE);
|
||||
// whiteMsg.add(MessageTypeProto.MessageType.SERVER_ZERO_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_MEMBER_REQUEST_VALUE);
|
||||
// whiteMsg.add(MessageTypeProto.MessageType.FAMILY_GET_APPLY_REQUEST_VALUE);
|
||||
//
|
||||
// whiteMsg.add(MessageTypeProto.MessageType.ADVENTURE_BOSSHURT_REQEUST_VALUE);
|
||||
// whiteMsg.add(MessageTypeProto.MessageType.USER_FORCE_CHANGE_REQUEST_VALUE);
|
||||
// whiteMsg.add(MessageTypeProto.MessageType.ENDLESS_SET_SKIPFIGHT_REQUEST_VALUE);
|
||||
// whiteMsg.add(MessageTypeProto.MessageType.GET_QUESTION_REQUEST_VALUE);
|
||||
// whiteMsg.add(MessageTypeProto.MessageType.MAIN_LEVEL_GET_INFO_REQUEST_VALUE);
|
||||
// whiteMsg.add(MessageTypeProto.MessageType.EXPEDITION_GET_EXPEDITION_REQUEST_VALUE);
|
||||
//
|
||||
//
|
||||
//
|
||||
// }
|
||||
public ConcurrentLinkedQueue<PacketNetData> handlerLinkedQueue = 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");
|
||||
return;
|
||||
}
|
||||
b = checkIsPermit(msgId, session);
|
||||
if(!b){
|
||||
MessageUtil.sendErrorResponse(session,-1,msgId+1,"在地图探索中,不可以操作");
|
||||
return;
|
||||
}
|
||||
// b = checkIsPermit(msgId, session);
|
||||
// if(!b){
|
||||
// MessageUtil.sendErrorResponse(session,-1,msgId+1,"在地图探索中,不可以操作");
|
||||
// return;
|
||||
// }
|
||||
}
|
||||
|
||||
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 {
|
||||
int uid = session.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
int curMapId = 0;
|
||||
//todo 暂时删除
|
||||
// int curMapId = user.getMapManager().getCurMapId();
|
||||
|
||||
if(curMapId!=0 && msgId == MessageTypeProto.MessageType.TEAM_POS_SAVE_REQUEST_VALUE){
|
||||
SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(curMapId);
|
||||
if(sChallengeConfig.getType()==4){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if(curMapId!=0 && !whiteMsg.contains(msgId)){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// private boolean checkIsPermit(int msgId, ISession session) throws Exception {
|
||||
// int uid = session.getUid();
|
||||
// User user = UserManager.getUser(uid);
|
||||
// int curMapId = 0;
|
||||
// //todo 暂时删除
|
||||
//// int curMapId = user.getMapManager().getCurMapId();
|
||||
//
|
||||
// return true;
|
||||
// }
|
||||
|
||||
|
||||
private boolean checkFunctionIsOpen(int msgId, ISession session ) {
|
||||
|
|
|
@ -43,5 +43,6 @@ public interface VipPrivilegeType {
|
|||
int UNLOCK_GUILD_BOSS_SWEEP = 1002; //公会boss扫荡
|
||||
int EXPEDITION_RELIVE = 1003; //猎妖之路免费复活次数
|
||||
int SIGN_AGAIN = 1005; //每日签到充值后再领一次
|
||||
int ADVENTURE_ADD_TIME = 2002;//挂机时常增加
|
||||
|
||||
}
|
||||
|
|
|
@ -141,6 +141,7 @@ public interface BIReason {
|
|||
int EXCEPTION_TREASURE_REWARD = 77;//天空密境积分奖励
|
||||
|
||||
int PROUD_REWARD = 78;//膜拜获得金币奖励
|
||||
int EQUIP_UNLOAD_REWARD = 79;
|
||||
|
||||
int ADVENTURE_UPLEVEL_CONSUME = 1000;//秘境升级
|
||||
int SECRETBOX_CONSUME = 1001;//秘盒抽卡
|
||||
|
@ -258,6 +259,8 @@ public interface BIReason {
|
|||
int TRIAL_ADD_HP_CONSUME = 1062;//试炼回春散消耗
|
||||
|
||||
int DAILY_SCORE_CONSUME = 1063;//删除日常任务积分
|
||||
int EQUIP_WEAR_CONSUME = 1064;
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -102,9 +102,8 @@ public class HeroNodeGetInfoRequestHandler extends BaseHandler<Expedition.HeroNo
|
|||
for(Map.Entry<Integer,Integer> item : heroNotBufferAttribute.entrySet()){
|
||||
inner.addSpecialEffects(CommonProto.SpecialEffects.newBuilder().setPropertyId(item.getKey()).setPropertyValue(item.getValue()).build());
|
||||
}
|
||||
Map<String, PropertyItem> equipMap = user.getExpeditionManager().getEquipMap();
|
||||
for(String equipId : hero.getEquipByPositionMap().values()){
|
||||
inner.addEquip(CBean2Proto.getEquipProto(equipMap.get(equipId)));
|
||||
for(Integer equipId : hero.getEquipByPositionMap().values()){
|
||||
inner.addEquip(CBean2Proto.getEquipProto(equipId));
|
||||
}
|
||||
inner.setForce(HeroLogic.getInstance().calForce(heroNotBufferAttribute));
|
||||
inner.setHero(CBean2Proto.getHero(hero));
|
||||
|
|
|
@ -71,22 +71,22 @@ public class ReliveExpeditionHeroRequest extends BaseHandler<Expedition.ReliveEx
|
|||
}
|
||||
Set<String> ids = new HashSet<>();
|
||||
// 更新队伍血量
|
||||
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(1001);
|
||||
Iterator<TeamPosHeroInfo> iterator = teamPosHeroInfos.iterator();
|
||||
while (iterator.hasNext()){
|
||||
TeamPosHeroInfo teamPosHeroInfo = iterator.next();
|
||||
Hero hero = user.getHeroManager().getHero(teamPosHeroInfo.getHeroId());
|
||||
if (hero == null) {
|
||||
continue;
|
||||
}
|
||||
ids.add(hero.getId());
|
||||
}
|
||||
//List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(1001);
|
||||
// Iterator<TeamPosHeroInfo> iterator = teamPosHeroInfos.iterator();
|
||||
// while (iterator.hasNext()){
|
||||
// TeamPosHeroInfo teamPosHeroInfo = iterator.next();
|
||||
// Hero hero = user.getHeroManager().getHero(teamPosHeroInfo.getHeroId());
|
||||
// if (hero == null) {
|
||||
// continue;
|
||||
// }
|
||||
// ids.add(hero.getId());
|
||||
// }
|
||||
|
||||
expeditionManager.getHeroHPWithChange().clear();
|
||||
|
||||
//更新节点
|
||||
Expedition.ExpeditionNodeInfoIndication.Builder builder = Expedition.ExpeditionNodeInfoIndication.newBuilder();
|
||||
builder.addAllHeroInfo(ExpeditionLogic.getInstance().getAllHeroInfo(user,ids));
|
||||
builder.addAllHeroInfo(ExpeditionLogic.getInstance().getAllHeroInfo(user,new HashSet<>()));
|
||||
MessageUtil.sendIndicationMessage(iSession, 1, MessageTypeProto.MessageType.EXPEDITION_NOINFO_INDICATION_VALUE, builder.build(), true);
|
||||
|
||||
} else {
|
||||
|
|
|
@ -6,6 +6,8 @@ import com.ljsd.jieling.db.redis.RedisKey;
|
|||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.handler.map.MapLogic;
|
||||
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.activity.ActivityLogic;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
|
@ -177,6 +179,7 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
|||
.addAllDailyChallengeInfo(playerInfoManager.getDailyPass())
|
||||
.setExpeditionLeve(user.getExpeditionManager().getExpeditionLeve())
|
||||
.build();
|
||||
ReportUtil.onReportEvent(user, ReportEventEnum.APP_LOGIN.getType());
|
||||
try {
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GET_PLAYERINFO_RESPONSE_VALUE, getPlayerInfoResponse, true);
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.ljsd.jieling.exception.ErrorCodeException;
|
|||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
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.root.User;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
|
@ -58,8 +59,6 @@ public class ComplexEquipHandler extends BaseHandler<HeroInfoProto.ComplexEquipR
|
|||
if (equipId == 0) {
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||
}
|
||||
Set<String> equipByIDs = ItemLogic.getEquipByID(user, equipId);
|
||||
|
||||
SEquipStarsConfig sEquipStarsConfig = STableManager.getConfig(SEquipStarsConfig.class).get(needStar);
|
||||
if (null == sEquipStarsConfig) {
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||
|
@ -68,58 +67,43 @@ public class ComplexEquipHandler extends BaseHandler<HeroInfoProto.ComplexEquipR
|
|||
if (null == sTargetEquipStarsConfig) {
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||
}
|
||||
int needcount = sEquipStarsConfig.getRankupCount();
|
||||
if (equipByIDs.size() / needcount < proto.getNum()) {
|
||||
//数据不够
|
||||
throw new ErrorCodeException(ErrorCode.UNKNOWN);
|
||||
}
|
||||
|
||||
//check cost
|
||||
int needCount = sEquipStarsConfig.getRankupCount();
|
||||
// //check cost
|
||||
Map<Integer, Integer> consumeMap = new HashMap<>();
|
||||
for (int i = 0; i < proto.getNum(); i++) {
|
||||
int[][] sumConsume = sTargetEquipStarsConfig.getRankupResources();
|
||||
HeroLogic.getInstance().combinedAttribute(sumConsume, consumeMap);
|
||||
int[][] sumConsume = sEquipStarsConfig.getRankupResources();
|
||||
for(int[] consumeArray:sumConsume){
|
||||
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);
|
||||
if (!enough) {
|
||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||
}
|
||||
|
||||
//drop
|
||||
//
|
||||
// //drop
|
||||
int[][] dropItems = new int[1][];
|
||||
dropItems[0] = new int[2];
|
||||
dropItems[0][0] = targetEquip;
|
||||
dropItems[0][1] = proto.getNum();
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, dropItems, BIReason.COMPLEX_EQUIP);
|
||||
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);
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.EQUIP_COMPLEX_RESPONSE_VALUE, response.build(), true);
|
||||
|
||||
} 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, Integer> consumeMap = new HashMap<>();
|
||||
List< CommonProto.Equip> equips = new LinkedList<>();
|
||||
Set<String> newids = new HashSet<>();
|
||||
Map<Integer, Integer> consumeMapTem = new HashMap<>();
|
||||
for (Map.Entry<Integer, Integer> entry : integerIntegerMap.entrySet()) {
|
||||
Map<Integer, Map<Integer, Integer>> equipComplexConfig = STableManager.getFigureConfig(ItemStaticConfig.class).getEuipTppes();
|
||||
|
||||
Map<Integer, Integer> typeComplexMap = new TreeMap<>(equipComplexConfig.getOrDefault(proto.getType(), new HashMap<>()));
|
||||
|
||||
Map<Integer,Integer> consumeMap = new HashMap<>();
|
||||
Map<Integer,Integer> countMap = new HashMap<>();
|
||||
for (Map.Entry<Integer, Integer> entry : typeComplexMap.entrySet()) {
|
||||
//star conf
|
||||
int targetstar = entry.getKey()+1;
|
||||
SEquipStarsConfig sTargetEquipStarsConfig = STableManager.getConfig(SEquipStarsConfig.class).get(targetstar);
|
||||
int targetStar = entry.getKey()+1;
|
||||
SEquipStarsConfig sTargetEquipStarsConfig = STableManager.getConfig(SEquipStarsConfig.class).get(targetStar);
|
||||
if (null == sTargetEquipStarsConfig) {
|
||||
break;
|
||||
}
|
||||
|
@ -128,7 +112,7 @@ public class ComplexEquipHandler extends BaseHandler<HeroInfoProto.ComplexEquipR
|
|||
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) {
|
||||
break;
|
||||
}
|
||||
|
@ -138,54 +122,67 @@ public class ComplexEquipHandler extends BaseHandler<HeroInfoProto.ComplexEquipR
|
|||
}
|
||||
|
||||
|
||||
TreeSet<String> equipByIDs = ItemLogic.getEquipByID(user, equipId);
|
||||
int canConNum =equipByIDs.size()/sEquipStarsConfig.getRankupCount();
|
||||
int equipByIDs = ItemLogic.getEquipByID(user, equipId);
|
||||
int canConNum =(countMap.getOrDefault(equipId,0)+equipByIDs)/sEquipStarsConfig.getRankupCount();
|
||||
if(canConNum<=0){
|
||||
continue;
|
||||
}
|
||||
//check cost
|
||||
boolean enough;
|
||||
int needcount=0;
|
||||
int equipNeedCount=0;
|
||||
|
||||
//进行合成
|
||||
Map<Integer, Integer> consumeMapTem = new HashMap<>();
|
||||
|
||||
for (int i = 0; i < canConNum; i++) {
|
||||
int[][] sumConsume = sEquipStarsConfig.getRankupResources();
|
||||
HeroLogic.getInstance().combinedAttribute(sumConsume, consumeMapTem);
|
||||
enough = ItemUtil.checkCost(user, consumeMapTem);
|
||||
//数组变map
|
||||
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) {
|
||||
break;
|
||||
}
|
||||
|
||||
//生成装备 混合消耗
|
||||
Equip equip = new Equip(user.getId(),targetEquipId);
|
||||
user.getEquipManager().addEquip(user,equip);
|
||||
newids.add(equip.getId());//后面合成可能会被删除
|
||||
|
||||
needcount += sEquipStarsConfig.getRankupCount();
|
||||
HeroLogic.getInstance().combinedAttribute(sumConsume, consumeMap);
|
||||
for(int[] consume:sumConsume){
|
||||
consumeMapTem.put(consume[0],consumeMapTem.getOrDefault(consume[0],0)+consume[1]);
|
||||
}
|
||||
countMap.put(targetEquipId,countMap.getOrDefault(targetEquipId,0)+1);
|
||||
equipNeedCount += sEquipStarsConfig.getRankupCount();
|
||||
// HeroLogic.getInstance().combinedAttribute(sumConsume, consumeMap);
|
||||
}
|
||||
|
||||
|
||||
//消耗装备
|
||||
int i = 1;
|
||||
for (String id : equipByIDs.descendingSet()) {
|
||||
if (i > needcount) {
|
||||
break;
|
||||
int needEquipMax = countMap.getOrDefault(equipId,0)+equipByIDs;
|
||||
if(equipNeedCount>needEquipMax){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}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)){
|
||||
equipadds.add(id);
|
||||
}else {
|
||||
newids.remove(id);
|
||||
}
|
||||
user.getEquipManager().remove(id);
|
||||
i++;
|
||||
}else{
|
||||
consumeMapTem.put(equipId,consumeMapTem.getOrDefault(equipId,0)+equipNeedCount-countMap.getOrDefault(equipId,0));
|
||||
countMap.remove(equipId);
|
||||
}
|
||||
for(Map.Entry<Integer, Integer> consumeEntry:consumeMapTem.entrySet()){
|
||||
consumeMap.put(consumeEntry.getKey(),consumeMap.getOrDefault(consumeEntry.getKey(),0)+consumeEntry.getValue());
|
||||
}
|
||||
}
|
||||
for (String id:newids) {
|
||||
equips.add(CBean2Proto.getEquipProto( user.getEquipManager().getEquipMap().get(id)));
|
||||
int[][] createArray = new int[countMap.size()][];
|
||||
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);
|
||||
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();
|
||||
response.addAllEquipIds(equipadds);
|
||||
response.setDrop(drop);
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.EQUIP_COMPLEX_RESPONSE_VALUE, response.build(), true);
|
||||
}
|
||||
|
|
|
@ -23,6 +23,8 @@ import com.ljsd.jieling.handler.mission.CheckMissionReturn;
|
|||
import com.ljsd.jieling.handler.mission.Mission;
|
||||
import com.ljsd.jieling.ktbeans.KTGameType;
|
||||
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.logic.GlobalDataManaager;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
|
@ -2092,7 +2094,8 @@ public class MapLogic {
|
|||
}
|
||||
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);
|
||||
String fightInfo = fightId + "#" + teamId;
|
||||
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);
|
||||
// RedisUtil.getInstence().zsetAddOne(rankKey, String.valueOf(user.getId()), sMainLevelConfig.getVirtureId());
|
||||
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);
|
||||
}
|
||||
}
|
||||
int[] openRules = sDailyChallengeConfig.getOpenRules();
|
||||
int[][] openRules = sDailyChallengeConfig.getOpenRules();
|
||||
boolean open = true;
|
||||
switch (openRules[0]){
|
||||
case 1:
|
||||
open = playerInfoManager.getLevel()>=openRules[1];
|
||||
break;
|
||||
case 2:
|
||||
open = SMainLevelConfig.biggerThanFight(user.getMainLevelManager().getFightId(),openRules[1]);
|
||||
break;
|
||||
}
|
||||
if(!open){
|
||||
throw new ErrorCodeException(ErrorCode.DAILY_NO_OPEN);
|
||||
for(int[] rule:openRules){
|
||||
switch (rule[0]){
|
||||
case 1:
|
||||
open = playerInfoManager.getLevel()>=rule[1];
|
||||
break;
|
||||
case 2:
|
||||
open = SMainLevelConfig.biggerThanFight(user.getMainLevelManager().getFightId(),rule[1]);
|
||||
break;
|
||||
case 3:
|
||||
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());
|
||||
MapManager mapManager = user.getMapManager();
|
||||
AbstractMap map = getMap(user);
|
||||
CommonProto.Drop.Builder drop = null;
|
||||
//是否在试炼副本中
|
||||
MapInfoProto.GetTrialBoxRewardResponse.Builder response = null;
|
||||
|
||||
if(map instanceof TowerMap){
|
||||
int curXY = mapManager.getCurXY();
|
||||
int floor = mapManager.getTrialInfo().getFloor();
|
||||
TreeMap<Integer, STrialConfig> sTrialConfigMap = (TreeMap<Integer,STrialConfig>)STrialConfig.sTrialConfigMap;
|
||||
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);
|
||||
}
|
||||
MapInfoProto.GetTrialBoxRewardResponse response = MapInfoProto.GetTrialBoxRewardResponse.newBuilder().setBoxDrop(drop).build();
|
||||
MessageUtil.sendMessage(session,1,messageType.getNumber(),response,true);
|
||||
MessageUtil.sendMessage(session,1,messageType.getNumber(),response.build(),true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3194,25 +3204,49 @@ public class MapLogic {
|
|||
* @return
|
||||
* @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();
|
||||
MapInfoProto.GetTrialBoxRewardResponse.Builder response= MapInfoProto.GetTrialBoxRewardResponse.newBuilder();
|
||||
CommonProto.Drop.Builder drop= null;
|
||||
Map<Integer, Cell> mapInfo = mapManager.getMapInfo();
|
||||
if(type==1){
|
||||
List<int[][]> reward = Arrays.asList(boxReward);
|
||||
drop = ItemUtil.drop(user,reward,BIReason.MAP_EVENET_REWARD);
|
||||
for(int[] position:boxPosition){
|
||||
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()) {
|
||||
cell.setPointId(0);
|
||||
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{
|
||||
for(int i = 0 ; i<boxPosition.length;i++){
|
||||
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(cell!=null&&cell.getPointId()==STrialSetting.sTrialSetting.getBoxPointId()) {
|
||||
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 {
|
||||
|
|
|
@ -59,7 +59,7 @@ public class BombGame extends ColorGame {
|
|||
public MapInfoProto.MapGameUpdateResponse updateGame(User user, Object... params) throws Exception {
|
||||
MapGameInfo mapGameInfo = user.getMapManager().getTrialInfo().getMapGameInfo();
|
||||
if(mapGameInfo==null){
|
||||
return null;
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
Set<Integer> operationInfo = mapGameInfo.getOperationInfo();
|
||||
if(operationInfo.size()==3){
|
||||
|
@ -74,7 +74,7 @@ public class BombGame extends ColorGame {
|
|||
|
||||
CommonProto.Drop.Builder drop = null;
|
||||
|
||||
//是否抽到炸弹
|
||||
//是否已经抽取过该位置
|
||||
if(operationInfo.contains((int)params[0]-1)){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
|
@ -88,11 +88,11 @@ public class BombGame extends ColorGame {
|
|||
}else{
|
||||
user.getMapManager().updateMapGameInfo(null);
|
||||
}
|
||||
MapInfoProto.MapGameUpdateResponse response = MapInfoProto.MapGameUpdateResponse.newBuilder().setDrop(drop)
|
||||
.setGameStatus(gameStatus)
|
||||
.setResultId(resultId).build();
|
||||
|
||||
return response;
|
||||
MapInfoProto.MapGameUpdateResponse.Builder response = MapInfoProto.MapGameUpdateResponse.newBuilder().setGameStatus(gameStatus).setResultId(resultId);
|
||||
if(drop!=null){
|
||||
response.setDrop(drop);
|
||||
}
|
||||
return response.build();
|
||||
}
|
||||
//乱序数组
|
||||
private int [] shuffle(int [] arr) {
|
||||
|
|
|
@ -31,7 +31,7 @@ public abstract class ColorGame implements MapGame {
|
|||
if(configs==null||configs.isEmpty()){
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,9 +19,9 @@ public class Cmd_fixequip extends GmAbstract{
|
|||
user.getEquipManager().getEquipMap().values().forEach(equip -> equip.setHeroId(""));
|
||||
Map<String, PropertyItem> equipMap = user.getEquipManager().getEquipMap();
|
||||
user.getHeroManager().getHeroMap().values().forEach(hero -> {
|
||||
Map<Integer, String> equipByPositionMap = hero.getEquipByPositionMap();
|
||||
Map<Integer, Integer> equipByPositionMap = hero.getEquipByPositionMap();
|
||||
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())){
|
||||
removeHeroEquip.add(item.getKey());
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -44,8 +44,8 @@ public class ParamEventBean {
|
|||
public ParamEventBean() {
|
||||
}
|
||||
|
||||
public ParamEventBean(int eveentType){
|
||||
add(eventTypeStringMap.get(eveentType));
|
||||
public ParamEventBean(int eventType){
|
||||
add(eventTypeStringMap.get(eventType));
|
||||
}
|
||||
|
||||
public List<String> getEvent_s() {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -6,6 +6,8 @@ import com.ljsd.jieling.globals.BIReason;
|
|||
import com.ljsd.jieling.globals.Global;
|
||||
import com.ljsd.jieling.jbean.*;
|
||||
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.logic.OnlineUserManager;
|
||||
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));
|
||||
}
|
||||
}
|
||||
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();
|
||||
MessageUtil.sendMessage(session, 1, rewardResponseValue, build, true);
|
||||
return true;
|
||||
|
|
|
@ -13,6 +13,8 @@ import com.ljsd.jieling.jbean.ActivityManager;
|
|||
import com.ljsd.jieling.jbean.ActivityMission;
|
||||
import com.ljsd.jieling.jbean.ActivityProgressInfo;
|
||||
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.activity.event.*;
|
||||
import com.ljsd.jieling.logic.dao.*;
|
||||
|
@ -320,6 +322,7 @@ public class ActivityLogic implements IEventHandler{
|
|||
}
|
||||
|
||||
abstractActivity.initActivity(user);
|
||||
ReportUtil.onReportEvent(user, ReportEventEnum.JOIN_ACTIVITY.getType(),String.valueOf(openActivityId));
|
||||
int activityOpenState = getActivityOpenState(user, openActivityId);
|
||||
abstractActivity.setOpenState(user,activityOpenState);
|
||||
if(activityOpenState == ActivityType.UNOPEN_STATE){
|
||||
|
@ -362,6 +365,7 @@ public class ActivityLogic implements IEventHandler{
|
|||
if (null==abstractActivity) {
|
||||
continue;
|
||||
}
|
||||
ReportUtil.onReportEvent(user, ReportEventEnum.JOIN_ACTIVITY.getType(),String.valueOf(activityId));
|
||||
abstractActivity.initActivity(user);
|
||||
// if(!initOtherActivity(user, sGlobalActivity)){
|
||||
initAllActivityMission(activityManager.getActivityMissionMap(),activityId);
|
||||
|
|
|
@ -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.Poster;
|
||||
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.root.User;
|
||||
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.util.ItemUtil;
|
||||
import config.*;
|
||||
import manager.STableManager;
|
||||
import org.springframework.data.redis.core.ZSetOperations;
|
||||
import util.TimeUtils;
|
||||
|
||||
|
@ -38,6 +40,7 @@ public class LimitRandomCardActivity extends AbstractActivity {
|
|||
public LimitRandomCardActivity(int id) {
|
||||
super(id);
|
||||
Poster.getPoster().listenEvent(this,RandomCardEvent.class);
|
||||
Poster.getPoster().listenEvent(this, RandomMustCardEvent.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -47,27 +50,37 @@ public class LimitRandomCardActivity extends AbstractActivity {
|
|||
|
||||
@Override
|
||||
public void onEvent(IEvent event) throws Exception {
|
||||
if(! (event instanceof RandomCardEvent) ){
|
||||
return;
|
||||
}
|
||||
RandomCardEvent cardEvent =(RandomCardEvent) event;
|
||||
if(cardEvent.getType()!=3){
|
||||
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();
|
||||
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);
|
||||
if(event instanceof RandomCardEvent){
|
||||
RandomCardEvent cardEvent =(RandomCardEvent) event;
|
||||
if(cardEvent.getType()!=3){
|
||||
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();
|
||||
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);
|
||||
|
||||
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);
|
||||
update(UserManager.getUser(cardEvent.getUid()),cardEvent.getScore());
|
||||
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);
|
||||
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
|
||||
void updateProgressWithUser(User user, ActivityMission activityMission, int count) {
|
||||
//150分赠一次
|
||||
// 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);
|
||||
// }
|
||||
super.updateProgressWithUser(user, activityMission, count);
|
||||
activityMission.setV(activityMission.getV()+count);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -13,6 +13,7 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
import java.util.*;
|
||||
|
||||
@Deprecated
|
||||
public class Equip extends PropertyItem implements Cloneable{
|
||||
private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(Equip.class);
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ public class Hero extends MongoBase {
|
|||
|
||||
private int star;
|
||||
|
||||
private Map<Integer,String> equipByPositionMap;
|
||||
private Map<Integer,Integer> equipByPositionMap;
|
||||
|
||||
private Map<Integer,Integer> soulEquipByPositionMap;
|
||||
|
||||
|
@ -60,12 +60,28 @@ public class Hero extends MongoBase {
|
|||
this.id = KeyGenUtils.produceIdByModule(UUIDEnum.HERO, uid);
|
||||
this.templateId = heroTid;
|
||||
this.level = initStar;
|
||||
int[] heroStar = SItem.getsItemMap().get(heroTid).getHeroStar();
|
||||
this.star =heroStar[1] ;
|
||||
SCHero hero1 = SCHero.getsCHero().get(heroTid);
|
||||
int initCfgStar = hero1.getStar();
|
||||
int maxStar = hero1.getMaxRank();
|
||||
if(hero.getStar()<initCfgStar){
|
||||
this.star =initCfgStar;
|
||||
}else if(hero.getStar()>maxStar){
|
||||
this.star=maxStar;
|
||||
}else {
|
||||
this.star = hero.getStar();
|
||||
}
|
||||
|
||||
if(initCfgStar<hero.getStar()){
|
||||
Map<Integer, SCHeroRankUpConfig> scHeroRankUpConfigByType = STableManager.getFigureConfig(HeroStaticConfig.class).getScHeroRankUpConfigByShow(GlobalsDef.UP_STAR_TYPE,initCfgStar);
|
||||
if(scHeroRankUpConfigByType!=null) {
|
||||
SCHeroRankUpConfig scHeroRankUpConfig = scHeroRankUpConfigByType.get(hero.getStar()-1);
|
||||
starBreakId = scHeroRankUpConfig.getId();
|
||||
}
|
||||
}
|
||||
|
||||
this.equipByPositionMap = new HashMap<>();
|
||||
this.soulEquipByPositionMap = hero.soulEquipByPositionMap;
|
||||
this.breakId = hero.breakId;
|
||||
this.starBreakId = hero.starBreakId;
|
||||
this.createTime = (int)(System.currentTimeMillis()/1000);
|
||||
this.speed = hero.speed;
|
||||
this.especialEquipLevel = hero.especialEquipLevel;
|
||||
|
@ -85,10 +101,10 @@ public class Hero extends MongoBase {
|
|||
this.especialEquipLevel = 1;
|
||||
if(initStar!=scHero.getStar()){
|
||||
Map<Integer, SCHeroRankUpConfig> scHeroRankUpConfigByType = STableManager.getFigureConfig(HeroStaticConfig.class).getScHeroRankUpConfigByShow(GlobalsDef.UP_STAR_TYPE,scHero.getStar());
|
||||
if(scHeroRankUpConfigByType!=null) {
|
||||
SCHeroRankUpConfig scHeroRankUpConfig = scHeroRankUpConfigByType.get(initStar-1);
|
||||
starBreakId = scHeroRankUpConfig.getId();
|
||||
}
|
||||
if(scHeroRankUpConfigByType!=null) {
|
||||
SCHeroRankUpConfig scHeroRankUpConfig = scHeroRankUpConfigByType.get(initStar-1);
|
||||
starBreakId = scHeroRankUpConfig.getId();
|
||||
}
|
||||
}
|
||||
|
||||
createTime = (int)(System.currentTimeMillis()/1000);
|
||||
|
@ -144,31 +160,31 @@ public class Hero extends MongoBase {
|
|||
return star;
|
||||
}
|
||||
|
||||
public Map<Integer, String> getEquipByPositionMap() {
|
||||
public Map<Integer, Integer> getEquipByPositionMap() {
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
updateString("equipByPositionMap" ,equipByPositionMap);
|
||||
}
|
||||
|
||||
public void removeEquip(int position){
|
||||
String value = this.equipByPositionMap.get(position);
|
||||
if (value!=null){
|
||||
removeString(getMongoKey()+".equipByPositionMap." + position);
|
||||
this.equipByPositionMap.remove(position);
|
||||
if (!equipByPositionMap.containsKey(position)){
|
||||
return;
|
||||
}
|
||||
removeString(getMongoKey()+".equipByPositionMap." + position);
|
||||
this.equipByPositionMap.remove(position);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -16,10 +16,10 @@ public class StoreInfo extends MongoBase {
|
|||
|
||||
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.id = id;
|
||||
this.lastRefreshTime = System.currentTimeMillis();
|
||||
this.lastRefreshTime = lastRefreshTime;
|
||||
this.startTime = startTime;
|
||||
this.endTime = endTime;
|
||||
this.itemNumMap = itemNumMap;
|
||||
|
|
|
@ -33,10 +33,9 @@ public class StoreManager extends MongoBase {
|
|||
}
|
||||
}
|
||||
|
||||
public StoreInfo newStoreInfo(int id,long startTime,long endTime,Map<Integer,Integer> itemNumMap) throws Exception {
|
||||
StoreInfo storeInfo = new StoreInfo(id,startTime,endTime,itemNumMap);
|
||||
public void newStoreInfo(int id,long lastRefreshTime,long startTime,long endTime,Map<Integer,Integer> itemNumMap) throws Exception {
|
||||
StoreInfo storeInfo = new StoreInfo(id,lastRefreshTime,startTime,endTime,itemNumMap);
|
||||
addStoreInfo(storeInfo);
|
||||
return storeInfo;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,6 +6,8 @@ import com.ljsd.jieling.core.GlobalsDef;
|
|||
import com.ljsd.jieling.db.mongo.MongoUtil;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
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.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.activity.ActivityLogic;
|
||||
|
@ -140,7 +142,8 @@ public class UserManager {
|
|||
playerManager.setMaxForce(force);
|
||||
user.getExpeditionManager().setExpeditionLeve(1);
|
||||
// user.getExpeditionManager().setForceSnap(force);
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserRegister);
|
||||
// KtEventUtils.onKtEvent(user, ParamEventBean.UserRegister);
|
||||
ReportUtil.onReportEvent(user, ReportEventEnum.CREATE_ACCOUNT.getType());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ public class ExpeditionLogic {
|
|||
manager.clearHeroToTemp();
|
||||
manager.getHeroMap().clear();
|
||||
manager.clearEquipToTemp();
|
||||
manager.clearEquip();
|
||||
// manager.clearEquip();
|
||||
manager.getEffectItems().clear();
|
||||
manager.setFreshTime((int)(openTimeOfFuntionCacheByType.getStartTime()/1000));
|
||||
checkAndResetTreasure(user);
|
||||
|
@ -480,10 +480,10 @@ public class ExpeditionLogic {
|
|||
}
|
||||
int ints = staffsSet.size()+1;//默认品质
|
||||
try {
|
||||
ints = MathUtils.randomFromWeight(cfg.getHolyProbability());
|
||||
ints = MathUtils.randomFromWeight(cfg.getHolyProbability());
|
||||
}catch (Exception e){
|
||||
break;
|
||||
// e.printStackTrace();
|
||||
// e.printStackTrace();
|
||||
}
|
||||
Map<Integer, Integer> type2holy2weight = STableManager.getFigureConfig(CommonStaticConfig.class).getType2holy2weight(ints);
|
||||
int i1 = ranndomFromWeight(type2holy2weight);
|
||||
|
@ -747,7 +747,7 @@ public class ExpeditionLogic {
|
|||
}
|
||||
SExpeditionHolyConfig orDefault = effectItems.getOrDefault(sExpeditionHolyConfig.geteffect(), null);
|
||||
if(null!=orDefault&&sExpeditionHolyConfig.gettype()<=orDefault.gettype()){
|
||||
continue;
|
||||
continue;
|
||||
}
|
||||
effectItems.put(sExpeditionHolyConfig.geteffect(),sExpeditionHolyConfig);
|
||||
}
|
||||
|
@ -863,21 +863,18 @@ public class ExpeditionLogic {
|
|||
//random tempid
|
||||
Hero newHero = new Hero(uid,tempid,finalstar,hero);
|
||||
|
||||
EquipManager equipManager = user.getEquipManager();
|
||||
for (Map.Entry<Integer, String> next : hero.getEquipByPositionMap().entrySet()) {
|
||||
String equipId = next.getValue();
|
||||
PropertyItem equip = equipManager.getEquipMap().get(equipId);
|
||||
if (equip == null) {
|
||||
continue;
|
||||
}
|
||||
Equip newequip = new Equip(uid, equip.getEquipId());
|
||||
// if(isTemp){
|
||||
// user.getExpeditionManager().addEquipToTemp(user, newequip);
|
||||
// }else {
|
||||
user.getExpeditionManager().addEquip(user, newequip);
|
||||
// }
|
||||
for (Map.Entry<Integer, Integer> next : hero.getEquipByPositionMap().entrySet()) {
|
||||
int equipId = next.getValue();
|
||||
// if (equip == null) {
|
||||
// continue;
|
||||
// }
|
||||
//// if(isTemp){
|
||||
//// 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 newequip = new Jewel(user.getId(), j.getEquipId());
|
||||
|
||||
// if(isTemp){
|
||||
// user.getExpeditionManager().addEquipToTemp(user, newequip);
|
||||
// }else {
|
||||
user.getExpeditionManager().addEquip(user, newequip);
|
||||
// }
|
||||
// if(isTemp){
|
||||
// user.getExpeditionManager().addEquipToTemp(user, newequip);
|
||||
// }else {
|
||||
user.getExpeditionManager().addEquip(user, newequip);
|
||||
// }
|
||||
newHero.addJewel(newequip.getId());
|
||||
}
|
||||
if(isTemp){
|
||||
|
@ -919,9 +916,30 @@ public class ExpeditionLogic {
|
|||
|
||||
//random ids
|
||||
TreeSet<Integer> tempid = new TreeSet<>();
|
||||
Set<Integer> tempType = new HashSet<>();
|
||||
int i=0;
|
||||
while (tempid.size()<size){
|
||||
if(i>1000){
|
||||
LOGGER.error("getRandomTidException:条件不匹配");
|
||||
break;
|
||||
}
|
||||
int i1 = ranndomFromWeight(cfg);
|
||||
SExpeditionRecruitConfig sExpeditionRecruitConfig = STableManager.getConfig(SExpeditionRecruitConfig.class).get(i1);
|
||||
SCHero hero1 = SCHero.getsCHero().get(sExpeditionRecruitConfig.getHeroId());
|
||||
i++;
|
||||
if(hero1==null){
|
||||
LOGGER.error("英雄配置不存在"+i1);
|
||||
continue;
|
||||
}
|
||||
int propertyName = hero1.getPropertyName();
|
||||
if(tempType.contains(propertyName)){
|
||||
continue;
|
||||
}
|
||||
|
||||
tempid.add(i1);
|
||||
tempType.add(propertyName);
|
||||
i++;
|
||||
|
||||
}
|
||||
return tempid;
|
||||
|
||||
|
|
|
@ -65,36 +65,42 @@ public class CombatLogic {
|
|||
|
||||
|
||||
|
||||
public Map<Integer,Integer> bufferOneHeroAttrAfterEat(Map<Integer,Integer> value,int foodId){
|
||||
SFoodsConfig sFoodsConfig = STableManager.getConfig(SFoodsConfig.class).get(foodId);
|
||||
if(value.get(HeroAttributeEnum.CurHP.getPropertyId()) == 0 || sFoodsConfig.getContiue()!=0){
|
||||
return value;
|
||||
}
|
||||
for(int[] effectPara : sFoodsConfig.getEffectPara()){
|
||||
int effectId = effectPara[0];
|
||||
int effectValue = effectPara[1];
|
||||
SPropertyConfig sPropertyConfig = SPropertyConfig.getsPropertyConfigByPID(effectId);
|
||||
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 = value.get(effectId) * effectValue/10000;
|
||||
public Map<Integer,Integer> bufferOneHeroAttrAfterEat(Map<Integer,Integer> value,int foodId) {
|
||||
List<Integer> foodIds = new ArrayList<>();
|
||||
foodIds.add(foodId);
|
||||
return bufferOneHeroAttrAfterEat(value,foodIds);
|
||||
}
|
||||
public Map<Integer,Integer> bufferOneHeroAttrAfterEat(Map<Integer,Integer> value,List<Integer> foodIds){
|
||||
Map<Integer,Integer> effectValueMap = new HashMap<>();
|
||||
for(int foodId:foodIds){
|
||||
SFoodsConfig sFoodsConfig = STableManager.getConfig(SFoodsConfig.class).get(foodId);
|
||||
if(value.get(HeroAttributeEnum.CurHP.getPropertyId()) == 0 || sFoodsConfig.getContiue()!=0){
|
||||
return value;
|
||||
}
|
||||
for(int[] effectPara : sFoodsConfig.getEffectPara()){
|
||||
int effectId = effectPara[0];
|
||||
int effectValue = effectPara[1];
|
||||
SPropertyConfig sPropertyConfig = SPropertyConfig.getsPropertyConfigByPID(effectId);
|
||||
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)){
|
||||
value.put(effectId,effectValue);
|
||||
continue;
|
||||
}
|
||||
int finalValue = value.get(effectId) + effectValue;
|
||||
}
|
||||
for(Map.Entry<Integer,Integer> entry:effectValueMap.entrySet()){
|
||||
int finalValue = value.get(entry.getKey()) + entry.getValue();
|
||||
if(finalValue < 0){
|
||||
finalValue = 0;
|
||||
}
|
||||
if(effectId == HeroAttributeEnum.CurHP.getPropertyId()){
|
||||
if(entry.getKey() == HeroAttributeEnum.CurHP.getPropertyId()){
|
||||
Integer maxValue = value.get(HeroAttributeEnum.Hp.getPropertyId());
|
||||
if(finalValue>maxValue){
|
||||
finalValue = maxValue;
|
||||
|
@ -103,7 +109,7 @@ public class CombatLogic {
|
|||
finalValue =1;
|
||||
}
|
||||
}
|
||||
value.put( effectId,finalValue );
|
||||
value.put(entry.getKey(),finalValue );
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
@ -910,7 +916,8 @@ public class CombatLogic {
|
|||
Map<Integer, Integer> fightStateInfo = user.getMainLevelManager().getFightStateInfo();
|
||||
SGameSetting gameSetting = STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting();
|
||||
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> baseCardMap = new HashMap<>();
|
||||
Map<Integer, Integer> baseEquipMap = new HashMap<>();
|
||||
|
|
|
@ -218,9 +218,8 @@ public class FightUtil {
|
|||
for(Map.Entry<Integer,Integer> tempProperty:trailHero.getProperty().entrySet()){
|
||||
propertyMap.put(tempProperty.getKey(),tempProperty.getValue());
|
||||
}
|
||||
for(int buffId:buffIds){
|
||||
CombatLogic.getInstance().bufferOneHeroAttrAfterEat(propertyMap,buffId);
|
||||
}
|
||||
CombatLogic.getInstance().bufferOneHeroAttrAfterEat(propertyMap,buffIds);
|
||||
|
||||
}else{
|
||||
propertyMap = trailHero.getProperty();
|
||||
}
|
||||
|
|
|
@ -12,6 +12,8 @@ import com.ljsd.jieling.exception.ErrorCodeException;
|
|||
import com.ljsd.jieling.globals.BIReason;
|
||||
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.eventhandler.HeroFiveStarGetEventHandler;
|
||||
import com.ljsd.jieling.logic.activity.eventhandler.LeveGiftEventHander;
|
||||
|
@ -128,13 +130,13 @@ public class HeroLogic{
|
|||
int uid = iSession.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
List<CommonProto.Equip> equipList = new ArrayList<>();
|
||||
if(type==1){
|
||||
Map<String, PropertyItem> equipMap = user.getEquipManager().getEquipMap();
|
||||
for(PropertyItem equipInfo: equipMap.values()){
|
||||
if(equipInfo instanceof Equip)
|
||||
equipList.add(CBean2Proto.getEquipProto(equipInfo));
|
||||
}
|
||||
}
|
||||
// if(type==1){
|
||||
// Map<String, PropertyItem> equipMap = user.getEquipManager().getEquipMap();
|
||||
// for(PropertyItem equipInfo: equipMap.values()){
|
||||
// if(equipInfo instanceof Equip)
|
||||
// equipList.add(CBean2Proto.getEquipProto(equipInfo));
|
||||
// }
|
||||
// }
|
||||
//宝器
|
||||
if(type==4){
|
||||
Map<String, PropertyItem> equipMap = user.getEquipManager().getEquipMap();
|
||||
|
@ -142,6 +144,8 @@ public class HeroLogic{
|
|||
if(equipInfo instanceof Jewel)
|
||||
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));
|
||||
int result = sLotteryRewardConfig.getId();
|
||||
System.out.print(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()});
|
||||
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 {
|
||||
//是否解锁法宝
|
||||
|
@ -1066,20 +1070,21 @@ public class HeroLogic{
|
|||
skillList.addAll( tempHero.getPassiveSkills(1,hero.getBreakId()));
|
||||
skillList.addAll( tempHero.getPassiveSkills(2,hero.getStarBreakId()));
|
||||
|
||||
Map<Integer, String> equipByPositionMap = hero.getEquipByPositionMap();
|
||||
if(!equipByPositionMap.isEmpty()){
|
||||
Map<String, PropertyItem> equipMap = hero.getCreateType()==1?user.getExpeditionManager().getEquipMap():user.getEquipManager().getEquipMap();
|
||||
for(Integer position : equipSkillPositionTemaplge){
|
||||
String equipId = equipByPositionMap.get(position);
|
||||
if(StringUtil.isEmpty(equipId)){
|
||||
continue;
|
||||
}
|
||||
int skillId = equipMap.get(equipId).getSkill();
|
||||
if(skillId!=0){
|
||||
skillList.add(skillId);
|
||||
}
|
||||
}
|
||||
}
|
||||
//装备没有技能不用计算
|
||||
// Map<Integer, Integer> equipByPositionMap = hero.getEquipByPositionMap();
|
||||
// if(!equipByPositionMap.isEmpty()){
|
||||
// Map<String, PropertyItem> equipMap = hero.getCreateType()==1?user.getExpeditionManager().getEquipMap():user.getEquipManager().getEquipMap();
|
||||
// for(Integer position : equipSkillPositionTemaplge){
|
||||
// Integer equipId = equipByPositionMap.get(position);
|
||||
// if(equipId==null){
|
||||
// continue;
|
||||
// }
|
||||
// int skillId = equipMap.get(equipId).getSkill();
|
||||
// if(skillId!=0){
|
||||
// skillList.add(skillId);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//魂印
|
||||
Map<Integer, Integer> soulEquipByPositionMap = hero.getSoulEquipByPositionMap();
|
||||
Map<Integer, SEquipConfig> config = STableManager.getConfig(SEquipConfig.class);
|
||||
|
@ -1306,22 +1311,17 @@ public class HeroLogic{
|
|||
//装备总战力评分
|
||||
int equipForce=0;
|
||||
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<>();
|
||||
while (iterator.hasNext()){
|
||||
Map.Entry<Integer, String> next = iterator.next();
|
||||
String equipId = next.getValue();
|
||||
PropertyItem equip = equipMap.get(equipId);
|
||||
if(equip == null){
|
||||
needRemove = true;
|
||||
continue;
|
||||
Map.Entry<Integer, Integer> next = iterator.next();
|
||||
SEquipConfig sEquipConfig = STableManager.getConfig(SEquipConfig.class).get(next.getValue());
|
||||
int[][] property = sEquipConfig.getProperty();
|
||||
Map<Integer,Integer> propertyValueByIdMap = new HashMap<>();
|
||||
for(int[] prop:property){
|
||||
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(secondValueByIdMap,heroAllAttribute);
|
||||
SEquipConfig sEquipConfig = STableManager.getConfig(SEquipConfig.class).get(equip.getEquipId());
|
||||
equipForce+=sEquipConfig.getScore();
|
||||
suiteNumByIdMap.put(sEquipConfig.getSuiteID(),suiteNumByIdMap.getOrDefault(sEquipConfig.getSuiteID(),0)+1);
|
||||
}
|
||||
|
@ -1340,11 +1340,11 @@ public class HeroLogic{
|
|||
AyyncWorker ayyncWorker = new AyyncWorker(user,true,user1 -> {
|
||||
Map<String, Hero> heroMap = user1.getHeroManager().getHeroMap();
|
||||
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;
|
||||
while (iterator1.hasNext()){
|
||||
Map.Entry<Integer, String> next = iterator1.next();
|
||||
String equipId = next.getValue();
|
||||
Map.Entry<Integer, Integer> next = iterator1.next();
|
||||
Integer equipId = next.getValue();
|
||||
PropertyItem equip = equipMap.get(equipId);
|
||||
if(equip == null){
|
||||
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()){
|
||||
return false;
|
||||
}
|
||||
Map<String, PropertyItem> equipMap = equipManager.getEquipMap();
|
||||
if(hero==null){
|
||||
return false;
|
||||
}
|
||||
for(String equipId : equipIds){
|
||||
PropertyItem equip =equipMap.get(equipId);
|
||||
if( null == equip || null == hero ){
|
||||
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 equip = Integer.parseInt(equipId);
|
||||
SEquipConfig sEquipConfig = STableManager.getConfig(SEquipConfig.class).get(equip);
|
||||
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();
|
||||
SCHero scHero = SCHero.getsCHero().get(hero.getTemplateId());
|
||||
if(professionLimit!=0 && scHero.getProfession()!= professionLimit){
|
||||
return false;
|
||||
}
|
||||
equipInfos.put(position,equipId);
|
||||
}
|
||||
if(equipInfos.size()!=equipIds.size()){
|
||||
return false;
|
||||
equipInfos.put(position,equip);
|
||||
}
|
||||
return true;
|
||||
|
||||
|
@ -1774,18 +1774,26 @@ public class HeroLogic{
|
|||
Hero hero = user.getHeroManager().getHeroMap().get(heroId);
|
||||
EquipManager equipManager = user.getEquipManager();
|
||||
if(type==1){
|
||||
Map<Integer,String> equipInfoTmp = new HashMap<>(6);
|
||||
if(!checkEquipForWear(hero,user.getEquipManager(),equipIds,equipInfoTmp)){
|
||||
Map<Integer,Integer> equipInfoTmp = new HashMap<>(4);
|
||||
if(!checkEquipForWear(hero,user,equipIds,equipInfoTmp)){
|
||||
throw new ErrorCodeException(ErrorCode.HERO_EQUIP_ERR);
|
||||
}
|
||||
hero.getEquipByPositionMap().forEach((Integer position,String equipId) -> {
|
||||
if(equipInfoTmp.containsKey(position) && !equipId.equals(equipInfoTmp.get(position))){
|
||||
equipManager.getEquipMap().get(equipId).setHeroId("");
|
||||
List<Integer> equipUnload = new ArrayList<>(4);
|
||||
for(Map.Entry<Integer,Integer> entry :hero.getEquipByPositionMap().entrySet()){
|
||||
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);
|
||||
user.getUserMissionManager().onGameEvent(user,GameEvent.WEAR_EQUIP,equipInfoTmp.size());
|
||||
equipIds.forEach(equipId->equipManager.getEquipMap().get(equipId).setHeroId(heroId));
|
||||
}else if(type ==2){
|
||||
for(String jId:equipIds){
|
||||
wearJewel(hero,equipManager,jId);
|
||||
|
@ -1807,7 +1815,7 @@ public class HeroLogic{
|
|||
|
||||
private void wearJewel(Hero hero,EquipManager equipManager,String equipId)throws Exception{
|
||||
Jewel equip =(Jewel)equipManager.getEquipMap().get(equipId);
|
||||
if( null == equip || null == hero ||hero.getJewelInfo().contains(equipId)){
|
||||
if( null == equip || null == hero ){
|
||||
throw new ErrorCodeException(ErrorCode.HERO_EQUIP_ERR);
|
||||
}
|
||||
|
||||
|
@ -1842,25 +1850,32 @@ public class HeroLogic{
|
|||
if( hero == null || equipIds.isEmpty()){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
Map<String, PropertyItem> equipMap = user.getEquipManager().getEquipMap();
|
||||
if(type==1){
|
||||
List<Integer> positions = new ArrayList<>();
|
||||
for(String equipId : equipIds){
|
||||
PropertyItem equip = equipMap.get(equipId);
|
||||
if(null == equip || StringUtil.isEmpty(equip.getHeroId())){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
int equipIdTid = equip.getEquipId();
|
||||
//
|
||||
int equipIdTid =Integer.parseInt(equipId);
|
||||
SEquipConfig sEquipConfig = STableManager.getConfig(SEquipConfig.class).get(equipIdTid);
|
||||
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);
|
||||
}
|
||||
equipIds.forEach(equidId->equipMap.get(equidId).setHeroId(""));
|
||||
|
||||
for(Integer position : positions){
|
||||
hero.removeEquip(position);
|
||||
if(positions.size()==0){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
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){
|
||||
Map<String, PropertyItem> equipMap = user.getEquipManager().getEquipMap();
|
||||
for(String equipId:equipIds){
|
||||
if(!hero.getJewelInfo().contains(equipId)||equipMap.get(equipId)==null){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
|
|
|
@ -581,17 +581,23 @@ public class ItemLogic {
|
|||
}
|
||||
|
||||
/**
|
||||
* 获取指定装备的所有装备 过滤掉已穿戴
|
||||
* 获取指定装备的数量 过滤掉已穿戴
|
||||
* @param user
|
||||
* @param equipid
|
||||
* @return
|
||||
*/
|
||||
public static TreeSet<String> getEquipByID(User user, int equipid) {
|
||||
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 equiplist;
|
||||
public static int getEquipByID(User user, int equipId) throws Exception {
|
||||
Item item = user.getItemManager().getItemMap().get(equipId);
|
||||
if(item==null){
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// 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();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -11,6 +11,8 @@ import com.ljsd.jieling.handler.map.MapLogic;
|
|||
import com.ljsd.jieling.handler.map.MapMission;
|
||||
import com.ljsd.jieling.jbean.ActivityMission;
|
||||
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.logic.activity.ActivityType;
|
||||
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);
|
||||
PlayerInfoProto.TakeMissionRewardResponse build = PlayerInfoProto.TakeMissionRewardResponse.newBuilder().setDrop(drop).build();
|
||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.TAKE_MISSION_REWARD_RESPONSE_VALUE,build,true);
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserTaskEvent,type,missionId);
|
||||
Repot37EventUtil.onKtEvent(user, Repot37EventUtil.Report37EventType.TASK_FINISH_EVEMT,missionId,"");
|
||||
// KtEventUtils.onKtEvent(user, ParamEventBean.UserTaskEvent,type,missionId);
|
||||
// Repot37EventUtil.onKtEvent(user, Repot37EventUtil.Report37EventType.TASK_FINISH_EVEMT,missionId,"");
|
||||
ReportUtil.onReportEvent(user, ReportEventEnum.MISSION_COMPLETE.getType(),missionId,GameMisionType.BLOODYMISSION.toString(),rewardGroup);
|
||||
return;
|
||||
}
|
||||
if(type == GameMisionType.VIPMISSION.getType()){ //vip 任务
|
||||
|
@ -440,10 +443,11 @@ public class MissionLoigc {
|
|||
if(missionStateChangeInfos!=null && !missionStateChangeInfos.isEmpty()){
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, missionStateChangeInfos.get(0).getRewwardGroups(), BIReason.TAKE_MISSION_REWARD);
|
||||
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();
|
||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.TAKE_MISSION_REWARD_RESPONSE_VALUE,build,true);
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserTaskEvent,type,missionId);
|
||||
Repot37EventUtil.onKtEvent(user, Repot37EventUtil.Report37EventType.TASK_FINISH_EVEMT,missionId,"");
|
||||
// KtEventUtils.onKtEvent(user, ParamEventBean.UserTaskEvent,type,missionId);
|
||||
// Repot37EventUtil.onKtEvent(user, Repot37EventUtil.Report37EventType.TASK_FINISH_EVEMT,missionId,"");
|
||||
}else{
|
||||
//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"));
|
||||
|
|
|
@ -246,7 +246,7 @@ public class PlayerLogic {
|
|||
int vipLevel = playerInfoManager.getVipLevel();
|
||||
playerInfoManager.setVipLevel(vipLevel+1);
|
||||
user.getUserMissionManager().onGameEvent(user,GameEvent.VIP_LEVLUP,playerInfoManager.getVipLevel());
|
||||
// CombatLogic.getInstance().getNewAdventureReward(user, true);
|
||||
CombatLogic.getInstance().getNewAdventureReward(user, true,TimeUtils.nowInt());
|
||||
List<CommonProto.UserMissionInfo> missionList = new ArrayList<>();
|
||||
MissionLoigc.getVipMission(user,missionList);
|
||||
CommonProto.VipBaseInfo vipInfoProto = CommonProto.VipBaseInfo.newBuilder()
|
||||
|
@ -654,8 +654,8 @@ public class PlayerLogic {
|
|||
for(String equipId : hero.getJewelInfo()){
|
||||
builder.addEquip(CBean2Proto.getEquipProto(equipMap.get(equipId)));
|
||||
}
|
||||
for(String equipId : hero.getEquipByPositionMap().values()){
|
||||
builder.addEquip(CBean2Proto.getEquipProto(equipMap.get(equipId)));
|
||||
for(int equipId : hero.getEquipByPositionMap().values()){
|
||||
builder.addEquip(CBean2Proto.getEquipProto(equipId));
|
||||
}
|
||||
builder.setForce(HeroLogic.getInstance().calForce(heroNotBufferAttribute));
|
||||
builder.setHero(CBean2Proto.getHero(hero));
|
||||
|
|
|
@ -20,6 +20,7 @@ import java.util.concurrent.TimeUnit;
|
|||
* @discribe
|
||||
*/
|
||||
public class ForceCurrRank extends AbstractRank implements IEventHandler{
|
||||
private static int TRANSPORT_SIZE = 100;
|
||||
|
||||
public ForceCurrRank(int type, String redisKey) {
|
||||
super(type, redisKey);
|
||||
|
@ -62,11 +63,13 @@ public class ForceCurrRank extends AbstractRank implements IEventHandler{
|
|||
int size = infoQueue.size();
|
||||
List<UserMainTeamForceEvent> eventList = new ArrayList<>(size);
|
||||
|
||||
if(size<100){
|
||||
for(int i = 0 ; i < size;i++){
|
||||
eventList.add(infoQueue.poll());
|
||||
}
|
||||
//看队列长度和每次最多传输多少比较,找最小
|
||||
int transport = Math.min(size,TRANSPORT_SIZE);
|
||||
|
||||
for(int i = 0 ; i < transport;i++){
|
||||
eventList.add(infoQueue.poll());
|
||||
}
|
||||
|
||||
Set<Integer> changeId = new HashSet<>();
|
||||
eventList.forEach(n->changeId.add(n.getUid()));
|
||||
changeId.forEach(i-> {
|
||||
|
|
|
@ -285,10 +285,10 @@ public class BuyGoodsLogic {
|
|||
}else {
|
||||
rechargeInfo.putDyGoodsCanBuyTimes(goodsId,dytime);
|
||||
}
|
||||
// List<CommonProto.GiftGoodsInfo> goodsBagInfo = new ArrayList<>(SRechargeCommodityConfig.rechargeCommodityConfigMap.size());
|
||||
// BuyGoodsLogic.getGoodsBagInfo(uid, goodsBagInfo,false);
|
||||
// PlayerInfoProto.AllGiftGoodsIndication build = PlayerInfoProto.AllGiftGoodsIndication.newBuilder().addAllGiftGoodsInfo(goodsBagInfo).build();
|
||||
// MessageUtil.sendIndicationMessage(session,1, MessageTypeProto.MessageType.ALL_GIFTGOODS_INDICATION_VALUE,build,true);
|
||||
List<CommonProto.GiftGoodsInfo> goodsBagInfo = new ArrayList<>(SRechargeCommodityConfig.rechargeCommodityConfigMap.size());
|
||||
BuyGoodsLogic.getGoodsBagInfo(uid, goodsBagInfo,false);
|
||||
PlayerInfoProto.AllGiftGoodsIndication build = PlayerInfoProto.AllGiftGoodsIndication.newBuilder().addAllGiftGoodsInfo(goodsBagInfo).build();
|
||||
MessageUtil.sendIndicationMessage(session,1, MessageTypeProto.MessageType.ALL_GIFTGOODS_INDICATION_VALUE,build,true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -269,7 +269,7 @@ public class StoreLogic implements IEventHandler {
|
|||
return;
|
||||
}
|
||||
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()));
|
||||
}
|
||||
|
||||
|
@ -298,7 +298,7 @@ public class StoreLogic implements IEventHandler {
|
|||
endTime = ToolsUtil.getTimeLong(sStoreTypeConfig.getStartTimeLong(),sStoreTypeConfig.getEndTimeLong(), ActivityType.OPEN_TYPE_SERVER,userCreateTime, 2);
|
||||
}
|
||||
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()));
|
||||
}
|
||||
|
||||
|
@ -319,7 +319,7 @@ public class StoreLogic implements IEventHandler {
|
|||
Map<Integer, Integer> itemNumMap = new LinkedHashMap<>();
|
||||
int rewardId = getRewardId(storeType,sort,user);
|
||||
itemNumMap.put(rewardId, 0);
|
||||
storeManager.newStoreInfo(sStoreTypeConfig.getId(),startTime,endTime,itemNumMap);
|
||||
storeManager.newStoreInfo(sStoreTypeConfig.getId(),System.currentTimeMillis(),startTime,endTime,itemNumMap);
|
||||
}else{
|
||||
Map<Integer, Integer> itemNumMap = storeInfo.getItemNumMap();
|
||||
int rewardId = getRewardId(storeType,sort,user);
|
||||
|
@ -337,13 +337,20 @@ public class StoreLogic implements IEventHandler {
|
|||
Map<Integer, SStoreTypeConfig> sstoreTypeConfigMap = SStoreTypeConfig.getsStoreTypeConfigMap();
|
||||
for ( Map.Entry<Integer, SStoreTypeConfig> entry :sstoreTypeConfigMap.entrySet()){
|
||||
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){
|
||||
TimeControllerOfFunction openTimeOfFuntionCacheByType = GlobalDataManaager.getInstance().getOpenTimeOfFuntionCacheByType(FunctionIdEnum.getFunctionIdEnumByType(sStoreTypeConfig.getOpenLevel()[1]));
|
||||
if(openTimeOfFuntionCacheByType!=null ){
|
||||
StoreInfo storeInfo = storeManager.getStoreInfoMap().get(sStoreTypeConfig.getId());
|
||||
if(storeInfo == null || storeInfo.getStartTime()!=openTimeOfFuntionCacheByType.getStartTime()){
|
||||
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")){
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -79,11 +79,7 @@ public class CBean2Proto {
|
|||
return itemProto;
|
||||
}
|
||||
|
||||
public static CommonProto.Hero getHero(Hero hero){ Map<Integer, String> equipByPositionMap = hero.getEquipByPositionMap();
|
||||
List<String> equipList = new ArrayList<>();
|
||||
if(equipByPositionMap!=null && !equipByPositionMap.isEmpty()){
|
||||
equipList.addAll(equipByPositionMap.values());
|
||||
}
|
||||
public static CommonProto.Hero getHero(Hero hero){
|
||||
List<CommonProto.SoulPos> soulPoss = new ArrayList<>();
|
||||
Map<Integer, Integer> soulEquipMap = hero.getSoulEquipByPositionMap();
|
||||
if(soulEquipMap!=null&&!soulEquipMap.isEmpty()){
|
||||
|
@ -103,7 +99,7 @@ public class CBean2Proto {
|
|||
.setBreakId(hero.getBreakId())
|
||||
.setStarBreakId(hero.getStarBreakId())
|
||||
.setCreateTime(hero.getCreateTime())
|
||||
.addAllEquipIdList(equipList)
|
||||
.addAllEquipIdList(hero.getEquipByPositionMap().values())
|
||||
.setEspecialEquipLevel(hero.getEspecialEquipLevel())
|
||||
.addAllSoulPos(soulPoss)
|
||||
.setLockState(hero.getIsLock())
|
||||
|
@ -165,8 +161,11 @@ public class CBean2Proto {
|
|||
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();
|
||||
for (Item item : temporaryItems.items.values()) {
|
||||
drop.addItemlist(getItem(item,-1));
|
||||
|
|
|
@ -16,6 +16,8 @@ import com.ljsd.jieling.handler.map.MapManager;
|
|||
import com.ljsd.jieling.handler.map.TemporaryItems;
|
||||
import com.ljsd.jieling.jbean.ActivityMission;
|
||||
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.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.activity.ActivityType;
|
||||
|
@ -202,7 +204,7 @@ public class ItemUtil {
|
|||
* @return
|
||||
* @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();
|
||||
Map<Integer, Integer> itemMap = new HashMap<>();
|
||||
Map<Integer, Integer> cardMap = new HashMap<>();
|
||||
|
@ -493,10 +495,10 @@ public class ItemUtil {
|
|||
switch (itemType) {
|
||||
case GlobalItemType.SOUL_MARK:
|
||||
case GlobalItemType.ITEM:
|
||||
case GlobalItemType.EQUIP:
|
||||
return itemMap;
|
||||
case GlobalItemType.CARD:
|
||||
return cardMap;
|
||||
case GlobalItemType.EQUIP:
|
||||
case GlobalItemType.ESPECIAL_EQUIP:
|
||||
case GlobalItemType.JEWEL:
|
||||
return equipMap;
|
||||
|
@ -674,6 +676,7 @@ public class ItemUtil {
|
|||
}
|
||||
playerInfoManager.setExp(curExp);
|
||||
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());
|
||||
}
|
||||
|
||||
|
@ -738,22 +741,6 @@ public class ItemUtil {
|
|||
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());
|
||||
}
|
||||
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);
|
||||
if (dropBuilder != null) {
|
||||
dropBuilder.addAllItemlist(itemProtoList);
|
||||
|
@ -1145,7 +1132,8 @@ public class ItemUtil {
|
|||
if(SItem.getsItemMap().get(scHero.getId()).getQuantity()>=5)
|
||||
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) {
|
||||
case GlobalItemType.ITEM:
|
||||
case GlobalItemType.SOUL_MARK:
|
||||
case GlobalItemType.EQUIP:
|
||||
putcountMap(itemId,itemNum,itemMap);
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -12,7 +12,7 @@ public class SDailyChallengeConfig implements BaseConfig {
|
|||
|
||||
private int type;
|
||||
|
||||
private int[] openRules;
|
||||
private int[][] openRules;
|
||||
|
||||
private int[] reward;
|
||||
|
||||
|
@ -35,7 +35,7 @@ public class SDailyChallengeConfig implements BaseConfig {
|
|||
return type;
|
||||
}
|
||||
|
||||
public int[] getOpenRules() {
|
||||
public int[][] getOpenRules() {
|
||||
return openRules;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue