back_recharge
zhangshanxue 2019-08-30 16:48:05 +08:00
commit 9eac78b1eb
10 changed files with 121 additions and 20 deletions

View File

@ -52,7 +52,7 @@ public class MapPointConfig implements BaseConfig{
private int[][] randomProbability;
private int isShowFightAbility;
private int[] isShowFightAbility;
@Override
public void init() throws Exception {
@ -95,7 +95,7 @@ public class MapPointConfig implements BaseConfig{
return randomProbability;
}
public int getIsShowFightAbility() {
public int[] getIsShowFightAbility() {
return isShowFightAbility;
}
}

View File

@ -20,6 +20,8 @@ public class SEndlessMapConfig implements BaseConfig {
private int[] mapItem;
private int[][] endlessPoint;
public static Map<Integer,SEndlessMapConfig> sEndlessMapConfigMap;
@Override
@ -48,5 +50,7 @@ public class SEndlessMapConfig implements BaseConfig {
return deathCost;
}
public int[][] getEndlessPoint() {
return endlessPoint;
}
}

View File

@ -61,6 +61,10 @@ public class SGuildSetting implements BaseConfig {
private int[] nameSize;
private int[] totemItem;
private int recruitCD;
public static SGuildSetting sGuildSetting;
@ -175,4 +179,12 @@ public class SGuildSetting implements BaseConfig {
public int[] getNameSize() {
return nameSize;
}
public int[] getTotemItem() {
return totemItem;
}
public int getRecruitCD() {
return recruitCD;
}
}

View File

@ -419,11 +419,12 @@ public class MapLogic {
continue;
}
Cell cellValue = new Cell(xy, mapPointConfig.getInitialEventId(), mapPointConfig.getId());
if(xy>1000){
cellValue.setForce(123456);
}
if(mapPointConfig.getIsShowFightAbility()==1){
cellValue.setForce(123456);
if(mapPointConfig.getIsShowFightAbility()!=null&&mapPointConfig.getIsShowFightAbility().length>0){
int force = 0;
for(int i = 0 ; i <mapPointConfig.getIsShowFightAbility().length;i++){
force+=mapPointConfig.getIsShowFightAbility()[i];
}
cellValue.setForce(force);
}
newMap.put(xy, cellValue);
}
@ -3055,7 +3056,7 @@ public class MapLogic {
if(heroEntry.getValue().getLevel()<20){
continue;
}
int calHp = HeroLogic.getInstance().calHeroNotBufferAttribute(user, heroEntry.getValue(), false,401).get(1);
int calHp = HeroLogic.getInstance().calHeroNotBufferAttribute(user, heroEntry.getValue(), true,401).get(1);
if(!endlessHeroInfo.containsKey(heroEntry.getKey())){
mapManager.addEndlessHero(heroEntry.getKey(),calHp);
}
@ -3242,4 +3243,41 @@ public class MapLogic {
public static int getEndlessMapId() {
return endlessMapId;
}
/**
*
* @param session
* @param messageType
*/
public void endlessMinMapInfo(ISession session, MessageTypeProto.MessageType messageType) throws Exception {
MapManager mapManager = UserManager.getUser(session.getUid()).getMapManager();
int[][] endlessMinMapPoint = SEndlessMapConfig.sEndlessMapConfigMap.get(MapLogic.endlessMapId).getEndlessPoint();
MapInfoProto.EndlessMinMapResponse.Builder response = MapInfoProto.EndlessMinMapResponse.newBuilder();
Map<Integer, SCMap> scMap = SCMap.sCMap.get(MapLogic.endlessMapId);
for(Map.Entry<Integer, SCMap> entry:scMap.entrySet()){
for(int i = 0 ; i <endlessMinMapPoint.length;i++){
if(entry.getValue().getEvent()==endlessMinMapPoint[i][0]){
int[][] groups = entry.getValue().getGroups();
for(int j = 0 ; j <groups.length;j++){
CommonProto.EndlessPoint.Builder point = CommonProto.EndlessPoint.newBuilder();
int x = groups[j][0];
int y = groups[j][1];
int xy = CellUtil.xy2Pos(x, y);
point.setLocation(xy).setMonsterId(endlessMinMapPoint[i][1]);
response.addPoints(point);
LOGGER.info("小地图怪物坐标点{}",xy);
}
}
}
}
EndlessMapInfo endlessMapInfo = mapManager.getEndlessMapInfo();
if(endlessMapInfo.getCurCell()!=0){
response.setMyXY(endlessMapInfo.getCurCell());
}else{
SChallengeMapConfig sChallengeMapConfig = SChallengeMapConfig.integerSChallengeMapConfigMap.get(MapLogic.endlessMapId);
int[] position = sChallengeMapConfig.getPosition();
response.setMyXY( CellUtil.xy2Pos(position[0],position[1]));
}
MessageUtil.sendMessage(session,1,messageType.getNumber(),response.build(),true);
}
}

View File

@ -0,0 +1,21 @@
package com.ljsd.jieling.handler.map.mapHandler;
import com.ljsd.jieling.handler.BaseHandler;
import com.ljsd.jieling.handler.map.MapLogic;
import com.ljsd.jieling.netty.cocdex.PacketNetData;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.MessageTypeProto;
import org.springframework.stereotype.Component;
@Component
public class EndlessMinMapHandler extends BaseHandler {
@Override
public MessageTypeProto.MessageType getMessageCode() {
return MessageTypeProto.MessageType.ENDLESS_MIN_MAP_INFO_REQUEST;
}
@Override
public void process(ISession iSession, PacketNetData netData) throws Exception {
MapLogic.getInstance().endlessMinMapInfo(iSession, MessageTypeProto.MessageType.ENDLESS_MIN_MAP_INFO_RESPONSE);
}
}

View File

@ -15,6 +15,7 @@ public class KTDataUtil {
ParamDataBean paramDataBean = dataInfo.get(uid);
if(paramDataBean!=null){
try {
paramDataBean.setData_unix((int)(System.currentTimeMillis()/1000));
return paramDataBean.clone();
} catch (CloneNotSupportedException e) {
e.printStackTrace();

View File

@ -120,7 +120,7 @@ public class KtEventUtils {
KTParam ktParam = ParamBuilder.paramBuild(user, eventType, paramEventBean);
DataMessageUtils.addLogQueue(ktParam);
// LOGGER.info("ktparm -- > {}",gson.toJson(ktParam));
// LOGGER.info("ktparm -- > {}",gson.toJson(ktParam));
}
public static ParamEnvironmentBean enviromentBuild(int uid){
return KTEnvironmentUtil.getUserEnviromentInfoById(uid);

View File

@ -58,10 +58,6 @@ public class GuilidManager {
RedisUtil.getInstence().removeMapEntrys("apply-user-play",Integer.toString(uid),Integer.toString(guild));
}
public static void removeMineApplyGuildInfos(int guild,int uid){
RedisUtil.getInstence().removeMapEntrys("apply-user-play",Integer.toString(uid),Integer.toString(guild));
}
public static void addGuildLog(GuildLog guildLog) throws Exception {
MongoUtil.getInstence().getMyMongoTemplate().save(guildLog);
if(!guildLogInfoMap.containsKey(guildLog.getGuildId())){

View File

@ -1,9 +1,11 @@
package com.ljsd.jieling.logic.dao.root;
import com.ljsd.common.mogodb.MongoBase;
import com.ljsd.jieling.config.SGuildSetting;
import com.ljsd.jieling.core.GlobalsDef;
import com.ljsd.jieling.db.redis.RedisKey;
import com.ljsd.jieling.db.redis.RedisUtil;
import com.ljsd.jieling.util.MathUtils;
import java.util.HashMap;
import java.util.HashSet;
@ -64,6 +66,7 @@ public class GuildInfo extends MongoBase {
joinType =1;
level = 1;
totalMembers=1;
icon = MathUtils.randomInt(SGuildSetting.sGuildSetting.getTotemItem().length)+1;
defendInfo = new ConcurrentHashMap<>();
}

View File

@ -190,6 +190,17 @@ public class GuildLogic {
MessageUtil.sendErrorResponse(session,0,msgId,"已加入过公会");
return;
}
Map<Integer, GuildApply> applyGuildPersonInfos = GuilidManager.getApplyGuildInfos(session.getUid(), 1);
SGuildSetting guildSetting = SGuildSetting.sGuildSetting;
if(applyGuildPersonInfos.size()>=guildSetting.getApplyLimit()){
MessageUtil.sendErrorResponse(session,0,msgId,"已达申请上线,无法继续申请");
return;
}
Map<Integer, GuildApply> applyGuildFamilyInfos = GuilidManager.getApplyGuildInfos(session.getUid(), 0);
if(applyGuildFamilyInfos.size()>=guildSetting.getBeApplyLimit()){
MessageUtil.sendErrorResponse(session,0,msgId,"当前公会被申请已达上线,无法继续申请");
return;
}
for(Integer applyGuildId : applyGuilds){
GuildApply guildApply = new GuildApply(uid,applyGuildId);
GuilidManager.addApplyGuildInfo(guildApply);
@ -362,28 +373,40 @@ public class GuildLogic {
return;
}
try {
Map<Integer, GuildApply> applyGuild = GuilidManager.getApplyGuildInfos(guildId, 0);
switch (type){
case 1: //全部同意
GuilidManager.removeApplyGuildInfos(guildId);
Map<Integer, Set<Integer>> members = guildInfo.getMembers();
int count = 0;
for(Set<Integer> memberOfType : members.values()){
count+=memberOfType.size();
}
Map<Integer, GuildApply> applyGuildInfos = GuilidManager.getApplyGuildInfos(guildId, 0);
for(Integer addUid : applyGuildInfos.keySet()){
for(Integer addUid : applyGuild.keySet()){
if(30-count<=0){
break;
}
applyToJoin(guildInfo,addUid,true);
count++;
}
for(Map.Entry<Integer, GuildApply> entry:applyGuild.entrySet()){
GuilidManager.removeOneApplyGuildInfos(entry.getValue().getGuildId(),entry.getValue().getId());
Map<Integer, GuildApply> applyPersonal = GuilidManager.getApplyGuildInfos(entry.getValue().getId(), 1);
for(Map.Entry<Integer, GuildApply> personalEntry:applyPersonal.entrySet()) {
GuilidManager.removeOneApplyGuildInfos(personalEntry.getValue().getGuildId(),personalEntry.getValue().getId());
}
}
break;
case 2: //全部拒绝
GuilidManager.removeApplyGuildInfos(guildId);
for(Map.Entry<Integer, GuildApply> entry:applyGuild.entrySet()){
GuilidManager.removeOneApplyGuildInfos(entry.getValue().getGuildId(),entry.getValue().getId());
}
break;
case 3: //同意一个
applyToJoin(guildInfo,applyId,true);
Map<Integer, GuildApply> applyPersonal = GuilidManager.getApplyGuildInfos(applyId, 1);
for(Map.Entry<Integer, GuildApply> personalEntry:applyPersonal.entrySet()) {
GuilidManager.removeOneApplyGuildInfos(personalEntry.getValue().getGuildId(),personalEntry.getValue().getId());
}
break;
case 4: //拒绝一个
GuilidManager.removeOneApplyGuildInfos(guildId,applyId);
@ -408,10 +431,13 @@ public class GuildLogic {
if(targetUser.getPlayerInfoManager().getGuildId()!=0){
return;
}
GuilidManager.removeOneApplyGuildInfos(guildInfo.getId(),applyId);
if(targetUser.getPlayerInfoManager().getGuildId()!=0){
// MessageUtil.sendErrorResponse();
return;
}
guildInfo.addMembers(GlobalsDef.MEMBER,applyId);
targetUser.getPlayerInfoManager().setGuildId(guildInfo.getId());
GuilidManager.removeMineApplyGuildInfos(guildInfo.getId(),applyId);
GuilidManager.removeOneApplyGuildInfos(guildInfo.getId(),applyId);
}catch (Exception e){
LOGGER.error("the exception={}",e);
}finally {