Merge branch 'master' of http://60.1.1.230/backend/jieling_server
commit
f4665ee4c7
|
@ -8,5 +8,3 @@ int string int string string int
|
|||
6 成长基金 6 0 0 1
|
||||
7 云梦祈福 7 0 604800 2
|
||||
8 孙龙的宝藏 8 0 604800 2
|
||||
9 招财猫 9 0 604800 2
|
||||
10 七日狂欢 10 0 604800 2
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
Id ActivityId LuckyType LuckyTime ConsumeValue ValueUp ValueDown RmbValue
|
||||
int int int int int int int int
|
||||
1 9 16 1 200 300 200 0
|
||||
2 9 16 2 500 750 500 0
|
||||
3 9 16 3 1000 1200 1000 0
|
||||
4 9 16 4 2000 2400 2000 100
|
||||
5 9 16 5 3000 3600 3000 500
|
||||
6 9 16 6 4000 4800 4000 1000
|
||||
7 9 16 7 5000 6000 5000 1500
|
||||
8 9 16 8 6000 7200 6000 2000
|
|
@ -5,9 +5,7 @@ public interface GlobalsDef {
|
|||
int MAP_MISSION_RETURN = -9999;
|
||||
|
||||
int CHAIRMAN = 1;
|
||||
int VICE_CHAIRMAN = 2;
|
||||
int HIGHER = 3;
|
||||
int ELITES = 4;
|
||||
int ADMINISTRATORS =2;
|
||||
int MEMBER = 5; // 门主, 副门主, 长老, 精英, 弟子
|
||||
|
||||
int RANDOM_LOTTERY_TYPE = 1;
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
package com.ljsd.jieling.handler.family;
|
||||
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.family.GuildLogic;
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.Family;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
|
||||
public class FamilyApplyHandler extends BaseHandler {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.FAMILY_APPLY_REQEUST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
byte[] bytes = netData.parseClientProtoNetData();
|
||||
Family.FamilyApplyRequest familyApplyRequest = Family.FamilyApplyRequest.parseFrom(bytes);
|
||||
GuildLogic.applyFamily(iSession,familyApplyRequest.getFamilyIdList());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package com.ljsd.jieling.handler.family;
|
||||
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.family.GuildLogic;
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.Family;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class FamilyJoinHandler extends BaseHandler {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.FAMILY_JOIN_REQUEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
byte[] bytes = netData.parseClientProtoNetData();
|
||||
Family.FamilyJoinRequest familyJoinRequest = Family.FamilyJoinRequest.parseFrom(bytes);
|
||||
GuildLogic.joinGuild(iSession,familyJoinRequest.getFamilyId());
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.ljsd.jieling.handler.family;
|
||||
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.family.GuildLogic;
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.Family;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class FamilySeachHandler extends BaseHandler {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.FAMILY_SEARCH_REQEUST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
byte[] bytes = netData.parseClientProtoNetData();
|
||||
Family.FamilySearchReqeust familySearchReqeust = Family.FamilySearchReqeust.parseFrom(bytes);
|
||||
GuildLogic.searchGuild(iSession,familySearchReqeust.getName());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package com.ljsd.jieling.handler.family;
|
||||
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.family.GuildLogic;
|
||||
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 GetFamilyApplyInfoHandler extends BaseHandler {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.FAMILY_GET_APPLY_REQUEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
GuildLogic.getGuildApplyInfo(iSession);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package com.ljsd.jieling.handler.family;
|
||||
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.family.GuildLogic;
|
||||
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 GetFamilyInfoHandler extends BaseHandler {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.FAMILY_GET_INFO_REQUEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
GuildLogic.getFamilyInfo(iSession);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package com.ljsd.jieling.handler.family;
|
||||
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.family.GuildLogic;
|
||||
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 GetFamilyLogInfoHandler extends BaseHandler {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.FAMILY_GET_LOG_REQUEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
GuildLogic.getGuildLogInfo(iSession);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.ljsd.jieling.handler.family;
|
||||
|
||||
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.family.GuildLogic;
|
||||
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 GetFamilyMemberHandler extends BaseHandler {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.FAMILY_GET_MEMBER_REQUEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
GuildLogic.getGuildMemberInfo(iSession);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package com.ljsd.jieling.handler.map;
|
||||
|
||||
public class EndlessHero {
|
||||
private int maxHp;
|
||||
|
||||
private int curHp;
|
||||
|
||||
public int getMaxHp() {
|
||||
return maxHp;
|
||||
}
|
||||
|
||||
public int getCurHp() {
|
||||
return curHp;
|
||||
}
|
||||
|
||||
public void setMaxHp(int maxHp) {
|
||||
this.maxHp = maxHp;
|
||||
}
|
||||
|
||||
public void setCurHp(int curHp) {
|
||||
this.curHp = curHp;
|
||||
}
|
||||
|
||||
public EndlessHero(int maxHp, int curHp) {
|
||||
this.maxHp = maxHp;
|
||||
this.curHp = curHp;
|
||||
}
|
||||
public EndlessHero() {
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package com.ljsd.jieling.handler.map;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class EndlessMapInfo {
|
||||
private int curMapId;
|
||||
|
||||
private int curCell;
|
||||
|
||||
private Map<String,EndlessHero> endlessHeroInfo;
|
||||
|
||||
private Map<Integer,Map<Integer,String>> mapSign;
|
||||
|
||||
public int getCurMapId() {
|
||||
return curMapId;
|
||||
}
|
||||
|
||||
public int getCurCell() {
|
||||
return curCell;
|
||||
}
|
||||
|
||||
public void setCurCell(int curCell) {
|
||||
this.curCell = curCell;
|
||||
}
|
||||
|
||||
public void setCurMapId(int curMapId) {
|
||||
this.curMapId = curMapId;
|
||||
}
|
||||
|
||||
public Map<String, EndlessHero> getEndlessHeroInfo() {
|
||||
return endlessHeroInfo;
|
||||
}
|
||||
|
||||
public void setEndlessHeroInfo(Map<String, EndlessHero> endlessHeroInfo) {
|
||||
this.endlessHeroInfo = endlessHeroInfo;
|
||||
}
|
||||
|
||||
public Map<Integer, Map<Integer, String>> getMapSign() {
|
||||
return mapSign;
|
||||
}
|
||||
|
||||
public void setMapSign(Map<Integer, Map<Integer, String>> mapSign) {
|
||||
this.mapSign = mapSign;
|
||||
}
|
||||
|
||||
public EndlessMapInfo() {
|
||||
this.endlessHeroInfo =new HashMap<>();
|
||||
this.mapSign = new HashMap<>();
|
||||
}
|
||||
}
|
|
@ -138,7 +138,7 @@ public class MapLogic {
|
|||
if (user.getPlayerInfoManager().getMapId() < mapId) {
|
||||
user.getPlayerInfoManager().setMapId(mapId);
|
||||
}
|
||||
String error = initTeamInfo(teamId, uid, user, mapManager);
|
||||
String error = initTeamInfo(teamId, uid, user, mapManager,1);
|
||||
if (!error.isEmpty()) {
|
||||
LOGGER.info("enterMap() uid=>{} error =>{} ", uid, error);
|
||||
MessageUtil.sendErrorResponse(iSession, 0, messageType.getNumber(), "");
|
||||
|
@ -161,6 +161,15 @@ public class MapLogic {
|
|||
MessageUtil.sendErrorResponse(iSession, 0, messageType.getNumber(), "no ticket");
|
||||
return;
|
||||
}
|
||||
}else if(type ==4){
|
||||
|
||||
List<TeamPosHeroInfo> teamPosForHero = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
||||
for (int i = 0; i <teamPosForHero.size() ; i++) {
|
||||
String endlessHeroId = teamPosForHero.get(i).getHeroId();
|
||||
int maxHp = HeroLogic.getInstance().calHeroNotBufferAttribute(user,user.getHeroManager().getHero(endlessHeroId),false).get(1);
|
||||
mapManager.addEndlessHero(teamPosForHero.get(i).getHeroId(),maxHp);
|
||||
}
|
||||
mapManager.setCurXY(mapManager.getEndlessMapInfo().getCurCell());
|
||||
}
|
||||
//todo 更新地圖次數
|
||||
mapManager.setCurMapId(mapId);
|
||||
|
@ -250,7 +259,17 @@ public class MapLogic {
|
|||
MessageUtil.sendMessage(iSession, 1, messageType.getNumber(), mapEnterResponse.build(), true);
|
||||
}
|
||||
|
||||
private String initTeamInfo(int teamId, int uid, User user, MapManager mapManager) throws Exception {
|
||||
/**
|
||||
*
|
||||
* @param teamId
|
||||
* @param uid
|
||||
* @param user
|
||||
* @param mapManager
|
||||
* @param initType 1为正常初始化、2为复活初始化
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
private String initTeamInfo(int teamId, int uid, User user, MapManager mapManager ,int initType) throws Exception {
|
||||
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
||||
if (teamPosHeroInfos == null || teamPosHeroInfos.isEmpty()) {
|
||||
return "阵容不存在";
|
||||
|
@ -263,6 +282,18 @@ public class MapLogic {
|
|||
break;
|
||||
}
|
||||
Map<Integer, Integer> heroAllAttribute = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero,false);
|
||||
if(teamId==401){
|
||||
Map<String, EndlessHero> endlessHeroInfo = user.getMapManager().getEndlessMapInfo().getEndlessHeroInfo();
|
||||
if(endlessHeroInfo!=null&&endlessHeroInfo.size()>0){
|
||||
if(initType!=2){
|
||||
if(endlessHeroInfo.get(hero.getId())!=null){
|
||||
heroAllAttribute.put(HeroAttributeEnum.CurHP.getPropertyId(), endlessHeroInfo.get(hero.getId()).getCurHp());
|
||||
}
|
||||
}else{
|
||||
mapManager.updateEndlessHeroHp(hero.getId(),endlessHeroInfo.get(hero.getId()).getMaxHp());
|
||||
}
|
||||
}
|
||||
}
|
||||
heroAllAttributeMap.put(hero.getId(), heroAllAttribute);
|
||||
heroes.add(heroInfo.getHeroId());
|
||||
}
|
||||
|
@ -889,6 +920,9 @@ public class MapLogic {
|
|||
}
|
||||
}
|
||||
}
|
||||
if(challengeConfig.getType()==4) {
|
||||
mapManager.updateEndlessLocation(mapManager.getCurXY());
|
||||
}
|
||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), builder.build(), true);
|
||||
return;
|
||||
}
|
||||
|
@ -901,12 +935,6 @@ public class MapLogic {
|
|||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
long diff = (1565920800000L - 1563242400000L)/1000/60/60/24;
|
||||
System.out.println(diff);
|
||||
}
|
||||
|
||||
|
||||
private boolean onlyLevelMap(User user, boolean needTemporaryItem) throws Exception {
|
||||
MapManager mapManager = user.getMapManager();
|
||||
if (mapManager.getMapInfo() == null) {
|
||||
|
@ -1047,7 +1075,7 @@ public class MapLogic {
|
|||
if (leftTime <= (int) (time / 1000)) {
|
||||
resetMapInfo(user, false);
|
||||
} else {
|
||||
initTeamInfo(mapManager.getTeamId(), uid, user, mapManager);
|
||||
initTeamInfo(mapManager.getTeamId(), uid, user, mapManager,2);
|
||||
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(mapManager.getTeamId());
|
||||
for (TeamPosHeroInfo heroInfo : teamPosHeroInfos) {
|
||||
Hero hero = user.getHeroManager().getHero(heroInfo.getHeroId());
|
||||
|
@ -1074,6 +1102,11 @@ public class MapLogic {
|
|||
for (TeamPosHeroInfo teamPosHeroInfo : team) {
|
||||
mapManager.updateHeroOneAttribute(teamPosHeroInfo.getHeroId(), HeroAttributeEnum.CurHP.getPropertyId(), checkResult[teamPosHeroInfo.getPosition()+1]);
|
||||
}
|
||||
if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4&&teamId==401){
|
||||
for (TeamPosHeroInfo teamPosHeroInfo : team) {
|
||||
mapManager.updateEndlessHeroHp(teamPosHeroInfo.getHeroId(),checkResult[teamPosHeroInfo.getPosition()+1]);
|
||||
}
|
||||
}
|
||||
|
||||
BehaviorUtil.destoryApointXY(user, destoryXY);
|
||||
SMonsterGroup sMonsterGroup = SMonsterGroup.getsMonsterGroupMap().get(groupId);
|
||||
|
@ -1233,6 +1266,7 @@ public class MapLogic {
|
|||
int optionId = Integer.parseInt((String) valueMap.get(RedisKey.NEED_VICTORY_AFTER));
|
||||
int nextEventId = 0;
|
||||
SOptionConfig sOptionConfig = SOptionConfig.sOptionConfigMap.get(optionId);
|
||||
SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(user.getMapManager().getCurMapId());
|
||||
//校验结果码 1:胜利
|
||||
int resultCode = checkResult[0];
|
||||
if (resultCode == -1) {
|
||||
|
@ -1245,7 +1279,6 @@ public class MapLogic {
|
|||
int dieCount = user.getMapManager().getDieCount();
|
||||
dieCount++;
|
||||
user.getMapManager().setDieCount(dieCount);
|
||||
SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(user.getMapManager().getCurMapId());
|
||||
int[] reviveTime = sChallengeConfig.getReviveTime();
|
||||
long time = (long) (MathUtils.calABX(dieCount, reviveTime) * 1000);
|
||||
user.getMapManager().setCanMoveTime(TimeUtils.now() + time);
|
||||
|
@ -1254,7 +1287,7 @@ public class MapLogic {
|
|||
if (leftTime <= (int) (time / 1000)) {
|
||||
resetMapInfo(user, false);
|
||||
} else {
|
||||
initTeamInfo(mapManager.getTeamId(), uid, user, mapManager);
|
||||
initTeamInfo(mapManager.getTeamId(), uid, user, mapManager,2);
|
||||
Map<String, Map<Integer, Integer>> heroAllAttributeMap = mapManager.getHeroAllAttributeMap();
|
||||
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(mapManager.getTeamId());
|
||||
for (TeamPosHeroInfo heroInfo : teamPosHeroInfos) {
|
||||
|
@ -1292,12 +1325,16 @@ public class MapLogic {
|
|||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightEndResponse.build(), true);
|
||||
return;
|
||||
}
|
||||
|
||||
int teamId = mapManager.getTeamId();
|
||||
List<TeamPosHeroInfo> team = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
||||
for (TeamPosHeroInfo teamPosHeroInfo : team) {
|
||||
mapManager.updateHeroOneAttribute(teamPosHeroInfo.getHeroId(), HeroAttributeEnum.CurHP.getPropertyId(), checkResult[teamPosHeroInfo.getPosition()+1]);
|
||||
}
|
||||
if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4&&teamId==401){
|
||||
for (TeamPosHeroInfo teamPosHeroInfo : team) {
|
||||
mapManager.updateEndlessHeroHp(teamPosHeroInfo.getHeroId(),checkResult[teamPosHeroInfo.getPosition()+1]);
|
||||
}
|
||||
}
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, sMonsterGroup.getRewardgroup(), 1, 1, BIReason.MAP_GENERAL_FIGHT_REWARD);
|
||||
FightInfoProto.FightEndResponse.Builder fightEndResponse = FightInfoProto.FightEndResponse.newBuilder();
|
||||
fightEndResponse.setEnventDrop(drop.build());
|
||||
|
@ -2252,9 +2289,9 @@ public class MapLogic {
|
|||
int[][] bossType = config.getRandomBossType();
|
||||
|
||||
type = MathUtils.randomFromWeight(bossType);
|
||||
// if(mapManager.getTower()%5!=0){
|
||||
// type = 3;
|
||||
// }
|
||||
if(mapManager.getTower()%5!=0){
|
||||
type = 3;
|
||||
}
|
||||
LOGGER.info("trigger!!!!!!!!!!!!!!!!!-------->{},{}",CellUtil.pos2XY(mapManager.getCurXY())[0],CellUtil.pos2XY(mapManager.getCurXY())[1]);
|
||||
int[][][] pointId = config.getRandomMapPointId();
|
||||
int mapId = config.getMapId();
|
||||
|
@ -2681,4 +2718,109 @@ public class MapLogic {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取无尽副本英雄信息
|
||||
* @param session
|
||||
* @param messageType
|
||||
*/
|
||||
public void getEndlessHero(ISession session, MessageTypeProto.MessageType messageType) throws Exception {
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
MapManager mapManager = user.getMapManager();
|
||||
HeroManager heroManager = user.getHeroManager();
|
||||
EndlessMapInfo endlessMapInfo = mapManager.getEndlessMapInfo();
|
||||
if(endlessMapInfo==null){
|
||||
mapManager.setEndlessMapInfo(new EndlessMapInfo());
|
||||
endlessMapInfo = mapManager.getEndlessMapInfo();
|
||||
}
|
||||
Map<String, EndlessHero> endlessHeroInfo = endlessMapInfo.getEndlessHeroInfo();
|
||||
MapInfoProto.GetEndlessHeroResponse.Builder response = MapInfoProto.GetEndlessHeroResponse.newBuilder();
|
||||
for(Map.Entry<String,Hero> heroEntry : heroManager.getHeroMap().entrySet()) {
|
||||
if(heroEntry.getValue().getLevel()<20){
|
||||
continue;
|
||||
}
|
||||
int calHp = HeroLogic.getInstance().calHeroFinalAttributeWhenInMap(user, heroEntry.getValue(), true).get(1);
|
||||
for (Map.Entry<String,EndlessHero> entry :endlessHeroInfo.entrySet()) {
|
||||
if (!entry.getKey().equals(heroEntry.getKey())) {
|
||||
continue;
|
||||
}
|
||||
if(calHp!=entry.getValue().getMaxHp()){
|
||||
int tempHp = calHp*entry.getValue().getCurHp()/entry.getValue().getMaxHp();
|
||||
endlessHeroInfo.put(entry.getKey(),new EndlessHero(calHp,tempHp));
|
||||
calHp = tempHp;
|
||||
}else{
|
||||
calHp = entry.getValue().getCurHp();
|
||||
}
|
||||
break;
|
||||
}
|
||||
LOGGER.info("英雄ID{},血量{}",heroEntry.getKey(),calHp);
|
||||
CommonProto.endlessHero endlessHero = CommonProto.endlessHero.newBuilder().setHeroId(heroEntry.getKey()).setHp(calHp).build();
|
||||
response.addHeroInfo(endlessHero);
|
||||
}
|
||||
endlessMapInfo.setEndlessHeroInfo(endlessHeroInfo);
|
||||
mapManager.setEndlessMapInfo(endlessMapInfo);
|
||||
List<TeamPosHeroInfo> team = user.getTeamPosManager().getTeamPosForHero().get(401);
|
||||
if(team!=null&&team.size()>0){
|
||||
Iterator<TeamPosHeroInfo> iterator = team.iterator();
|
||||
while(iterator.hasNext()){
|
||||
TeamPosHeroInfo teamInfo = iterator.next();
|
||||
EndlessHero endlessHero = endlessMapInfo.getEndlessHeroInfo().get(teamInfo.getHeroId());
|
||||
if(endlessHero==null){
|
||||
continue;
|
||||
}
|
||||
if(endlessHero.getCurHp()==0){
|
||||
Map<String, Map<Integer, Integer>> heroAllAttributeMap = mapManager.getHeroAllAttributeMap();
|
||||
if(heroAllAttributeMap.containsKey(teamInfo.getHeroId())){
|
||||
heroAllAttributeMap.remove(teamInfo.getHeroId());
|
||||
}
|
||||
mapManager.setHeroAllAttributeMap(heroAllAttributeMap);
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
user.getTeamPosManager().updateTeamPosByTeamId(401,team);
|
||||
}
|
||||
MessageUtil.sendMessage(session,1,messageType.getNumber(),response.build(),true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 无尽副本复位
|
||||
* @param session
|
||||
* @param messageType
|
||||
*/
|
||||
public void resetEndlessHero(ISession session, MessageTypeProto.MessageType messageType) throws Exception {
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
MapManager mapManager = user.getMapManager();
|
||||
EndlessMapInfo endlessMapInfo = mapManager.getEndlessMapInfo();
|
||||
|
||||
for(Map.Entry<String,EndlessHero> entry:endlessMapInfo.getEndlessHeroInfo().entrySet()){
|
||||
mapManager.updateEndlessHeroHp(entry.getKey(),entry.getValue().getMaxHp());
|
||||
}
|
||||
for (Map.Entry<String, Map<Integer, Integer>> entry:mapManager.getHeroAllAttributeMap().entrySet()){
|
||||
mapManager.updateHeroOneAttribute(entry.getKey(),HeroAttributeEnum.CurHP.getPropertyId(),entry.getValue().get(HeroAttributeEnum.Hp.getPropertyId()));
|
||||
}
|
||||
|
||||
MessageUtil.sendMessage(session,1,messageType.getNumber(),null,true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 无尽副本设置标记
|
||||
* @param session
|
||||
* @param cellId
|
||||
* @param content
|
||||
* @param messageType
|
||||
*/
|
||||
public void setEndlessSign(ISession session,int mapId,int cellId, String content, MessageTypeProto.MessageType messageType) throws Exception {
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
MapManager mapManager = user.getMapManager();
|
||||
boolean result = ShieldedWordUtils.checkName(content,false);
|
||||
String error;
|
||||
if (!result) {
|
||||
error = "输入有敏感字符";
|
||||
}else{
|
||||
mapManager.addEndlessSign(mapId,cellId,content);
|
||||
error = "设置成功";
|
||||
}
|
||||
MapInfoProto.SignEndlessCellResponse response = MapInfoProto.SignEndlessCellResponse.newBuilder().setError(error).build();
|
||||
MessageUtil.sendMessage(session,1,messageType.getNumber(),response,true);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -110,6 +110,8 @@ public class MapManager extends MongoBase {
|
|||
private Map<Integer,Integer> towerReceivedReward = new HashMap<>();
|
||||
|
||||
private Map<Integer, Map<Integer,Integer>> monsterTempSkill = new HashMap<>();
|
||||
//无尽副本信息
|
||||
private EndlessMapInfo endlessMapInfo;
|
||||
|
||||
public MapManager() {
|
||||
this.setRootCollection(User._COLLECTION_NAME);
|
||||
|
@ -674,7 +676,52 @@ public class MapManager extends MongoBase {
|
|||
|
||||
public void setLastFightResult(int lastFightResult) {
|
||||
this.lastFightResult = lastFightResult;
|
||||
updateString("lastFightResult",lastFightResult);
|
||||
updateString("lastFightResult", lastFightResult);
|
||||
}
|
||||
public EndlessMapInfo getEndlessMapInfo() {
|
||||
return endlessMapInfo;
|
||||
}
|
||||
|
||||
public void setEndlessMapInfo(EndlessMapInfo endlessMapInfo) {
|
||||
updateString("endlessMapInfo",endlessMapInfo);
|
||||
this.endlessMapInfo = endlessMapInfo;
|
||||
}
|
||||
public void addEndlessHero(String heroId,int maxHp){
|
||||
if(endlessMapInfo==null){
|
||||
setEndlessMapInfo(new EndlessMapInfo());
|
||||
}
|
||||
if(endlessMapInfo.getEndlessHeroInfo().containsKey(heroId)){
|
||||
return;
|
||||
}
|
||||
EndlessHero endlessHero = new EndlessHero(maxHp, maxHp);
|
||||
updateString("endlessMapInfo."+heroId,endlessHero);
|
||||
endlessMapInfo.getEndlessHeroInfo().put(heroId,endlessHero);
|
||||
}
|
||||
public void updateEndlessHeroHp(String heroId,int hp){
|
||||
updateString("endlessMapInfo.endlessHeroInfo."+heroId+".curHp",hp);
|
||||
EndlessHero endlessHero = endlessMapInfo.getEndlessHeroInfo().get(heroId);
|
||||
if(endlessHero!=null){
|
||||
endlessHero.setCurHp(hp);
|
||||
endlessMapInfo.getEndlessHeroInfo().put(heroId,endlessHero);
|
||||
}
|
||||
}
|
||||
public void updateEndlessLocation(int cellId){
|
||||
endlessMapInfo.setCurCell(cellId);
|
||||
updateString("endlessMapInfo.curCell",cellId);
|
||||
}
|
||||
public void updateEndlessMapId(int mapId){
|
||||
endlessMapInfo.setCurMapId(mapId);
|
||||
updateString("endlessMapInfo.curMapId",mapId);
|
||||
}
|
||||
public void addEndlessSign(int mapId,int cellId,String info){
|
||||
if(endlessMapInfo.getMapSign()==null){
|
||||
endlessMapInfo.setMapSign(new HashMap<>());
|
||||
}
|
||||
if(!endlessMapInfo.getMapSign().containsKey(mapId)){
|
||||
endlessMapInfo.getMapSign().put(mapId,new HashMap<>());
|
||||
}
|
||||
endlessMapInfo.getMapSign().get(mapId).put(mapId,info);
|
||||
updateString("endlessMapInfo.mapSign."+mapId+"."+cellId,info);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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 EndlessGetHeroHandler extends BaseHandler {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.ENDLESS_MAP_HERO_INFO_REQUEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
MapLogic.getInstance().getEndlessHero(iSession, MessageTypeProto.MessageType.ENDLESS_MAP_HERO_INFO_RESPONSE);
|
||||
}
|
||||
}
|
|
@ -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 EndlessResetHandler extends BaseHandler {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.ENDLESS_MAP_RESET_REQUEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
MapLogic.getInstance().resetEndlessHero(iSession, MessageTypeProto.MessageType.ENDLESS_MAP_RESET_RESPONSE);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
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.CommonProto;
|
||||
import com.ljsd.jieling.protocols.MapInfoProto;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class EndlessSetSignHandler extends BaseHandler {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.ENDLESS_MAP_SIGN_REQUEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
byte[] bytes = netData.parseClientProtoNetData();
|
||||
MapInfoProto.SignEndlessCellRequest request = MapInfoProto.SignEndlessCellRequest.parseFrom(bytes);
|
||||
CommonProto.endlessSign sign = request.getSign();
|
||||
MapLogic.getInstance().setEndlessSign(iSession,sign.getMapId(),sign.getCellId(),sign.getInfo(),MessageTypeProto.MessageType.ENDLESS_MAP_SIGN_RESPONSE);
|
||||
}
|
||||
}
|
|
@ -13,6 +13,7 @@ import com.ljsd.jieling.db.mongo.MongoUtil;
|
|||
import com.ljsd.jieling.handler.map.MapLogic;
|
||||
import com.ljsd.jieling.logic.activity.ActivityLogic;
|
||||
import com.ljsd.jieling.logic.arena.ArenaLogic;
|
||||
import com.ljsd.jieling.logic.dao.GuilidManager;
|
||||
import com.ljsd.jieling.logic.dao.TimeControllerOfFunction;
|
||||
import com.ljsd.jieling.logic.dao.UserMissionManager;
|
||||
import com.ljsd.jieling.logic.dao.root.GlobalSystemControl;
|
||||
|
@ -189,6 +190,7 @@ public class GlobalDataManaager {
|
|||
DataManagerDistributor.init();
|
||||
initServerIsLanEnviornment(configurableApplicationContext);
|
||||
StoreLogic.checkGlobalStore(true);
|
||||
GuilidManager.init();
|
||||
new RPCServerTask(configurableApplicationContext).start();
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("e",e);
|
||||
|
|
|
@ -894,6 +894,10 @@ public class ActivityLogic {
|
|||
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){
|
||||
MessageUtil.sendErrorResponse(session,0,messageType.getNumber(),"不在活动开启时间内");
|
||||
return;
|
||||
}
|
||||
Map<Integer, ActivityProgressInfo> activityProgressInfoMap = activityMission.getActivityProgressInfoMap();
|
||||
if(activityProgressInfoMap.get(locationId+BlessInfoConfig.START_CAPACITY).getProgrss()!=0){
|
||||
MessageUtil.sendErrorResponse(session,0,messageType.getNumber(),"已经抽过改格子");
|
||||
|
@ -996,7 +1000,9 @@ public class ActivityLogic {
|
|||
MessageUtil.sendErrorResponse(session,0,messageType.getNumber(),"活动不可刷新");
|
||||
return;
|
||||
}
|
||||
PlayerInfoProto.blessRefresh res = PlayerInfoProto.blessRefresh.newBuilder().setReward(getBlessInfoResponse(blessRefresh(user)).build()).build();
|
||||
ActivityMission activityMission = blessRefresh(user);
|
||||
activityMission.updateProgressInfo(BlessInfoConfig.LAST_REFRESH_TIME,new ActivityProgressInfo((int)(TimeUtils.now()/1000),0));
|
||||
PlayerInfoProto.blessRefresh res = PlayerInfoProto.blessRefresh.newBuilder().setReward(getBlessInfoResponse(activityMission).build()).build();
|
||||
|
||||
MessageUtil.sendMessage(session,1,messageType.getNumber(),res,true);
|
||||
}
|
||||
|
@ -1009,7 +1015,6 @@ public class ActivityLogic {
|
|||
activityMission.updateProgressInfo(entry.getKey(),tempProgress);
|
||||
}
|
||||
activityMission = blessInfoInit(activityManager, 7);
|
||||
activityMission.updateProgressInfo(BlessInfoConfig.LAST_REFRESH_TIME,new ActivityProgressInfo((int)(TimeUtils.now()/1000),0));
|
||||
return activityMission;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,20 +1,57 @@
|
|||
package com.ljsd.jieling.logic.dao;
|
||||
|
||||
import com.ljsd.jieling.db.mongo.MongoUtil;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.logic.dao.root.GuildApply;
|
||||
import com.ljsd.jieling.logic.dao.root.GuildInfo;
|
||||
import com.ljsd.jieling.logic.dao.root.GuildLog;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
public class GuilidManager {
|
||||
|
||||
private static Map<Integer,GuildInfo> guildInfoMap = new HashMap<>();
|
||||
public static Map<Integer,GuildInfo> guildInfoMap = new HashMap<>();
|
||||
public static Map<String,GuildInfo> guildNameInfoMap = new HashMap<>();
|
||||
public static Map<Integer,List<GuildLog>> guildLogInfoMap = new HashMap<>();
|
||||
|
||||
public static void addGuildInfo(GuildInfo guildInfo) throws Exception {
|
||||
MongoUtil.getInstence().getMyMongoTemplate().save(guildInfo);
|
||||
guildInfoMap.put(guildInfo.getId(),guildInfo);
|
||||
guildNameInfoMap.put(guildInfo.getName(),guildInfo);
|
||||
}
|
||||
|
||||
public static void addApplyGuildInfo(GuildApply guildApply){
|
||||
RedisUtil.getInstence().hset( RedisUtil.getInstence().getKey("apply-user-play",Integer.toString(guildApply.getId())),Integer.toString(guildApply.getGuildId()),guildApply);
|
||||
RedisUtil.getInstence().hset(RedisUtil.getInstence().getKey("apply-user-guild",Integer.toString(guildApply.getGuildId())),Integer.toString(guildApply.getId()),guildApply);
|
||||
}
|
||||
|
||||
public static Map<Integer, GuildApply> getApplyGuildInfos(int id,int type){
|
||||
String typeStr = "apply-user-guild";
|
||||
if(type == 1){
|
||||
typeStr = "apply-user-play";
|
||||
}
|
||||
return RedisUtil.getInstence().getMapValues(typeStr, Integer.toString(id), Integer.class, GuildApply.class);
|
||||
}
|
||||
|
||||
public static void addGuildLog(GuildLog guildLog) throws Exception {
|
||||
MongoUtil.getInstence().getMyMongoTemplate().save(guildLog);
|
||||
}
|
||||
|
||||
public static void init() throws Exception {
|
||||
List<GuildInfo> all = MongoUtil.getInstence().getMyMongoTemplate().findAll(GuildInfo._COLLECTION_NAME, GuildInfo.class);
|
||||
List<GuildLog> guildLogs = MongoUtil.getInstence().getMyMongoTemplate().findAll(GuildLog._COLLECTION_NAME, GuildLog.class);
|
||||
for(GuildInfo guildInfo : all){
|
||||
guildInfoMap.put(guildInfo.getId(),guildInfo);
|
||||
guildNameInfoMap.put(guildInfo.getName(),guildInfo);
|
||||
}
|
||||
|
||||
for(GuildLog guildLog : guildLogs){
|
||||
if(!guildLogInfoMap.containsKey(guildLog.getGuildId())){
|
||||
guildLogInfoMap.put(guildLog.getGuildId(),new ArrayList<>());
|
||||
}
|
||||
guildLogInfoMap.get(guildLog.getGuildId()).add(guildLog);
|
||||
}
|
||||
}
|
||||
|
||||
public static Collection<GuildInfo> recommandGuild(User user) {
|
||||
|
|
|
@ -31,8 +31,6 @@ public class PlayerManager extends MongoBase {
|
|||
|
||||
private int vipLevel;
|
||||
|
||||
private String familyId;
|
||||
|
||||
private String head;
|
||||
|
||||
private long gold;
|
||||
|
@ -73,6 +71,8 @@ public class PlayerManager extends MongoBase {
|
|||
|
||||
private int hadBuyTreasure; //是否已购
|
||||
|
||||
private int guildId ;// 公会id
|
||||
|
||||
public PlayerManager(){
|
||||
this.setRootCollection(User._COLLECTION_NAME);
|
||||
}
|
||||
|
@ -140,15 +140,6 @@ public class PlayerManager extends MongoBase {
|
|||
return vipLevel;
|
||||
}
|
||||
|
||||
public String getFamilyId() {
|
||||
return familyId;
|
||||
}
|
||||
|
||||
public void setFamilyId(String familyId) throws Exception {
|
||||
updateString("familyId", familyId);
|
||||
this.familyId = familyId;
|
||||
}
|
||||
|
||||
public String getHead() {
|
||||
return head;
|
||||
}
|
||||
|
@ -404,4 +395,14 @@ public class PlayerManager extends MongoBase {
|
|||
updateString("headFrame", headFrame);
|
||||
this.headFrame = headFrame;
|
||||
}
|
||||
|
||||
|
||||
public int getGuildId() {
|
||||
return guildId;
|
||||
}
|
||||
|
||||
public void setGuildId(int guildId) {
|
||||
updateString("guildId", guildId);
|
||||
this.guildId = guildId;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,4 +94,9 @@ public class TeamPosManager extends MongoBase {
|
|||
public void updateTeamPos(int teamId,List<int[][]> result){
|
||||
cacheTeamPro.put(teamId,result);
|
||||
}
|
||||
|
||||
public void updateTeamPosByTeamId(int teamId,List<TeamPosHeroInfo> infos){
|
||||
teamPosForHero.put(teamId,infos);
|
||||
updateString("teamPosForHero."+teamId,infos);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,7 +79,6 @@ public class UserManager {
|
|||
playerManager.setOpenId(openId);
|
||||
playerManager.setLevel(1);
|
||||
playerManager.setExp(0);
|
||||
playerManager.setFamilyId("12345");
|
||||
playerManager.setHead("image_head_1");
|
||||
playerManager.setGold(100000l);
|
||||
playerManager.setGem(9999);
|
||||
|
|
|
@ -151,7 +151,7 @@ public class UserMissionManager extends MongoBase {
|
|||
}
|
||||
}
|
||||
|
||||
/* if(!sevenHappyMissionType.getDoingMissionIds().isEmpty() ){
|
||||
if(!sevenHappyMissionType.getDoingMissionIds().isEmpty() ){
|
||||
List<STreasureTaskConfig> sTreasureTaskConfigs = STreasureTaskConfig.sTreasureTaskConfigListByTypeMap.get(missionType.getMissionTypeValue());
|
||||
if(sTreasureTaskConfigs!=null){
|
||||
CumulationData.Result result = sevenHappyCumulationData.updateData(missionType, parm);
|
||||
|
@ -161,7 +161,7 @@ public class UserMissionManager extends MongoBase {
|
|||
updateString("sevenHappyMissionType",sevenHappyMissionType);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
CumulationData.Result result = cumulationData.updateData(missionType, parm);
|
||||
if(result!=null){
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
package com.ljsd.jieling.logic.dao.root;
|
||||
|
||||
public class GuildApply implements Comparable<GuildApply>{
|
||||
private int id ; // 申请人id
|
||||
private int guildId; // 申请公会id
|
||||
private int createTime; // 申请时间
|
||||
|
||||
|
||||
public GuildApply(int id, int guildId) {
|
||||
this.id = id;
|
||||
this.guildId = guildId;
|
||||
this.createTime = (int)(System.currentTimeMillis()/1000);
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getGuildId() {
|
||||
return guildId;
|
||||
}
|
||||
|
||||
public int getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(GuildApply o) {
|
||||
return this.createTime - o.getCreateTime();
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package com.ljsd.jieling.logic.dao.root;
|
||||
|
||||
import com.ljsd.common.mogodb.MongoBase;
|
||||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
|
@ -9,7 +10,7 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class GuildInfo {
|
||||
public class GuildInfo extends MongoBase {
|
||||
|
||||
public static final String _COLLECTION_NAME = "familyInfo";
|
||||
|
||||
|
@ -37,6 +38,14 @@ public class GuildInfo {
|
|||
this.createTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public void addMembers(int uid){
|
||||
if(!members.containsKey(GlobalsDef.MEMBER)){
|
||||
members.put(GlobalsDef.MEMBER,new HashSet<>());
|
||||
}
|
||||
members.get(GlobalsDef.MEMBER).add(uid);
|
||||
updateString("members.3",members.get(GlobalsDef.MEMBER));
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
package com.ljsd.jieling.logic.dao.root;
|
||||
|
||||
import com.ljsd.jieling.util.KeyGenUtils;
|
||||
import com.ljsd.jieling.util.UUIDEnum;
|
||||
|
||||
public class GuildLog {
|
||||
public static final String _COLLECTION_NAME = "guildLog";
|
||||
private String id;
|
||||
private int guildId; // 所属公会id
|
||||
private int logTime; // 记录日志时间
|
||||
private String name; // 记录人
|
||||
private String info; // 记录信息
|
||||
|
||||
|
||||
public GuildLog(int guildId, String name, String info) {
|
||||
this.id = KeyGenUtils.produceIdByModule(UUIDEnum.GUILDLOG,guildId);
|
||||
this.guildId = guildId;
|
||||
this.logTime = (int) (System.currentTimeMillis()/1000);
|
||||
this.name = name;
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
|
||||
public int getGuildId() {
|
||||
return guildId;
|
||||
}
|
||||
|
||||
public int getLogTime() {
|
||||
return logTime;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getInfo() {
|
||||
return info;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package com.ljsd.jieling.logic.family;
|
||||
|
||||
public interface GuildDef {
|
||||
interface Log{
|
||||
int CREATE = 1;
|
||||
int JOIN = 2;
|
||||
}
|
||||
}
|
|
@ -1,24 +1,64 @@
|
|||
package com.ljsd.jieling.logic.family;
|
||||
|
||||
import com.ljsd.jieling.config.SErrorCodeEerverConfig;
|
||||
import com.ljsd.jieling.config.SGuildSetting;
|
||||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.logic.dao.GuilidManager;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.GuildApply;
|
||||
import com.ljsd.jieling.logic.dao.root.GuildInfo;
|
||||
import com.ljsd.jieling.logic.dao.root.GuildLog;
|
||||
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.Family;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import com.ljsd.jieling.util.ShieldedWordUtils;
|
||||
import com.ljsd.jieling.util.StringUtil;
|
||||
import com.ljsd.jieling.util.*;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.*;
|
||||
|
||||
public class GuildLogic {
|
||||
|
||||
|
||||
|
||||
public static int getMemberType(int targetUid, Map<Integer, Set<Integer>> members ){
|
||||
for(Map.Entry<Integer,Set<Integer>> memberEntry : members.entrySet()){
|
||||
Integer position = memberEntry.getKey();
|
||||
Set<Integer> value = memberEntry.getValue();
|
||||
if(value.contains(targetUid)){
|
||||
return position;
|
||||
}
|
||||
}
|
||||
return GlobalsDef.MEMBER;
|
||||
}
|
||||
|
||||
|
||||
public static void getFamilyInfo(ISession session) throws Exception {
|
||||
int uid = session.getUid();
|
||||
int msgId = MessageTypeProto.MessageType.FAMILY_GET_INFO_RESPONSE_VALUE;
|
||||
User user = UserManager.getUser(uid);
|
||||
int guildId = user.getPlayerInfoManager().getGuildId();
|
||||
if( 0 == guildId ){
|
||||
MessageUtil.sendErrorResponse(session,0,msgId,"");
|
||||
return;
|
||||
}
|
||||
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(guildId);
|
||||
Family.GetFamilyInfoResponse.newBuilder()
|
||||
.setFamilyBaseInfo(CBean2Proto.getFamilyBaseInfo(guildInfo))
|
||||
.setFamilyUserInfo(CBean2Proto.getFamilyUserInfo(user,getMemberType(uid,guildInfo.getMembers())))
|
||||
.build();
|
||||
MessageUtil.sendMessage(session,1,msgId,null,true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 创建公会
|
||||
* @param session
|
||||
* @param familyName
|
||||
* @param announce
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void createFamily(ISession session,String familyName,String announce) throws Exception {
|
||||
int uid = session.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
|
@ -30,7 +70,13 @@ public class GuildLogic {
|
|||
}
|
||||
GuildInfo guildInfo = new GuildInfo(user.getId(),familyName,announce);
|
||||
GuilidManager.addGuildInfo(guildInfo);
|
||||
MessageUtil.sendMessage(session,1,msgId,null,true);
|
||||
user.getPlayerInfoManager().setGuildId(guildInfo.getId());
|
||||
addGuildLog(guildInfo.getId(),GuildDef.Log.CREATE,user.getPlayerInfoManager().getNickName());
|
||||
Family.FamilyCreateResponse build = Family.FamilyCreateResponse.newBuilder()
|
||||
.setFamilyBaseInfo(CBean2Proto.getFamilyBaseInfo(guildInfo))
|
||||
.setFamilyUserInfo(CBean2Proto.getFamilyUserInfo(user,GlobalsDef.CHAIRMAN)).build();
|
||||
MessageUtil.sendMessage(session,1,msgId,build,true);
|
||||
|
||||
}
|
||||
|
||||
public static String checkForCreateGuild( User user,String familyName,String announce) throws Exception {
|
||||
|
@ -55,6 +101,11 @@ public class GuildLogic {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 推荐公会
|
||||
* @param session
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void recommendFamily(ISession session) throws Exception {
|
||||
int uid = session.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
|
@ -62,12 +113,230 @@ public class GuildLogic {
|
|||
Collection<GuildInfo> guildInfos = GuilidManager.recommandGuild(user);
|
||||
Family.FamilyRecommandResponse.Builder builder = Family.FamilyRecommandResponse.newBuilder();
|
||||
for(GuildInfo guildInfo : guildInfos){
|
||||
builder.addFamilyBaseInfo(CommonProto.FamilyBaseInfo.newBuilder().setId(guildInfo.getId()).setLevle(1).setAnnouce(guildInfo.getAnnounce()).setName(guildInfo.getName()));
|
||||
builder.addFamilyRecomandInfo(Family.FamilyRecomandInfo.newBuilder().
|
||||
setFamilyBaseInfo(CBean2Proto.getFamilyBaseInfo(guildInfo))
|
||||
.setIsApply(0)
|
||||
.build());
|
||||
}
|
||||
MessageUtil.sendMessage(session,1,msgId,builder.build(),true);
|
||||
}
|
||||
|
||||
public static void applyFamily(ISession session){
|
||||
/**
|
||||
* 搜素公会
|
||||
* @param session
|
||||
* @param searchName
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void searchGuild(ISession session,String searchName) throws Exception {
|
||||
int msgId = MessageTypeProto.MessageType.FAMILY_SEARCH_RESPONSE_VALUE;
|
||||
if(StringUtil.isEmpty(searchName)){
|
||||
MessageUtil.sendErrorResponse(session,0,msgId,"搜索名字不能为空");
|
||||
return;
|
||||
}
|
||||
GuildInfo guildInfo = GuilidManager.guildNameInfoMap.get(searchName);
|
||||
if(guildInfo == null){
|
||||
MessageUtil.sendErrorResponse(session,0,msgId,searchName +"公会不存在");
|
||||
return;
|
||||
}
|
||||
Family.FamilySeachResponse build = Family.FamilySeachResponse.newBuilder().addFamilyRecomandInfo(Family.FamilyRecomandInfo.newBuilder().
|
||||
setFamilyBaseInfo(CBean2Proto.getFamilyBaseInfo(guildInfo))
|
||||
.setIsApply(0)
|
||||
.build()).build();
|
||||
MessageUtil.sendMessage(session,1,msgId,build,true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 申请公会
|
||||
* @param session
|
||||
* @param applyGuilds
|
||||
*/
|
||||
public static void applyFamily(ISession session, List<Integer> applyGuilds) throws Exception {
|
||||
int uid = session.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
int msgId = MessageTypeProto.MessageType.FAMILY_APPLY_RESPONSE_VALUE;
|
||||
if(user.getPlayerInfoManager().getGuildId()!=0){
|
||||
MessageUtil.sendErrorResponse(session,0,msgId,"已加入过公会");
|
||||
return;
|
||||
}
|
||||
for(Integer applyGuildId : applyGuilds){
|
||||
GuildApply guildApply = new GuildApply(uid,applyGuildId);
|
||||
GuilidManager.addApplyGuildInfo(guildApply);
|
||||
}
|
||||
MessageUtil.sendMessage(session,1,msgId,null,true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 加入公会
|
||||
* @param session
|
||||
* @param guildId
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void joinGuild(ISession session,int guildId) throws Exception {
|
||||
int uid = session.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
int msgId = MessageTypeProto.MessageType.FAMILY_JOIN_RESPONSE_VALUE;
|
||||
if(user.getPlayerInfoManager().getGuildId()!=0){
|
||||
MessageUtil.sendErrorResponse(session,0,msgId,"已加入过公会");
|
||||
return;
|
||||
}
|
||||
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(guildId);
|
||||
if(guildInfo == null){
|
||||
MessageUtil.sendErrorResponse(session,0,msgId,"公会不存在");
|
||||
return;
|
||||
}
|
||||
guildInfo.addMembers(guildId);
|
||||
addGuildLog(guildInfo.getId(),GuildDef.Log.JOIN,user.getPlayerInfoManager().getNickName());
|
||||
Family.FamilyJoinIndicaion build = Family.FamilyJoinIndicaion.newBuilder().setFamilyBaseInfo(CBean2Proto.getFamilyBaseInfo(guildInfo)).setFamilyUserInfo(CBean2Proto.getFamilyUserInfo(user, GlobalsDef.MEMBER)).build();
|
||||
Family.FamilyJoinResponse response = Family.FamilyJoinResponse.newBuilder().setFamilyJoinIndicaion(build).build();
|
||||
MessageUtil.sendMessage(session,1,msgId,response,true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取公会日志信息
|
||||
* @param session
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void getGuildLogInfo(ISession session) throws Exception {
|
||||
int uid = session.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
int msgId = MessageTypeProto.MessageType.FAMILY_GET_LOG_RESPOSNE_VALUE;
|
||||
if(user.getPlayerInfoManager().getGuildId()==0){
|
||||
MessageUtil.sendErrorResponse(session,0,msgId,"已加入过公会");
|
||||
return;
|
||||
}
|
||||
Family.GetFamilyLogResponse.Builder builder = Family.GetFamilyLogResponse.newBuilder();
|
||||
List<GuildLog> guildLogs = GuilidManager.guildLogInfoMap.get(user.getPlayerInfoManager().getGuildId());
|
||||
if(guildLogs!=null){
|
||||
for(GuildLog guildLog : guildLogs){
|
||||
builder.addFamilyLogInfo(Family.FamilyLogInfo.newBuilder()
|
||||
.setInfo(guildLog.getInfo())
|
||||
.setName(guildLog.getName())
|
||||
.setTime(guildLog.getLogTime())
|
||||
.build());
|
||||
}
|
||||
}
|
||||
MessageUtil.sendMessage(session,1,msgId,builder.build(),true);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取公会成员信息
|
||||
* @param session
|
||||
*/
|
||||
public static void getGuildMemberInfo(ISession session) throws Exception {
|
||||
int uid = session.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
int msgId = MessageTypeProto.MessageType.FAMILY_GET_MEMBER_RESPOSNE_VALUE;
|
||||
if(user.getPlayerInfoManager().getGuildId()==0){
|
||||
MessageUtil.sendErrorResponse(session,0,msgId,"未加入公会");
|
||||
return;
|
||||
}
|
||||
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(user.getPlayerInfoManager().getGuildId());
|
||||
Family.GetFamilyMemberInfoResponse.Builder builder = Family.GetFamilyMemberInfoResponse.newBuilder();
|
||||
Map<Integer, Set<Integer>> members = guildInfo.getMembers();
|
||||
for(Map.Entry<Integer,Set<Integer>> memberEntry : members.entrySet()){
|
||||
Integer position = memberEntry.getKey();
|
||||
Set<Integer> value = memberEntry.getValue();
|
||||
for(Integer uidTmp : value){
|
||||
User userTmp = UserManager.getUser(uidTmp);
|
||||
builder.addFamilyUserInfo(CBean2Proto.getFamilyUserInfo(userTmp,position));
|
||||
}
|
||||
}
|
||||
MessageUtil.sendMessage(session,1,msgId,builder.build(),true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取申请列表信息
|
||||
* @param session
|
||||
*/
|
||||
public static void getGuildApplyInfo(ISession session) throws Exception {
|
||||
int uid = session.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
int msgId = MessageTypeProto.MessageType.FAMILY_JOIN_RESPONSE_VALUE;
|
||||
if(user.getPlayerInfoManager().getGuildId()==0){
|
||||
MessageUtil.sendErrorResponse(session,0,msgId,"未加入公会");
|
||||
return;
|
||||
}
|
||||
Map<Integer, GuildApply> applyGuildInfos = GuilidManager.getApplyGuildInfos(user.getPlayerInfoManager().getGuildId(), 1);
|
||||
List<GuildApply> guildApplies = new ArrayList<>();
|
||||
for(GuildApply guildApply :applyGuildInfos.values()){
|
||||
guildApplies.add(guildApply);
|
||||
}
|
||||
Collections.sort(guildApplies);
|
||||
Family.GetFamilyApplyResponse.Builder builder = Family.GetFamilyApplyResponse.newBuilder();
|
||||
for(GuildApply guildApply :guildApplies){
|
||||
User userTmp = UserManager.getUser(guildApply.getId());
|
||||
builder.addFamilyApply(CBean2Proto.getFamilyApplyInfo(userTmp)).build();
|
||||
}
|
||||
MessageUtil.sendMessage(session,1,msgId,builder.build(),true);
|
||||
}
|
||||
|
||||
public static void addGuildLog(int guildId, int type,String name) throws Exception {
|
||||
switch (type) {
|
||||
case 1: {
|
||||
// 宗门创立
|
||||
GuildLog cGuildLog = new GuildLog(guildId,name, SErrorCodeEerverConfig.getI18NMessage("guild.logCreate", new Object[]{name}));
|
||||
GuilidManager.addGuildLog(cGuildLog);
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
// 加入宗门
|
||||
GuildLog cGuildLog = new GuildLog(guildId,name, SErrorCodeEerverConfig.getI18NMessage("guild.logCreate", new Object[]{name}));
|
||||
GuilidManager.addGuildLog(cGuildLog);
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
// 退出宗门
|
||||
GuildLog cGuildLog = new GuildLog(guildId,name, SErrorCodeEerverConfig.getI18NMessage("guild.logCreate", new Object[]{name}));
|
||||
GuilidManager.addGuildLog(cGuildLog);
|
||||
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
// 宗门任免
|
||||
GuildLog cGuildLog = new GuildLog(guildId,name, SErrorCodeEerverConfig.getI18NMessage("guild.logCreate", new Object[]{name}));
|
||||
GuilidManager.addGuildLog(cGuildLog);
|
||||
|
||||
break;
|
||||
}
|
||||
case 5: {
|
||||
// 宗门转让
|
||||
GuildLog cGuildLog = new GuildLog(guildId,name, SErrorCodeEerverConfig.getI18NMessage("guild.logCreate", new Object[]{name}));
|
||||
GuilidManager.addGuildLog(cGuildLog);
|
||||
|
||||
break;
|
||||
}
|
||||
case 6: {
|
||||
// 宗门改名和改图腾
|
||||
GuildLog cGuildLog = new GuildLog(guildId,name, SErrorCodeEerverConfig.getI18NMessage("guild.logCreate", new Object[]{name}));
|
||||
GuilidManager.addGuildLog(cGuildLog);
|
||||
|
||||
break;
|
||||
}
|
||||
case 7: {
|
||||
// 宗门公告
|
||||
GuildLog cGuildLog = new GuildLog(guildId,name, SErrorCodeEerverConfig.getI18NMessage("guild.logCreate", new Object[]{name}));
|
||||
GuilidManager.addGuildLog(cGuildLog);
|
||||
break;
|
||||
}
|
||||
case 8: {
|
||||
// 宗门宣言
|
||||
GuildLog cGuildLog = new GuildLog(guildId,name, SErrorCodeEerverConfig.getI18NMessage("guild.logCreate", new Object[]{name}));
|
||||
GuilidManager.addGuildLog(cGuildLog);
|
||||
|
||||
break;
|
||||
}
|
||||
case 9: {
|
||||
// 15天转让
|
||||
GuildLog cGuildLog = new GuildLog(guildId,name, SErrorCodeEerverConfig.getI18NMessage("guild.logCreate", new Object[]{name}));
|
||||
GuilidManager.addGuildLog(cGuildLog);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -389,8 +389,25 @@ public class HeroLogic {
|
|||
MessageUtil.sendErrorResponse(iSession,0,MessageTypeProto.MessageType.TEAM_POS_SAVE_RESPONSE_VALUE,err);
|
||||
return;
|
||||
}
|
||||
|
||||
user.getTeamPosManager().changeTeamInfo(teamId,heroIds,pokemonoIds);
|
||||
if(teamId == 401){
|
||||
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
||||
List<String> heroes = new ArrayList<>(teamPosHeroInfos.size());
|
||||
Map<String, Map<Integer, Integer>> heroAllAttributeMap = new HashMap<>(teamPosHeroInfos.size());
|
||||
for (TeamPosHeroInfo heroInfo : teamPosHeroInfos) {
|
||||
Hero hero = user.getHeroManager().getHero(heroInfo.getHeroId());
|
||||
if (hero == null) {
|
||||
break;
|
||||
}
|
||||
Map<Integer, Integer> heroAllAttribute = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero,true);
|
||||
if(user.getMapManager().getEndlessMapInfo().getEndlessHeroInfo()!=null&&user.getMapManager().getEndlessMapInfo().getEndlessHeroInfo().size()>0){
|
||||
heroAllAttribute.put(HeroAttributeEnum.CurHP.getPropertyId(),user.getMapManager().getEndlessMapInfo().getEndlessHeroInfo().get(hero.getId()).getCurHp());
|
||||
}
|
||||
heroAllAttributeMap.put(hero.getId(), heroAllAttribute);
|
||||
heroes.add(heroInfo.getHeroId());
|
||||
}
|
||||
user.getMapManager().setHeroAllAttributeMap(heroAllAttributeMap);
|
||||
}
|
||||
MessageUtil.sendMessage(iSession,1,MessageTypeProto.MessageType.TEAM_POS_SAVE_RESPONSE_VALUE,null,true);
|
||||
}
|
||||
|
||||
|
|
|
@ -89,10 +89,14 @@ public class MissionLoigc {
|
|||
}else{
|
||||
state=0;
|
||||
}
|
||||
if(sTreasureTaskConfig.getTaskType() == MissionType.SENVER_HAPPY.getMissionTypeValue()){
|
||||
sendProgress = doingProgress;
|
||||
}
|
||||
|
||||
}else{
|
||||
takeTimes = takeTimesMap.get(missionId);
|
||||
}
|
||||
|
||||
missionList.add(CommonProto.UserMissionInfo.newBuilder().setMissionId(missionId).setState(state).setType(treasuremissionType).setProgress(sendProgress).setTakeTimes(takeTimes).build());
|
||||
}
|
||||
}
|
||||
|
@ -253,11 +257,6 @@ public class MissionLoigc {
|
|||
if(type == GameMisionType.SEVENMISSION.getType()){
|
||||
Map<GameMisionType, List<MissionStateChangeInfo>> gameMisionTypeListMap = userMissionManager.onGameEvent(user, GameEvent.SEVENHAPPY_MISSION_REWARD, missionId);
|
||||
missionStateChangeInfos = gameMisionTypeListMap.get(GameMisionType.SEVENMISSION);
|
||||
if(missionStateChangeInfos!=null && !missionStateChangeInfos.isEmpty()){
|
||||
PlayerInfoProto.TakeMissionRewardResponse build = PlayerInfoProto.TakeMissionRewardResponse.newBuilder().setTreasureScore(user.getPlayerInfoManager().getTreasureScore()).build();
|
||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.TAKE_MISSION_REWARD_RESPONSE_VALUE,build,true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(missionStateChangeInfos!=null && !missionStateChangeInfos.isEmpty()){
|
||||
|
|
|
@ -156,6 +156,7 @@ public class MissionEventDistributor {
|
|||
eventProcessor.put(GameEvent.VIP_MISSION_REWARD,new RewardEventProcessor());
|
||||
eventProcessor.put(GameEvent.DAILY_MISSION_REWARD,new RewardEventProcessor());
|
||||
eventProcessor.put(GameEvent.TREASURE_MISSION_REWARD,new RewardEventProcessor());
|
||||
eventProcessor.put(GameEvent.SEVENHAPPY_MISSION_REWARD,new RewardEventProcessor());
|
||||
|
||||
typeList = new ArrayList<>();
|
||||
typeList.add(MissionType.RING_FIREA_DVANCED);
|
||||
|
|
|
@ -55,4 +55,8 @@ public class MissionStateChangeInfo {
|
|||
public int getHadTakes() {
|
||||
return hadTakes;
|
||||
}
|
||||
|
||||
public void setRewwards(int[][] rewwards) {
|
||||
this.rewwards = rewwards;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ 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 com.ljsd.jieling.util.MathUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
@ -43,21 +44,38 @@ public class TreasureMissionType extends AbstractMissionType{
|
|||
if(sTreasureTaskConfig.getTimes()>0 && hadTakes>=sTreasureTaskConfig.getTimes()){
|
||||
hadTakes = sTreasureTaskConfig.getTimes();
|
||||
}
|
||||
int[][] rewward = sTreasureTaskConfig.getRewward();
|
||||
int[][] rewardFinal = new int[rewward.length][];
|
||||
if(rewward.length>0){
|
||||
for(int i=0;i<rewward.length;i++){
|
||||
rewardFinal[i] = new int[2];
|
||||
rewardFinal[i][0] = rewward[i][0];
|
||||
rewardFinal[i][1] = rewward[i][1] * reallyTakeTimes;
|
||||
}
|
||||
}
|
||||
this.takeTimes.put(missionId,hadTakes);
|
||||
if(sTreasureTaskConfig.getTimes()>0 && this.takeTimes.get(missionId)>=sTreasureTaskConfig.getTimes()){
|
||||
getRewardedMissionIds().set(missionId);
|
||||
getDoingMissionIds().remove(missionId);
|
||||
getFinishMissionIds().remove(missionId);
|
||||
MissionStateChangeInfo stateChangeInfo = new MissionStateChangeInfo(missionId, MissionState.REWARD,reallyTakeTimes,hadTakes);
|
||||
if(rewward.length>0){
|
||||
stateChangeInfo.setRewwards(rewardFinal);
|
||||
}
|
||||
missionTypeEnumListMap.add(stateChangeInfo);
|
||||
return;
|
||||
}else{
|
||||
MissionStateChangeInfo stateChangeInfo = new MissionStateChangeInfo(missionId, MissionState.DOING,reallyTakeTimes,hadTakes);
|
||||
if(rewward.length>0){
|
||||
stateChangeInfo.setRewwards(rewardFinal);
|
||||
}
|
||||
missionTypeEnumListMap.add(stateChangeInfo);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int[][] reward(int missionId) {
|
||||
return new int[0][];
|
||||
|
@ -95,6 +113,9 @@ public class TreasureMissionType extends AbstractMissionType{
|
|||
}
|
||||
|
||||
int sendProgress = (doingProgress - takeTimes * finishParm) / finishParm;
|
||||
if(sTreasureTaskConfig.getTaskType() == MissionType.SENVER_HAPPY.getMissionTypeValue()){
|
||||
sendProgress = doingProgress;
|
||||
}
|
||||
if(sendProgress>0){
|
||||
MissionStateChangeInfo missionStateChangeInfo = new MissionStateChangeInfo(id, MissionState.FINISH,sendProgress,takeTimes);
|
||||
missionStateChangeInfos.add(missionStateChangeInfo);
|
||||
|
|
|
@ -10,9 +10,12 @@ import com.ljsd.jieling.handler.map.TemporaryItems;
|
|||
import com.ljsd.jieling.handler.map.TowerBuff;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.dao.*;
|
||||
import com.ljsd.jieling.logic.dao.root.GuildInfo;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.ChatProto;
|
||||
import com.ljsd.jieling.protocols.CommonProto;
|
||||
import com.ljsd.jieling.protocols.Family;
|
||||
import com.ljsd.jieling.protocols.MapInfoProto;
|
||||
|
||||
import java.util.*;
|
||||
|
@ -29,9 +32,9 @@ public class CBean2Proto {
|
|||
.setLevel(playerManager.getLevel())
|
||||
.setExp(playerManager.getExp())
|
||||
.setVipLevel(playerManager.getVipLevel())
|
||||
.setFamilyId(playerManager.getFamilyId())
|
||||
.setHead(playerManager.getHead())
|
||||
.setCurMapId(mapId)
|
||||
.setFamilyId(playerManager.getGuildId())
|
||||
.setEnergy(0)
|
||||
.setLastUpdateEnergyTime(mapManager.getLastUpdateEnergyTime())
|
||||
.setServerTime((int)(System.currentTimeMillis()/1000))
|
||||
|
@ -344,4 +347,52 @@ public class CBean2Proto {
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static CommonProto.FamilyBaseInfo getFamilyBaseInfo(GuildInfo guildInfo){
|
||||
return CommonProto.FamilyBaseInfo.newBuilder()
|
||||
.setId(guildInfo.getId())
|
||||
.setLevle(1)
|
||||
.setAnnouce(guildInfo.getAnnounce())
|
||||
.setName(guildInfo.getName())
|
||||
.setJoinType(1)
|
||||
.setMaxNum(30)
|
||||
.setTotalNum(1).build();
|
||||
|
||||
}
|
||||
|
||||
public static Family.FamilyUserInfo getFamilyUserInfo(User user,int position){
|
||||
boolean online = OnlineUserManager.checkUidOnline(user.getId());
|
||||
int outTime = 0;
|
||||
if(online){
|
||||
outTime = (int)(System.currentTimeMillis() - user.getPlayerInfoManager().getLoginTime());
|
||||
}
|
||||
return Family.FamilyUserInfo.newBuilder().setRoleUid(user.getId())
|
||||
.setUserName(user.getPlayerInfoManager().getNickName())
|
||||
.setUserLevel(user.getPlayerInfoManager().getLevel())
|
||||
.setContribute(0)
|
||||
.setSeconds(outTime)
|
||||
.setPosition(position)
|
||||
.setContributeToday(0)
|
||||
.setSoulForce(user.getPlayerInfoManager().getMaxForce())
|
||||
.setHead(user.getPlayerInfoManager().getHead())
|
||||
.setFrame(user.getPlayerInfoManager().getHeadFrame())
|
||||
.build();
|
||||
}
|
||||
|
||||
public static Family.FamilyApply getFamilyApplyInfo(User user){
|
||||
boolean online = OnlineUserManager.checkUidOnline(user.getId());
|
||||
int outTime = 0;
|
||||
if(online){
|
||||
outTime = (int)(System.currentTimeMillis() - user.getPlayerInfoManager().getLoginTime());
|
||||
}
|
||||
return Family.FamilyApply.newBuilder()
|
||||
.setRoleUid(user.getId())
|
||||
.setName(user.getPlayerInfoManager().getNickName())
|
||||
.setLevel(user.getPlayerInfoManager().getLevel())
|
||||
.setForeces(user.getPlayerInfoManager().getMaxForce())
|
||||
.setOutTime(outTime)
|
||||
.setFrame(user.getPlayerInfoManager().getHeadFrame())
|
||||
.build();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ public enum UUIDEnum {
|
|||
MAIL(2),
|
||||
ARENARECORD(3),
|
||||
ADVENTUREBOSS(4),
|
||||
GUILDLOG(5),
|
||||
;
|
||||
|
||||
private int value;
|
||||
|
|
Loading…
Reference in New Issue