Skip to content

Commit b379b68

Browse files
authored
align world endpoint transfer_type to regular by default (#348)
1 parent 4412b6b commit b379b68

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

src/TibiaWorldsOverview.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ type OverviewWorld struct {
1717
Location string `json:"location"` // The physical location of the servers.
1818
PvpType string `json:"pvp_type"` // The type of PvP.
1919
PremiumOnly bool `json:"premium_only"` // Whether only premium account players are allowed to play on it.
20-
TransferType string `json:"transfer_type"` // The type of transfer restrictions it has. regular (if not present) / locked / blocked
20+
TransferType string `json:"transfer_type"` // The type of transfer restrictions it has. regular / locked / blocked
2121
BattleyeProtected bool `json:"battleye_protected"` // The type of BattlEye protection. true if protected / false if "Not protected by BattlEye."
2222
BattleyeDate string `json:"battleye_date"` // The date when BattlEye was added. "" if since release / else show date?
2323
GameWorldType string `json:"game_world_type"` // The type of world. regular / experimental / tournament (if Tournament World Type exists)

src/TibiaWorldsWorld.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ type World struct {
2727
Location string `json:"location"` // The physical location of the servers.
2828
PvpType string `json:"pvp_type"` // The type of PvP.
2929
PremiumOnly bool `json:"premium_only"` // Whether only premium account players are allowed to play on it.
30-
TransferType string `json:"transfer_type"` // The type of transfer restrictions it has. regular (if not present) / locked / blocked
30+
TransferType string `json:"transfer_type"` // The type of transfer restrictions it has. regular / locked / blocked
3131
WorldsQuestTitles []string `json:"world_quest_titles"` // List of world quest titles the server has achieved.
3232
BattleyeProtected bool `json:"battleye_protected"` // The type of BattlEye protection. true if protected / false if "Not protected by BattlEye."
3333
BattleyeDate string `json:"battleye_date"` // The date when BattlEye was added. "" if since release / else show date?
@@ -70,6 +70,9 @@ func TibiaWorldsWorldImpl(world string, BoxContentHTML string) (WorldResponse, e
7070
insideError error
7171
)
7272

73+
// set default values
74+
WorldsTransferType = "regular"
75+
7376
// Running query over each div
7477
ReaderHTML.Find(".Table1 .InnerTableContainer table tr").EachWithBreak(func(index int, s *goquery.Selection) bool {
7578
// Storing HTML into CreatureDivHTML

src/TibiaWorldsWorld_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func TestWorldPremia(t *testing.T) {
7575
assert.Equal("Europe", world.Location)
7676
assert.Equal("Open PvP", world.PvpType)
7777
assert.True(world.PremiumOnly)
78-
assert.Empty(world.TransferType)
78+
assert.Equal("regular", world.TransferType)
7979
assert.Equal(4, len(world.WorldsQuestTitles))
8080
assert.Equal("Rise of Devovorga", world.WorldsQuestTitles[0])
8181
assert.Equal("Bewitched", world.WorldsQuestTitles[1])
@@ -116,7 +116,7 @@ func TestWorldWintera(t *testing.T) {
116116
assert.Equal("North America", world.Location)
117117
assert.Equal("Open PvP", world.PvpType)
118118
assert.False(world.PremiumOnly)
119-
assert.Empty(world.TransferType)
119+
assert.Equal("regular", world.TransferType)
120120
assert.Equal(4, len(world.WorldsQuestTitles))
121121
assert.Equal("A Piece of Cake", world.WorldsQuestTitles[0])
122122
assert.Equal("Rise of Devovorga", world.WorldsQuestTitles[1])

0 commit comments

Comments
 (0)