Skip to content

Commit d345564

Browse files
committed
chore: use switches instead
1 parent efb8aba commit d345564

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

src/TibiaCharactersCharacter.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,10 @@ func TibiaCharactersCharacterImpl(BoxContentHTML string, url string) (CharacterR
279279
AccountInformationData.Created = TibiaDataDatetime(RowData)
280280
case "Position:":
281281
TmpPosition := strings.Split(RowData, "<")
282-
if SectionName == "Character Information" {
282+
switch SectionName {
283+
case "Character Information":
283284
CharacterInfoData.Position = strings.TrimSpace(TmpPosition[0])
284-
} else if SectionName == "Account Information" {
285+
case "Account Information":
285286
AccountInformationData.Position = strings.TrimSpace(TmpPosition[0])
286287
}
287288

src/TibiaGuildsOverview.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,10 @@ func TibiaGuildsOverviewImpl(world string, BoxContentHTML string, url string) (G
4646
// Figure out the guild category
4747
s.Find(".Text").Each(func(index int, s *goquery.Selection) {
4848
tableName := s.Nodes[0].FirstChild.Data
49-
if strings.Contains(tableName, "Active Guilds") {
49+
switch {
50+
case strings.Contains(tableName, "Active Guilds"):
5051
GuildCategory = "active"
51-
} else if strings.Contains(tableName, "Guilds in Course of Formation") {
52+
case strings.Contains(tableName, "Guilds in Course of Formation"):
5253
GuildCategory = "formation"
5354
}
5455
})
@@ -75,9 +76,10 @@ func TibiaGuildsOverviewImpl(world string, BoxContentHTML string, url string) (G
7576
}
7677

7778
// Adding OneGuild to correct category
78-
if GuildCategory == "active" {
79+
switch GuildCategory {
80+
case "active":
7981
ActiveGuilds = append(ActiveGuilds, OneGuild)
80-
} else if GuildCategory == "formation" {
82+
case "formation":
8183
FormationGuilds = append(FormationGuilds, OneGuild)
8284
}
8385
})

src/TibiaSpellsSpell.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,11 @@ func TibiaSpellsSpellImpl(spell string, BoxContentHTML string, url string) (Spel
106106
SectionName := s.Find(".CaptionInnerContainer div.Text").Text()
107107

108108
// Determine if this is the spell or rune section
109-
if SectionName == "Spell Information" {
109+
switch SectionName {
110+
case "Spell Information":
110111
SpellInformationSection = "spell"
111112
SpellsHasSpellSection = true
112-
} else if SectionName == "Rune Information" {
113+
case "Rune Information":
113114
SpellInformationSection = "rune"
114115
SpellsHasRuneSection = true
115116
}

0 commit comments

Comments
 (0)