diff --git a/src/TibiaCharactersCharacter.go b/src/TibiaCharactersCharacter.go
index 44c38059..7ac68e32 100644
--- a/src/TibiaCharactersCharacter.go
+++ b/src/TibiaCharactersCharacter.go
@@ -392,11 +392,21 @@ func TibiaCharactersCharacterImpl(BoxContentHTML string) (*CharacterResponse, er
DeathAssists := []Killers{}
const (
- initIndexer = `CET`
- levelIndexer = `at Level `
- killersIndexer = `by `
+ initCetIndexer = `CET`
+ initCestIndexer = `CEST`
+ levelIndexer = `at Level `
+ killersIndexer = `by `
)
+ var initIndexer string
+ timeZoneIdentifiers := []string{initCetIndexer, initCestIndexer}
+ for _, tz := range timeZoneIdentifiers {
+ if strings.Contains(dataNoTags, tz) {
+ initIndexer = tz
+ break
+ }
+ }
+
initIdx := strings.Index(
dataNoTags, initIndexer,
) + len(initIndexer)
@@ -412,8 +422,8 @@ func TibiaCharactersCharacterImpl(BoxContentHTML string) (*CharacterResponse, er
timeIdx := 0
endTimeIdx := strings.Index(
- dataNoTags[timeIdx:], `CET`,
- ) + timeIdx + len(`CET`)
+ dataNoTags[timeIdx:], initIndexer,
+ ) + timeIdx + len(initIndexer)
time := TibiaDataDatetime(dataNoTags[timeIdx:endTimeIdx])
diff --git a/src/TibiaCharactersCharacter_test.go b/src/TibiaCharactersCharacter_test.go
index 37955bd6..fb2ce724 100644
--- a/src/TibiaCharactersCharacter_test.go
+++ b/src/TibiaCharactersCharacter_test.go
@@ -3034,6 +3034,87 @@ func TestNumber10(t *testing.T) {
assert.Equal(6, character.UnlockedTitles)
}
+func TestNumber11(t *testing.T) {
+ file, err := static.TestFiles.Open("testdata/characters/Orca Kaoksh.html")
+ if err != nil {
+ t.Fatalf("file opening error: %s", err)
+ }
+ defer file.Close()
+
+ data, err := io.ReadAll(file)
+ if err != nil {
+ t.Fatalf("File reading error: %s", err)
+ }
+
+ characterJson, err := TibiaCharactersCharacterImpl(string(data))
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ assert := assert.New(t)
+ character := characterJson.Character.CharacterInfo
+
+ assert.Equal("Orca Kaoksh", character.Name)
+
+ //validate death data
+ assert.Equal(2, len(characterJson.Character.Deaths))
+ deaths := characterJson.Character.Deaths
+
+ for idx, tc := range []struct {
+ Assists []Killers
+ Killers []Killers
+ Level int
+ Reason string
+ Time string
+ }{
+ {
+ Assists: []Killers{},
+ Killers: []Killers{
+ {Name: "fire", Player: false, Traded: false, Summon: ""},
+ },
+ Level: 10,
+ Reason: "Died at Level 10 by fire.",
+ Time: "2023-10-08T16:19:35Z",
+ },
+ {
+ Assists: []Killers{},
+ Killers: []Killers{
+ {Name: "wasp", Player: false, Traded: false, Summon: ""},
+ },
+ Level: 8,
+ Reason: "Died at Level 8 by wasp.",
+ Time: "2023-10-07T00:27:38Z",
+ },
+ } {
+ assert.True(
+ reflect.DeepEqual(deaths[idx].Assists, tc.Assists),
+ "Wrong assists\nidx: %d\nwant: %#v\n\ngot: %#v",
+ idx, tc.Assists, deaths[idx].Assists,
+ )
+ assert.True(
+ reflect.DeepEqual(deaths[idx].Killers, tc.Killers),
+ "Wrong killers\nidx: %d\nwant: %#v\n\ngot: %#v",
+ idx, tc.Killers, deaths[idx].Killers,
+ )
+ assert.Equal(
+ deaths[idx].Level, tc.Level,
+ "Wrong Level\nidx: %d\nwant: %d\n\ngot: %d",
+ idx, tc.Level, deaths[idx].Level,
+ )
+ assert.Equal(
+ deaths[idx].Reason, tc.Reason,
+ "Wrong Reason\nidx: %d\nwant: %s\n\ngot: %s",
+ idx, tc.Reason, deaths[idx].Reason,
+ )
+ assert.Equal(
+ deaths[idx].Time, tc.Time,
+ "Wrong Time\nidx: %d\nwant: %s\n\ngot: %s",
+ idx, tc.Time, deaths[idx].Time,
+ )
+ }
+
+}
+
func BenchmarkNumber1(b *testing.B) {
file, err := static.TestFiles.Open("testdata/characters/Darkside Rafa.html")
if err != nil {
diff --git a/src/static/testdata/characters/Orca Kaoksh.html b/src/static/testdata/characters/Orca Kaoksh.html
new file mode 100644
index 00000000..1be1e0b4
--- /dev/null
+++ b/src/static/testdata/characters/Orca Kaoksh.html
@@ -0,0 +1,778 @@
+
+
+
+
+Tibia - Free Multiplayer Online Role Playing Game - Community
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
NO - internet explorer
+
NEW - internet explorer
+
OLD - internet explorer
+
+
+
+
+
+
+
+

+

+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+
+
+
+
| Name: | Orca Kaoksh | | Title: | None (0 titles unlocked) | | Sex: | male | | Vocation: | None | | Level: | 10 | | Achievement Points: | 0 | | World: | Kalibra | | Residence: | Rookgaard | | Last Login: | Oct 08 2023, 18:13:29 CEST | | Account Status: | Free Account | | |
| There are no achievements set to be displayed for this character. | | |
| Oct 08 2023, 18:19:35 CEST | Died at Level 10 by fire. | | Oct 07 2023, 02:27:38 CEST | Died at Level 8 by wasp. | | |
| Loyalty Title: | (no title) | | Created: | Sep 27 2023, 23:40:35 CEST | | |
| Name | World | Status | | 1. Atumalaka Black  | Kalibra | | | | 2. Baba Egum | Nadora | deleted | | | 3. Cha de Saco | Venebra | deleted | | | 4. Onlyhaters | Descubra | deleted | | | 5. Orca Kaoksh | Kalibra | online | | | 6. Yomin Goba | Descubra | deleted | | | |
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+
+
+
+
+
+
+
+
+