|
7 | 7 | "net/http"
|
8 | 8 | "reflect"
|
9 | 9 | "strings"
|
| 10 | + "unicode" |
| 11 | + "unicode/utf8" |
10 | 12 |
|
11 | 13 | "github.com/PuerkitoBio/goquery"
|
12 | 14 | "github.com/TibiaData/tibiadata-api-go/src/validation"
|
@@ -560,6 +562,13 @@ func TibiaCharactersCharacterImpl(BoxContentHTML string, url string) (CharacterR
|
560 | 562 | }
|
561 | 563 | }
|
562 | 564 | buffer.WriteByte(cur)
|
| 565 | + |
| 566 | + if cur == ')' { |
| 567 | + str := buffer.String() |
| 568 | + |
| 569 | + buffer.Reset() |
| 570 | + ListOfKillers = append(ListOfKillers, str) |
| 571 | + } |
563 | 572 | case openAnchorTag:
|
564 | 573 | if cur == '>' {
|
565 | 574 | state = nonTag
|
@@ -777,19 +786,19 @@ func TibiaDataParseKiller(data string) (string, bool, bool, string) {
|
777 | 786 | data = RemoveHtmlTag(data)
|
778 | 787 | }
|
779 | 788 |
|
780 |
| - // remove htlm, spaces and dots from data-string |
| 789 | + // remove htlm, spaces, dots and prefixes from data-string |
781 | 790 | data = strings.TrimSpace(strings.TrimSuffix(strings.TrimSuffix(data, "</td>"), "."))
|
| 791 | + data = strings.TrimPrefix(strings.TrimPrefix(strings.TrimPrefix(data, "and "), "a "), "an ") |
782 | 792 |
|
| 793 | + firstRune, _ := utf8.DecodeRuneInString(data) |
783 | 794 | // get summon information
|
784 |
| - if strings.HasPrefix(data, "a ") || strings.HasPrefix(data, "an ") { |
785 |
| - if containsCreaturesWithOf(data) { |
786 |
| - // this is not a summon, since it is a creature with a of in the middle |
787 |
| - } else { |
788 |
| - ofIdx := strings.Index(data, "of") |
789 |
| - if ofIdx != -1 { |
790 |
| - theSummon = data[:ofIdx-1] |
791 |
| - data = data[ofIdx+3:] |
792 |
| - } |
| 795 | + if containsCreaturesWithOf(data) { |
| 796 | + // this is not a summon, since it is a creature with a of in the middle |
| 797 | + } else if unicode.IsLower(firstRune) { |
| 798 | + ofIdx := strings.Index(data, "of") |
| 799 | + if ofIdx != -1 { |
| 800 | + theSummon = data[:ofIdx-1] |
| 801 | + data = data[ofIdx+3:] |
793 | 802 | }
|
794 | 803 | }
|
795 | 804 |
|
@@ -876,9 +885,9 @@ func containsCreaturesWithOf(str string) bool {
|
876 | 885 | "pillar of summoning",
|
877 | 886 | "priestess of the wild sun",
|
878 | 887 | "rage of mazoran",
|
| 888 | + "reflection of a mage", |
879 | 889 | "reflection of mawhawk",
|
880 | 890 | "reflection of obujos",
|
881 |
| - "reflection of a mage", |
882 | 891 | "retainer of baeloc",
|
883 | 892 | "scorn of the emperor",
|
884 | 893 | "servant of tentugly",
|
|
0 commit comments