Skip to content

Commit b14b58c

Browse files
authored
TibiaCharactersCharacter: remove summon regex (tibiadata#224)
1 parent 600800a commit b14b58c

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/TibiaCharactersCharacter.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ type CharacterResponse struct {
123123
const Br = 0x202
124124

125125
var (
126-
summonRegex = regexp.MustCompile(`(an? .+) of ([^<]+)`)
127126
characterInfoRegex = regexp.MustCompile(`<td.*<nobr>[0-9]+\..(.*)<\/nobr><\/td><td.*><nobr>(.*)<\/nobr><\/td><td style="width: 70%">(.*)<\/td><td.*`)
128127
)
129128

@@ -643,10 +642,10 @@ func TibiaDataParseKiller(data string) (string, bool, bool, string) {
643642
if containsCreaturesWithOf(data) {
644643
// this is not a summon, since it is a creature with a of in the middle
645644
} else {
646-
rs := summonRegex.FindAllStringSubmatch(data, -1)
647-
if len(rs) >= 1 {
648-
theSummon = rs[0][1]
649-
data = rs[0][2]
645+
ofIdx := strings.Index(data, "of")
646+
if ofIdx != -1 {
647+
theSummon = data[:ofIdx-1]
648+
data = data[ofIdx+3:]
650649
}
651650
}
652651
}

0 commit comments

Comments
 (0)