Merge branch 'master' of 60.1.1.230:backend/jieling_server
commit
470a104809
|
|
@ -21,7 +21,7 @@ public class NetWorkFactory {
|
||||||
return new NettyGameServer(cfg, handler);
|
return new NettyGameServer(cfg, handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static NettyGameClient getClient(MessageLite gameMessage, EndPortCfg cfg, INetWorkHandler handler) throws ConnectException {
|
public static NettyGameClient getClient(EndPortCfg cfg, INetWorkHandler handler) throws ConnectException {
|
||||||
return new NettyGameClient(gameMessage, cfg, handler);
|
return new NettyGameClient(cfg, handler);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||||
public abstract class AbstractClient<T extends NettyGameSession> extends AbstractEndport {
|
public abstract class AbstractClient<T extends NettyGameSession> extends AbstractEndport {
|
||||||
protected Logger LOGGER = LoggerFactory.getLogger(AbstractClient.class);
|
protected Logger LOGGER = LoggerFactory.getLogger(AbstractClient.class);
|
||||||
//不对外暴露接口
|
//不对外暴露接口
|
||||||
private T gameSession;
|
|
||||||
private InetSocketAddress localAddress;
|
private InetSocketAddress localAddress;
|
||||||
final int readTimeout;
|
final int readTimeout;
|
||||||
final int writeTimeout;
|
final int writeTimeout;
|
||||||
|
|
@ -49,39 +48,31 @@ public abstract class AbstractClient<T extends NettyGameSession> extends Abstrac
|
||||||
@Override
|
@Override
|
||||||
public void connected(IChannel channel) {
|
public void connected(IChannel channel) {
|
||||||
|
|
||||||
if (handler instanceof INetSession) {
|
// if (handler instanceof INetSession) {
|
||||||
gameSession = ((INetSession<T>) handler).createGameSession(channel, handler);
|
// gameSession = ((INetSession<T>) handler).createGameSession(channel, handler);
|
||||||
if (null != gameSession) {
|
// if (null != gameSession) {
|
||||||
LOGGER.info("seission" + gameSession + "channelActive: " + gameSession.getChannel().getRemoteAddress() + " ,uid: " +
|
// LOGGER.info("seission" + gameSession + "channelActive: " + gameSession.getChannel().getRemoteAddress() + " ,uid: " +
|
||||||
gameSession.getUid() + " ,areaId: " + gameSession.getAreaId());
|
// gameSession.getUid() + " ,areaId: " + gameSession.getAreaId());
|
||||||
this.gameSession = gameSession;
|
// this.gameSession = gameSession;
|
||||||
String sessionId = gameSession.getId();
|
// String sessionId = gameSession.getId();
|
||||||
channel.setBindSessionId(sessionId);
|
// channel.setBindSessionId(sessionId);
|
||||||
gameSession.open();
|
// gameSession.open();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disconnected(IChannel channel) {
|
public void disconnected(IChannel channel) {
|
||||||
if (handler instanceof INetConnet) {
|
if (handler instanceof INetConnet) {
|
||||||
if (null != this.gameSession) {
|
((INetConnet) handler).offLine(null);
|
||||||
LOGGER.info("channelInactive->uid={},seission={},remoteAddress={}",
|
|
||||||
gameSession.getUid(), gameSession, gameSession.getChannel().getRemoteAddress());
|
|
||||||
((INetConnet) handler).offLine(gameSession);
|
|
||||||
gameSession.close();
|
|
||||||
gameSession = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void received(IChannel channel, Object msg) {
|
public void received(IChannel channel, Object msg) {
|
||||||
if (null != gameSession) {
|
((INetReceived) handler).onReceive(null,msg);
|
||||||
gameSession.received(msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -92,11 +83,8 @@ public abstract class AbstractClient<T extends NettyGameSession> extends Abstrac
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void idle(IChannel channel) {
|
public void idle(IChannel channel) {
|
||||||
|
|
||||||
if (handler instanceof INetConnet) {
|
if (handler instanceof INetConnet) {
|
||||||
if (null != gameSession) {
|
((INetConnet) handler).readIdel(null);
|
||||||
((INetConnet) handler).readIdel(gameSession);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,58 +1,32 @@
|
||||||
package com.ljsd.jieling.netty.server;
|
package com.ljsd.jieling.netty.server;
|
||||||
|
|
||||||
import com.google.protobuf.MessageLite;
|
import com.google.protobuf.MessageLite;
|
||||||
import com.ljsd.jieling.netty.NettyGameSession;
|
import com.ljsd.jieling.netty.cocdex.TeaDecoder;
|
||||||
import com.ljsd.jieling.netty.cocdex.Int32FrameDecoder;
|
import com.ljsd.jieling.netty.cocdex.TeaEncoder;
|
||||||
import com.ljsd.jieling.netty.cocdex.Int32LengthFieldPrepender;
|
|
||||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
|
||||||
import com.ljsd.jieling.netty.config.EndPortCfg;
|
import com.ljsd.jieling.netty.config.EndPortCfg;
|
||||||
import com.ljsd.jieling.netty.handler.GameMessageHandler;
|
import com.ljsd.jieling.netty.handler.GameMessageHandler;
|
||||||
import com.ljsd.jieling.netty.handler.ServerResponseMessageHandler;
|
import com.ljsd.jieling.protocol.INetWorkHandler;
|
||||||
import com.ljsd.jieling.protocol.*;
|
|
||||||
import com.ljsd.jieling.session.GameSession;
|
|
||||||
import com.ljsd.jieling.session.GameSessionFactory;
|
|
||||||
import io.netty.bootstrap.Bootstrap;
|
import io.netty.bootstrap.Bootstrap;
|
||||||
import io.netty.buffer.PooledByteBufAllocator;
|
import io.netty.buffer.PooledByteBufAllocator;
|
||||||
import io.netty.channel.*;
|
import io.netty.channel.*;
|
||||||
import io.netty.channel.nio.NioEventLoopGroup;
|
import io.netty.channel.nio.NioEventLoopGroup;
|
||||||
import io.netty.channel.socket.nio.NioSocketChannel;
|
import io.netty.channel.socket.nio.NioSocketChannel;
|
||||||
import io.netty.handler.codec.protobuf.ProtobufDecoder;
|
|
||||||
import io.netty.handler.codec.protobuf.ProtobufEncoder;
|
|
||||||
import io.netty.handler.timeout.IdleStateHandler;
|
import io.netty.handler.timeout.IdleStateHandler;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import util.StringUtil;
|
|
||||||
import util.TimeUtils;
|
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
public class NettyGameClient extends AbstractClient {
|
public class NettyGameClient extends AbstractClient {
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(NettyGameClient.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(NettyGameClient.class);
|
||||||
private static Bootstrap bootstrap = null;
|
private static Bootstrap bootstrap = null;
|
||||||
//key位IP+Port的组合
|
|
||||||
private static Map<String, Channel> channels = new ConcurrentHashMap<>();
|
|
||||||
|
|
||||||
private final MessageLite gameMessage;
|
|
||||||
|
|
||||||
// public NettyGameClient(int readTimeout, int writeTimeout,
|
|
||||||
// int allTimeout, MessageLite gameMessage, ProtocolsAbstract protocols, GameSessionFactory<T> sessionFactory) {
|
|
||||||
// super(readTimeout, writeTimeout, allTimeout);
|
|
||||||
//
|
|
||||||
// this.protocols = protocols;
|
|
||||||
// this.sessionFactory = sessionFactory;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
|
|
||||||
public NettyGameClient( MessageLite gameMessage, EndPortCfg endPortCfg, INetWorkHandler channelHandler) {
|
|
||||||
super(endPortCfg, channelHandler);
|
|
||||||
this.gameMessage = gameMessage;
|
|
||||||
|
|
||||||
|
public NettyGameClient(EndPortCfg endPortCfg, INetWorkHandler iNetWorkHandler) {
|
||||||
|
super(endPortCfg, iNetWorkHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void start() {
|
public Channel start() {
|
||||||
try {
|
try {
|
||||||
EventLoopGroup group = new NioEventLoopGroup(1);
|
EventLoopGroup group = new NioEventLoopGroup(1);
|
||||||
bootstrap = new Bootstrap();
|
bootstrap = new Bootstrap();
|
||||||
|
|
@ -69,41 +43,20 @@ public class NettyGameClient extends AbstractClient {
|
||||||
protected void initChannel(Channel ch) throws Exception {
|
protected void initChannel(Channel ch) throws Exception {
|
||||||
|
|
||||||
ChannelPipeline p = ch.pipeline();
|
ChannelPipeline p = ch.pipeline();
|
||||||
|
p.addLast(new TeaDecoder());
|
||||||
p.addLast(new Int32FrameDecoder());
|
|
||||||
p.addLast(new ProtobufDecoder(gameMessage));
|
|
||||||
|
|
||||||
// 心跳检测处理
|
// 心跳检测处理
|
||||||
p.addLast(new IdleStateHandler(readTimeout, writeTimeout, allTimeout, TimeUnit.SECONDS));
|
p.addLast(new IdleStateHandler(readTimeout, writeTimeout, allTimeout, TimeUnit.SECONDS));
|
||||||
|
p.addLast(new TeaEncoder());
|
||||||
p.addLast(new Int32LengthFieldPrepender());
|
p.addLast(new GameMessageHandler(NettyGameClient.this));
|
||||||
p.addLast(new ProtobufEncoder());
|
// p.addLast(new ServerResponseMessageHandler(NettyGameClient.this));
|
||||||
|
|
||||||
p.addLast(new ServerResponseMessageHandler(NettyGameClient.this));
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
return bootstrap.connect(getLocalAddress().getHostName(),getLocalAddress().getPort()).sync().channel();//"39.100.38.60",16080).sync().channel();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("start->msg={}", e.getMessage(), e);
|
LOGGER.error("start->msg={}", e.getMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
public static Channel getChannel(String serverIp, int port) {
|
|
||||||
try {
|
|
||||||
String key = serverIp + ":" + port;
|
|
||||||
Channel channel = channels.get(key);
|
|
||||||
if(channel == null || !channel.isOpen() || !channel.isActive()) {
|
|
||||||
channel = bootstrap.connect(serverIp, port).sync().channel();
|
|
||||||
channels.put(key, channel);
|
|
||||||
}
|
|
||||||
return channel;
|
|
||||||
} catch (Exception e) {
|
|
||||||
LOGGER.error("getChannel->serverIp={},port={},msg={}", serverIp, port, e.getMessage(), e);
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
public static Channel getChannel(String serverIpPort) {
|
|
||||||
String strs[] = serverIpPort.split(":");
|
|
||||||
return getChannel(strs[0], Integer.parseInt(strs[1]));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
|
|
@ -111,4 +64,6 @@ public class NettyGameClient extends AbstractClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,7 @@ public enum FunctionIdEnum {
|
||||||
WorkShopCreateProtectEquip(103,null),
|
WorkShopCreateProtectEquip(103,null),
|
||||||
WorkShopRebuildEquip(104,null,MessageTypeProto.MessageType.WORKSHOP_REBUILD_REQUEST_VALUE),
|
WorkShopRebuildEquip(104,null,MessageTypeProto.MessageType.WORKSHOP_REBUILD_REQUEST_VALUE),
|
||||||
Expedition(64,null),
|
Expedition(64,null),
|
||||||
|
Achieve(65,null),
|
||||||
;
|
;
|
||||||
|
|
||||||
private int functionType;
|
private int functionType;
|
||||||
|
|
|
||||||
|
|
@ -41,5 +41,6 @@ public interface VipPrivilegeType {
|
||||||
int GUILD_BOSS_CHALLENGE_TIMES = 37; //公会boss挑战次数
|
int GUILD_BOSS_CHALLENGE_TIMES = 37; //公会boss挑战次数
|
||||||
int UNLOCK_GUILD_BOSS_SWEEP = 1002; //公会boss扫荡
|
int UNLOCK_GUILD_BOSS_SWEEP = 1002; //公会boss扫荡
|
||||||
int EXPEDITION_RELIVE = 1003; //猎妖之路免费复活次数
|
int EXPEDITION_RELIVE = 1003; //猎妖之路免费复活次数
|
||||||
|
int SIGN_AGAIN = 1005; //每日签到充值后再领一次
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ import com.ljsd.jieling.util.ItemUtil;
|
||||||
import com.ljsd.jieling.util.MessageUtil;
|
import com.ljsd.jieling.util.MessageUtil;
|
||||||
import config.SExpeditionFloorConfig;
|
import config.SExpeditionFloorConfig;
|
||||||
import config.SExpeditionHolyConfig;
|
import config.SExpeditionHolyConfig;
|
||||||
|
import config.SExpeditionNodeConfig;
|
||||||
import config.SExpeditionSetting;
|
import config.SExpeditionSetting;
|
||||||
import manager.STableManager;
|
import manager.STableManager;
|
||||||
import org.luaj.vm2.LuaValue;
|
import org.luaj.vm2.LuaValue;
|
||||||
|
|
@ -195,11 +196,11 @@ public class EndExpeditionBattleRequest extends BaseHandler<Expedition.EndExpedi
|
||||||
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.EXPEDITION_NOINFO_INDICATION_VALUE, builder.build(), true);
|
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.EXPEDITION_NOINFO_INDICATION_VALUE, builder.build(), true);
|
||||||
|
|
||||||
//drop
|
//drop
|
||||||
SExpeditionFloorConfig sExpeditionFloorConfig = STableManager.getConfig(SExpeditionFloorConfig.class).get(oldlay);
|
SExpeditionNodeConfig sExpeditionNodeConfig = STableManager.getConfig(SExpeditionNodeConfig.class).get(nodeInfo.getType());
|
||||||
if (sExpeditionFloorConfig == null) {
|
if (sExpeditionNodeConfig == null) {
|
||||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||||
}
|
}
|
||||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, sExpeditionFloorConfig.getReward(),1,0,BIReason.EXPEDITION_DROP_REWARD);
|
CommonProto.Drop.Builder drop = ItemUtil.drop(user, sExpeditionNodeConfig.getreward(),1,0,BIReason.EXPEDITION_DROP_REWARD);
|
||||||
Expedition.EndExpeditionBattleResponse.Builder response = Expedition.EndExpeditionBattleResponse.newBuilder();
|
Expedition.EndExpeditionBattleResponse.Builder response = Expedition.EndExpeditionBattleResponse.newBuilder();
|
||||||
response.setResult(resultCode);
|
response.setResult(resultCode);
|
||||||
response.setDrop(drop);
|
response.setDrop(drop);
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,12 @@
|
||||||
package com.ljsd.jieling.handler;
|
package com.ljsd.jieling.handler;
|
||||||
|
|
||||||
|
import com.ljsd.jieling.core.VipPrivilegeType;
|
||||||
import com.ljsd.jieling.exception.ErrorCode;
|
import com.ljsd.jieling.exception.ErrorCode;
|
||||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||||
import com.ljsd.jieling.globals.BIReason;
|
import com.ljsd.jieling.globals.BIReason;
|
||||||
import com.ljsd.jieling.logic.dao.UserManager;
|
import com.ljsd.jieling.logic.dao.UserManager;
|
||||||
import com.ljsd.jieling.logic.dao.root.User;
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
|
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||||
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.CommonProto;
|
import com.ljsd.jieling.protocols.CommonProto;
|
||||||
|
|
@ -47,6 +49,12 @@ public class SignInHandler extends BaseHandler {
|
||||||
throw new ErrorCodeException(ErrorCode.newDefineCode("day out0findex"));
|
throw new ErrorCodeException(ErrorCode.newDefineCode("day out0findex"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//check 道具
|
||||||
|
boolean check = PlayerLogic.getInstance().check(user, VipPrivilegeType.SIGN_AGAIN, 1);
|
||||||
|
if(!check){
|
||||||
|
throw new ErrorCodeException("次数不足");
|
||||||
|
}
|
||||||
|
PlayerLogic.getInstance().checkAndUpdate(user, VipPrivilegeType.SIGN_AGAIN, 1);
|
||||||
user.getPlayerInfoManager().setSignTotay(1);
|
user.getPlayerInfoManager().setSignTotay(1);
|
||||||
|
|
||||||
int[] reward = sign.getreward();
|
int[] reward = sign.getreward();
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ public class HotfixUtil implements IEventHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(IEvent event) throws Exception {
|
public void onEvent(IEvent event) throws Exception {
|
||||||
doWork(SysUtil.getPath("../conf/hotfix.json"));
|
doWork(SysUtil.getPath("conf/hotfix.json"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -99,6 +99,7 @@ public class UserManager {
|
||||||
user.getUserMissionManager().onGameEvent(user, GameEvent.DAILY_REFRESH,0);
|
user.getUserMissionManager().onGameEvent(user, GameEvent.DAILY_REFRESH,0);
|
||||||
user.getUserMissionManager().onGameEvent(user, GameEvent.BLOODY_REFRESH,0);
|
user.getUserMissionManager().onGameEvent(user, GameEvent.BLOODY_REFRESH,0);
|
||||||
user.getUserMissionManager().onGameEvent(user, GameEvent.MISSING_ROOM_REFRESH,0);
|
user.getUserMissionManager().onGameEvent(user, GameEvent.MISSING_ROOM_REFRESH,0);
|
||||||
|
user.getUserMissionManager().onGameEvent(user, GameEvent.ACHIEVE_REFRESH, 0);
|
||||||
user.getUserMissionManager().onGameEvent(user, GameEvent.BEGINNER);
|
user.getUserMissionManager().onGameEvent(user, GameEvent.BEGINNER);
|
||||||
Poster.getPoster().dispatchEvent(new NewWelfareEvent(user, NewWelfareTypeEnum.LOGIN_TIMES.getType(),1));
|
Poster.getPoster().dispatchEvent(new NewWelfareEvent(user, NewWelfareTypeEnum.LOGIN_TIMES.getType(),1));
|
||||||
ItemUtil.drop(user,gameSetting.getBornItem(), BIReason.USER_BORN_REWARD);
|
ItemUtil.drop(user,gameSetting.getBornItem(), BIReason.USER_BORN_REWARD);
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,8 @@ public class UserMissionManager extends MongoBase {
|
||||||
private ServenMissionIdsType sevenHappyMissionType =new ServenMissionIdsType();
|
private ServenMissionIdsType sevenHappyMissionType =new ServenMissionIdsType();
|
||||||
private BloodyMissionIdsType bloodyMissionIdsType =new BloodyMissionIdsType();
|
private BloodyMissionIdsType bloodyMissionIdsType =new BloodyMissionIdsType();
|
||||||
private MissingRoomMissionType missingRoomMissionType = new MissingRoomMissionType();
|
private MissingRoomMissionType missingRoomMissionType = new MissingRoomMissionType();
|
||||||
|
private AchieveMissionIdsType achievementMissionTypMap = new AchieveMissionIdsType();
|
||||||
|
|
||||||
//数据累加项
|
//数据累加项
|
||||||
private CumulationData cumulationData = new CumulationData();
|
private CumulationData cumulationData = new CumulationData();
|
||||||
private CumulationData dailyCumulationData = new CumulationData();
|
private CumulationData dailyCumulationData = new CumulationData();
|
||||||
|
|
@ -45,6 +47,7 @@ public class UserMissionManager extends MongoBase {
|
||||||
private CumulationData treasureWeekCumulationData = new CumulationData();
|
private CumulationData treasureWeekCumulationData = new CumulationData();
|
||||||
private CumulationData treasureMonthCumulationData = new CumulationData();
|
private CumulationData treasureMonthCumulationData = new CumulationData();
|
||||||
private CumulationData sevenHappyCumulationData = new CumulationData();
|
private CumulationData sevenHappyCumulationData = new CumulationData();
|
||||||
|
private CumulationData achievementMap = new CumulationData();
|
||||||
|
|
||||||
public void openMission(User user,GameEvent event,Map<GameMisionType, List<MissionStateChangeInfo>> missionTypeEnumListMap, Object... parm) throws Exception {
|
public void openMission(User user,GameEvent event,Map<GameMisionType, List<MissionStateChangeInfo>> missionTypeEnumListMap, Object... parm) throws Exception {
|
||||||
ISession session= OnlineUserManager.getSessionByUid(user.getId());
|
ISession session= OnlineUserManager.getSessionByUid(user.getId());
|
||||||
|
|
@ -145,6 +148,17 @@ public class UserMissionManager extends MongoBase {
|
||||||
bloodyMissionIdsType.getRewardedMissionIds().clear();
|
bloodyMissionIdsType.getRewardedMissionIds().clear();
|
||||||
bloodyMissionIdsType.getDoingMissionIds().addAll(bloodyMissionIds);
|
bloodyMissionIdsType.getDoingMissionIds().addAll(bloodyMissionIds);
|
||||||
updateString("bloodyMissionIdsType",bloodyMissionIdsType);
|
updateString("bloodyMissionIdsType",bloodyMissionIdsType);
|
||||||
|
break;
|
||||||
|
case ACHIEVE_REFRESH:
|
||||||
|
Set<Integer> ds =STableManager.getConfig(SAchievementConfig.class).keySet();
|
||||||
|
achievementMissionTypMap.getDoingMissionIds().clear();
|
||||||
|
achievementMissionTypMap.getFinishMissionIds().clear();
|
||||||
|
achievementMissionTypMap.getRewardedMissionIds().clear();
|
||||||
|
achievementMissionTypMap.getDoingMissionIds().addAll(ds);
|
||||||
|
achievementMap =new CumulationData();
|
||||||
|
updateString("achievementMissionTypMap",achievementMissionTypMap);
|
||||||
|
updateString("achievementMap",achievementMap);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case MISSING_ROOM_REFRESH:
|
case MISSING_ROOM_REFRESH:
|
||||||
Map<Integer,Integer> mustAppear = new HashMap<>();
|
Map<Integer,Integer> mustAppear = new HashMap<>();
|
||||||
|
|
@ -245,6 +259,13 @@ public class UserMissionManager extends MongoBase {
|
||||||
updateString("treasureMissionIdsType",treasureMissionIdsType);
|
updateString("treasureMissionIdsType",treasureMissionIdsType);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case ACHIEVE_REWARD:{
|
||||||
|
int missId = (int)parm[0];
|
||||||
|
achievementMissionTypMap.rewardMission(missId, missionTypeEnumListMap.get(GameMisionType.ACHIEVEMISSION));
|
||||||
|
updateString("achievementMissionTypMap",achievementMissionTypMap);
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
case SEVENHAPPY_MISSION_REWARD:{
|
case SEVENHAPPY_MISSION_REWARD:{
|
||||||
int missionId = (int) parm[0];
|
int missionId = (int) parm[0];
|
||||||
List<MissionStateChangeInfo> missionStateChangeInfos = missionTypeEnumListMap.get(GameMisionType.SEVENMISSION);
|
List<MissionStateChangeInfo> missionStateChangeInfos = missionTypeEnumListMap.get(GameMisionType.SEVENMISSION);
|
||||||
|
|
@ -270,6 +291,8 @@ public class UserMissionManager extends MongoBase {
|
||||||
missingRoomMissionType.rewardMission((int)parm[0],missionTypeEnumListMap.get(GameMisionType.MISSINGROOMMISSION));
|
missingRoomMissionType.rewardMission((int)parm[0],missionTypeEnumListMap.get(GameMisionType.MISSINGROOMMISSION));
|
||||||
updateString("missingRoomMissionType",missingRoomMissionType);
|
updateString("missingRoomMissionType",missingRoomMissionType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
@ -357,6 +380,20 @@ public class UserMissionManager extends MongoBase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!achievementMissionTypMap.getDoingMissionIds().isEmpty() ){
|
||||||
|
|
||||||
|
List<SAchievementConfig> sAchievementConfigs = SAchievementConfig.sTaskConfigByTypeMap.get(missionType.getMissionTypeValue());
|
||||||
|
if(sAchievementConfigs!=null&&sAchievementConfigs.size()!=0){
|
||||||
|
CumulationData.Result result= achievementMap.updateData(missionType, parm);
|
||||||
|
if(result!=null){
|
||||||
|
achievementMissionTypMap.calCumulationDataResult(user,result,missionTypeEnumListMap.get(GameMisionType.ACHIEVEMISSION),achievementMap);
|
||||||
|
updateString("achievementMap",achievementMap);
|
||||||
|
updateString("achievementMissionTypMap",achievementMissionTypMap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
CumulationData.Result result = cumulationData.updateData(missionType, parm);
|
CumulationData.Result result = cumulationData.updateData(missionType, parm);
|
||||||
if(result!=null){
|
if(result!=null){
|
||||||
vipMissionIdsType.calCumulationDataResult(user,result,missionTypeEnumListMap.get(GameMisionType.VIPMISSION),cumulationData);
|
vipMissionIdsType.calCumulationDataResult(user,result,missionTypeEnumListMap.get(GameMisionType.VIPMISSION),cumulationData);
|
||||||
|
|
@ -487,4 +524,12 @@ public class UserMissionManager extends MongoBase {
|
||||||
public MissingRoomMissionType getMissingRoomMissionType() {
|
public MissingRoomMissionType getMissingRoomMissionType() {
|
||||||
return missingRoomMissionType;
|
return missingRoomMissionType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AchieveMissionIdsType getAchievementMissionTypMap() {
|
||||||
|
return achievementMissionTypMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CumulationData getAchievementMap() {
|
||||||
|
return achievementMap;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -360,9 +360,15 @@ public class ExpeditionLogic {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Set<Integer> staffsSet = new HashSet<>();
|
Set<Integer> staffsSet = new HashSet<>();
|
||||||
while (staffsSet.size()<3){
|
while (staffsSet.size()<3){
|
||||||
|
int[][] holyProbability = cfg.getHolyProbability();
|
||||||
|
SExpeditionNodeConfig sExpeditionNodeConfig = STableManager.getConfig(SExpeditionNodeConfig.class).get(type);
|
||||||
|
if(null!=sExpeditionNodeConfig && sExpeditionNodeConfig.getHolyProbability().length==3){
|
||||||
|
for (int j = 0; j <holyProbability.length ; j++) {
|
||||||
|
holyProbability[j][1]+= sExpeditionNodeConfig.getHolyProbability()[j][1];
|
||||||
|
}
|
||||||
|
}
|
||||||
int ints = MathUtils.randomFromWeight(cfg.getHolyProbability());
|
int ints = MathUtils.randomFromWeight(cfg.getHolyProbability());
|
||||||
Map<Integer, Integer> type2holy2weight = STableManager.getFigureConfig(CommonStaticConfig.class).getType2holy2weight(ints);
|
Map<Integer, Integer> type2holy2weight = STableManager.getFigureConfig(CommonStaticConfig.class).getType2holy2weight(ints);
|
||||||
int i1 = ranndomFromWeight(type2holy2weight);
|
int i1 = ranndomFromWeight(type2holy2weight);
|
||||||
|
|
|
||||||
|
|
@ -2065,6 +2065,7 @@ public class HeroLogic{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void heroBack(ISession session,String heroId) throws Exception {
|
public void heroBack(ISession session,String heroId) throws Exception {
|
||||||
|
int returnPercent = SSpecialConfig.getIntegerValue(SSpecialConfig.HERO_RETURN_PERCENT);
|
||||||
int uid = session.getUid();
|
int uid = session.getUid();
|
||||||
int responseMsgId = MessageTypeProto.MessageType.HERO_RETURN_RESPONSE_VALUE;
|
int responseMsgId = MessageTypeProto.MessageType.HERO_RETURN_RESPONSE_VALUE;
|
||||||
User user = UserManager.getUser(uid);
|
User user = UserManager.getUser(uid);
|
||||||
|
|
@ -2096,10 +2097,15 @@ public class HeroLogic{
|
||||||
}
|
}
|
||||||
|
|
||||||
heroManager.removeHero(uid,heroId);
|
heroManager.removeHero(uid,heroId);
|
||||||
int[][] returnMaterials = sHeroReturn.getReturnMaterials();
|
int[] returnMaterials = sHeroReturn.getRankupReturn();
|
||||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, returnMaterials, BIReason.HERO_BACK_REWARD);
|
int[][] returnHero = sHeroReturn.getReturnHero();
|
||||||
|
//进阶材料返还乘万分比
|
||||||
|
returnMaterials[1]*=(double)returnPercent/10000;
|
||||||
|
CommonProto.Drop.Builder drop = ItemUtil.drop(user,new int[][]{returnMaterials}, BIReason.HERO_BACK_REWARD);
|
||||||
|
ItemUtil.drop(user, returnHero,drop, BIReason.HERO_BACK_REWARD);
|
||||||
SHeroLevlConfig sHeroLevlConfig = SHeroLevlConfig.getsHeroLevlConfigMap().get(hero.getLevel());
|
SHeroLevlConfig sHeroLevlConfig = SHeroLevlConfig.getsHeroLevlConfigMap().get(hero.getLevel());
|
||||||
ItemUtil.drop(user, sHeroLevlConfig.getRankupReturn(),drop, BIReason.HERO_BACK_REWARD);
|
int[][] levelUpReturn = sHeroLevlConfig.getSumConsume();
|
||||||
|
ItemUtil.drop(user, ItemLogic.getInstance().itemReturnPercent(levelUpReturn,returnPercent),drop, BIReason.HERO_BACK_REWARD);
|
||||||
HeroInfoProto.HeroReturnResponse build = HeroInfoProto.HeroReturnResponse.newBuilder().setDrop(drop).build();
|
HeroInfoProto.HeroReturnResponse build = HeroInfoProto.HeroReturnResponse.newBuilder().setDrop(drop).build();
|
||||||
MessageUtil.sendMessage(session,1,responseMsgId,build,true);
|
MessageUtil.sendMessage(session,1,responseMsgId,build,true);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -301,21 +301,25 @@ public class ItemLogic {
|
||||||
Map<Integer, Integer> baseCardMap = new HashMap<>();
|
Map<Integer, Integer> baseCardMap = new HashMap<>();
|
||||||
Map<Integer, Integer> baseEquipMap = new HashMap<>();
|
Map<Integer, Integer> baseEquipMap = new HashMap<>();
|
||||||
Map<Integer,Integer> baseRandomMap = new HashMap<>();
|
Map<Integer,Integer> baseRandomMap = new HashMap<>();
|
||||||
|
int rankUpReturnPercent= SSpecialConfig.getIntegerValue(SSpecialConfig.HERO_SACRIFICE_PERCENT);
|
||||||
for (String heroId : heroIdsList) {
|
for (String heroId : heroIdsList) {
|
||||||
Hero hero = heroManager.getHeroMap().get(heroId);
|
Hero hero = heroManager.getHeroMap().get(heroId);
|
||||||
heroManager.removeHero(uid,heroId);
|
heroManager.removeHero(uid,heroId);
|
||||||
int[][] sumConsume = SHeroLevlConfig.getsHeroLevlConfigMap().get(hero.getLevel()).getSumConsume();
|
int[][] sumConsume = SHeroLevlConfig.getsHeroLevlConfigMap().get(hero.getLevel()).getSumConsume();
|
||||||
ItemUtil.combineReward(sumConsume,baseItemMap,baseCardMap,baseEquipMap,baseRandomMap);
|
|
||||||
|
ItemUtil.combineReward(itemReturnPercent(sumConsume,rankUpReturnPercent),baseItemMap,baseCardMap,baseEquipMap,baseRandomMap);
|
||||||
int breakId = hero.getBreakId();
|
int breakId = hero.getBreakId();
|
||||||
int starBreakId = hero.getStarBreakId();
|
int starBreakId = hero.getStarBreakId();
|
||||||
if(breakId!=0 || starBreakId!=0){
|
if(breakId!=0 || starBreakId!=0){
|
||||||
SCHeroRankUpConfig scHeroRankUpConfig = STableManager.getConfig(SCHeroRankUpConfig.class).get(breakId);
|
SCHeroRankUpConfig scHeroRankUpConfig = STableManager.getConfig(SCHeroRankUpConfig.class).get(breakId);
|
||||||
if(scHeroRankUpConfig!=null){
|
if(scHeroRankUpConfig!=null){
|
||||||
ItemUtil.combineReward(scHeroRankUpConfig.getSumConsume(),baseItemMap,baseCardMap,baseEquipMap,baseRandomMap);
|
int[][] levelUpReturn = scHeroRankUpConfig.getSumConsume();
|
||||||
|
ItemUtil.combineReward(itemReturnPercent(levelUpReturn,rankUpReturnPercent),baseItemMap,baseCardMap,baseEquipMap,baseRandomMap);
|
||||||
}
|
}
|
||||||
scHeroRankUpConfig = STableManager.getConfig(SCHeroRankUpConfig.class).get(starBreakId);
|
scHeroRankUpConfig = STableManager.getConfig(SCHeroRankUpConfig.class).get(starBreakId);
|
||||||
if(scHeroRankUpConfig!=null){
|
if(scHeroRankUpConfig!=null){
|
||||||
ItemUtil.combineReward(scHeroRankUpConfig.getSumConsume(),baseItemMap,baseCardMap,baseEquipMap,baseRandomMap);
|
int[][] levelUpReturn = scHeroRankUpConfig.getSumConsume();
|
||||||
|
ItemUtil.combineReward(itemReturnPercent(levelUpReturn,rankUpReturnPercent),baseItemMap,baseCardMap,baseEquipMap,baseRandomMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -344,6 +348,18 @@ public class ItemLogic {
|
||||||
return baseBuilder;
|
return baseBuilder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回数量乘比值
|
||||||
|
* @param sumConsume
|
||||||
|
* @param rankUpReturnPercent 注:这需要乘万分比(如果为90%,此处填9000)
|
||||||
|
*/
|
||||||
|
public int[][] itemReturnPercent(int[][] sumConsume,int rankUpReturnPercent){
|
||||||
|
int[][] tempReturn = new int[sumConsume.length][];
|
||||||
|
for(int i = 0 ; i < sumConsume.length;i++){
|
||||||
|
tempReturn[i] = new int[]{sumConsume[i][0],Double.valueOf(sumConsume[i][1]*(double)rankUpReturnPercent/10000).intValue()};
|
||||||
|
}
|
||||||
|
return tempReturn;
|
||||||
|
}
|
||||||
public ErrorCode checkHeroResolve(List<String> heroIdsList,User user){
|
public ErrorCode checkHeroResolve(List<String> heroIdsList,User user){
|
||||||
HeroManager heroManager = user.getHeroManager();
|
HeroManager heroManager = user.getHeroManager();
|
||||||
if (heroIdsList.size() == 0){
|
if (heroIdsList.size() == 0){
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ public enum GameEvent {
|
||||||
TREASH_WEEK_REFRESH,//孙龙的宝藏周任务
|
TREASH_WEEK_REFRESH,//孙龙的宝藏周任务
|
||||||
TREASH_MONTH_REFRESH,//孙龙的宝藏月任务
|
TREASH_MONTH_REFRESH,//孙龙的宝藏月任务
|
||||||
SERVENHAPPY_REFRESH,//七日狂欢
|
SERVENHAPPY_REFRESH,//七日狂欢
|
||||||
|
ACHIEVE_REFRESH,//成就刷新
|
||||||
MISSING_ROOM_REFRESH,//迷宫寻宝刷新
|
MISSING_ROOM_REFRESH,//迷宫寻宝刷新
|
||||||
BEGINNER,//新手
|
BEGINNER,//新手
|
||||||
|
|
||||||
|
|
@ -35,6 +36,7 @@ public enum GameEvent {
|
||||||
MISSING_ROOM_MISSION_REWARD,//迷宫寻宝领奖
|
MISSING_ROOM_MISSION_REWARD,//迷宫寻宝领奖
|
||||||
WORKSHOP_CREATE_EQUIP,//打造装备
|
WORKSHOP_CREATE_EQUIP,//打造装备
|
||||||
ADVENTURE_TAKEREWARD, //收取秘境奖励
|
ADVENTURE_TAKEREWARD, //收取秘境奖励
|
||||||
|
ACHIEVE_REWARD,// 领取成就的宝藏
|
||||||
|
|
||||||
BUY_MATERIAL,//购买道具
|
BUY_MATERIAL,//购买道具
|
||||||
RINGFIRE_ADVANCE,//天赋进阶
|
RINGFIRE_ADVANCE,//天赋进阶
|
||||||
|
|
@ -72,5 +74,5 @@ public enum GameEvent {
|
||||||
JOIN_FAMILY,//加入公会次数
|
JOIN_FAMILY,//加入公会次数
|
||||||
FRIEND_APPLY,//提出好友申请次数
|
FRIEND_APPLY,//提出好友申请次数
|
||||||
|
|
||||||
|
COPY_COHERO_TIMES//通关剧情副本和精英本
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,8 @@ public enum GameMisionType {
|
||||||
BEGINNERMISSION(6),
|
BEGINNERMISSION(6),
|
||||||
BLOODYMISSION(7),
|
BLOODYMISSION(7),
|
||||||
MISSINGROOMMISSION(8),
|
MISSINGROOMMISSION(8),
|
||||||
|
ACHIEVEMISSION(9),
|
||||||
|
|
||||||
;
|
;
|
||||||
private int type;
|
private int type;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@ package com.ljsd.jieling.logic.mission;
|
||||||
|
|
||||||
|
|
||||||
import com.ljsd.jieling.config.clazzStaticCfg.TaskStaticConfig;
|
import com.ljsd.jieling.config.clazzStaticCfg.TaskStaticConfig;
|
||||||
|
import com.ljsd.jieling.core.FunctionIdEnum;
|
||||||
|
import com.ljsd.jieling.core.HandlerLogicThread;
|
||||||
import com.ljsd.jieling.dataReport.reportBeans_37.Repot37EventUtil;
|
import com.ljsd.jieling.dataReport.reportBeans_37.Repot37EventUtil;
|
||||||
import com.ljsd.jieling.exception.ErrorCode;
|
import com.ljsd.jieling.exception.ErrorCode;
|
||||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||||
|
|
@ -17,6 +19,7 @@ import com.ljsd.jieling.logic.activity.event.MissingRoomBestEvent;
|
||||||
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.expedition.ExpeditionLogic;
|
||||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||||
import com.ljsd.jieling.logic.mission.main.*;
|
import com.ljsd.jieling.logic.mission.main.*;
|
||||||
import com.ljsd.jieling.network.session.ISession;
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
|
|
@ -47,6 +50,7 @@ public class MissionLoigc {
|
||||||
getBeginnerMisssion(user,missionList);
|
getBeginnerMisssion(user,missionList);
|
||||||
getBloodyMisison(user,missionList);
|
getBloodyMisison(user,missionList);
|
||||||
getMissingRoomMission(user,missionList);
|
getMissingRoomMission(user,missionList);
|
||||||
|
getAchieveMission(user,missionList);
|
||||||
PlayerInfoProto.GetMissionResponse build = PlayerInfoProto.GetMissionResponse.newBuilder().addAllUserMissionInfo(missionList).build();
|
PlayerInfoProto.GetMissionResponse build = PlayerInfoProto.GetMissionResponse.newBuilder().addAllUserMissionInfo(missionList).build();
|
||||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.GET_MISSION_RESPONSE_VALUE,build,true);
|
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.GET_MISSION_RESPONSE_VALUE,build,true);
|
||||||
}
|
}
|
||||||
|
|
@ -312,6 +316,32 @@ public class MissionLoigc {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void getAchieveMission(User user ,List<CommonProto.UserMissionInfo> missionList){
|
||||||
|
SGlobalSystemConfig sGlobalSystemConfig = STableManager.getConfig(SGlobalSystemConfig.class).get(FunctionIdEnum.Achieve.getFunctionType());
|
||||||
|
if (sGlobalSystemConfig!=null&&!HandlerLogicThread.checkOpen(user,sGlobalSystemConfig)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
UserMissionManager userMissionManager = user.getUserMissionManager();
|
||||||
|
AchieveMissionIdsType achievementMissionTypMap = userMissionManager.getAchievementMissionTypMap();
|
||||||
|
|
||||||
|
CumulationData achievementdata = userMissionManager.getAchievementMap();
|
||||||
|
Set<Integer> doingMissionIds = achievementMissionTypMap.getDoingMissionIds();
|
||||||
|
Set<Integer> finishMissionIds = achievementMissionTypMap.getFinishMissionIds();
|
||||||
|
for (SAchievementConfig sAchievementConfig : STableManager.getConfig(SAchievementConfig.class).values()) {
|
||||||
|
int state = 2;
|
||||||
|
int missionId = sAchievementConfig.getId();
|
||||||
|
int progrss = sAchievementConfig.getValues()[1][0];
|
||||||
|
if (doingMissionIds.contains(missionId)) {
|
||||||
|
progrss = getDoingProgress(user, achievementdata, sAchievementConfig.getType(), sAchievementConfig.getValues()[0]);
|
||||||
|
state = 0;
|
||||||
|
} else if (finishMissionIds.contains(missionId)) {
|
||||||
|
state = 1;
|
||||||
|
}
|
||||||
|
missionList.add(CommonProto.UserMissionInfo.newBuilder().setMissionId(missionId).setState(state).setType(GameMisionType.ACHIEVEMISSION.getType()).setProgress(progrss).build());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
public static void takeMissionReward(ISession session,int type,int missionId) throws Exception {
|
public static void takeMissionReward(ISession session,int type,int missionId) throws Exception {
|
||||||
int uid = session.getUid();
|
int uid = session.getUid();
|
||||||
User user = UserManager.getUser(uid);
|
User user = UserManager.getUser(uid);
|
||||||
|
|
@ -397,6 +427,12 @@ public class MissionLoigc {
|
||||||
missionStateChangeInfos = gameMisionTypeListMap.get(GameMisionType.MISSINGROOMMISSION);
|
missionStateChangeInfos = gameMisionTypeListMap.get(GameMisionType.MISSINGROOMMISSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(type==GameMisionType.ACHIEVEMISSION.getType()){
|
||||||
|
Map<GameMisionType, List<MissionStateChangeInfo>> gameMisionTypeListMap = userMissionManager.onGameEvent(user, GameEvent.ACHIEVE_REWARD, missionId);
|
||||||
|
missionStateChangeInfos = gameMisionTypeListMap.get(GameMisionType.ACHIEVEMISSION);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if(missionStateChangeInfos!=null && !missionStateChangeInfos.isEmpty()){
|
if(missionStateChangeInfos!=null && !missionStateChangeInfos.isEmpty()){
|
||||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, missionStateChangeInfos.get(0).getRewwardGroups(), BIReason.TAKE_MISSION_REWARD);
|
CommonProto.Drop.Builder drop = ItemUtil.drop(user, missionStateChangeInfos.get(0).getRewwardGroups(), BIReason.TAKE_MISSION_REWARD);
|
||||||
PlayerInfoProto.TakeMissionRewardResponse build = PlayerInfoProto.TakeMissionRewardResponse.newBuilder().setDrop(drop).build();
|
PlayerInfoProto.TakeMissionRewardResponse build = PlayerInfoProto.TakeMissionRewardResponse.newBuilder().setDrop(drop).build();
|
||||||
|
|
@ -502,6 +538,20 @@ public class MissionLoigc {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case COMHERO_STORY_PASS:
|
||||||
|
Map<Integer, CrossInfo> crossMap = user.getMapManager().getCrossInfoMap();
|
||||||
|
for(Map.Entry<Integer,CrossInfo> item : crossMap.entrySet()){
|
||||||
|
CrossInfo value = item.getValue();
|
||||||
|
if(value.getStars().contains(MapLogic.STAR_1)){
|
||||||
|
Integer fightId = item.getKey();
|
||||||
|
SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(fightId);
|
||||||
|
if(sChallengeConfig.getType() == 1 && sChallengeConfig.getType() == 3){
|
||||||
|
count++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
case KILL_INVASIONBOSS:
|
case KILL_INVASIONBOSS:
|
||||||
count = cumulationData.getKillInvasionbossCount();
|
count = cumulationData.getKillInvasionbossCount();
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -85,6 +85,7 @@ public enum MissionType {
|
||||||
TAKE_FRIEND_GIFT(66),//领取好友友情点
|
TAKE_FRIEND_GIFT(66),//领取好友友情点
|
||||||
JOIN_FAMILY(69),
|
JOIN_FAMILY(69),
|
||||||
FRIEND_APPLY(71),//提出%s次好友申请
|
FRIEND_APPLY(71),//提出%s次好友申请
|
||||||
|
COMHERO_STORY_PASS(72), //通关剧情副本或精英副本%s次
|
||||||
;
|
;
|
||||||
|
|
||||||
private int missionType;
|
private int missionType;
|
||||||
|
|
@ -231,6 +232,8 @@ public enum MissionType {
|
||||||
return JOIN_FAMILY;
|
return JOIN_FAMILY;
|
||||||
case 71:
|
case 71:
|
||||||
return FRIEND_APPLY;
|
return FRIEND_APPLY;
|
||||||
|
case 72:
|
||||||
|
return COMHERO_STORY_PASS;
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,8 @@ public class DataManagerDistributor {
|
||||||
judges.put(MissionType.LEVEL_STORY_PASS,new FightDataManager());
|
judges.put(MissionType.LEVEL_STORY_PASS,new FightDataManager());
|
||||||
judges.put(MissionType.GENERAL_STORY_PASS,new FightDataManager());
|
judges.put(MissionType.GENERAL_STORY_PASS,new FightDataManager());
|
||||||
judges.put(MissionType.HERO_STORY_PASS,new FightDataManager());
|
judges.put(MissionType.HERO_STORY_PASS,new FightDataManager());
|
||||||
|
judges.put(MissionType.COMHERO_STORY_PASS,new FightDataManager());
|
||||||
|
|
||||||
|
|
||||||
judges.put(MissionType.KILL_INVASIONBOSS,new KillInvasionBossDataManager());
|
judges.put(MissionType.KILL_INVASIONBOSS,new KillInvasionBossDataManager());
|
||||||
judges.put(MissionType.SECRETBOX_TIMES,new SecretboxRandomManager());
|
judges.put(MissionType.SECRETBOX_TIMES,new SecretboxRandomManager());
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,12 @@ public class FightDataManager implements BaseDataManager{
|
||||||
if(sChallengeConfig.getType() == 3){
|
if(sChallengeConfig.getType() == 3){
|
||||||
result = new CumulationData.Result(missionType);
|
result = new CumulationData.Result(missionType);
|
||||||
}
|
}
|
||||||
}
|
}else if(missionType ==MissionType.COMHERO_STORY_PASS){
|
||||||
|
SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(fightId);
|
||||||
|
if(sChallengeConfig.getType() == 3||sChallengeConfig.getType() == 1){
|
||||||
|
result = new CumulationData.Result(missionType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import com.ljsd.jieling.protocols.CommonProto;
|
||||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||||
import com.ljsd.jieling.protocols.PlayerInfoProto;
|
import com.ljsd.jieling.protocols.PlayerInfoProto;
|
||||||
import com.ljsd.jieling.util.MessageUtil;
|
import com.ljsd.jieling.util.MessageUtil;
|
||||||
|
import manager.STableManager;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
@ -33,7 +34,7 @@ public class MissionEventDistributor {
|
||||||
eventProcessor.put(GameEvent.BLOODY_REFRESH,new DailyRefreshEventProcess());
|
eventProcessor.put(GameEvent.BLOODY_REFRESH,new DailyRefreshEventProcess());
|
||||||
eventProcessor.put(GameEvent.TREASH_REFRESH,new TreasureRefreshEventProcess());
|
eventProcessor.put(GameEvent.TREASH_REFRESH,new TreasureRefreshEventProcess());
|
||||||
eventProcessor.put(GameEvent.TREASH_WEEK_REFRESH,new TreasureRefreshEventProcess());
|
eventProcessor.put(GameEvent.TREASH_WEEK_REFRESH,new TreasureRefreshEventProcess());
|
||||||
|
eventProcessor.put(GameEvent.ACHIEVE_REFRESH,new DailyRefreshEventProcess());
|
||||||
eventProcessor.put(GameEvent.TREASH_MONTH_REFRESH,new TreasureRefreshEventProcess());
|
eventProcessor.put(GameEvent.TREASH_MONTH_REFRESH,new TreasureRefreshEventProcess());
|
||||||
eventProcessor.put(GameEvent.SERVENHAPPY_REFRESH,new TreasureRefreshEventProcess());
|
eventProcessor.put(GameEvent.SERVENHAPPY_REFRESH,new TreasureRefreshEventProcess());
|
||||||
eventProcessor.put(GameEvent.BEGINNER,new BeginneRefreshEventProcessor());
|
eventProcessor.put(GameEvent.BEGINNER,new BeginneRefreshEventProcessor());
|
||||||
|
|
@ -177,6 +178,7 @@ public class MissionEventDistributor {
|
||||||
eventProcessor.put(GameEvent.BEGINNER_MISSION_REWARD,new RewardEventProcessor());
|
eventProcessor.put(GameEvent.BEGINNER_MISSION_REWARD,new RewardEventProcessor());
|
||||||
eventProcessor.put(GameEvent.BLOODY_MISSION_REWARD,new RewardEventProcessor());
|
eventProcessor.put(GameEvent.BLOODY_MISSION_REWARD,new RewardEventProcessor());
|
||||||
eventProcessor.put(GameEvent.MISSING_ROOM_MISSION_REWARD,new RewardEventProcessor());
|
eventProcessor.put(GameEvent.MISSING_ROOM_MISSION_REWARD,new RewardEventProcessor());
|
||||||
|
eventProcessor.put(GameEvent.ACHIEVE_REWARD,new RewardEventProcessor());
|
||||||
|
|
||||||
|
|
||||||
typeList = new ArrayList<>();
|
typeList = new ArrayList<>();
|
||||||
|
|
@ -289,6 +291,12 @@ public class MissionEventDistributor {
|
||||||
eventEnumListMap.put(GameEvent.FRIEND_APPLY,typeList);
|
eventEnumListMap.put(GameEvent.FRIEND_APPLY,typeList);
|
||||||
eventProcessor.put(GameEvent.FRIEND_APPLY,new CumulationDataEventProcessor());
|
eventProcessor.put(GameEvent.FRIEND_APPLY,new CumulationDataEventProcessor());
|
||||||
|
|
||||||
|
|
||||||
|
typeList = new ArrayList<>();
|
||||||
|
typeList.add(MissionType.COMHERO_STORY_PASS);
|
||||||
|
eventEnumListMap.put(GameEvent.COPY_COHERO_TIMES,typeList);
|
||||||
|
eventProcessor.put(GameEvent.COPY_COHERO_TIMES,new CumulationDataEventProcessor());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final ThreadLocal<Map<GameMisionType, List<MissionStateChangeInfo>>> threadMissionChangeList =
|
private static final ThreadLocal<Map<GameMisionType, List<MissionStateChangeInfo>>> threadMissionChangeList =
|
||||||
|
|
@ -315,6 +323,8 @@ public class MissionEventDistributor {
|
||||||
missionTypeEnumListMap.put(GameMisionType.BEGINNERMISSION, new ArrayList<>());
|
missionTypeEnumListMap.put(GameMisionType.BEGINNERMISSION, new ArrayList<>());
|
||||||
missionTypeEnumListMap.put(GameMisionType.BLOODYMISSION, new ArrayList<>());
|
missionTypeEnumListMap.put(GameMisionType.BLOODYMISSION, new ArrayList<>());
|
||||||
missionTypeEnumListMap.put(GameMisionType.MISSINGROOMMISSION, new ArrayList<>());
|
missionTypeEnumListMap.put(GameMisionType.MISSINGROOMMISSION, new ArrayList<>());
|
||||||
|
missionTypeEnumListMap.put(GameMisionType.ACHIEVEMISSION, new ArrayList<>());
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
missionTypeEnumListMap.get(GameMisionType.VIPMISSION).clear();
|
missionTypeEnumListMap.get(GameMisionType.VIPMISSION).clear();
|
||||||
|
|
@ -325,6 +335,8 @@ public class MissionEventDistributor {
|
||||||
missionTypeEnumListMap.get(GameMisionType.BEGINNERMISSION).clear();
|
missionTypeEnumListMap.get(GameMisionType.BEGINNERMISSION).clear();
|
||||||
missionTypeEnumListMap.get(GameMisionType.BLOODYMISSION).clear();
|
missionTypeEnumListMap.get(GameMisionType.BLOODYMISSION).clear();
|
||||||
missionTypeEnumListMap.get(GameMisionType.MISSINGROOMMISSION).clear();
|
missionTypeEnumListMap.get(GameMisionType.MISSINGROOMMISSION).clear();
|
||||||
|
missionTypeEnumListMap.get(GameMisionType.ACHIEVEMISSION).clear();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
threadMissionChangeList.set(missionTypeEnumListMap);
|
threadMissionChangeList.set(missionTypeEnumListMap);
|
||||||
|
|
@ -360,7 +372,7 @@ public class MissionEventDistributor {
|
||||||
if(gameMisionType==GameMisionType.MISSINGROOMMISSION){
|
if(gameMisionType==GameMisionType.MISSINGROOMMISSION){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(gameMisionType == GameMisionType.COPYMISSION || gameMisionType == GameMisionType.TREASUREMISSION || gameMisionType == GameMisionType.SEVENMISSION || gameMisionType == GameMisionType.BLOODYMISSION){
|
if(gameMisionType == GameMisionType.COPYMISSION || gameMisionType == GameMisionType.TREASUREMISSION || gameMisionType == GameMisionType.SEVENMISSION || gameMisionType == GameMisionType.BLOODYMISSION|| gameMisionType == GameMisionType.ACHIEVEMISSION){
|
||||||
progress = missionStateChangeInfo.getProgress();
|
progress = missionStateChangeInfo.getProgress();
|
||||||
}
|
}
|
||||||
if(missionState == MissionState.DOING){
|
if(missionState == MissionState.DOING){
|
||||||
|
|
@ -391,6 +403,12 @@ public class MissionEventDistributor {
|
||||||
STreasureSunlongTaskConfig sunlongTaskConfig = STreasureSunlongTaskConfig.treasureTaskConfig.get(missionStateChangeInfo.getMissionId());
|
STreasureSunlongTaskConfig sunlongTaskConfig = STreasureSunlongTaskConfig.treasureTaskConfig.get(missionStateChangeInfo.getMissionId());
|
||||||
progress= sunlongTaskConfig.getTaskValue()[1][0];
|
progress= sunlongTaskConfig.getTaskValue()[1][0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(gameMisionType == GameMisionType.ACHIEVEMISSION){
|
||||||
|
SAchievementConfig achievementConfig = STableManager.getConfig(SAchievementConfig.class).get(missionStateChangeInfo.getMissionId());
|
||||||
|
progress= achievementConfig.getValues()[1][0];
|
||||||
|
}
|
||||||
|
|
||||||
if(gameMisionType == GameMisionType.SEVENMISSION){
|
if(gameMisionType == GameMisionType.SEVENMISSION){
|
||||||
STreasureTaskConfig sTreasureTaskConfig = STreasureTaskConfig.sTreasureTaskConfigMap.get(missionStateChangeInfo.getMissionId());
|
STreasureTaskConfig sTreasureTaskConfig = STreasureTaskConfig.sTreasureTaskConfigMap.get(missionStateChangeInfo.getMissionId());
|
||||||
if(sTreasureTaskConfig.getTaskType() != MissionType.SENVER_HAPPY.getMissionTypeValue()){
|
if(sTreasureTaskConfig.getTaskType() != MissionType.SENVER_HAPPY.getMissionTypeValue()){
|
||||||
|
|
@ -424,4 +442,5 @@ public class MissionEventDistributor {
|
||||||
processor.onGameEvent(user, missionTypeEnumListMap,event,parm );
|
processor.onGameEvent(user, missionTypeEnumListMap,event,parm );
|
||||||
return missionTypeEnumListMap;
|
return missionTypeEnumListMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,70 @@
|
||||||
|
package com.ljsd.jieling.logic.mission.main;
|
||||||
|
|
||||||
|
import com.ljsd.jieling.logic.dao.CumulationData;
|
||||||
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
|
import com.ljsd.jieling.logic.mission.MissionLoigc;
|
||||||
|
import com.ljsd.jieling.logic.mission.MissionState;
|
||||||
|
import com.ljsd.jieling.logic.mission.MissionType;
|
||||||
|
import config.SAchievementConfig;
|
||||||
|
import config.SBloodyBattleTask;
|
||||||
|
import config.STreasureSunlongTaskConfig;
|
||||||
|
import manager.STableManager;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
|
||||||
|
public class AchieveMissionIdsType extends AbstractMissionType{
|
||||||
|
@Override
|
||||||
|
public void openMission(User user, int missionId, List<MissionStateChangeInfo> missionTypeEnumList) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int[][] reward(int missionId) {
|
||||||
|
SAchievementConfig sDailyTasksConfigById = STableManager.getConfig(SAchievementConfig.class).get(missionId);
|
||||||
|
return sDailyTasksConfigById.getReward();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void calCumulationDataResult(User user, CumulationData.Result result, List<MissionStateChangeInfo> missionStateChangeInfos, CumulationData cumulationData) {
|
||||||
|
|
||||||
|
Set<Integer> doingMissionIds = getDoingMissionIds();
|
||||||
|
|
||||||
|
List<SAchievementConfig> sAchievementConfigs = SAchievementConfig.sTaskConfigByTypeMap.get(result.subType.getMissionTypeValue());
|
||||||
|
if(sAchievementConfigs == null){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(SAchievementConfig sAchievementConfig : sAchievementConfigs){
|
||||||
|
int id = sAchievementConfig.getId();
|
||||||
|
if(!doingMissionIds.contains(sAchievementConfig.getId())){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
int doingProgress = MissionLoigc.getDoingProgress(user, cumulationData, sAchievementConfig.getType(), sAchievementConfig.getValues()[0]);
|
||||||
|
//完成
|
||||||
|
int finishParm = sAchievementConfig.getValues()[1][0];
|
||||||
|
|
||||||
|
if (doingProgress<finishParm) {
|
||||||
|
boolean flag = false;
|
||||||
|
for (MissionStateChangeInfo missionStateChangeInfo : missionStateChangeInfos) {
|
||||||
|
if (missionStateChangeInfo.getMissionId() == id) {
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!flag) {
|
||||||
|
MissionStateChangeInfo doingInfo = new MissionStateChangeInfo(id, MissionState.DOING, doingProgress);
|
||||||
|
missionStateChangeInfos.add(doingInfo);
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
MissionStateChangeInfo finishInfo = new MissionStateChangeInfo(id,
|
||||||
|
MissionState.FINISH, null);
|
||||||
|
missionStateChangeInfos.removeIf(next -> next.getMissionId() == id);
|
||||||
|
missionStateChangeInfos.add(finishInfo);
|
||||||
|
doingMissionIds.remove(id);
|
||||||
|
getFinishMissionIds().add(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -186,6 +186,7 @@ public class BuyGoodsLogic {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rechargeInfo.setSaveAmt(price+saveAmt);
|
rechargeInfo.setSaveAmt(price+saveAmt);
|
||||||
|
|
||||||
user.getPlayerInfoManager().addRechargedaily(price);
|
user.getPlayerInfoManager().addRechargedaily(price);
|
||||||
//TODO 用事件分发
|
//TODO 用事件分发
|
||||||
ActivityLogic.getInstance().updateActivityMissionProgress(user, ActivityType.RechargeTotal,price);
|
ActivityLogic.getInstance().updateActivityMissionProgress(user, ActivityType.RechargeTotal,price);
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,7 @@ import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class ItemUtil {
|
public class ItemUtil {
|
||||||
private static Map<Integer,String> dropRewardMap = new ConcurrentHashMap<>();
|
private static Map<Integer,String> dropRewardMap = new ConcurrentHashMap<>();
|
||||||
|
private static Set<Integer> dropAddition = new HashSet<>();//掉落权重加成id
|
||||||
public static Map<Integer,String> equipQulityNameMap = new HashMap<>(2);
|
public static Map<Integer,String> equipQulityNameMap = new HashMap<>(2);
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(ItemUtil.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(ItemUtil.class);
|
||||||
|
|
||||||
|
|
@ -170,14 +171,14 @@ public class ItemUtil {
|
||||||
if (sRewardGroup == null) {
|
if (sRewardGroup == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
selectDrop(sRewardGroup, itemMap, cardMap, equipMap, randomMap, dropRatio);
|
selectDrop(user,sRewardGroup, itemMap, cardMap, equipMap, randomMap, dropRatio);
|
||||||
int[] extraDropGroupIds = activityExtraDropGroupId(user, dropGroupId);
|
int[] extraDropGroupIds = activityExtraDropGroupId(user, dropGroupId);
|
||||||
for (int dropExtraGroupId : extraDropGroupIds) {
|
for (int dropExtraGroupId : extraDropGroupIds) {
|
||||||
SRewardGroup sRewardGroupExtra = SRewardGroup.getsRewardItemMap().get(dropExtraGroupId);
|
SRewardGroup sRewardGroupExtra = SRewardGroup.getsRewardItemMap().get(dropExtraGroupId);
|
||||||
if (sRewardGroupExtra == null) {
|
if (sRewardGroupExtra == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
selectDrop(sRewardGroupExtra, itemMap, cardMap, equipMap, randomMap, dropRatio);
|
selectDrop(user,sRewardGroupExtra, itemMap, cardMap, equipMap, randomMap, dropRatio);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -353,20 +354,41 @@ public class ItemUtil {
|
||||||
getMap(items.getKey(), items.getValue(), itemMap, cardMap,equipMap,randomMap,1);
|
getMap(items.getKey(), items.getValue(), itemMap, cardMap,equipMap,randomMap,1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private static void selectDrop(SRewardGroup sRewardGroup,Map<Integer, Integer> itemMap, Map<Integer, Integer> cardMap,Map<Integer,Integer> equipMap,Map<Integer,Integer> randomMap , float dropRatio) {
|
private static void selectDrop(User user, SRewardGroup sRewardGroup,Map<Integer, Integer> itemMap, Map<Integer, Integer> cardMap,Map<Integer,Integer> equipMap,Map<Integer,Integer> randomMap , float dropRatio) {
|
||||||
String dropInfo = dropRewardMap.get(sRewardGroup.getId());
|
String dropInfo = dropRewardMap.get(sRewardGroup.getId());
|
||||||
String rewardStr = dropInfo.split("\\|")[0];
|
String rewardStr = dropInfo.split("\\|")[0];
|
||||||
String weight = dropInfo.split("\\|")[1];
|
String weight = dropInfo.split("\\|")[1];
|
||||||
|
String[] rewards= rewardStr.split("#");
|
||||||
|
String[] weights= rewardStr.split("#");
|
||||||
|
for (int i = 0; i < rewards.length; i++) {
|
||||||
|
int rewardId = Integer.valueOf(rewards[i]);
|
||||||
|
if (dropAddition.contains(rewardId)) {
|
||||||
|
int dropWeight = Integer.valueOf(weights[i]);
|
||||||
|
SRewardItem sRewardItem = SRewardItem.getsDropMap().get(rewardId);
|
||||||
|
//权重加成 1等级权重加成
|
||||||
|
int[] chanceAddition = sRewardItem.getChanceAddition();
|
||||||
|
if(chanceAddition.length==3){
|
||||||
|
int part= chanceAddition[1];
|
||||||
|
int sumWeight= chanceAddition[2];
|
||||||
|
if(chanceAddition[0]==1){//等级
|
||||||
|
dropWeight = dropWeight+sumWeight*(user.getPlayerInfoManager().getLevel()/ part);
|
||||||
|
}
|
||||||
|
//扩展其他权重
|
||||||
|
}
|
||||||
|
weights[i] =String.valueOf(dropWeight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch (sRewardGroup.getIsUpset()) {
|
switch (sRewardGroup.getIsUpset()) {
|
||||||
case GlobalItemType.ALL_DROP:
|
case GlobalItemType.ALL_DROP:
|
||||||
getMap(StringUtil.parseFiledInt(rewardStr),itemMap,cardMap,equipMap,randomMap,dropRatio);
|
getMap(user,StringUtil.parseFiledInt(rewardStr),itemMap,cardMap,equipMap,randomMap,dropRatio);
|
||||||
break;
|
break;
|
||||||
case GlobalItemType.WEIGHT_DROP:
|
case GlobalItemType.WEIGHT_DROP:
|
||||||
getRandomMap(sRewardGroup.getRewardMaxNum(),rewardStr.split("#"),weight.split("#"),
|
getRandomMap(user,sRewardGroup.getRewardMaxNum(),rewards,weights,
|
||||||
itemMap,cardMap,equipMap,randomMap,dropRatio);
|
itemMap,cardMap,equipMap,randomMap,dropRatio);
|
||||||
break;
|
break;
|
||||||
case GlobalItemType.SUCCESSIVELY_RANDOM:
|
case GlobalItemType.SUCCESSIVELY_RANDOM:
|
||||||
getSuccessivelyRandmoMap(sRewardGroup,rewardStr.split("#"),weight.split("#"),
|
getSuccessivelyRandmoMap(user,sRewardGroup,rewards,weights,
|
||||||
itemMap,cardMap,equipMap,randomMap,dropRatio);
|
itemMap,cardMap,equipMap,randomMap,dropRatio);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
@ -374,7 +396,7 @@ public class ItemUtil {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void getSuccessivelyRandmoMap(SRewardGroup sRewardGroup, String[]
|
private static void getSuccessivelyRandmoMap(User user,SRewardGroup sRewardGroup, String[]
|
||||||
rewardArr, String[] weightArr, Map<Integer, Integer> itemMap, Map<Integer, Integer>
|
rewardArr, String[] weightArr, Map<Integer, Integer> itemMap, Map<Integer, Integer>
|
||||||
cardMap, Map<Integer,Integer> equipMap, Map<Integer,Integer> randomMap, float dropRatio) {
|
cardMap, Map<Integer,Integer> equipMap, Map<Integer,Integer> randomMap, float dropRatio) {
|
||||||
for (int i = 0 ; i < sRewardGroup.getRewardMaxNum();i++){
|
for (int i = 0 ; i < sRewardGroup.getRewardMaxNum();i++){
|
||||||
|
|
@ -391,7 +413,7 @@ public class ItemUtil {
|
||||||
id = Integer.parseInt(rewardArr[index]);
|
id = Integer.parseInt(rewardArr[index]);
|
||||||
}
|
}
|
||||||
SRewardItem sRewardItem = SRewardItem.getsDropMap().get(id);
|
SRewardItem sRewardItem = SRewardItem.getsDropMap().get(id);
|
||||||
int itemNum = getItemNum(sRewardItem);
|
int itemNum = getItemNum(user,sRewardItem);
|
||||||
if (itemNum <= 0){
|
if (itemNum <= 0){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -399,7 +421,7 @@ public class ItemUtil {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void getRandomMap(int randomItemNum ,String[] rewardArr,String[] weightArr, Map<Integer, Integer> itemMap, Map<Integer, Integer> cardMap,
|
private static void getRandomMap(User user,int randomItemNum ,String[] rewardArr,String[] weightArr, Map<Integer, Integer> itemMap, Map<Integer, Integer> cardMap,
|
||||||
Map<Integer,Integer> equipMap,Map<Integer,Integer> randomMap ,float dropRatio) {
|
Map<Integer,Integer> equipMap,Map<Integer,Integer> randomMap ,float dropRatio) {
|
||||||
for (int i = 0 ; i < randomItemNum;i++){
|
for (int i = 0 ; i < randomItemNum;i++){
|
||||||
int index = MathUtils.randomForStrArray(weightArr);
|
int index = MathUtils.randomForStrArray(weightArr);
|
||||||
|
|
@ -408,7 +430,7 @@ public class ItemUtil {
|
||||||
}
|
}
|
||||||
int id = Integer.parseInt(rewardArr[index]);
|
int id = Integer.parseInt(rewardArr[index]);
|
||||||
SRewardItem sRewardItem = SRewardItem.getsDropMap().get(id);
|
SRewardItem sRewardItem = SRewardItem.getsDropMap().get(id);
|
||||||
int itemNum = getItemNum(sRewardItem);
|
int itemNum = getItemNum(user,sRewardItem);
|
||||||
if (itemNum <= 0){
|
if (itemNum <= 0){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -421,17 +443,34 @@ public class ItemUtil {
|
||||||
* @param sRewardItem
|
* @param sRewardItem
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private static int getItemNum(SRewardItem sRewardItem) {
|
private static int getItemNum(User user,SRewardItem sRewardItem) {
|
||||||
|
int itemNum ;
|
||||||
if (sRewardItem.getRandomMin() == sRewardItem.getRandomMax()) {
|
if (sRewardItem.getRandomMin() == sRewardItem.getRandomMax()) {
|
||||||
return sRewardItem.getRandomMin();
|
itemNum = sRewardItem.getRandomMin();
|
||||||
|
}else {
|
||||||
|
itemNum = MathUtils.numRount(MathUtils.random(sRewardItem.getRandomMin(), sRewardItem.getRandomMax()) * sRewardItem.getGrowChance());
|
||||||
}
|
}
|
||||||
return MathUtils.numRount(MathUtils.random(sRewardItem.getRandomMin(), sRewardItem.getRandomMax()) * sRewardItem.getGrowChance());
|
|
||||||
|
//权重加成 1等级权重加成
|
||||||
|
int[] addition = sRewardItem.getAddition();
|
||||||
|
if(addition.length==2){
|
||||||
|
int weight= addition[1];
|
||||||
|
if(addition[0]==1){
|
||||||
|
itemNum = itemNum+(int)(itemNum*((float)user.getPlayerInfoManager().getLevel()/(float) weight));
|
||||||
|
}
|
||||||
|
//扩展其他权重
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return itemNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void getMap(int[] itemInfo, Map<Integer, Integer> itemMap,Map<Integer, Integer> cardMap,Map<Integer,Integer> equipMap,Map<Integer,Integer> randomMap ,float dropRatio) {
|
private static void getMap(User user,int[] itemInfo, Map<Integer, Integer> itemMap,Map<Integer, Integer> cardMap,Map<Integer,Integer> equipMap,Map<Integer,Integer> randomMap ,float dropRatio) {
|
||||||
for (int id :itemInfo){
|
for (int id :itemInfo){
|
||||||
SRewardItem sRewardItem = SRewardItem.getsDropMap().get(id);
|
SRewardItem sRewardItem = SRewardItem.getsDropMap().get(id);
|
||||||
int itemNum = getItemNum(sRewardItem);
|
int itemNum = getItemNum(user,sRewardItem);
|
||||||
if (itemNum <= 0){
|
if (itemNum <= 0){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -1396,6 +1435,9 @@ public class ItemUtil {
|
||||||
if (sRewardItem == null){
|
if (sRewardItem == null){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if(sRewardItem.getChanceAddition().length!=0){
|
||||||
|
dropAddition.add(dropId);
|
||||||
|
}
|
||||||
if (rewardStr.length() == 0){
|
if (rewardStr.length() == 0){
|
||||||
rewardStr = new StringBuilder(String.valueOf(sRewardItem.getId()));
|
rewardStr = new StringBuilder(String.valueOf(sRewardItem.getId()));
|
||||||
}else{
|
}else{
|
||||||
|
|
@ -1406,8 +1448,8 @@ public class ItemUtil {
|
||||||
}else{
|
}else{
|
||||||
weight.append("#").append(sRewardItem.getChance());
|
weight.append("#").append(sRewardItem.getChance());
|
||||||
}
|
}
|
||||||
dropMap.put(sRewardGroup.getId(),rewardStr +"|"+weight);
|
|
||||||
}
|
}
|
||||||
|
dropMap.put(sRewardGroup.getId(),rewardStr +"|"+weight);
|
||||||
}
|
}
|
||||||
dropRewardMap = dropMap;
|
dropRewardMap = dropMap;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
package config;
|
||||||
|
|
||||||
|
import manager.STableManager;
|
||||||
|
import manager.Table;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
@Table(name ="AchievementConfig")
|
||||||
|
public class SAchievementConfig implements BaseConfig {
|
||||||
|
|
||||||
|
private int id;
|
||||||
|
|
||||||
|
private int type;
|
||||||
|
|
||||||
|
private int[][] values;
|
||||||
|
|
||||||
|
private int[][] reward;
|
||||||
|
|
||||||
|
public static Map<Integer, Set<Integer>> setTMap;
|
||||||
|
public static Map<Integer, List<SAchievementConfig>> sTaskConfigByTypeMap;
|
||||||
|
@Override
|
||||||
|
public void init() throws Exception {
|
||||||
|
Map<Integer, SAchievementConfig> configTmp = STableManager.getConfig(SAchievementConfig.class);
|
||||||
|
Map<Integer, List<SAchievementConfig>> configListTmp = new HashMap<>();
|
||||||
|
for(SAchievementConfig sAchievementConfig : configTmp.values()){
|
||||||
|
int taskType = sAchievementConfig.getType();
|
||||||
|
if(!configListTmp.containsKey(taskType)){
|
||||||
|
configListTmp.put(taskType,new ArrayList<>());
|
||||||
|
}
|
||||||
|
configListTmp.get(taskType).add(sAchievementConfig);
|
||||||
|
}
|
||||||
|
sTaskConfigByTypeMap = configListTmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[][] getValues() {
|
||||||
|
return values;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[][] getReward() {
|
||||||
|
return reward;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Map<Integer, List<SAchievementConfig>> getsTaskConfigByTypeMap() {
|
||||||
|
return sTaskConfigByTypeMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setsTaskConfigByTypeMap(Map<Integer, List<SAchievementConfig>> sTaskConfigByTypeMap) {
|
||||||
|
SAchievementConfig.sTaskConfigByTypeMap = sTaskConfigByTypeMap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
package config;
|
||||||
|
|
||||||
|
import manager.STableManager;
|
||||||
|
import manager.Table;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Table(name ="ExpeditionNodeConfig")
|
||||||
|
public class SExpeditionNodeConfig implements BaseConfig {
|
||||||
|
|
||||||
|
private int id;
|
||||||
|
|
||||||
|
private int type;
|
||||||
|
|
||||||
|
private int[] reward;
|
||||||
|
|
||||||
|
private int[][] holyProbability;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init() throws Exception {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int gettype() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[] getreward() {
|
||||||
|
return reward;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[][] getHolyProbability() {
|
||||||
|
return holyProbability;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -52,6 +52,8 @@ public class SSpecialConfig implements BaseConfig {
|
||||||
public static final String LAMP_TEXT_SPEED = "lamp_text_speed";//跑马灯速度
|
public static final String LAMP_TEXT_SPEED = "lamp_text_speed";//跑马灯速度
|
||||||
public static final String TIME_LIMIT_RECRUITMENT_INTEGRAL = "time_limit_recruitment_integral";//限时抽卡一次积分
|
public static final String TIME_LIMIT_RECRUITMENT_INTEGRAL = "time_limit_recruitment_integral";//限时抽卡一次积分
|
||||||
public static final String TIME_LIMIT_RECRUITMENT_FREEINTEGRAL = "time_limit_recruitment_FreeIntegral";//东海寻仙每获得150分赠送一次免费招募
|
public static final String TIME_LIMIT_RECRUITMENT_FREEINTEGRAL = "time_limit_recruitment_FreeIntegral";//东海寻仙每获得150分赠送一次免费招募
|
||||||
|
public static final String HERO_RETURN_PERCENT = "hero_return_percent";//回溯返还材料比例 实际百分比为填写数值/10000
|
||||||
|
public static final String HERO_SACRIFICE_PERCENT = "hero_sacrifice_percent";//献祭返还材料比例 实际百分比为填写数值/10000
|
||||||
@Override
|
@Override
|
||||||
public void init() throws Exception {
|
public void init() throws Exception {
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue