fix guild
parent
7e5eb8ece8
commit
54407dabe6
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -1,20 +1,44 @@
|
|||
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.List;
|
||||
import java.util.Map;
|
||||
|
||||
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("apply-user" + guildApply.getId(),Integer.toString(guildApply.getGuildId()),guildApply);
|
||||
RedisUtil.getInstence().hset("apply-user" + guildApply.getGuildId(),Integer.toString(guildApply.getId()),guildApply);
|
||||
}
|
||||
|
||||
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);
|
||||
for(GuildInfo guildInfo : all){
|
||||
guildInfoMap.put(guildInfo.getId(),guildInfo);
|
||||
guildNameInfoMap.put(guildInfo.getName(),guildInfo);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,27 @@
|
|||
package com.ljsd.jieling.logic.dao.root;
|
||||
|
||||
public class 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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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,22 @@
|
|||
package com.ljsd.jieling.logic.dao.root;
|
||||
|
||||
import com.ljsd.jieling.util.KeyGenUtils;
|
||||
import com.ljsd.jieling.util.UUIDEnum;
|
||||
|
||||
public class 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;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package com.ljsd.jieling.logic.family;
|
||||
|
||||
public interface GuildDef {
|
||||
interface Log{
|
||||
int CREATE = 1;
|
||||
int JOIN = 2;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,24 +1,52 @@
|
|||
package com.ljsd.jieling.logic.family;
|
||||
|
||||
import com.ljsd.jieling.config.SErrorCodeEerverConfig;
|
||||
import com.ljsd.jieling.config.SGuildSetting;
|
||||
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.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class GuildLogic {
|
||||
|
||||
|
||||
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))
|
||||
.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 +58,10 @@ public class GuildLogic {
|
|||
}
|
||||
GuildInfo guildInfo = new GuildInfo(user.getId(),familyName,announce);
|
||||
GuilidManager.addGuildInfo(guildInfo);
|
||||
user.getPlayerInfoManager().setGuildId(guildInfo.getId());
|
||||
addGuildLog(guildInfo.getId(),GuildDef.Log.CREATE,user.getPlayerInfoManager().getNickName());
|
||||
MessageUtil.sendMessage(session,1,msgId,null,true);
|
||||
|
||||
}
|
||||
|
||||
public static String checkForCreateGuild( User user,String familyName,String announce) throws Exception {
|
||||
|
|
@ -55,6 +86,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 +98,195 @@ 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());
|
||||
MessageUtil.sendMessage(session,1,msgId,null,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_JOIN_RESPONSE_VALUE;
|
||||
if(user.getPlayerInfoManager().getGuildId()==0){
|
||||
MessageUtil.sendErrorResponse(session,0,msgId,"已加入过公会");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取公会成员信息
|
||||
* @param session
|
||||
*/
|
||||
public static void getGuildMemberInfo(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;
|
||||
}
|
||||
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(user.getPlayerInfoManager().getGuildId());
|
||||
Map<Integer, Set<Integer>> members = guildInfo.getMembers();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取申请列表信息
|
||||
* @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;
|
||||
}
|
||||
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(user.getPlayerInfoManager().getGuildId());
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,11 @@ 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.protocols.ChatProto;
|
||||
import com.ljsd.jieling.protocols.CommonProto;
|
||||
import com.ljsd.jieling.protocols.Family;
|
||||
import com.ljsd.jieling.protocols.MapInfoProto;
|
||||
|
||||
import java.util.*;
|
||||
|
|
@ -29,7 +31,6 @@ public class CBean2Proto {
|
|||
.setLevel(playerManager.getLevel())
|
||||
.setExp(playerManager.getExp())
|
||||
.setVipLevel(playerManager.getVipLevel())
|
||||
.setFamilyId(playerManager.getFamilyId())
|
||||
.setHead(playerManager.getHead())
|
||||
.setCurMapId(mapId)
|
||||
.setEnergy(0)
|
||||
|
|
@ -344,4 +345,28 @@ 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())
|
||||
.setMaxNum(30)
|
||||
.setTotalNum(1).build();
|
||||
|
||||
}
|
||||
|
||||
public static Family.FamilyUserInfo getFamilyUserInfo(User user){
|
||||
return Family.FamilyUserInfo.newBuilder().setRoleUid(user.getId())
|
||||
.setUserName(user.getPlayerInfoManager().getNickName())
|
||||
.setUserLevel(user.getPlayerInfoManager().getLevel())
|
||||
.setContribute(0)
|
||||
.setSeconds(0)
|
||||
.setContributeToday(0)
|
||||
.setSoulForce(user.getPlayerInfoManager().getMaxForce())
|
||||
.setHead(user.getPlayerInfoManager().getHead())
|
||||
.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