This commit is contained in:
aozhiwei 2024-04-11 13:40:31 +08:00
parent 8ff8c10ba1
commit 07cb052c8c

View File

@ -7,6 +7,7 @@ import (
"main/constant" "main/constant"
"fmt" "fmt"
"mt" "mt"
"strings"
. "main/global" . "main/global"
) )
@ -89,6 +90,10 @@ func (this *guildMgr) isNameTooLong(name string) bool {
return len(name) > 15 return len(name) > 15
} }
func (this *guildMgr) isValidName(name string) bool {
return !strings.Contains(name, "!")
}
func (this *guildMgr) GetGuildByGuildId(guildId string) common.Guild { func (this *guildMgr) GetGuildByGuildId(guildId string) common.Guild {
if p := this.internalGetGuildByGuildId(guildId); p != nil { if p := this.internalGetGuildByGuildId(guildId); p != nil {
return p return p
@ -287,6 +292,11 @@ func (this *guildMgr) AsyncCreateGuild(accountId string, sessionId string, avata
cb(2, "Name is to long", "") cb(2, "Name is to long", "")
return return
} }
if !this.isValidName(name) {
task.SetFail()
cb(2, "Name is invalid", "")
return
}
if this.GetGuildByAccountId(accountId) != nil { if this.GetGuildByAccountId(accountId) != nil {
task.SetFail() task.SetFail()
cb(3, "You already have a cube", "") cb(3, "You already have a cube", "")