公会改名提交
parent
460a9ad41a
commit
b00ab56b99
|
@ -177,5 +177,7 @@ public interface BIReason {
|
||||||
|
|
||||||
int TREASURE_RESET_CONCUME = 1044;//孙龙宝藏重置删除积分
|
int TREASURE_RESET_CONCUME = 1044;//孙龙宝藏重置删除积分
|
||||||
|
|
||||||
|
int FAMILY_RENAME = 1045;//公会改名
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -9,16 +9,14 @@ import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class FamilyChangeNoticHandler extends BaseHandler {
|
public class FamilyChangeNoticHandler extends BaseHandler<Family.FamilyChangeRequest> {
|
||||||
@Override
|
@Override
|
||||||
public MessageTypeProto.MessageType getMessageCode() {
|
public MessageTypeProto.MessageType getMessageCode() {
|
||||||
return MessageTypeProto.MessageType.FAMILY_CHANGE_NOTICE_REQUEST;
|
return MessageTypeProto.MessageType.FAMILY_CHANGE_NOTICE_REQUEST;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
public void processWithProto(ISession iSession, Family.FamilyChangeRequest proto) throws Exception {
|
||||||
byte[] bytes = netData.parseClientProtoNetData();
|
GuildLogic.changeNotice(iSession,proto.getType(),proto.getContent());
|
||||||
Family.FamilyChangeRequest familyChangeRequest = Family.FamilyChangeRequest.parseFrom(bytes);
|
|
||||||
GuildLogic.changeNotice(iSession,familyChangeRequest.getContent());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,6 +92,8 @@ public class GuildInfo extends MongoBase {
|
||||||
|
|
||||||
public void setAnnounce(String announce) {
|
public void setAnnounce(String announce) {
|
||||||
this.announce = announce;
|
this.announce = announce;
|
||||||
|
updateString("announce",announce);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
|
@ -102,6 +104,12 @@ public class GuildInfo extends MongoBase {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
updateString("name",name);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public String getAnnounce() {
|
public String getAnnounce() {
|
||||||
return announce;
|
return announce;
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,6 +91,13 @@ public class GuildLogic {
|
||||||
if(!"".equals(err)){
|
if(!"".equals(err)){
|
||||||
throw new ErrorCodeException(ErrorCode.newDefineCode(err));
|
throw new ErrorCodeException(ErrorCode.newDefineCode(err));
|
||||||
}
|
}
|
||||||
|
boolean enough= ItemUtil.itemCost(user, SGuildSetting.sGuildSetting.getCreatCost(), BIReason.CREATE_GUILD_CONSUME, 0);
|
||||||
|
if(!enough){
|
||||||
|
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||||
|
}
|
||||||
|
if(user.getPlayerInfoManager().getGuildId()!=0){
|
||||||
|
throw new ErrorCodeException(ErrorCode.FAMILY_IN);
|
||||||
|
}
|
||||||
if(StringUtil.isEmpty(announce)){
|
if(StringUtil.isEmpty(announce)){
|
||||||
announce= SGuildSetting.sGuildSetting.getDefaultDeclaration();
|
announce= SGuildSetting.sGuildSetting.getDefaultDeclaration();
|
||||||
}
|
}
|
||||||
|
@ -134,13 +141,7 @@ public class GuildLogic {
|
||||||
return "此名已存在";
|
return "此名已存在";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
boolean enough= ItemUtil.itemCost(user, SGuildSetting.sGuildSetting.getCreatCost(), BIReason.CREATE_GUILD_CONSUME, 0);
|
|
||||||
if(!enough){
|
|
||||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
|
||||||
}
|
|
||||||
if(user.getPlayerInfoManager().getGuildId()!=0){
|
|
||||||
throw new ErrorCodeException(ErrorCode.FAMILY_IN);
|
|
||||||
}
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -654,7 +655,7 @@ public class GuildLogic {
|
||||||
* @param session
|
* @param session
|
||||||
* @param content
|
* @param content
|
||||||
*/
|
*/
|
||||||
public static void changeNotice(ISession session,String content) throws Exception {
|
public static void changeNotice(ISession session,int type,String content) throws Exception {
|
||||||
int msgId = MessageTypeProto.MessageType.FAMILY_CHANGE_NOTICE_RESPONSE_VALUE;
|
int msgId = MessageTypeProto.MessageType.FAMILY_CHANGE_NOTICE_RESPONSE_VALUE;
|
||||||
int uid = session.getUid();
|
int uid = session.getUid();
|
||||||
User user = UserManager.getUser(uid);
|
User user = UserManager.getUser(uid);
|
||||||
|
@ -683,7 +684,20 @@ public class GuildLogic {
|
||||||
if(resultCode==0){
|
if(resultCode==0){
|
||||||
throw new ErrorCodeException(ErrorCode.FAMILY_IN_SENSITIVE);
|
throw new ErrorCodeException(ErrorCode.FAMILY_IN_SENSITIVE);
|
||||||
}else{
|
}else{
|
||||||
guildInfo.setAnnounce(content);
|
if(type==1){
|
||||||
|
guildInfo.setAnnounce(content);
|
||||||
|
}else{
|
||||||
|
String checkResult = checkForCreateGuild(user, content, guildInfo.getAnnounce());
|
||||||
|
if(!"".equals(checkResult)){
|
||||||
|
throw new ErrorCodeException(ErrorCode.newDefineCode(checkResult));
|
||||||
|
}
|
||||||
|
int[][] renameCost = SGuildSetting.sGuildSetting.getRenameCost();
|
||||||
|
boolean b = ItemUtil.itemCost(user, renameCost, BIReason.FAMILY_RENAME, 1);
|
||||||
|
if(!b){
|
||||||
|
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||||
|
}
|
||||||
|
guildInfo.setName(content);
|
||||||
|
}
|
||||||
MessageUtil.sendMessage(session,resultCode,msgId,response,true);
|
MessageUtil.sendMessage(session,resultCode,msgId,response,true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,6 +66,8 @@ public class SGuildSetting implements BaseConfig {
|
||||||
|
|
||||||
private int warTime;
|
private int warTime;
|
||||||
|
|
||||||
|
private int[][] renameCost;
|
||||||
|
|
||||||
public static SGuildSetting sGuildSetting;
|
public static SGuildSetting sGuildSetting;
|
||||||
|
|
||||||
|
|
||||||
|
@ -195,4 +197,8 @@ public class SGuildSetting implements BaseConfig {
|
||||||
public int getWarTime() {
|
public int getWarTime() {
|
||||||
return warTime;
|
return warTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int[][] getRenameCost() {
|
||||||
|
return renameCost;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue