Merge branch 'master' of http://60.1.1.230/backend/jieling_server
commit
bf36633caf
|
@ -5,6 +5,7 @@ import com.ljsd.common.mogodb.LjsdMongoTemplate;
|
||||||
import com.ljsd.common.mogodb.test.pojo.PlayerForTest;
|
import com.ljsd.common.mogodb.test.pojo.PlayerForTest;
|
||||||
import com.ljsd.jieling.logic.dao.PlayerManager;
|
import com.ljsd.jieling.logic.dao.PlayerManager;
|
||||||
import com.ljsd.jieling.logic.dao.root.User;
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
|
import com.ljsd.jieling.util.MathUtils;
|
||||||
import com.mongodb.DBObject;
|
import com.mongodb.DBObject;
|
||||||
import com.mongodb.MongoClientURI;
|
import com.mongodb.MongoClientURI;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -60,28 +61,23 @@ public class MongoUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static LjsdMongoTemplate getLjsdMongoTemplate() throws UnknownHostException {
|
public static LjsdMongoTemplate getLjsdMongoTemplate() throws UnknownHostException {
|
||||||
SimpleMongoDbFactory simpleMongoDbFactory = new SimpleMongoDbFactory(new MongoClientURI("mongodb://60.1.1.14:27017/jieling_10212"));
|
return MongoUtil.getInstence().getMyMongoTemplate();
|
||||||
DefaultDbRefResolver dbRefResolver = new DefaultDbRefResolver(simpleMongoDbFactory);
|
|
||||||
MappingMongoConverter converter = new MappingMongoConverter(dbRefResolver, new MongoMappingContext());
|
|
||||||
converter.setTypeMapper(new DefaultMongoTypeMapper(null));
|
|
||||||
// MongoTemplate mongoTemplate = new MongoTemplate(simpleMongoDbFactory, converter);
|
|
||||||
/* MappingMongoConverter mongoMapping = (MappingMongoConverter) mongoTemplate.getConverter();
|
|
||||||
mongoMapping.setCustomConversions(customConversions()); // tell mongodb to use the custom converters
|
|
||||||
mongoMapping.afterPropertiesSet();*/
|
|
||||||
return new LjsdMongoTemplate(new MongoTemplate(simpleMongoDbFactory, converter));
|
|
||||||
}
|
}
|
||||||
public List<User> getRandomUsers(int size, int uid, int level) throws Exception {
|
public List<User> getRandomUsers(int size, int uid, int level) throws Exception {
|
||||||
|
if(size <= 0){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
int randomLevel = MathUtils.random(5, 20);
|
||||||
Criteria criatira = new Criteria();
|
Criteria criatira = new Criteria();
|
||||||
Random random = new Random();
|
int minLevel = level - randomLevel;
|
||||||
int minLevel = random.nextInt(level) - 10;
|
|
||||||
minLevel = minLevel <= 5 ? 5 : minLevel;
|
minLevel = minLevel <= 5 ? 5 : minLevel;
|
||||||
int maxLevel = random.nextInt(level) + 10;
|
int maxLevel = level + randomLevel;
|
||||||
long befor3Day = System.currentTimeMillis() - BEFOR_3_DAY;
|
long befor3Day = System.currentTimeMillis() - BEFOR_3_DAY;
|
||||||
|
|
||||||
criatira.andOperator(Criteria.where("id").nin(uid),
|
criatira.andOperator(Criteria.where("id").nin(uid),
|
||||||
Criteria.where("playerManager.level").gte(minLevel), Criteria.where("playerManager.level").lte(maxLevel),
|
Criteria.where("playerManager.level").gte(minLevel), Criteria.where("playerManager.level").lte(maxLevel),
|
||||||
Criteria.where("playerManager.loginTime").gte(befor3Day));//不包含自己
|
Criteria.where("playerManager.loginTime").gte(befor3Day));//不包含自己
|
||||||
Query query = new Query(criatira).limit(size);
|
Query query = new Query(criatira).limit(size*2+1);
|
||||||
query.fields().include("playerManager");
|
query.fields().include("playerManager");
|
||||||
return this.myMongoTemplate.findAllByCondition(query, User.class) ;
|
return this.myMongoTemplate.findAllByCondition(query, User.class) ;
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,6 +74,7 @@ public interface BIReason {
|
||||||
int MONSTERATTACK_BACK = 45; // 妖兽来袭预扣归还
|
int MONSTERATTACK_BACK = 45; // 妖兽来袭预扣归还
|
||||||
|
|
||||||
int FIRST_ADVENTURE_REWARD = 46; // 秘境首次奖励外敌挑战券
|
int FIRST_ADVENTURE_REWARD = 46; // 秘境首次奖励外敌挑战券
|
||||||
|
int UPHERO_DECOMPOS_HERO_REWARD= 47 ;//进阶妖灵师返还奖励
|
||||||
|
|
||||||
//道具消耗原因 1000开头
|
//道具消耗原因 1000开头
|
||||||
int ADVENTURE_UPLEVEL_CONSUME = 1000; //秘境升级
|
int ADVENTURE_UPLEVEL_CONSUME = 1000; //秘境升级
|
||||||
|
|
|
@ -138,7 +138,7 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
||||||
try {
|
try {
|
||||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GET_PLAYERINFO_RESPONSE_VALUE, getPlayerInfoResponse, true);
|
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GET_PLAYERINFO_RESPONSE_VALUE, getPlayerInfoResponse, true);
|
||||||
ActivityLogic.getInstance().flushForLogin(user);
|
ActivityLogic.getInstance().flushForLogin(user);
|
||||||
DoFix.getInstance().loginFix(user);
|
// DoFix.getInstance().loginFix(user);
|
||||||
if(playerInfoManager.getIsdayFirst()==0){
|
if(playerInfoManager.getIsdayFirst()==0){
|
||||||
playerInfoManager.setIsdayFirst(1);
|
playerInfoManager.setIsdayFirst(1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,13 +47,13 @@ public class LoginRequestHandler extends BaseHandler {
|
||||||
LoginParamType.NETWORK_WIFI.equals(loginRequest.getNetworkS()));
|
LoginParamType.NETWORK_WIFI.equals(loginRequest.getNetworkS()));
|
||||||
switch (loginRequest.getPlatformS()){
|
switch (loginRequest.getPlatformS()){
|
||||||
case LoginParamType.PLATFORM_ANDRIOD:
|
case LoginParamType.PLATFORM_ANDRIOD:
|
||||||
paramEnvironmentSimpleBean.setIdfa_s(loginRequest.getIdfaSOrImeiS());
|
paramEnvironmentSimpleBean.setImei_s(loginRequest.getIdfaSOrImeiS());
|
||||||
break;
|
break;
|
||||||
case LoginParamType.PLATFORM_IOS:
|
case LoginParamType.PLATFORM_IOS:
|
||||||
paramEnvironmentSimpleBean.setImei_s(loginRequest.getIdfaSOrImeiS());
|
paramEnvironmentSimpleBean.setIdfa_s(loginRequest.getIdfaSOrImeiS());
|
||||||
break;
|
break;
|
||||||
case LoginParamType.PLATFORM_IOS_YY:
|
case LoginParamType.PLATFORM_IOS_YY:
|
||||||
paramEnvironmentSimpleBean.setImei_s(loginRequest.getIdfaSOrImeiS());
|
paramEnvironmentSimpleBean.setIdfa_s(loginRequest.getIdfaSOrImeiS());
|
||||||
break;
|
break;
|
||||||
case LoginParamType.PLATFORM_PC:
|
case LoginParamType.PLATFORM_PC:
|
||||||
break;
|
break;
|
||||||
|
@ -73,8 +73,17 @@ public class LoginRequestHandler extends BaseHandler {
|
||||||
|
|
||||||
|
|
||||||
//登陆注册入内存
|
//登陆注册入内存
|
||||||
User user = UserManager.userLogin(userId,loginRequest.getOpenId());
|
String openIdFront = loginRequest.getOpenId();
|
||||||
user.getPlayerInfoManager().setOpenId(loginRequest.getOpenId());
|
String[] split = openIdFront.split("\\.");
|
||||||
|
User user = null;
|
||||||
|
if(split.length>=2){
|
||||||
|
String openId = split[0];
|
||||||
|
String chanel = split[1];
|
||||||
|
user = UserManager.userLogin(userId,openId,chanel);
|
||||||
|
}else{
|
||||||
|
user = UserManager.userLogin(userId,openIdFront,"");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
String newToken = UserManager.getNewToken(userId);
|
String newToken = UserManager.getNewToken(userId);
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,8 @@ public class UseAndPriceItemHandler extends BaseHandler {
|
||||||
} else if (type == 2){ //分解装备
|
} else if (type == 2){ //分解装备
|
||||||
ItemLogic.getInstance().decomposeEquip(iSession,equipIdsList);
|
ItemLogic.getInstance().decomposeEquip(iSession,equipIdsList);
|
||||||
}else{
|
}else{
|
||||||
ItemLogic.getInstance().decomposeHero(iSession,heroIdsList);
|
CommonProto.Drop.Builder baseBuilder =ItemLogic.getInstance().decomposeHero(iSession,heroIdsList,null, MessageTypeProto.MessageType.USER_AND_PRICE_ITEM_RESPONSE_VALUE);
|
||||||
|
ItemLogic.sendUseAndPriceItemMessage(iSession, MessageTypeProto.MessageType.USER_AND_PRICE_ITEM_RESPONSE_VALUE, baseBuilder);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,7 +188,7 @@ public class MapLogic {
|
||||||
}
|
}
|
||||||
user.setMapManager(mapManager);
|
user.setMapManager(mapManager);
|
||||||
user.getUserMissionManager().onGameEvent(user,GameEvent.PlAY_STORY,SChallengeConfig.sChallengeConfigs.get(mapId).getType(),1);
|
user.getUserMissionManager().onGameEvent(user,GameEvent.PlAY_STORY,SChallengeConfig.sChallengeConfigs.get(mapId).getType(),1);
|
||||||
Poster.getPoster().dispatchEvent(new StoryEvent(user.getId()));
|
Poster.getPoster().dispatchEvent(new StoryEvent(user.getId(),1));
|
||||||
} else if (mapManager.getCurMapId() != mapId) {
|
} else if (mapManager.getCurMapId() != mapId) {
|
||||||
|
|
||||||
MessageUtil.sendErrorResponse(iSession, 0, messageType.getNumber(), "地图错误,应进入" + mapManager.getCurMapId());
|
MessageUtil.sendErrorResponse(iSession, 0, messageType.getNumber(), "地图错误,应进入" + mapManager.getCurMapId());
|
||||||
|
@ -1813,6 +1813,7 @@ public class MapLogic {
|
||||||
CommonProto.Drop.Builder dropBuilder = ItemUtil.drop(user, sChallengeMapConfig.getSweepingAward(), 1, 0, BIReason.MAP_SWEEP_REWARD);
|
CommonProto.Drop.Builder dropBuilder = ItemUtil.drop(user, sChallengeMapConfig.getSweepingAward(), 1, 0, BIReason.MAP_SWEEP_REWARD);
|
||||||
mapSweepResponse.addDrop(dropBuilder);
|
mapSweepResponse.addDrop(dropBuilder);
|
||||||
}
|
}
|
||||||
|
Poster.getPoster().dispatchEvent(new StoryEvent(user.getId(),count));
|
||||||
user.getUserMissionManager().onGameEvent(user, GameEvent.STORY_FIGHT, mapId,1,count);
|
user.getUserMissionManager().onGameEvent(user, GameEvent.STORY_FIGHT, mapId,1,count);
|
||||||
user.getUserMissionManager().onGameEvent(user, GameEvent.PlAY_STORY, type,count);
|
user.getUserMissionManager().onGameEvent(user, GameEvent.PlAY_STORY, type,count);
|
||||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), mapSweepResponse.build(), true);
|
MessageUtil.sendMessage(session, 1, messageType.getNumber(), mapSweepResponse.build(), true);
|
||||||
|
|
|
@ -16,7 +16,7 @@ public class EatBuffBehavior extends BaseBehavior {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||||
CombatLogic.getInstance().bufferAddByEatFoodOrEventTrigger(user.getMapManager(), behaviorTypeValues[0][0]);
|
CombatLogic.getInstance().bufferAddByEatFoodOrEventTrigger(user, behaviorTypeValues[0][0]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ public class FourtyBehavior extends BaseBehavior {
|
||||||
@Override
|
@Override
|
||||||
public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||||
BehaviorUtil.updateMission(user, eventUpdateResponse);
|
BehaviorUtil.updateMission(user, eventUpdateResponse);
|
||||||
CombatLogic.getInstance().bufferAddByEatFoodOrEventTrigger(user.getMapManager(), behaviorTypeValues[0][0]);
|
CombatLogic.getInstance().bufferAddByEatFoodOrEventTrigger(user, behaviorTypeValues[0][0]);
|
||||||
BehaviorUtil.destoryPoints(user, behaviorTypeValues[1]);
|
BehaviorUtil.destoryPoints(user, behaviorTypeValues[1]);
|
||||||
for (int i = 2; i < behaviorTypeValues.length; i++) {
|
for (int i = 2; i < behaviorTypeValues.length; i++) {
|
||||||
BehaviorUtil.addBehaviorInfo(user,behaviorTypeValues[i][3], user.getMapManager(), behaviorTypeValues[i][0], behaviorTypeValues[i][1], behaviorTypeValues[i][2]);
|
BehaviorUtil.addBehaviorInfo(user,behaviorTypeValues[i][3], user.getMapManager(), behaviorTypeValues[i][0], behaviorTypeValues[i][1], behaviorTypeValues[i][2]);
|
||||||
|
|
|
@ -15,7 +15,7 @@ public class ThirtyFourBehavior extends BaseBehavior {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||||
CombatLogic.getInstance().bufferAddByEatFoodOrEventTrigger(user.getMapManager(), behaviorTypeValues[0][0]);
|
CombatLogic.getInstance().bufferAddByEatFoodOrEventTrigger(user, behaviorTypeValues[0][0]);
|
||||||
BehaviorUtil.destoryPoint(user, behaviorTypeValues[0][1]);
|
BehaviorUtil.destoryPoint(user, behaviorTypeValues[0][1]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ public class ThirtySevenBehavior extends BaseBehavior{
|
||||||
cost[0][0] = behaviorTypeValues[0][0];
|
cost[0][0] = behaviorTypeValues[0][0];
|
||||||
cost[0][1] = behaviorTypeValues[0][1];
|
cost[0][1] = behaviorTypeValues[0][1];
|
||||||
ItemUtil.itemCost(user,cost, BIReason.MAP_CONSUME,user.getMapManager().getCurMapId());
|
ItemUtil.itemCost(user,cost, BIReason.MAP_CONSUME,user.getMapManager().getCurMapId());
|
||||||
CombatLogic.getInstance().bufferAddByEatFoodOrEventTrigger(user.getMapManager(), behaviorTypeValues[0][2]);
|
CombatLogic.getInstance().bufferAddByEatFoodOrEventTrigger(user, behaviorTypeValues[0][2]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,11 @@ public class KtEventUtils {
|
||||||
int itemTotalNum = (int)parm[4];
|
int itemTotalNum = (int)parm[4];
|
||||||
paramEventBean.add(itemUseType[useType]);
|
paramEventBean.add(itemUseType[useType]);
|
||||||
paramEventBean.add(String.valueOf(useReson));
|
paramEventBean.add(String.valueOf(useReson));
|
||||||
|
if(currencyMap.containsKey(itemId)){
|
||||||
|
paramEventBean.add(currencyMap.get(itemId));
|
||||||
|
}else{
|
||||||
paramEventBean.add(String.valueOf(itemId));
|
paramEventBean.add(String.valueOf(itemId));
|
||||||
|
}
|
||||||
paramEventBean.add(String.valueOf(itemNum));
|
paramEventBean.add(String.valueOf(itemNum));
|
||||||
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||||
BILog.info("itemflow {}|{}|{}|{}|{}|{}|{}|{}",user.getId(), playerInfoManager.getLevel(), playerInfoManager.getVipLevel(),useType,useReson,itemId,itemNum,itemTotalNum);
|
BILog.info("itemflow {}|{}|{}|{}|{}|{}|{}|{}",user.getId(), playerInfoManager.getLevel(), playerInfoManager.getVipLevel(),useType,useReson,itemId,itemNum,itemTotalNum);
|
||||||
|
|
|
@ -97,7 +97,13 @@ public class ActivityLogic {
|
||||||
if (endTime != 0 && now > endTime) {
|
if (endTime != 0 && now > endTime) {
|
||||||
if (openActivityIds.contains(sGlobalActivity.getId())) {
|
if (openActivityIds.contains(sGlobalActivity.getId())) {
|
||||||
openActivityIds.remove(sGlobalActivity.getId());
|
openActivityIds.remove(sGlobalActivity.getId());
|
||||||
ActivityTypeEnum.getActicityType(sGlobalActivity.getId()).onActivityEnd();
|
|
||||||
|
AbstractActivity abstractActivity = ActivityTypeEnum.getActicityType(sGlobalActivity.getId());
|
||||||
|
if (null == abstractActivity) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
abstractActivity.onActivityEnd();
|
||||||
|
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -106,6 +112,9 @@ public class ActivityLogic {
|
||||||
|
|
||||||
for (Map.Entry<Integer, ISession> entry : OnlineUserManager.sessionMap.entrySet()) {
|
for (Map.Entry<Integer, ISession> entry : OnlineUserManager.sessionMap.entrySet()) {
|
||||||
User user = UserManager.getUserInMem(entry.getKey());
|
User user = UserManager.getUserInMem(entry.getKey());
|
||||||
|
if(user==null){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
PlayerInfoProto.ActivityUpateIndication.Builder builder = PlayerInfoProto.ActivityUpateIndication.newBuilder();
|
PlayerInfoProto.ActivityUpateIndication.Builder builder = PlayerInfoProto.ActivityUpateIndication.newBuilder();
|
||||||
MissionEventDistributor.requestStart();
|
MissionEventDistributor.requestStart();
|
||||||
Set<Integer> openNews = checkActivityOfUser(user, builder);
|
Set<Integer> openNews = checkActivityOfUser(user, builder);
|
||||||
|
@ -156,7 +165,7 @@ public class ActivityLogic {
|
||||||
activityManager.initAllActivityMission(openActivityId);
|
activityManager.initAllActivityMission(openActivityId);
|
||||||
}
|
}
|
||||||
AbstractActivity abstractActivity = ActivityTypeEnum.getActicityType(openActivityId);
|
AbstractActivity abstractActivity = ActivityTypeEnum.getActicityType(openActivityId);
|
||||||
if (abstractActivity == null) {
|
if (null==abstractActivity) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
abstractActivity.initActivity(user);
|
abstractActivity.initActivity(user);
|
||||||
|
@ -185,7 +194,11 @@ public class ActivityLogic {
|
||||||
if (endTime != 0 && now > endTime) {
|
if (endTime != 0 && now > endTime) {
|
||||||
ActivityMission activityMission = activityMissionMap.get(activityId);
|
ActivityMission activityMission = activityMissionMap.get(activityId);
|
||||||
if (activityMission != null) {
|
if (activityMission != null) {
|
||||||
ActivityTypeEnum.getActicityType(sGlobalActivity.getId()).onActivityEndSelfWithDealReward(user);
|
AbstractActivity abstractActivity = ActivityTypeEnum.getActicityType(sGlobalActivity.getId());
|
||||||
|
if (null==abstractActivity) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
abstractActivity .onActivityEndSelfWithDealReward(user);
|
||||||
activityManager.removeActivity(activityId);
|
activityManager.removeActivity(activityId);
|
||||||
LOGGER.info("the uid={},remove the activity id ={}", user.getId(), activityId);
|
LOGGER.info("the uid={},remove the activity id ={}", user.getId(), activityId);
|
||||||
if (builder != null) {
|
if (builder != null) {
|
||||||
|
@ -206,7 +219,11 @@ public class ActivityLogic {
|
||||||
} else {
|
} else {
|
||||||
ActivityMission activityMission = activityMissionMap.get(activityId);
|
ActivityMission activityMission = activityMissionMap.get(activityId);
|
||||||
if (activityMission != null) {
|
if (activityMission != null) {
|
||||||
ActivityTypeEnum.getActicityType(sGlobalActivity.getId()).onActivityEndSelfWithDealReward(user);
|
AbstractActivity abstractActivity = ActivityTypeEnum.getActicityType(sGlobalActivity.getId());
|
||||||
|
if (null==abstractActivity) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
abstractActivity.onActivityEndSelfWithDealReward(user);
|
||||||
activityManager.removeActivity(activityId);
|
activityManager.removeActivity(activityId);
|
||||||
LOGGER.info("the uid={},remove the activity id ={}", user.getId(), activityId);
|
LOGGER.info("the uid={},remove the activity id ={}", user.getId(), activityId);
|
||||||
if (builder != null) {
|
if (builder != null) {
|
||||||
|
@ -364,7 +381,7 @@ public class ActivityLogic {
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractActivity abstractActivity = ActivityTypeEnum.getActicityType(activityId);
|
AbstractActivity abstractActivity = ActivityTypeEnum.getActicityType(activityId);
|
||||||
if (abstractActivity == null) {
|
if (null==abstractActivity) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ class CopyExpectRankActivity extends ExpectRankActivity {
|
||||||
public void onEvent(IEvent event) throws Exception {
|
public void onEvent(IEvent event) throws Exception {
|
||||||
if (!(event instanceof StoryEvent))
|
if (!(event instanceof StoryEvent))
|
||||||
return;
|
return;
|
||||||
update(UserManager.getUser(((StoryEvent) event).getUid()), 1);
|
update(UserManager.getUser(((StoryEvent) event).getUid()), ((StoryEvent) event).getCount());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,6 +58,9 @@ class RechargeSumDayActivity extends AbstractActivity {
|
||||||
if (value < values[0][1]) {
|
if (value < values[0][1]) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if(activityProgressInfo.getProgrss()!=1){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,12 +6,18 @@ package com.ljsd.jieling.logic.activity.event;
|
||||||
public class StoryEvent implements IEvent {
|
public class StoryEvent implements IEvent {
|
||||||
|
|
||||||
private int uid;
|
private int uid;
|
||||||
|
private int count;
|
||||||
|
|
||||||
public StoryEvent(int uid) {
|
public StoryEvent(int uid, int count) {
|
||||||
this.uid = uid;
|
this.uid = uid;
|
||||||
|
this.count = count;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getUid() {
|
public int getUid() {
|
||||||
return uid;
|
return uid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getCount() {
|
||||||
|
return count;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,6 +80,8 @@ public class PlayerManager extends MongoBase {
|
||||||
|
|
||||||
private int sendDays;
|
private int sendDays;
|
||||||
|
|
||||||
|
private String channel;
|
||||||
|
|
||||||
private Map<Integer,Long> onlineTimeOfDay = new HashMap<>(); // 20190808
|
private Map<Integer,Long> onlineTimeOfDay = new HashMap<>(); // 20190808
|
||||||
|
|
||||||
public PlayerManager(){
|
public PlayerManager(){
|
||||||
|
@ -436,7 +438,7 @@ public class PlayerManager extends MongoBase {
|
||||||
|
|
||||||
public void addOnlineTime(long onlineTime) {
|
public void addOnlineTime(long onlineTime) {
|
||||||
this.onlineTime += onlineTime;
|
this.onlineTime += onlineTime;
|
||||||
setOnlineTimeOfDay(onlineTime);
|
//setOnlineTimeOfDay(onlineTime);
|
||||||
updateString("onlineTime", this.onlineTime);
|
updateString("onlineTime", this.onlineTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -464,6 +466,16 @@ public class PlayerManager extends MongoBase {
|
||||||
updateString("onlineTimeOfDay", this.onlineTimeOfDay);
|
updateString("onlineTimeOfDay", this.onlineTimeOfDay);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getChannel() {
|
||||||
|
return channel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChannel(String channel) {
|
||||||
|
updateString("channel", this.channel);
|
||||||
|
this.channel = channel;
|
||||||
|
}
|
||||||
|
|
||||||
public Map<Integer, Long> getOnlineTimeOfDay() {
|
public Map<Integer, Long> getOnlineTimeOfDay() {
|
||||||
return onlineTimeOfDay;
|
return onlineTimeOfDay;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ import java.util.*;
|
||||||
public class RechargeInfo extends MongoBase{
|
public class RechargeInfo extends MongoBase{
|
||||||
|
|
||||||
private int saveAmt;//累计充值
|
private int saveAmt;//累计充值
|
||||||
|
private int soulCrystalAmt;//累计充值购买魂晶
|
||||||
private int isFirst;
|
private int isFirst;
|
||||||
private long createTime;
|
private long createTime;
|
||||||
private int hadBuyFound;
|
private int hadBuyFound;
|
||||||
|
@ -152,4 +153,13 @@ public class RechargeInfo extends MongoBase{
|
||||||
updateString("goodseSendDailyMap." + goodsType,sendTime);
|
updateString("goodseSendDailyMap." + goodsType,sendTime);
|
||||||
this.goodseSendDailyMap.put(goodsType,sendTime);
|
this.goodseSendDailyMap.put(goodsType,sendTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getSoulCrystalAmt() {
|
||||||
|
return soulCrystalAmt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addSoulCrystalAmt(int soulCrystalAmt) {
|
||||||
|
this.soulCrystalAmt += soulCrystalAmt;
|
||||||
|
updateString("soulCrystalAmt",soulCrystalAmt);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,12 +31,12 @@ public class UserManager {
|
||||||
return userMap.containsKey(uid);
|
return userMap.containsKey(uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static User userLogin(int uid,String openId) throws Exception {
|
public static User userLogin(int uid,String openId,String channel) throws Exception {
|
||||||
User user = null;
|
User user = null;
|
||||||
if (!UserManager.isUserExist(uid)){
|
if (!UserManager.isUserExist(uid)){
|
||||||
user = MongoUtil.getInstence().getMyMongoTemplate().findById(User.getCollectionName(), uid, User.class);
|
user = MongoUtil.getInstence().getMyMongoTemplate().findById(User.getCollectionName(), uid, User.class);
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
user = registerUser(uid,openId);
|
user = registerUser(uid,openId,channel);
|
||||||
}
|
}
|
||||||
UserManager.addUser(user);
|
UserManager.addUser(user);
|
||||||
}else{
|
}else{
|
||||||
|
@ -46,16 +46,16 @@ public class UserManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static User registerUser(int uid,String openId) throws Exception {
|
private static User registerUser(int uid,String openId,String channel) throws Exception {
|
||||||
User user = new User(uid);
|
User user = new User(uid);
|
||||||
initPlayer(user,openId);
|
initPlayer(user,openId,channel);
|
||||||
UserManager.addUser(user);
|
UserManager.addUser(user);
|
||||||
MongoUtil.getInstence().getMyMongoTemplate().save(user);
|
MongoUtil.getInstence().getMyMongoTemplate().save(user);
|
||||||
PlayerLogic.getInstance().sendTestWelfareMail(user,1,1);
|
PlayerLogic.getInstance().sendTestWelfareMail(user,1,1);
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void initPlayer(User user,String openId) throws Exception {
|
private static void initPlayer(User user,String openId,String channel) throws Exception {
|
||||||
SGameSetting gameSetting = SGameSetting.getGameSetting();
|
SGameSetting gameSetting = SGameSetting.getGameSetting();
|
||||||
PlayerManager playerManager = user.getPlayerInfoManager();
|
PlayerManager playerManager = user.getPlayerInfoManager();
|
||||||
long now = TimeUtils.now();
|
long now = TimeUtils.now();
|
||||||
|
@ -70,6 +70,7 @@ public class UserManager {
|
||||||
playerManager.setSendDays(1);
|
playerManager.setSendDays(1);
|
||||||
playerManager.updateVipInfo(user,0);
|
playerManager.updateVipInfo(user,0);
|
||||||
playerManager.setRechargeInfo(new RechargeInfo());
|
playerManager.setRechargeInfo(new RechargeInfo());
|
||||||
|
playerManager.setChannel(channel);
|
||||||
playerManager.setHeadFrame(SGameSetting.getGameSetting().getDefaultPicture());
|
playerManager.setHeadFrame(SGameSetting.getGameSetting().getDefaultPicture());
|
||||||
SPlayerLevelConfig sPlayerLevelConfig = SPlayerLevelConfig.getsPlayerLevelConfigMap().get(1);
|
SPlayerLevelConfig sPlayerLevelConfig = SPlayerLevelConfig.getsPlayerLevelConfigMap().get(1);
|
||||||
playerManager.setMaxStamina(sPlayerLevelConfig.getMaxEnergy());
|
playerManager.setMaxStamina(sPlayerLevelConfig.getMaxEnergy());
|
||||||
|
|
|
@ -8,6 +8,7 @@ import com.ljsd.jieling.db.redis.RedisKey;
|
||||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||||
import com.ljsd.jieling.globals.BIReason;
|
import com.ljsd.jieling.globals.BIReason;
|
||||||
import com.ljsd.jieling.globals.Global;
|
import com.ljsd.jieling.globals.Global;
|
||||||
|
import com.ljsd.jieling.handler.map.EndlessHero;
|
||||||
import com.ljsd.jieling.handler.map.MapManager;
|
import com.ljsd.jieling.handler.map.MapManager;
|
||||||
import com.ljsd.jieling.handler.map.behavior.BehaviorUtil;
|
import com.ljsd.jieling.handler.map.behavior.BehaviorUtil;
|
||||||
import com.ljsd.jieling.ktbeans.KTGameType;
|
import com.ljsd.jieling.ktbeans.KTGameType;
|
||||||
|
@ -19,6 +20,7 @@ import com.ljsd.jieling.logic.activity.event.SecretEvent;
|
||||||
import com.ljsd.jieling.logic.dao.*;
|
import com.ljsd.jieling.logic.dao.*;
|
||||||
import com.ljsd.jieling.logic.dao.root.User;
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
import com.ljsd.jieling.logic.hero.HeroAttributeEnum;
|
import com.ljsd.jieling.logic.hero.HeroAttributeEnum;
|
||||||
|
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||||
import com.ljsd.jieling.logic.mail.MailLogic;
|
import com.ljsd.jieling.logic.mail.MailLogic;
|
||||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||||
import com.ljsd.jieling.logic.store.StoreLogic;
|
import com.ljsd.jieling.logic.store.StoreLogic;
|
||||||
|
@ -114,13 +116,33 @@ public class CombatLogic {
|
||||||
|
|
||||||
return heroAllAttributeMap;
|
return heroAllAttributeMap;
|
||||||
}
|
}
|
||||||
public void bufferAddByEatFoodOrEventTrigger(MapManager mapManager,int foodIdOrEventId) throws Exception {
|
public void bufferAddByEatFoodOrEventTrigger(User user,int foodIdOrEventId) throws Exception {
|
||||||
|
MapManager mapManager = user.getMapManager();
|
||||||
Map<String, Map<Integer, Integer>> heroAllAttributeMap = bufferAddByEatFoodOrEventTrigger(foodIdOrEventId, mapManager.getHeroAllAttributeMap());
|
Map<String, Map<Integer, Integer>> heroAllAttributeMap = bufferAddByEatFoodOrEventTrigger(foodIdOrEventId, mapManager.getHeroAllAttributeMap());
|
||||||
mapManager.setHeroAllAttributeMap(heroAllAttributeMap);
|
mapManager.setHeroAllAttributeMap(heroAllAttributeMap);
|
||||||
SFoodsConfig sFoodsConfig = SFoodsConfig.getsFoodsConfigByFoodId(foodIdOrEventId);
|
SFoodsConfig sFoodsConfig = SFoodsConfig.getsFoodsConfigByFoodId(foodIdOrEventId);
|
||||||
int contiue = sFoodsConfig.getContiue();
|
int contiue = sFoodsConfig.getContiue();
|
||||||
if(contiue==0){
|
if(contiue==0){
|
||||||
contiue=-1;
|
contiue=-1;
|
||||||
|
int teamId = mapManager.getTeamId();
|
||||||
|
List<TeamPosHeroInfo> teamPosHeroInfoList = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
||||||
|
Map<Integer,Integer> foodAddMap = new HashMap<>();
|
||||||
|
getFoodAttributeAdd(GlobalsDef.FOOD_ADDITION_BATTLE_TYPE, GlobalsDef.FOOD_EAT_AFFECT_PERSON, foodAddMap, sFoodsConfig);
|
||||||
|
for (TeamPosHeroInfo heroInfo : teamPosHeroInfoList) {
|
||||||
|
Hero hero = user.getHeroManager().getHero(heroInfo.getHeroId());
|
||||||
|
if (hero == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Map<Integer, Integer> heroAllAttribute = user.getMapManager().getHeroAllAttributeByHeroId(hero.getId());
|
||||||
|
if(heroAllAttribute == null || heroAllAttribute.get(HeroAttributeEnum.CurHP.getPropertyId()) <= 0){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
HeroLogic.getInstance().combinedAttribute(foodAddMap,heroAllAttribute);
|
||||||
|
HeroLogic.getInstance().calInteractAdd(heroAllAttribute);
|
||||||
|
heroAllAttributeMap.put(hero.getId(), heroAllAttribute);
|
||||||
|
}
|
||||||
|
mapManager.setHeroAllAttributeMap(heroAllAttributeMap);
|
||||||
}
|
}
|
||||||
mapManager.eatFood(foodIdOrEventId,contiue);
|
mapManager.eatFood(foodIdOrEventId,contiue);
|
||||||
}
|
}
|
||||||
|
@ -136,6 +158,12 @@ public class CombatLogic {
|
||||||
}
|
}
|
||||||
int foodId = foodBuffer.getKey();
|
int foodId = foodBuffer.getKey();
|
||||||
SFoodsConfig sFoodsConfig = SFoodsConfig.getsFoodsConfigByFoodId(foodId);
|
SFoodsConfig sFoodsConfig = SFoodsConfig.getsFoodsConfigByFoodId(foodId);
|
||||||
|
getFoodAttributeAdd(type, target, foddAddResult, sFoodsConfig);
|
||||||
|
}
|
||||||
|
return foddAddResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void getFoodAttributeAdd(int type, int target, Map<Integer, Integer> foddAddResult, SFoodsConfig sFoodsConfig) {
|
||||||
int typeTmp = sFoodsConfig.getType();
|
int typeTmp = sFoodsConfig.getType();
|
||||||
int targetTmp = sFoodsConfig.getTarget();
|
int targetTmp = sFoodsConfig.getTarget();
|
||||||
if( typeTmp==type && targetTmp==target ){
|
if( typeTmp==type && targetTmp==target ){
|
||||||
|
@ -151,9 +179,6 @@ public class CombatLogic {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return foddAddResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/************** 新挂机*****************/
|
/************** 新挂机*****************/
|
||||||
|
|
|
@ -24,10 +24,7 @@ import com.ljsd.jieling.util.*;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
|
|
||||||
public class FriendLogic {
|
public class FriendLogic {
|
||||||
|
@ -95,18 +92,54 @@ public class FriendLogic {
|
||||||
FriendManager friendManager = user.getFriendManager();
|
FriendManager friendManager = user.getFriendManager();
|
||||||
int selectSize = 10;
|
int selectSize = 10;
|
||||||
Set<Integer> recommondIds = new HashSet<>();
|
Set<Integer> recommondIds = new HashSet<>();
|
||||||
|
Set<Integer> onlineUIds = OnlineUserManager.sessionMap.keySet();
|
||||||
|
int level = playerInfoManager.getLevel();
|
||||||
|
int randomLevel = MathUtils.random(5, 20);
|
||||||
|
List<Integer> recommandFriends = new ArrayList<>();
|
||||||
|
List<CommonProto.Friend> friendList = new CopyOnWriteArrayList<>();
|
||||||
|
for(Integer recommandId : onlineUIds){
|
||||||
|
if(recommandId == uid ){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!checkIsAllowRecommandFriend(friendManager, recommandId,recommondIds)){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
User recommandIdUser = UserManager.getUserInMem(recommandId);
|
||||||
|
int minLevel = level - randomLevel;
|
||||||
|
minLevel = minLevel <= 5 ? 5 : minLevel;
|
||||||
|
int maxLevel = level + randomLevel;
|
||||||
|
int recommandLevel = recommandIdUser.getPlayerInfoManager().getLevel();
|
||||||
|
if(recommandLevel < minLevel || recommandLevel > maxLevel){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
recommondIds.add(recommandId);
|
||||||
|
recommandFriends.add(recommandId);
|
||||||
|
selectSize--;
|
||||||
|
if(selectSize<=0){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Collections.shuffle(recommandFriends);
|
||||||
|
|
||||||
|
|
||||||
List<User> cUsers = MongoUtil.getInstence().getRandomUsers(selectSize, uid, playerInfoManager.getLevel());
|
List<User> cUsers = MongoUtil.getInstence().getRandomUsers(selectSize, uid, playerInfoManager.getLevel());
|
||||||
if (cUsers != null){
|
if (cUsers != null){
|
||||||
|
Collections.shuffle(cUsers);
|
||||||
for (User cUser1 : cUsers) {
|
for (User cUser1 : cUsers) {
|
||||||
int recommandId = cUser1.getId();
|
int recommandId = cUser1.getId();
|
||||||
if (!checkIsAllowRecommandFriend(friendManager, recommandId,recommondIds)){
|
if (!checkIsAllowRecommandFriend(friendManager, recommandId,recommondIds)){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
recommondIds.add(recommandId);
|
recommondIds.add(recommandId);
|
||||||
|
recommandFriends.add(recommandId);
|
||||||
|
selectSize--;
|
||||||
|
if(selectSize<=0){
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<CommonProto.Friend> friendList = new CopyOnWriteArrayList<>();
|
}
|
||||||
for (Integer commondUid : recommondIds){
|
|
||||||
|
for (Integer commondUid : recommandFriends){
|
||||||
CommonProto.Friend friend = CBean2Proto.getFriendInfo(commondUid,friendManager);
|
CommonProto.Friend friend = CBean2Proto.getFriendInfo(commondUid,friendManager);
|
||||||
friendList.add(friend);
|
friendList.add(friend);
|
||||||
}
|
}
|
||||||
|
@ -298,9 +331,7 @@ public class FriendLogic {
|
||||||
@Override
|
@Override
|
||||||
public void work(User user) throws Exception {
|
public void work(User user) throws Exception {
|
||||||
boolean isOnline = OnlineUserManager.checkUidOnline(user.getId());
|
boolean isOnline = OnlineUserManager.checkUidOnline(user.getId());
|
||||||
if(isOnline){
|
|
||||||
MissionEventDistributor.requestStart();
|
MissionEventDistributor.requestStart();
|
||||||
}
|
|
||||||
user.getUserMissionManager().onGameEvent(user, GameEvent.FRIEND_NUMS, 1);
|
user.getUserMissionManager().onGameEvent(user, GameEvent.FRIEND_NUMS, 1);
|
||||||
if(isOnline){
|
if(isOnline){
|
||||||
ISession session = OnlineUserManager.getSessionByUid(user.getId());
|
ISession session = OnlineUserManager.getSessionByUid(user.getId());
|
||||||
|
@ -420,7 +451,7 @@ public class FriendLogic {
|
||||||
User friendUser = UserManager.getUser(friendId);
|
User friendUser = UserManager.getUser(friendId);
|
||||||
FriendManager friendManager1 = friendUser.getFriendManager();
|
FriendManager friendManager1 = friendUser.getFriendManager();
|
||||||
Map<Integer, Integer> haveRewardMap = friendUser.getFriendManager().getHaveRewardMap();
|
Map<Integer, Integer> haveRewardMap = friendUser.getFriendManager().getHaveRewardMap();
|
||||||
if (haveRewardMap.get(uid) != 0) {
|
if (haveRewardMap.containsKey(uid) && haveRewardMap.get(uid) != 0) {
|
||||||
MessageUtil.sendErrorResponse(iSession, 0, msgId, "已经赠送过");
|
MessageUtil.sendErrorResponse(iSession, 0, msgId, "已经赠送过");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -439,14 +470,14 @@ public class FriendLogic {
|
||||||
User friendUser = UserManager.getUser(friendUserId);
|
User friendUser = UserManager.getUser(friendUserId);
|
||||||
FriendManager friendManager1 = friendUser.getFriendManager();
|
FriendManager friendManager1 = friendUser.getFriendManager();
|
||||||
Map<Integer, Integer> haveRewardMap = friendManager1.getHaveRewardMap();
|
Map<Integer, Integer> haveRewardMap = friendManager1.getHaveRewardMap();
|
||||||
if (haveRewardMap.get(uid) != 0) {
|
if (haveRewardMap.containsKey(uid) && haveRewardMap.get(uid) != 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
friendManager.updateGiveMap(friendUserId,1);
|
friendManager.updateGiveMap(friendUserId,1);
|
||||||
boolean check = friendUser.getPlayerInfoManager().check(SGameSetting.getGameSetting().getMaxEnergyGet(), 0);
|
boolean check = friendUser.getPlayerInfoManager().check(SGameSetting.getGameSetting().getMaxEnergyGet(), 0);
|
||||||
if(check){
|
if(check){
|
||||||
friendManager1.updateHaveRewardMap(uid,1);
|
friendManager1.updateHaveRewardMap(uid,1);
|
||||||
sendFriendStatedication(uid,friendId,2);
|
sendFriendStatedication(uid,friendUserId,2);
|
||||||
times++;
|
times++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -481,7 +512,7 @@ public class FriendLogic {
|
||||||
MessageUtil.sendErrorResponse(iSession, 0, msgId, "没有该好友");
|
MessageUtil.sendErrorResponse(iSession, 0, msgId, "没有该好友");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (haveRewardMap.get(friendId) !=1){
|
if (haveRewardMap.containsKey(friendId) && haveRewardMap.get(friendId) !=1){
|
||||||
MessageUtil.sendErrorResponse(iSession, 0, msgId, "已领取赠礼");
|
MessageUtil.sendErrorResponse(iSession, 0, msgId, "已领取赠礼");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -492,7 +523,7 @@ public class FriendLogic {
|
||||||
receieveFriends.add(friendId);
|
receieveFriends.add(friendId);
|
||||||
}else{
|
}else{
|
||||||
for (Integer friend : friends) {
|
for (Integer friend : friends) {
|
||||||
if (haveRewardMap.get(friend) != 1) {
|
if (haveRewardMap.containsKey(friend) && haveRewardMap.get(friend) != 1) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
check = playerInfoManager.check(SGameSetting.getGameSetting().getMaxEnergyGet(), 1);
|
check = playerInfoManager.check(SGameSetting.getGameSetting().getMaxEnergyGet(), 1);
|
||||||
|
@ -570,6 +601,7 @@ public class FriendLogic {
|
||||||
User user = UserManager.getUser(uid);
|
User user = UserManager.getUser(uid);
|
||||||
FriendManager friendManager = user.getFriendManager();
|
FriendManager friendManager = user.getFriendManager();
|
||||||
Map<Integer, Integer> giveMap = friendManager.getGiveMap();
|
Map<Integer, Integer> giveMap = friendManager.getGiveMap();
|
||||||
|
friendManager.setHaveRewardMap(new HashMap<>());
|
||||||
for (Map.Entry<Integer,Integer> entry: giveMap.entrySet()){
|
for (Map.Entry<Integer,Integer> entry: giveMap.entrySet()){
|
||||||
Integer friendId = entry.getKey();
|
Integer friendId = entry.getKey();
|
||||||
User friendUser = UserManager.getUser(friendId);
|
User friendUser = UserManager.getUser(friendId);
|
||||||
|
|
|
@ -4,15 +4,21 @@ import com.ljsd.GameApplication;
|
||||||
import com.ljsd.jieling.chat.logic.ChatLogic;
|
import com.ljsd.jieling.chat.logic.ChatLogic;
|
||||||
import com.ljsd.jieling.config.*;
|
import com.ljsd.jieling.config.*;
|
||||||
import com.ljsd.jieling.core.GlobalsDef;
|
import com.ljsd.jieling.core.GlobalsDef;
|
||||||
|
import com.ljsd.jieling.core.HandlerLogicThread;
|
||||||
import com.ljsd.jieling.core.VipPrivilegeType;
|
import com.ljsd.jieling.core.VipPrivilegeType;
|
||||||
|
import com.ljsd.jieling.db.mongo.MongoUtil;
|
||||||
import com.ljsd.jieling.globals.BIReason;
|
import com.ljsd.jieling.globals.BIReason;
|
||||||
import com.ljsd.jieling.globals.Global;
|
import com.ljsd.jieling.globals.Global;
|
||||||
|
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||||
import com.ljsd.jieling.logic.activity.event.HeroUpStarEvent;
|
import com.ljsd.jieling.logic.activity.event.HeroUpStarEvent;
|
||||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||||
import com.ljsd.jieling.logic.dao.*;
|
import com.ljsd.jieling.logic.dao.*;
|
||||||
import com.ljsd.jieling.logic.dao.root.User;
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
import com.ljsd.jieling.logic.fight.CombatLogic;
|
import com.ljsd.jieling.logic.fight.CombatLogic;
|
||||||
|
import com.ljsd.jieling.logic.item.ItemLogic;
|
||||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||||
|
import com.ljsd.jieling.logic.mission.event.MissionEventDistributor;
|
||||||
|
import com.ljsd.jieling.network.server.ProtocolsManager;
|
||||||
import com.ljsd.jieling.network.session.ISession;
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
import com.ljsd.jieling.protocols.CommonProto;
|
import com.ljsd.jieling.protocols.CommonProto;
|
||||||
import com.ljsd.jieling.protocols.HeroInfoProto;
|
import com.ljsd.jieling.protocols.HeroInfoProto;
|
||||||
|
@ -626,12 +632,13 @@ public class HeroLogic {
|
||||||
}
|
}
|
||||||
|
|
||||||
//删除hero
|
//删除hero
|
||||||
recyleHeroBySystem(user,removeHeroIds);
|
CommonProto.Drop.Builder baseBuilder = ItemLogic.getInstance().decomposeHero(session,new LinkedList<>(removeHeroIds),Collections.singleton(26),MessageTypeProto.MessageType.UP_HERO_STAR_RESPONSE_VALUE);
|
||||||
|
// recyleHeroBySystem(user,removeHeroIds);
|
||||||
targetHero.upStar( 1 );
|
targetHero.upStar( 1 );
|
||||||
Poster.getPoster().dispatchEvent(new HeroUpStarEvent(user.getId(),targetHero.getStar()));
|
Poster.getPoster().dispatchEvent(new HeroUpStarEvent(user.getId(),targetHero.getStar()));
|
||||||
targetHero.setStarBreakId(scHeroRankUpConfig.getId());
|
targetHero.setStarBreakId(scHeroRankUpConfig.getId());
|
||||||
user.getUserMissionManager().onGameEvent(user,GameEvent.HERO_UP,2,targetHero.getTemplateId(),targetHero.getStar());
|
user.getUserMissionManager().onGameEvent(user,GameEvent.HERO_UP,2,targetHero.getTemplateId(),targetHero.getStar());
|
||||||
MessageUtil.sendMessage(session,1,MessageTypeProto.MessageType.UP_HERO_STAR_RESPONSE_VALUE,null,true);
|
MessageUtil.sendMessage(session,1,MessageTypeProto.MessageType.UP_HERO_STAR_RESPONSE_VALUE,baseBuilder.build(),true);
|
||||||
if(targetHero.getStar()>=7){
|
if(targetHero.getStar()>=7){
|
||||||
String message = SErrorCodeEerverConfig.getI18NMessage("lamp_rankup_hero_content", new Object[]{user.getPlayerInfoManager().getNickName(), scHero.getReadingName(),targetHero.getStar()});
|
String message = SErrorCodeEerverConfig.getI18NMessage("lamp_rankup_hero_content", new Object[]{user.getPlayerInfoManager().getNickName(), scHero.getReadingName(),targetHero.getStar()});
|
||||||
ChatLogic.getInstance().sendSysChatMessage(message,Global.DILIGENT,targetHero.getTemplateId(),0,0,0,0,0);
|
ChatLogic.getInstance().sendSysChatMessage(message,Global.DILIGENT,targetHero.getTemplateId(),0,0,0,0,0);
|
||||||
|
@ -912,7 +919,7 @@ public class HeroLogic {
|
||||||
public Map<Integer,Integer> calHeroNotBufferAttribute(User user, Hero hero,boolean isForce,int teamId){
|
public Map<Integer,Integer> calHeroNotBufferAttribute(User user, Hero hero,boolean isForce,int teamId){
|
||||||
Map<Integer, Integer> heroAllAttribute = calHeroAllAttribute(hero,isForce);
|
Map<Integer, Integer> heroAllAttribute = calHeroAllAttribute(hero,isForce);
|
||||||
heroAllAttribute.put(HeroAttributeEnum.CurHP.getPropertyId(),heroAllAttribute.get(GlobalsDef.HP_TYPE));
|
heroAllAttribute.put(HeroAttributeEnum.CurHP.getPropertyId(),heroAllAttribute.get(GlobalsDef.HP_TYPE));
|
||||||
Collection<String> values = hero.getEquipByPositionMap().values();
|
|
||||||
EquipManager equipManager = user.getEquipManager();
|
EquipManager equipManager = user.getEquipManager();
|
||||||
PokemonManager pokemonManager = user.getPokemonManager();
|
PokemonManager pokemonManager = user.getPokemonManager();
|
||||||
SCHero scHero = SCHero.getsCHero().get(hero.getTemplateId());
|
SCHero scHero = SCHero.getsCHero().get(hero.getTemplateId());
|
||||||
|
@ -936,8 +943,16 @@ public class HeroLogic {
|
||||||
}
|
}
|
||||||
//装备总战力评分
|
//装备总战力评分
|
||||||
int equipForce=0;
|
int equipForce=0;
|
||||||
for(String equipId:values){
|
boolean needRemove = false;
|
||||||
|
Iterator<Map.Entry<Integer, String>> iterator = hero.getEquipByPositionMap().entrySet().iterator();
|
||||||
|
while (iterator.hasNext()){
|
||||||
|
Map.Entry<Integer, String> next = iterator.next();
|
||||||
|
String equipId = next.getValue();
|
||||||
Equip equip = equipManager.getEquipMap().get(equipId);
|
Equip equip = equipManager.getEquipMap().get(equipId);
|
||||||
|
if(equip == null){
|
||||||
|
needRemove = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
Map<Integer, Integer> propertyValueByIdMap = equip.getPropertyValueByIdMap();
|
Map<Integer, Integer> propertyValueByIdMap = equip.getPropertyValueByIdMap();
|
||||||
Map<Integer, Integer> secondValueByIdMap = equip.getSecondValueByIdMap();
|
Map<Integer, Integer> secondValueByIdMap = equip.getSecondValueByIdMap();
|
||||||
// LOGGER.info("cal equip = {}",equip.getEquipId());
|
// LOGGER.info("cal equip = {}",equip.getEquipId());
|
||||||
|
@ -945,7 +960,33 @@ public class HeroLogic {
|
||||||
combinedAttribute(secondValueByIdMap,heroAllAttribute);
|
combinedAttribute(secondValueByIdMap,heroAllAttribute);
|
||||||
SEquipConfig sEquipConfig = SEquipConfig.getsEquipConfigById(equip.getEquipId());
|
SEquipConfig sEquipConfig = SEquipConfig.getsEquipConfigById(equip.getEquipId());
|
||||||
equipForce+=sEquipConfig.getScore();
|
equipForce+=sEquipConfig.getScore();
|
||||||
// LOGGER.info("cal equip = {} end",equip.getEquipId());
|
}
|
||||||
|
if(needRemove){
|
||||||
|
AyyncWorker ayyncWorker = new AyyncWorker(user,true) {
|
||||||
|
@Override
|
||||||
|
public void work(User user) throws Exception {
|
||||||
|
Map<String, Hero> heroMap = user.getHeroManager().getHeroMap();
|
||||||
|
for(Hero heroTmp : heroMap.values()){
|
||||||
|
Iterator<Map.Entry<Integer, String>> iterator = heroTmp.getEquipByPositionMap().entrySet().iterator();
|
||||||
|
boolean isUpate = false;
|
||||||
|
while (iterator.hasNext()){
|
||||||
|
Map.Entry<Integer, String> next = iterator.next();
|
||||||
|
String equipId = next.getValue();
|
||||||
|
Equip equip = equipManager.getEquipMap().get(equipId);
|
||||||
|
if(equip == null){
|
||||||
|
iterator.remove();
|
||||||
|
isUpate = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(isUpate){
|
||||||
|
heroTmp.setEquipByPositionMap(heroTmp.getEquipByPositionMap());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
ProtocolsManager instance = ProtocolsManager.getInstance();
|
||||||
|
HandlerLogicThread handlerThread = instance.handlerThreads[user.getId() % instance.HANDLER_THREAD_NUM];
|
||||||
|
handlerThread.addAyyncWorker(ayyncWorker);
|
||||||
}
|
}
|
||||||
//天赋异妖加成
|
//天赋异妖加成
|
||||||
Map<Integer, Pokemon> ringFireMap = pokemonManager.getRingFireMap();
|
Map<Integer, Pokemon> ringFireMap = pokemonManager.getRingFireMap();
|
||||||
|
@ -1079,7 +1120,7 @@ public class HeroLogic {
|
||||||
return heroAllAttribute;
|
return heroAllAttribute;
|
||||||
}
|
}
|
||||||
//食物buffer加成
|
//食物buffer加成
|
||||||
Map<Integer, Integer> foodAddMap = CombatLogic.getInstance().attributeByEatFood(user,GlobalsDef.FOOD_ADDITION_BATTLE_TYPE, GlobalsDef.FOOD_EAT_AFFECT_TEAM);
|
Map<Integer, Integer> foodAddMap = CombatLogic.getInstance().attributeByEatFood(user,GlobalsDef.FOOD_ADDITION_BATTLE_TYPE, GlobalsDef.FOOD_EAT_AFFECT_PERSON);
|
||||||
if(foodAddMap.isEmpty()){
|
if(foodAddMap.isEmpty()){
|
||||||
return heroAllAttribute;
|
return heroAllAttribute;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,10 +15,7 @@ import com.ljsd.jieling.util.*;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class ItemLogic {
|
public class ItemLogic {
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(ItemLogic.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(ItemLogic.class);
|
||||||
|
@ -92,7 +89,7 @@ public class ItemLogic {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendUseAndPriceItemMessage(ISession iSession, int msgId, CommonProto.Drop.Builder drop) {
|
public static void sendUseAndPriceItemMessage(ISession iSession, int msgId, CommonProto.Drop.Builder drop) {
|
||||||
PlayerInfoProto.UseAndPriceItemResponse useAndPriceItemResponse = PlayerInfoProto.UseAndPriceItemResponse.newBuilder()
|
PlayerInfoProto.UseAndPriceItemResponse useAndPriceItemResponse = PlayerInfoProto.UseAndPriceItemResponse.newBuilder()
|
||||||
.setDrop(drop)
|
.setDrop(drop)
|
||||||
.build();
|
.build();
|
||||||
|
@ -200,20 +197,20 @@ public class ItemLogic {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分解卡牌
|
* 分解卡牌|进阶消耗
|
||||||
* @param iSession
|
* @param iSession
|
||||||
* @param heroIdsList
|
* @param heroIdsList
|
||||||
*/
|
*/
|
||||||
public void decomposeHero(ISession iSession, List<String> heroIdsList) throws Exception {
|
public CommonProto.Drop.Builder decomposeHero(ISession iSession, List<String> heroIdsList,Set<Integer> filterItem,int msgId) throws Exception {
|
||||||
int msgId = MessageTypeProto.MessageType.USER_AND_PRICE_ITEM_RESPONSE_VALUE;
|
|
||||||
int uid = iSession.getUid();
|
int uid = iSession.getUid();
|
||||||
|
CommonProto.Drop.Builder baseBuilder = CommonProto.Drop.newBuilder();
|
||||||
User user = UserManager.getUser(uid);
|
User user = UserManager.getUser(uid);
|
||||||
HeroManager heroManager = user.getHeroManager();
|
HeroManager heroManager = user.getHeroManager();
|
||||||
StringBuilder reward = new StringBuilder();
|
StringBuilder reward = new StringBuilder();
|
||||||
String erroMags = checkHeroResolve(heroIdsList,user);
|
String erroMags = checkHeroResolve(heroIdsList,user);
|
||||||
if (!erroMags.isEmpty()){
|
if (!erroMags.isEmpty()){
|
||||||
MessageUtil.sendErrorResponse(iSession,0,msgId,erroMags);
|
MessageUtil.sendErrorResponse(iSession,0,msgId,erroMags);
|
||||||
return;
|
return baseBuilder;
|
||||||
}
|
}
|
||||||
//1裸角色卡(没有突破过的角色卡)熔炼后返还的材料=当前等级返还升级材料+item表返还材料
|
//1裸角色卡(没有突破过的角色卡)熔炼后返还的材料=当前等级返还升级材料+item表返还材料
|
||||||
//2有过突破的卡 =当前等级返还升级材料+突破表返还材料
|
//2有过突破的卡 =当前等级返还升级材料+突破表返还材料
|
||||||
|
@ -248,10 +245,21 @@ public class ItemLogic {
|
||||||
reward.append("#").append(sItem.getResolveReward());
|
reward.append("#").append(sItem.getResolveReward());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
int reson =BIReason.DECOMPOS_HERO_REWARD;
|
||||||
|
if(null!=filterItem){
|
||||||
|
reson= BIReason.UPHERO_DECOMPOS_HERO_REWARD;
|
||||||
|
|
||||||
|
for (Integer id:filterItem){
|
||||||
|
if(baseItemMap.containsKey(id)){
|
||||||
|
baseItemMap.remove(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// filterItem.retainAll(baseItemMap.keySet());
|
||||||
|
// filterItem.forEach(baseItemMap::remove);
|
||||||
|
}
|
||||||
ItemUtil.combineReward(user,StringUtil.parseFiledInt(reward.toString()),1,baseItemMap,baseCardMap,baseEquipMap,baseRandomMap);
|
ItemUtil.combineReward(user,StringUtil.parseFiledInt(reward.toString()),1,baseItemMap,baseCardMap,baseEquipMap,baseRandomMap);
|
||||||
CommonProto.Drop.Builder baseBuilder = CommonProto.Drop.newBuilder();
|
ItemUtil.drop(user,baseBuilder,baseItemMap,baseCardMap,baseEquipMap,baseRandomMap, reson);
|
||||||
ItemUtil.drop(user,baseBuilder,baseItemMap,baseCardMap,baseEquipMap,baseRandomMap, BIReason.DECOMPOS_HERO_REWARD);
|
return baseBuilder;
|
||||||
sendUseAndPriceItemMessage(iSession, msgId, baseBuilder);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String checkHeroResolve(List<String> heroIdsList,User user){
|
private String checkHeroResolve(List<String> heroIdsList,User user){
|
||||||
|
|
|
@ -71,8 +71,8 @@ public class MailLogic {
|
||||||
if (size > Global.MAIL_BOX_CAPACITY){
|
if (size > Global.MAIL_BOX_CAPACITY){
|
||||||
Collections.sort(cMailList, Comparator.comparingInt(Mail::getSendTime));
|
Collections.sort(cMailList, Comparator.comparingInt(Mail::getSendTime));
|
||||||
for(int i = 0; i < (size - Global.MAIL_BOX_CAPACITY); i++){
|
for(int i = 0; i < (size - Global.MAIL_BOX_CAPACITY); i++){
|
||||||
cMailList.remove(0);
|
|
||||||
mailManager.removeMail(cMailList.get(0).getId());
|
mailManager.removeMail(cMailList.get(0).getId());
|
||||||
|
cMailList.remove(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
getAllMailProtoList(cMailList,mailList);
|
getAllMailProtoList(cMailList,mailList);
|
||||||
|
@ -192,6 +192,10 @@ public class MailLogic {
|
||||||
// mail.setState(Global.MAIL_DRAW_ST_GOT);
|
// mail.setState(Global.MAIL_DRAW_ST_GOT);
|
||||||
// mailManager.addMail(mail);
|
// mailManager.addMail(mail);
|
||||||
}
|
}
|
||||||
|
if(mailItem.length()==0){
|
||||||
|
MessageUtil.sendErrorResponse(iSession,0,msgId,"该邮件没有附件可以领取");
|
||||||
|
return;
|
||||||
|
}
|
||||||
int[][] itemArr = StringUtil.parseFiledInt2(mailItem.toString());
|
int[][] itemArr = StringUtil.parseFiledInt2(mailItem.toString());
|
||||||
boolean isLimit = ItemUtil.checkCardAndEquipLimit(user,itemArr);
|
boolean isLimit = ItemUtil.checkCardAndEquipLimit(user,itemArr);
|
||||||
if (isLimit){
|
if (isLimit){
|
||||||
|
|
|
@ -171,6 +171,13 @@ public class BuyGoodsLogic {
|
||||||
}
|
}
|
||||||
if(sRechargeCommodityConfig.getAccumulativeRecharge() == 1){
|
if(sRechargeCommodityConfig.getAccumulativeRecharge() == 1){
|
||||||
int saveAmt = rechargeInfo.getSaveAmt();
|
int saveAmt = rechargeInfo.getSaveAmt();
|
||||||
|
|
||||||
|
int[][] costItemArr = StringUtil.parseFiledInt2(rewardStr);
|
||||||
|
for (int i = 0; i <costItemArr.length ; i++) {
|
||||||
|
if(costItemArr[i][0]==Global.SOULCRYSTAL){
|
||||||
|
rechargeInfo.addSoulCrystalAmt(costItemArr[i][1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
rechargeInfo.setSaveAmt(price+saveAmt);
|
rechargeInfo.setSaveAmt(price+saveAmt);
|
||||||
user.getPlayerInfoManager().addRechargedaily(price);
|
user.getPlayerInfoManager().addRechargedaily(price);
|
||||||
//TODO 用事件分发
|
//TODO 用事件分发
|
||||||
|
|
|
@ -274,7 +274,7 @@ public class CBean2Proto {
|
||||||
if (giveMap.size() != 0 && giveMap.containsKey(friendId)){
|
if (giveMap.size() != 0 && giveMap.containsKey(friendId)){
|
||||||
isGrive = giveMap.get(friendId);
|
isGrive = giveMap.get(friendId);
|
||||||
}
|
}
|
||||||
if (haveRewardMap.size() != 0 && giveMap.containsKey(friendId)){
|
if (haveRewardMap.size() != 0 && giveMap.containsKey(friendId) && haveRewardMap.containsKey(friendId)){
|
||||||
haveReward = haveRewardMap.get(friendId) ==2?0:haveRewardMap.get(friendId);
|
haveReward = haveRewardMap.get(friendId) ==2?0:haveRewardMap.get(friendId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,9 @@ public class ItemUtil {
|
||||||
currencyMap.add(Global.GEM);
|
currencyMap.add(Global.GEM);
|
||||||
currencyMap.add(Global.GOLD);
|
currencyMap.add(Global.GOLD);
|
||||||
currencyMap.add(Global.SOULCRYSTAL);
|
currencyMap.add(Global.SOULCRYSTAL);
|
||||||
|
currencyMap.add(Global.DEVILJADE);//妖灵玉
|
||||||
|
currencyMap.add(Global.ELITEPROOF);//精英证明
|
||||||
|
currencyMap.add(Global.HEARTFIRE);//心火明晶
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void initNoDelete(){
|
public static void initNoDelete(){
|
||||||
|
|
Loading…
Reference in New Issue