Merge branch 'online_1121'
# Conflicts: # serverlogic/src/main/java/com/ljsd/jieling/handler/map/MapLogic.javaback_recharge
commit
4d4ccd4703
|
|
@ -48,12 +48,12 @@ public class GmService implements RPCRequestGMIFace.Iface {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if(cmd.contains("restartthread")){
|
if(cmd.contains("restartthread")){
|
||||||
Field configurableApplicationContextField = GameApplication.class.getDeclaredField("configurableApplicationContext");
|
LOGGER.info("restartthread....");
|
||||||
configurableApplicationContextField.setAccessible(true);
|
HandlerLogicThread handlerLogicThread = new HandlerLogicThread();
|
||||||
ConfigurableApplicationContext configurableApplicationContext =(ConfigurableApplicationContext) configurableApplicationContextField.get(GameApplication.class);
|
ProtocolsManager.getInstance().handlerThreads[Integer.parseInt(arg[1].trim())] = handlerLogicThread;
|
||||||
DataReportTask bean = configurableApplicationContext.getBean(DataReportTask.class);
|
handlerLogicThread.setPriority(9);//优先级最高
|
||||||
bean.start();
|
handlerLogicThread.setName("h-" + Integer.parseInt(arg[1].trim()));
|
||||||
result.setResultCode(1);
|
handlerLogicThread.start();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -110,10 +110,11 @@ public class ChatLogic {
|
||||||
char[] original = unSymbolWord.toCharArray();
|
char[] original = unSymbolWord.toCharArray();
|
||||||
char[] tmpChar = tmp.toCharArray();
|
char[] tmpChar = tmp.toCharArray();
|
||||||
int j=0;
|
int j=0;
|
||||||
|
int length = original.length;
|
||||||
char[] result = new char[chars.length];
|
char[] result = new char[chars.length];
|
||||||
for(int i=0;i<chars.length;i++){
|
for(int i=0;i<chars.length;i++){
|
||||||
char c= chars[i];
|
char c= chars[i];
|
||||||
if(original[j] == chars[i]){
|
if(j<length && original[j] == chars[i]){
|
||||||
c = tmpChar[j];
|
c = tmpChar[j];
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -64,8 +64,8 @@ public class Repot37EventUtil {
|
||||||
report37CheckChat.setUid(String.valueOf(user.getPlayerInfoManager().getOpenId()));//uid
|
report37CheckChat.setUid(String.valueOf(user.getPlayerInfoManager().getOpenId()));//uid
|
||||||
report37CheckChat.setActor_name(user.getPlayerInfoManager().getNickName());
|
report37CheckChat.setActor_name(user.getPlayerInfoManager().getNickName());
|
||||||
report37CheckChat.setActor_id(String.valueOf(user.getId()));
|
report37CheckChat.setActor_id(String.valueOf(user.getId()));
|
||||||
report37CheckChat.setGid(String.valueOf(user.getPlayerInfoManager().getGid()));
|
report37CheckChat.setGid(SDK37Constans.gid);
|
||||||
report37CheckChat.setPid(String.valueOf(user.getPlayerInfoManager().getPid()));
|
report37CheckChat.setPid(SDK37Constans.pid);
|
||||||
report37CheckChat.setDsid(String.valueOf(GameApplication.serverId));
|
report37CheckChat.setDsid(String.valueOf(GameApplication.serverId));
|
||||||
report37CheckChat.setType(parm[0].toString());//类型
|
report37CheckChat.setType(parm[0].toString());//类型
|
||||||
report37CheckChat.setContent(parm[1].toString());//内容
|
report37CheckChat.setContent(parm[1].toString());//内容
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.ljsd.jieling.handler.activity;
|
||||||
|
|
||||||
import com.ljsd.jieling.handler.BaseHandler;
|
import com.ljsd.jieling.handler.BaseHandler;
|
||||||
import com.ljsd.jieling.logic.activity.ActivityLogic;
|
import com.ljsd.jieling.logic.activity.ActivityLogic;
|
||||||
|
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||||
import com.ljsd.jieling.network.session.ISession;
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.ljsd.jieling.handler.activity;
|
package com.ljsd.jieling.handler.activity;
|
||||||
|
|
||||||
import com.ljsd.jieling.handler.BaseHandler;
|
import com.ljsd.jieling.handler.BaseHandler;
|
||||||
|
import com.ljsd.jieling.logic.activity.AbstractActivity;
|
||||||
import com.ljsd.jieling.logic.activity.ActivityLogic;
|
import com.ljsd.jieling.logic.activity.ActivityLogic;
|
||||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||||
import com.ljsd.jieling.network.session.ISession;
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
|
|
@ -17,6 +18,8 @@ public class BlessInfoHandler extends BaseHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||||
|
///
|
||||||
ActivityLogic.getInstance().blessInfo(iSession,MessageTypeProto.MessageType.BLESS_INFO_RESPONSE);
|
ActivityLogic.getInstance().blessInfo(iSession,MessageTypeProto.MessageType.BLESS_INFO_RESPONSE);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,5 +27,7 @@ public class BlessSaveRewardHandler extends BaseHandler {
|
||||||
info[i] = rewardIdsList.get(i);
|
info[i] = rewardIdsList.get(i);
|
||||||
}
|
}
|
||||||
ActivityLogic.getInstance().blessSaveOptionalReward(iSession,info,MessageTypeProto.MessageType.BLESS_SAVE_REWARD_RESPONSE);
|
ActivityLogic.getInstance().blessSaveOptionalReward(iSession,info,MessageTypeProto.MessageType.BLESS_SAVE_REWARD_RESPONSE);
|
||||||
|
////
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1228,7 +1228,6 @@ public class MapLogic {
|
||||||
groupId = newGroupId;
|
groupId = newGroupId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(user.getMapManager().getCurMapId());
|
SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(user.getMapManager().getCurMapId());
|
||||||
int mostTime = sChallengeConfig.getMostTime();
|
int mostTime = sChallengeConfig.getMostTime();
|
||||||
PVEFightEvent pveFightEvent = new PVEFightEvent(uid, mapManager.getTeamId(), mostTime, "", GameFightType.MapFastFight, groupId, 3);
|
PVEFightEvent pveFightEvent = new PVEFightEvent(uid, mapManager.getTeamId(), mostTime, "", GameFightType.MapFastFight, groupId, 3);
|
||||||
|
|
@ -1424,6 +1423,7 @@ public class MapLogic {
|
||||||
}
|
}
|
||||||
FightInfoProto.FightStartResponse.Builder fightStartResponse = FightInfoProto.FightStartResponse.newBuilder();
|
FightInfoProto.FightStartResponse.Builder fightStartResponse = FightInfoProto.FightStartResponse.newBuilder();
|
||||||
SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId());
|
SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId());
|
||||||
|
LOGGER.info("EventId为{},groupId为{}",bigEventId,groupId);
|
||||||
BehaviorUtil.getFightInfo(user, groupId, fightStartResponse, pointId, sChallengeConfig.getMostTime(), true);
|
BehaviorUtil.getFightInfo(user, groupId, fightStartResponse, pointId, sChallengeConfig.getMostTime(), true);
|
||||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightStartResponse.build(), true);
|
MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightStartResponse.build(), true);
|
||||||
}
|
}
|
||||||
|
|
@ -1520,8 +1520,10 @@ public class MapLogic {
|
||||||
fightEndResponse.addAllRemainHpList(remainHp);
|
fightEndResponse.addAllRemainHpList(remainHp);
|
||||||
fightEndResponse.setLastXY(mapManager.getLastXY());
|
fightEndResponse.setLastXY(mapManager.getLastXY());
|
||||||
mapManager.setCurXY(mapManager.getLastXY());
|
mapManager.setCurXY(mapManager.getLastXY());
|
||||||
if (SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType() == 2) {
|
if(mapManager.getCurMapId()!=0){
|
||||||
fightEndResponse.setLastTowerTime((int) (mapManager.getCurrTowerTime() / 1000));
|
if (SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType() == 2) {
|
||||||
|
fightEndResponse.setLastTowerTime((int) (mapManager.getCurrTowerTime() / 1000));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sOptionConfig != null) {
|
if (sOptionConfig != null) {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package com.ljsd.jieling.handler.store;
|
package com.ljsd.jieling.handler.store;
|
||||||
|
|
||||||
|
import com.ljsd.GameApplication;
|
||||||
|
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||||
import com.ljsd.jieling.handler.BaseHandler;
|
import com.ljsd.jieling.handler.BaseHandler;
|
||||||
import com.ljsd.jieling.logic.store.BuyGoodsLogic;
|
import com.ljsd.jieling.logic.store.BuyGoodsLogic;
|
||||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||||
|
|
@ -17,6 +19,11 @@ public class TestBuyGiftGoodsHandler extends BaseHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||||
|
|
||||||
|
if(!GameApplication.serverProperties.isDebug()){
|
||||||
|
throw new ErrorCodeException("In a formal setting");
|
||||||
|
}
|
||||||
|
|
||||||
PlayerInfoProto.TestBuyGiftGoodsRequest testBuyGiftGoodsRequest = PlayerInfoProto.TestBuyGiftGoodsRequest.parseFrom(netData.parseClientProtoNetData());
|
PlayerInfoProto.TestBuyGiftGoodsRequest testBuyGiftGoodsRequest = PlayerInfoProto.TestBuyGiftGoodsRequest.parseFrom(netData.parseClientProtoNetData());
|
||||||
BuyGoodsLogic.testBuyGoods(iSession,testBuyGiftGoodsRequest.getGoodsId());
|
BuyGoodsLogic.testBuyGoods(iSession,testBuyGiftGoodsRequest.getGoodsId());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
package com.ljsd.jieling.kefu;
|
||||||
|
|
||||||
|
import com.ljsd.jieling.db.mongo.MongoUtil;
|
||||||
|
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||||
|
import com.ljsd.jieling.logic.dao.UserManager;
|
||||||
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
|
import com.ljsd.jieling.network.server.ProtocolsManager;
|
||||||
|
import com.ljsd.jieling.util.AyncWorkerRunnable;
|
||||||
|
import com.ljsd.jieling.util.AyyncWorker;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class Cmd_fixindb extends GmAbstract{
|
||||||
|
@Override
|
||||||
|
public boolean exec(String[] args) throws Exception {
|
||||||
|
List<User> userList = MongoUtil.getInstence().getMyMongoTemplate().findAll(User.getCollectionName(), User.class);
|
||||||
|
userList.forEach(user -> {
|
||||||
|
try {
|
||||||
|
User userInMem = UserManager.getUser(user.getId());
|
||||||
|
AyyncWorker ayyncWorker = new AyyncWorker(userInMem, true, new AyncWorkerRunnable() {
|
||||||
|
@Override
|
||||||
|
public void work(User user) throws Exception {
|
||||||
|
MongoUtil.getLjsdMongoTemplate().save(user);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ProtocolsManager.getInstance().updateAyncWorker(ayyncWorker);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -705,10 +705,129 @@ public class ActivityLogic {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int getBlessActivityId(User user){
|
||||||
|
Map<Integer, ActivityMission> activityMissionMap = user.getActivityManager().getActivityMissionMap();
|
||||||
|
for(Integer activityId:activityMissionMap.keySet()){
|
||||||
|
if(SGlobalActivity.getsGlobalActivityMap().get(activityId).getType()==ActivityType.BLESSACTIVITY){
|
||||||
|
return activityId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 云梦抽取
|
||||||
|
*
|
||||||
|
* @param session
|
||||||
|
* @param locationId
|
||||||
|
* @param messageType
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public void blessChoose(ISession session, int locationId, MessageTypeProto.MessageType messageType) throws Exception {
|
||||||
|
User user = UserManager.getUser(session.getUid());
|
||||||
|
int blessActivityId = getBlessActivityId(user);
|
||||||
|
if(blessActivityId==0){
|
||||||
|
throw new ErrorCodeException(ErrorCode.ACTIVITY_NOT_OPEN);
|
||||||
|
}
|
||||||
|
ActivityMission activityMission = user.getActivityManager().getActivityMissionMap().get(blessActivityId);
|
||||||
|
if (activityMission == null) {
|
||||||
|
throw new ErrorCodeException(ErrorCode.ACTIVITY_NOT_OPEN);
|
||||||
|
}
|
||||||
|
Map<Integer, ActivityProgressInfo> activityProgressInfoMap = activityMission.getActivityProgressInfoMap();
|
||||||
|
if (activityProgressInfoMap.get(locationId + BlessInfoConfig.START_CAPACITY).getProgrss() != 0) {
|
||||||
|
throw new ErrorCodeException(ErrorCode.newDefineCode("已经抽过改格子"));
|
||||||
|
}
|
||||||
|
int resultRewardId = 0;
|
||||||
|
if (activityProgressInfoMap.get(BlessInfoConfig.BLESS_PROGRESS_STATUS).getProgrss() == -1) {
|
||||||
|
Map<Integer, SBlessingRewardPool> poolMap = STableManager.getConfig(SBlessingRewardPool.class);
|
||||||
|
int[][] result = new int[BlessInfoConfig.START_CAPACITY][];
|
||||||
|
int index = 0;
|
||||||
|
for (Map.Entry<Integer, ActivityProgressInfo> entry : activityProgressInfoMap.entrySet()) {
|
||||||
|
if (entry.getKey() > BlessInfoConfig.START_CAPACITY) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
int[] temp = new int[2];
|
||||||
|
temp[0] = entry.getValue().getProgrss();
|
||||||
|
temp[1] = poolMap.get(entry.getValue().getProgrss()).getExtractWeight();
|
||||||
|
result[index] = temp;
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
int[] order = MathUtils.randomFromWeightWithTaking(result, BlessInfoConfig.START_CAPACITY);
|
||||||
|
for (int i = 0; i < order.length; i++) {
|
||||||
|
LOGGER.info("获取顺序{}", order[i]);
|
||||||
|
}
|
||||||
|
index = 0;
|
||||||
|
for (Map.Entry<Integer, ActivityProgressInfo> entry : activityProgressInfoMap.entrySet()) {
|
||||||
|
if (entry.getKey() > BlessInfoConfig.START_CAPACITY) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
ActivityProgressInfo progress = new ActivityProgressInfo();
|
||||||
|
progress.setProgrss(order[index]);
|
||||||
|
activityMission.updateProgressInfo(entry.getKey(), progress);
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
activityMission.updateProgressInfo(BlessInfoConfig.BLESS_PROGRESS_STATUS, new ActivityProgressInfo(1, 0));
|
||||||
|
}
|
||||||
|
//检验消耗道具
|
||||||
|
int[][] costConfig = SBlessingConfig.blessingConfigMap.get(blessActivityId).getCost();
|
||||||
|
int[][] cost = new int[1][];
|
||||||
|
int[] temp = new int[2];
|
||||||
|
temp[0] = costConfig[0][0];
|
||||||
|
temp[1] = (int) MathUtils.calABX(activityProgressInfoMap.get(BlessInfoConfig.BLESS_PROGRESS_STATUS).getProgrss(), costConfig[1]);
|
||||||
|
cost[0] = temp;
|
||||||
|
LOGGER.info("本次为第{}次抽取,消耗{}个数为{}", activityProgressInfoMap.get(BlessInfoConfig.BLESS_PROGRESS_STATUS).getProgrss(), temp[0], temp[1]);
|
||||||
|
boolean costResult = ItemUtil.itemCost(user, cost, BIReason.BLESS_CHOOSE_CONSUME, 1);
|
||||||
|
if (!costResult) {
|
||||||
|
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||||
|
}
|
||||||
|
if (activityProgressInfoMap.get(BlessInfoConfig.BLESS_PROGRESS_STATUS).getProgrss() > 0) {
|
||||||
|
for (Map.Entry<Integer, ActivityProgressInfo> entry : activityProgressInfoMap.entrySet()) {
|
||||||
|
if (entry.getKey() > BlessInfoConfig.START_CAPACITY) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (entry.getValue().getProgrss() == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
resultRewardId = entry.getValue().getProgrss();
|
||||||
|
ActivityProgressInfo progress = new ActivityProgressInfo();
|
||||||
|
progress.setProgrss(entry.getValue().getProgrss());
|
||||||
|
activityMission.updateProgressInfo(locationId + BlessInfoConfig.START_CAPACITY, progress);
|
||||||
|
activityMission.updateProgressInfo(entry.getKey(), new ActivityProgressInfo());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
LOGGER.info("本次抽取的Id为{}", resultRewardId);
|
||||||
|
Map<Integer, SBlessingRewardPool> poolMap = STableManager.getConfig(SBlessingRewardPool.class);
|
||||||
|
int[][] dropItem = new int[1][];
|
||||||
|
for (Integer count : SBlessingConfig.blessingConfigMap.get(blessActivityId).getCounts()) {
|
||||||
|
if (count != activityProgressInfoMap.get(BlessInfoConfig.BLESS_PROGRESS_STATUS).getProgrss()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
dropItem = new int[2][];
|
||||||
|
dropItem[1] = poolMap.get(activityProgressInfoMap.get(BlessInfoConfig.COUNT_REWARD_START_ID + count).getProgrss()).getReward();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
int[] reward = poolMap.get(resultRewardId).getReward();
|
||||||
|
dropItem[0] = reward;
|
||||||
|
CommonProto.Drop.Builder drop = ItemUtil.dropPer(user, dropItem, BIReason.BLESS_REWARD);
|
||||||
|
activityMission.updateProgressInfo(BlessInfoConfig.BLESS_PROGRESS_STATUS, new ActivityProgressInfo(activityProgressInfoMap.get(BlessInfoConfig.BLESS_PROGRESS_STATUS).getProgrss() + 1, 0));
|
||||||
|
// if (activityProgressInfoMap.get(BlessInfoConfig.BLESS_PROGRESS_STATUS).getProgrss() == BlessInfoConfig.START_CAPACITY + 1) {
|
||||||
|
// if (SBlessingConfig.sBlessingConfig.getIsRefresh() != 0) {
|
||||||
|
// blessRefresh(user);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
PlayerInfoProto.blessChooseResponse response = PlayerInfoProto.blessChooseResponse.newBuilder().setReward(drop).setChooseRewardId(resultRewardId).build();
|
||||||
|
MessageUtil.sendMessage(session, 1, messageType.getNumber(), response, true);
|
||||||
|
}
|
||||||
|
|
||||||
//云梦请求数据
|
//云梦请求数据
|
||||||
public void blessInfo(ISession session, MessageTypeProto.MessageType messageType) throws Exception {
|
public void blessInfo(ISession session, MessageTypeProto.MessageType messageType) throws Exception {
|
||||||
User user = UserManager.getUser(session.getUid());
|
User user = UserManager.getUser(session.getUid());
|
||||||
ActivityMission activityMission = user.getActivityManager().getActivityMissionMap().get(SBlessingConfig.sBlessingConfig.getActivityId());
|
int blessActivityId = getBlessActivityId(user);
|
||||||
|
if(blessActivityId==0){
|
||||||
|
throw new ErrorCodeException(ErrorCode.ACTIVITY_NOT_OPEN);
|
||||||
|
}
|
||||||
|
ActivityMission activityMission = user.getActivityManager().getActivityMissionMap().get(blessActivityId);
|
||||||
if (activityMission == null) {
|
if (activityMission == null) {
|
||||||
throw new ErrorCodeException(ErrorCode.ACTIVITY_NOT_OPEN);
|
throw new ErrorCodeException(ErrorCode.ACTIVITY_NOT_OPEN);
|
||||||
}
|
}
|
||||||
|
|
@ -816,11 +935,24 @@ public class ActivityLogic {
|
||||||
|
|
||||||
public void blessSaveOptionalReward(ISession session, int[] rewardIds, MessageTypeProto.MessageType messageType) throws Exception {
|
public void blessSaveOptionalReward(ISession session, int[] rewardIds, MessageTypeProto.MessageType messageType) throws Exception {
|
||||||
User user = UserManager.getUser(session.getUid());
|
User user = UserManager.getUser(session.getUid());
|
||||||
ActivityMission activityMission = user.getActivityManager().getActivityMissionMap().get(SBlessingConfig.sBlessingConfig.getActivityId());
|
// for(Map.Entry<Integer,SBlessingConfig> entry:SBlessingConfig.blessingConfigMap.entrySet()){
|
||||||
|
//
|
||||||
|
// int activityOpenState = getActivityOpenState(user, entry.getKey());
|
||||||
|
// if(activityOpenState==ActivityType.OPEN_STATE){
|
||||||
|
// blessingConfig = entry.getValue();
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
int blessActivityId = getBlessActivityId(user);
|
||||||
|
if(blessActivityId==0){
|
||||||
|
throw new ErrorCodeException(ErrorCode.ACTIVITY_NOT_OPEN);
|
||||||
|
}
|
||||||
|
SBlessingConfig blessingConfig =SBlessingConfig.blessingConfigMap.get(blessActivityId) ;
|
||||||
|
ActivityMission activityMission = user.getActivityManager().getActivityMissionMap().get(blessActivityId);
|
||||||
if (activityMission.getActivityProgressInfoMap().get(BlessInfoConfig.BLESS_PROGRESS_STATUS).getProgrss() != 0) {
|
if (activityMission.getActivityProgressInfoMap().get(BlessInfoConfig.BLESS_PROGRESS_STATUS).getProgrss() != 0) {
|
||||||
throw new ErrorCodeException(ErrorCode.newDefineCode("您当前不能进行保存"));
|
throw new ErrorCodeException(ErrorCode.newDefineCode("您当前不能进行保存"));
|
||||||
}
|
}
|
||||||
if (SBlessingConfig.sBlessingConfig.getRandomNum() != BlessInfoConfig.START_CAPACITY - rewardIds.length) {
|
if (blessingConfig.getRandomNum() != BlessInfoConfig.START_CAPACITY - rewardIds.length) {
|
||||||
throw new ErrorCodeException(ErrorCode.newDefineCode("选择数量不对"));
|
throw new ErrorCodeException(ErrorCode.newDefineCode("选择数量不对"));
|
||||||
}
|
}
|
||||||
for (int i = 0; i < rewardIds.length; i++) {
|
for (int i = 0; i < rewardIds.length; i++) {
|
||||||
|
|
@ -836,108 +968,6 @@ public class ActivityLogic {
|
||||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), null, true);
|
MessageUtil.sendMessage(session, 1, messageType.getNumber(), null, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 云梦抽取
|
|
||||||
*
|
|
||||||
* @param session
|
|
||||||
* @param locationId
|
|
||||||
* @param messageType
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public void blessChoose(ISession session, int locationId, MessageTypeProto.MessageType messageType) throws Exception {
|
|
||||||
User user = UserManager.getUser(session.getUid());
|
|
||||||
ActivityMission activityMission = user.getActivityManager().getActivityMissionMap().get(SBlessingConfig.sBlessingConfig.getActivityId());
|
|
||||||
if (activityMission == null) {
|
|
||||||
throw new ErrorCodeException(ErrorCode.ACTIVITY_NOT_OPEN);
|
|
||||||
}
|
|
||||||
Map<Integer, ActivityProgressInfo> activityProgressInfoMap = activityMission.getActivityProgressInfoMap();
|
|
||||||
if (activityProgressInfoMap.get(locationId + BlessInfoConfig.START_CAPACITY).getProgrss() != 0) {
|
|
||||||
throw new ErrorCodeException(ErrorCode.newDefineCode("已经抽过改格子"));
|
|
||||||
}
|
|
||||||
int resultRewardId = 0;
|
|
||||||
if (activityProgressInfoMap.get(BlessInfoConfig.BLESS_PROGRESS_STATUS).getProgrss() == -1) {
|
|
||||||
Map<Integer, SBlessingRewardPool> poolMap = STableManager.getConfig(SBlessingRewardPool.class);
|
|
||||||
int[][] result = new int[BlessInfoConfig.START_CAPACITY][];
|
|
||||||
int index = 0;
|
|
||||||
for (Map.Entry<Integer, ActivityProgressInfo> entry : activityProgressInfoMap.entrySet()) {
|
|
||||||
if (entry.getKey() > BlessInfoConfig.START_CAPACITY) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
int[] temp = new int[2];
|
|
||||||
temp[0] = entry.getValue().getProgrss();
|
|
||||||
temp[1] = poolMap.get(entry.getValue().getProgrss()).getExtractWeight();
|
|
||||||
result[index] = temp;
|
|
||||||
index++;
|
|
||||||
}
|
|
||||||
int[] order = MathUtils.randomFromWeightWithTaking(result, BlessInfoConfig.START_CAPACITY);
|
|
||||||
for (int i = 0; i < order.length; i++) {
|
|
||||||
LOGGER.info("获取顺序{}", order[i]);
|
|
||||||
}
|
|
||||||
index = 0;
|
|
||||||
for (Map.Entry<Integer, ActivityProgressInfo> entry : activityProgressInfoMap.entrySet()) {
|
|
||||||
if (entry.getKey() > BlessInfoConfig.START_CAPACITY) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
ActivityProgressInfo progress = new ActivityProgressInfo();
|
|
||||||
progress.setProgrss(order[index]);
|
|
||||||
activityMission.updateProgressInfo(entry.getKey(), progress);
|
|
||||||
index++;
|
|
||||||
}
|
|
||||||
activityMission.updateProgressInfo(BlessInfoConfig.BLESS_PROGRESS_STATUS, new ActivityProgressInfo(1, 0));
|
|
||||||
}
|
|
||||||
//检验消耗道具
|
|
||||||
int[][] costConfig = SBlessingConfig.sBlessingConfig.getCost();
|
|
||||||
int[][] cost = new int[1][];
|
|
||||||
int[] temp = new int[2];
|
|
||||||
temp[0] = costConfig[0][0];
|
|
||||||
temp[1] = (int) MathUtils.calABX(activityProgressInfoMap.get(BlessInfoConfig.BLESS_PROGRESS_STATUS).getProgrss(), costConfig[1]);
|
|
||||||
cost[0] = temp;
|
|
||||||
LOGGER.info("本次为第{}次抽取,消耗{}个数为{}", activityProgressInfoMap.get(BlessInfoConfig.BLESS_PROGRESS_STATUS).getProgrss(), temp[0], temp[1]);
|
|
||||||
boolean costResult = ItemUtil.itemCost(user, cost, BIReason.BLESS_CHOOSE_CONSUME, 1);
|
|
||||||
if (!costResult) {
|
|
||||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
|
||||||
}
|
|
||||||
if (activityProgressInfoMap.get(BlessInfoConfig.BLESS_PROGRESS_STATUS).getProgrss() > 0) {
|
|
||||||
for (Map.Entry<Integer, ActivityProgressInfo> entry : activityProgressInfoMap.entrySet()) {
|
|
||||||
if (entry.getKey() > BlessInfoConfig.START_CAPACITY) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (entry.getValue().getProgrss() == 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
resultRewardId = entry.getValue().getProgrss();
|
|
||||||
ActivityProgressInfo progress = new ActivityProgressInfo();
|
|
||||||
progress.setProgrss(entry.getValue().getProgrss());
|
|
||||||
activityMission.updateProgressInfo(locationId + BlessInfoConfig.START_CAPACITY, progress);
|
|
||||||
activityMission.updateProgressInfo(entry.getKey(), new ActivityProgressInfo());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
LOGGER.info("本次抽取的Id为{}", resultRewardId);
|
|
||||||
Map<Integer, SBlessingRewardPool> poolMap = STableManager.getConfig(SBlessingRewardPool.class);
|
|
||||||
int[][] dropItem = new int[1][];
|
|
||||||
for (Integer count : SBlessingConfig.sBlessingConfig.getCounts()) {
|
|
||||||
if (count != activityProgressInfoMap.get(BlessInfoConfig.BLESS_PROGRESS_STATUS).getProgrss()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
dropItem = new int[2][];
|
|
||||||
dropItem[1] = poolMap.get(activityProgressInfoMap.get(BlessInfoConfig.COUNT_REWARD_START_ID + count).getProgrss()).getReward();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
int[] reward = poolMap.get(resultRewardId).getReward();
|
|
||||||
dropItem[0] = reward;
|
|
||||||
CommonProto.Drop.Builder drop = ItemUtil.dropPer(user, dropItem, BIReason.BLESS_REWARD);
|
|
||||||
activityMission.updateProgressInfo(BlessInfoConfig.BLESS_PROGRESS_STATUS, new ActivityProgressInfo(activityProgressInfoMap.get(BlessInfoConfig.BLESS_PROGRESS_STATUS).getProgrss() + 1, 0));
|
|
||||||
// if (activityProgressInfoMap.get(BlessInfoConfig.BLESS_PROGRESS_STATUS).getProgrss() == BlessInfoConfig.START_CAPACITY + 1) {
|
|
||||||
// if (SBlessingConfig.sBlessingConfig.getIsRefresh() != 0) {
|
|
||||||
// blessRefresh(user);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
PlayerInfoProto.blessChooseResponse response = PlayerInfoProto.blessChooseResponse.newBuilder().setReward(drop).setChooseRewardId(resultRewardId).build();
|
|
||||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), response, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * 云梦手动刷新
|
// * 云梦手动刷新
|
||||||
// *
|
// *
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ public interface ActivityType {
|
||||||
int FirstRecharge = 4; //首充
|
int FirstRecharge = 4; //首充
|
||||||
int RechargeTotal = 5; //累计充值
|
int RechargeTotal = 5; //累计充值
|
||||||
int GrowthFund = 6; //成长基金
|
int GrowthFund = 6; //成长基金
|
||||||
int BLESSACTIVITY = 7;
|
int BLESSACTIVITY = 7;//云梦祈福
|
||||||
int TREASURE = 8; //孙龙的宝藏
|
int TREASURE = 8; //孙龙的宝藏
|
||||||
int LUCKYCAT = 9;//招財貓
|
int LUCKYCAT = 9;//招財貓
|
||||||
int SERVERHAPPY = 10; //七日狂欢
|
int SERVERHAPPY = 10; //七日狂欢
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,23 @@
|
||||||
package com.ljsd.jieling.logic.activity;
|
package com.ljsd.jieling.logic.activity;
|
||||||
|
|
||||||
|
|
||||||
|
import com.ljsd.jieling.exception.ErrorCode;
|
||||||
|
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||||
|
import com.ljsd.jieling.globals.BIReason;
|
||||||
import com.ljsd.jieling.handler.activity.BlessInfoConfig;
|
import com.ljsd.jieling.handler.activity.BlessInfoConfig;
|
||||||
|
import com.ljsd.jieling.logic.activity.event.IEvent;
|
||||||
|
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||||
import com.ljsd.jieling.logic.dao.ActivityManager;
|
import com.ljsd.jieling.logic.dao.ActivityManager;
|
||||||
import com.ljsd.jieling.logic.dao.ActivityMission;
|
import com.ljsd.jieling.logic.dao.ActivityMission;
|
||||||
import com.ljsd.jieling.logic.dao.ActivityProgressInfo;
|
import com.ljsd.jieling.logic.dao.ActivityProgressInfo;
|
||||||
|
import com.ljsd.jieling.logic.dao.UserManager;
|
||||||
import com.ljsd.jieling.logic.dao.root.User;
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
|
import com.ljsd.jieling.protocols.CommonProto;
|
||||||
|
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||||
|
import com.ljsd.jieling.protocols.PlayerInfoProto;
|
||||||
|
import com.ljsd.jieling.util.ItemUtil;
|
||||||
|
import com.ljsd.jieling.util.MessageUtil;
|
||||||
import config.SBlessingConfig;
|
import config.SBlessingConfig;
|
||||||
import config.SBlessingRewardPool;
|
import config.SBlessingRewardPool;
|
||||||
import config.SGlobalActivity;
|
import config.SGlobalActivity;
|
||||||
|
|
@ -39,17 +51,21 @@ public class BlessActivity extends AbstractActivity {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private ActivityMission blessInfoInit(ActivityManager activityManager, int activityId) {
|
private ActivityMission blessInfoInit(ActivityManager activityManager, int activityId) {
|
||||||
|
SBlessingConfig sBlessingConfig = SBlessingConfig.blessingConfigMap.get(activityId);
|
||||||
|
if(sBlessingConfig==null){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
//第一次9种
|
//第一次9种
|
||||||
int fixRewardPool = SBlessingConfig.sBlessingConfig.getRandomPoolId();
|
int fixRewardPool = sBlessingConfig.getRandomPoolId();
|
||||||
int fixRewardNum = SBlessingConfig.sBlessingConfig.getRandomNum();
|
int fixRewardNum = sBlessingConfig.getRandomNum();
|
||||||
List<int[]> fixRewardArray = new ArrayList<>();
|
List<int[]> fixRewardArray = new ArrayList<>();
|
||||||
//第二次6,6种
|
//第二次6,6种
|
||||||
int legendPool = SBlessingConfig.sBlessingConfig.getLegendPoolId();
|
int legendPool = sBlessingConfig.getLegendPoolId();
|
||||||
int legendNum = SBlessingConfig.sBlessingConfig.getLegendNum();
|
int legendNum = sBlessingConfig.getLegendNum();
|
||||||
List<int[]> legendRewardArray = new ArrayList<>();
|
List<int[]> legendRewardArray = new ArrayList<>();
|
||||||
|
|
||||||
int supremePool = SBlessingConfig.sBlessingConfig.getSupremePoolId();
|
int supremePool = sBlessingConfig.getSupremePoolId();
|
||||||
int supremeNum = SBlessingConfig.sBlessingConfig.getSupremeNum();
|
int supremeNum = sBlessingConfig.getSupremeNum();
|
||||||
List<int[]> supremeRewardArray = new ArrayList<>();
|
List<int[]> supremeRewardArray = new ArrayList<>();
|
||||||
|
|
||||||
for (Map.Entry<Integer, SBlessingRewardPool> entry : STableManager.getConfig(SBlessingRewardPool.class).entrySet()) {
|
for (Map.Entry<Integer, SBlessingRewardPool> entry : STableManager.getConfig(SBlessingRewardPool.class).entrySet()) {
|
||||||
|
|
@ -62,8 +78,8 @@ public class BlessActivity extends AbstractActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//第三次,次数奖励6个
|
//第三次,次数奖励6个
|
||||||
int[] countPool = SBlessingConfig.sBlessingConfig.getCopuntsPoolId();
|
int[] countPool = sBlessingConfig.getCopuntsPoolId();
|
||||||
int[] counts = SBlessingConfig.sBlessingConfig.getCounts();
|
int[] counts = sBlessingConfig.getCounts();
|
||||||
int[] countResult = new int[counts.length];
|
int[] countResult = new int[counts.length];
|
||||||
int countIndex = 0;
|
int countIndex = 0;
|
||||||
for (Integer cpool : countPool) {
|
for (Integer cpool : countPool) {
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ import com.ljsd.jieling.util.MessageUtil;
|
||||||
import config.SActivityRewardConfig;
|
import config.SActivityRewardConfig;
|
||||||
import config.SGlobalActivity;
|
import config.SGlobalActivity;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
@ -79,9 +80,12 @@ public class NewWelfareActivity extends AbstractActivity {
|
||||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(ActivityProgressInfo activityProgressInfo : activityProgressInfoMap.values()){
|
for(Map.Entry<Integer,ActivityProgressInfo> item: activityProgressInfoMap.entrySet()){
|
||||||
activityProgressInfo.setState(2);
|
item.getValue().setState(2);
|
||||||
|
activityMission.updateProgressInfo(item.getKey(),item.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
sendActivityProgress(session, activityMission, null);
|
sendActivityProgress(session, activityMission, null);
|
||||||
List<SActivityRewardConfig> sActivityRewardConfigs = SActivityRewardConfig.getsActivityRewardConfigByActivityId(id);
|
List<SActivityRewardConfig> sActivityRewardConfigs = SActivityRewardConfig.getsActivityRewardConfigByActivityId(id);
|
||||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, sActivityRewardConfigs.get(0).getReward(), BIReason.TAKE_ACTIVITY_REWARD);
|
CommonProto.Drop.Builder drop = ItemUtil.drop(user, sActivityRewardConfigs.get(0).getReward(), BIReason.TAKE_ACTIVITY_REWARD);
|
||||||
|
|
@ -107,6 +111,12 @@ public class NewWelfareActivity extends AbstractActivity {
|
||||||
for(ActivityProgressInfo activityProgressInfo : activityProgressInfoMap.values()){
|
for(ActivityProgressInfo activityProgressInfo : activityProgressInfoMap.values()){
|
||||||
activityProgressInfo.setState(2);
|
activityProgressInfo.setState(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(Map.Entry<Integer,ActivityProgressInfo> item: activityProgressInfoMap.entrySet()){
|
||||||
|
item.getValue().setState(2);
|
||||||
|
activityMission.updateProgressInfo(item.getKey(),item.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
List<SActivityRewardConfig> sActivityRewardConfigs = SActivityRewardConfig.getsActivityRewardConfigByActivityId(id);
|
List<SActivityRewardConfig> sActivityRewardConfigs = SActivityRewardConfig.getsActivityRewardConfigByActivityId(id);
|
||||||
itemAttrs.add(sActivityRewardConfigs.get(0).getReward());
|
itemAttrs.add(sActivityRewardConfigs.get(0).getReward());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ public class EquipManager extends MongoBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addEquip(User user,Equip equip) throws Exception {
|
public void addEquip(User user,Equip equip) throws Exception {
|
||||||
|
equip.init(this.getRootId(),getMongoKey() + ".equipMap." + equip.getId());
|
||||||
updateString("equipMap." + equip.getId(), equip);
|
updateString("equipMap." + equip.getId(), equip);
|
||||||
equipMap.put(equip.getId(),equip);
|
equipMap.put(equip.getId(),equip);
|
||||||
// addEquipHandBook(equip.getEquipId());
|
// addEquipHandBook(equip.getEquipId());
|
||||||
|
|
@ -42,6 +43,7 @@ public class EquipManager extends MongoBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addEspecialEquip(User user,EspecialEquip especialEquip){
|
public void addEspecialEquip(User user,EspecialEquip especialEquip){
|
||||||
|
especialEquip.init(this.getRootId(),getMongoKey() + ".especialEquipMap." + especialEquip.getId());
|
||||||
updateString("especialEquipMap." + especialEquip.getId(), especialEquip);
|
updateString("especialEquipMap." + especialEquip.getId(), especialEquip);
|
||||||
addEquipHandBook(especialEquip.getEquipId());
|
addEquipHandBook(especialEquip.getEquipId());
|
||||||
especialEquipMap.put(especialEquip.getId(), especialEquip);
|
especialEquipMap.put(especialEquip.getId(), especialEquip);
|
||||||
|
|
|
||||||
|
|
@ -453,7 +453,9 @@ public class GuildLogic {
|
||||||
case 2: //全部拒绝
|
case 2: //全部拒绝
|
||||||
Family.RefuseJoinFamily refuse = Family.RefuseJoinFamily.newBuilder().setName(guildInfo.getName()).build();
|
Family.RefuseJoinFamily refuse = Family.RefuseJoinFamily.newBuilder().setName(guildInfo.getName()).build();
|
||||||
for(Map.Entry<Integer, GuildApply> entry:applyGuild.entrySet()){
|
for(Map.Entry<Integer, GuildApply> entry:applyGuild.entrySet()){
|
||||||
MessageUtil.sendIndicationMessage(OnlineUserManager.getSessionByUid(applyId),1, MessageTypeProto.MessageType.FAMILY_REFUSE_JOIN_INDICATION_VALUE,refuse,true);
|
if(OnlineUserManager.checkUidOnline(applyId)){
|
||||||
|
MessageUtil.sendIndicationMessage(OnlineUserManager.getSessionByUid(applyId),1, MessageTypeProto.MessageType.FAMILY_REFUSE_JOIN_INDICATION_VALUE,refuse,true);
|
||||||
|
}
|
||||||
GuilidManager.removeOneApplyGuildInfos(entry.getValue().getGuildId(),entry.getValue().getId());
|
GuilidManager.removeOneApplyGuildInfos(entry.getValue().getGuildId(),entry.getValue().getId());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -204,6 +204,7 @@ public class CombatLogic {
|
||||||
if(adventureFastReward.get(1).getItemlistCount()==0){
|
if(adventureFastReward.get(1).getItemlistCount()==0){
|
||||||
throw new ErrorCodeException(ErrorCode.REWARD_COLLECTING);
|
throw new ErrorCodeException(ErrorCode.REWARD_COLLECTING);
|
||||||
}
|
}
|
||||||
|
user.getUserMissionManager().onGameEvent(user,GameEvent.ADVENTURE_TAKEREWARD,1);
|
||||||
}else{
|
}else{
|
||||||
String err ="";
|
String err ="";
|
||||||
if(position == 0){
|
if(position == 0){
|
||||||
|
|
@ -231,7 +232,7 @@ public class CombatLogic {
|
||||||
Map<Integer, CommonProto.Drop> result = new HashMap<>(2);
|
Map<Integer, CommonProto.Drop> result = new HashMap<>(2);
|
||||||
result.put(1,baseBuilder.build());
|
result.put(1,baseBuilder.build());
|
||||||
result.put(2,randomBuilder.build());
|
result.put(2,randomBuilder.build());
|
||||||
user.getUserMissionManager().onGameEvent(user,GameEvent.ADVENTURE_TAKEREWARD,1);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -382,6 +382,7 @@ public class FriendLogic {
|
||||||
User friendUser;
|
User friendUser;
|
||||||
FriendManager friendfriendManager;
|
FriendManager friendfriendManager;
|
||||||
List<Integer> friendFriendList;
|
List<Integer> friendFriendList;
|
||||||
|
List<Integer> alreadyFriendList = new ArrayList<>();
|
||||||
int nums =0;
|
int nums =0;
|
||||||
for (Integer applyfriendId :applyFriends){
|
for (Integer applyfriendId :applyFriends){
|
||||||
friendUser = UserManager.getUser(applyfriendId);
|
friendUser = UserManager.getUser(applyfriendId);
|
||||||
|
|
@ -393,20 +394,27 @@ public class FriendLogic {
|
||||||
if(friendManager.getBlackFriends().contains(applyfriendId)){
|
if(friendManager.getBlackFriends().contains(applyfriendId)){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (friends.size() >= maxFriends){
|
if (friends.size()+1> maxFriends){
|
||||||
|
// throw new ErrorCodeException(ErrorCode.FRIENDS_MAX);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (friendFriendList.size() >= maxFriends){
|
if (friendFriendList.size()>= maxFriends){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
friendManager.setApplyFriends(new CopyOnWriteArrayList<>());
|
alreadyFriendList.add(applyfriendId);
|
||||||
|
// friendManager.delApplyFriend(applyfriendId);
|
||||||
friendfriendManager.addFriendId(uid);
|
friendfriendManager.addFriendId(uid);
|
||||||
friendManager.addFriendId(applyfriendId);
|
friendManager.addFriendId(applyfriendId);
|
||||||
UserManager.getUser(applyfriendId).getFriendManager().delMyApplyFriend(uid);
|
UserManager.getUser(applyfriendId).getFriendManager().delMyApplyFriend(uid);
|
||||||
initFriendGriveAndRreward(applyfriendId, uid, friendManager, friendfriendManager);
|
initFriendGriveAndRreward(applyfriendId, uid, friendManager, friendfriendManager);
|
||||||
sendFriendInfoIndication(uid,applyfriendId,2);
|
sendFriendInfoIndication(uid,applyfriendId,2);
|
||||||
nums++;
|
|
||||||
updateFriendUserInfo(friendUser);
|
updateFriendUserInfo(friendUser);
|
||||||
|
nums++;
|
||||||
|
}
|
||||||
|
if(!alreadyFriendList.isEmpty()){
|
||||||
|
for(Integer id:alreadyFriendList){
|
||||||
|
friendManager.delApplyFriend(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return nums;
|
return nums;
|
||||||
}
|
}
|
||||||
|
|
@ -587,6 +595,7 @@ public class FriendLogic {
|
||||||
takeTimes++;
|
takeTimes++;
|
||||||
rewardStr = reward.toString();
|
rewardStr = reward.toString();
|
||||||
}else{
|
}else{
|
||||||
|
int i=0;
|
||||||
for (Integer friend : friends) {
|
for (Integer friend : friends) {
|
||||||
if (!haveRewardMap.containsKey(friend)) {
|
if (!haveRewardMap.containsKey(friend)) {
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -594,9 +603,11 @@ public class FriendLogic {
|
||||||
if (haveRewardMap.containsKey(friend) && haveRewardMap.get(friend) != 1) {
|
if (haveRewardMap.containsKey(friend) && haveRewardMap.get(friend) != 1) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
check = playerInfoManager.check(STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getMaxEnergyGet(), 1);
|
if(i++>0){
|
||||||
if(!check){
|
check = playerInfoManager.check(STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getMaxEnergyGet(), 1);
|
||||||
break;
|
if(!check){
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
playerInfoManager.updateVipPrivilage(STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getMaxEnergyGet(),1);
|
playerInfoManager.updateVipPrivilage(STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getMaxEnergyGet(),1);
|
||||||
friendManager.updateHaveRewardMap(friend,2);
|
friendManager.updateHaveRewardMap(friend,2);
|
||||||
|
|
@ -604,7 +615,10 @@ public class FriendLogic {
|
||||||
receieveFriends.add(friend);
|
receieveFriends.add(friend);
|
||||||
takeTimes++;
|
takeTimes++;
|
||||||
}
|
}
|
||||||
rewardStr = reward.toString().substring(0,reward.toString().length()-1);
|
|
||||||
|
if(reward.length()!=0){
|
||||||
|
rewardStr = reward.toString().substring(0,reward.toString().length()-1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StringUtil.isEmpty(rewardStr)){
|
if (StringUtil.isEmpty(rewardStr)){
|
||||||
|
|
|
||||||
|
|
@ -732,9 +732,9 @@ public class HeroLogic{
|
||||||
// recyleHeroBySystem(user,removeHeroIds);
|
// 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()));
|
||||||
if(targetHero.getStar()==5){
|
// if(targetHero.getStar()==5){
|
||||||
Poster.getPoster().dispatchEvent(new HeroFiveStarGetEvent(user.getId()));
|
// Poster.getPoster().dispatchEvent(new HeroFiveStarGetEvent(user.getId()));
|
||||||
}
|
// }
|
||||||
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,baseBuilder.build(),true);
|
MessageUtil.sendMessage(session,1,MessageTypeProto.MessageType.UP_HERO_STAR_RESPONSE_VALUE,baseBuilder.build(),true);
|
||||||
|
|
|
||||||
|
|
@ -207,11 +207,15 @@ public class MailLogic {
|
||||||
if (mail == null){
|
if (mail == null){
|
||||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||||
}
|
}
|
||||||
|
if(mail.getState() == Global.MAIL_DRAW_ST_GOT){
|
||||||
|
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||||
|
}
|
||||||
if (mailItem.length() == 0){
|
if (mailItem.length() == 0){
|
||||||
mailItem = new StringBuilder(mail.getMailItem());
|
mailItem = new StringBuilder(mail.getMailItem());
|
||||||
}else{
|
}else{
|
||||||
mailItem.append("|").append(mail.getMailItem());
|
mailItem.append("|").append(mail.getMailItem());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if(mailItem.length()==0){
|
if(mailItem.length()==0){
|
||||||
throw new ErrorCodeException(ErrorCode.MAIL_NO_REWARD);
|
throw new ErrorCodeException(ErrorCode.MAIL_NO_REWARD);
|
||||||
|
|
@ -223,9 +227,6 @@ public class MailLogic {
|
||||||
}
|
}
|
||||||
for (String mailId : mailIdsList){
|
for (String mailId : mailIdsList){
|
||||||
Mail mail = mailManager.getMail(mailId);
|
Mail mail = mailManager.getMail(mailId);
|
||||||
if (mail == null){
|
|
||||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
|
||||||
}
|
|
||||||
mail.setState(Global.MAIL_DRAW_ST_GOT);
|
mail.setState(Global.MAIL_DRAW_ST_GOT);
|
||||||
// mail.setMailItem("");
|
// mail.setMailItem("");
|
||||||
mail.setNoUseDeleteTime(TimeUtils.now()+TimeUtils.DAY*Global.MAIL_NOUSE_DELETE_TIME);
|
mail.setNoUseDeleteTime(TimeUtils.now()+TimeUtils.DAY*Global.MAIL_NOUSE_DELETE_TIME);
|
||||||
|
|
|
||||||
|
|
@ -500,7 +500,9 @@ public class PlayerLogic {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getOneTeamInfo(ISession session, int id,int teamId,MessageTypeProto.MessageType messageType) throws Exception {
|
public void getOneTeamInfo(ISession session, int id,int teamId,MessageTypeProto.MessageType messageType) throws Exception {
|
||||||
|
if(id==0){
|
||||||
|
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||||
|
}
|
||||||
SArenaRobotConfig sArenaRobotConfig = SArenaRobotConfig.getsArenaRobotConfigById(id);
|
SArenaRobotConfig sArenaRobotConfig = SArenaRobotConfig.getsArenaRobotConfigById(id);
|
||||||
if(sArenaRobotConfig!=null){
|
if(sArenaRobotConfig!=null){
|
||||||
getRobotTeamInfo(session,sArenaRobotConfig,messageType);
|
getRobotTeamInfo(session,sArenaRobotConfig,messageType);
|
||||||
|
|
|
||||||
|
|
@ -416,7 +416,7 @@ public class CBean2Proto {
|
||||||
.setAnnouce(guildInfo.getAnnounce())
|
.setAnnouce(guildInfo.getAnnounce())
|
||||||
.setName(guildInfo.getName())
|
.setName(guildInfo.getName())
|
||||||
.setJoinType(guildInfo.getJoinType())
|
.setJoinType(guildInfo.getJoinType())
|
||||||
.setMaxNum(30)
|
.setMaxNum(STableManager.getConfig(SGuildLevelConfig.class).get(guildInfo.getLevel()).getNum())
|
||||||
.setLevelTime(guildInfo.getLevelTime())
|
.setLevelTime(guildInfo.getLevelTime())
|
||||||
.setLevle(guildInfo.getLevel())
|
.setLevle(guildInfo.getLevel())
|
||||||
.setExp(guildInfo.getExp())
|
.setExp(guildInfo.getExp())
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,14 @@
|
||||||
package com.ljsd.jieling.util;
|
package com.ljsd.jieling.util;
|
||||||
|
|
||||||
import com.ljsd.jieling.config.clazzStaticCfg.MapStaticConfig;
|
import com.ljsd.jieling.config.clazzStaticCfg.MapStaticConfig;
|
||||||
|
import com.ljsd.jieling.exception.ErrorCode;
|
||||||
|
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||||
import com.ljsd.jieling.protocols.CommonProto;
|
import com.ljsd.jieling.protocols.CommonProto;
|
||||||
import config.SMonsterConfig;
|
import config.SMonsterConfig;
|
||||||
import config.SMonsterGroup;
|
import config.SMonsterGroup;
|
||||||
import manager.STableManager;
|
import manager.STableManager;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
@ -15,10 +19,16 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
|
|
||||||
public class MonsterUtil {
|
public class MonsterUtil {
|
||||||
|
|
||||||
public static Map<Integer, List<CommonProto.FightUnitInfo>> getMonsterByGroup(int groupId){
|
private static final Logger LOGGER = LoggerFactory.getLogger(MonsterUtil.class);
|
||||||
|
|
||||||
|
public static Map<Integer, List<CommonProto.FightUnitInfo>> getMonsterByGroup(int groupId) {
|
||||||
SMonsterGroup sMonsterGroup = SMonsterGroup.getsMonsterGroupMap().get(groupId);
|
SMonsterGroup sMonsterGroup = SMonsterGroup.getsMonsterGroupMap().get(groupId);
|
||||||
int[][] groupIds = sMonsterGroup.getContents();
|
|
||||||
Map<Integer, List<CommonProto.FightUnitInfo>> map = new ConcurrentHashMap<>();
|
Map<Integer, List<CommonProto.FightUnitInfo>> map = new ConcurrentHashMap<>();
|
||||||
|
if(sMonsterGroup==null){
|
||||||
|
LOGGER.info("{}怪物组为空",groupId);
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
int[][] groupIds = sMonsterGroup.getContents();
|
||||||
Map<Integer, CommonProto.FightUnitInfo> monsterMap = STableManager.getFigureConfig(MapStaticConfig.class).getMonsterMap();
|
Map<Integer, CommonProto.FightUnitInfo> monsterMap = STableManager.getFigureConfig(MapStaticConfig.class).getMonsterMap();
|
||||||
for (int i = 0; i < groupIds.length; i++) {
|
for (int i = 0; i < groupIds.length; i++) {
|
||||||
int[] monsterIds = groupIds[i];
|
int[] monsterIds = groupIds[i];
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,10 @@ package config;
|
||||||
import manager.STableManager;
|
import manager.STableManager;
|
||||||
import manager.Table;
|
import manager.Table;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
@Table(name ="BlessingConfig")
|
@Table(name ="BlessingConfig")
|
||||||
public class SBlessingConfig implements BaseConfig {
|
public class SBlessingConfig implements BaseConfig {
|
||||||
|
|
||||||
|
|
@ -38,11 +42,17 @@ public class SBlessingConfig implements BaseConfig {
|
||||||
|
|
||||||
private int countsNum;
|
private int countsNum;
|
||||||
|
|
||||||
public static SBlessingConfig sBlessingConfig;
|
public static Map<Integer,SBlessingConfig> sBlessingConfig;
|
||||||
|
|
||||||
|
public static Map<Integer,SBlessingConfig> blessingConfigMap;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() throws Exception {
|
public void init() throws Exception {
|
||||||
sBlessingConfig = STableManager.getConfig(SBlessingConfig.class).get(1);
|
sBlessingConfig = STableManager.getConfig(SBlessingConfig.class);
|
||||||
|
blessingConfigMap = new HashMap<>();
|
||||||
|
for(Map.Entry<Integer,SBlessingConfig> blessingConfigEntry:sBlessingConfig.entrySet()){
|
||||||
|
blessingConfigMap.put(blessingConfigEntry.getValue().getActivityId(),blessingConfigEntry.getValue());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue