Skip to content

Commit

Permalink
align world endpoint transfer_type to regular by default (#348)
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasehlert committed Apr 10, 2024
1 parent 4412b6b commit b379b68
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/TibiaWorldsOverview.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type OverviewWorld struct {
Location string `json:"location"` // The physical location of the servers.
PvpType string `json:"pvp_type"` // The type of PvP.
PremiumOnly bool `json:"premium_only"` // Whether only premium account players are allowed to play on it.
TransferType string `json:"transfer_type"` // The type of transfer restrictions it has. regular (if not present) / locked / blocked
TransferType string `json:"transfer_type"` // The type of transfer restrictions it has. regular / locked / blocked
BattleyeProtected bool `json:"battleye_protected"` // The type of BattlEye protection. true if protected / false if "Not protected by BattlEye."
BattleyeDate string `json:"battleye_date"` // The date when BattlEye was added. "" if since release / else show date?
GameWorldType string `json:"game_world_type"` // The type of world. regular / experimental / tournament (if Tournament World Type exists)
Expand Down
5 changes: 4 additions & 1 deletion src/TibiaWorldsWorld.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type World struct {
Location string `json:"location"` // The physical location of the servers.
PvpType string `json:"pvp_type"` // The type of PvP.
PremiumOnly bool `json:"premium_only"` // Whether only premium account players are allowed to play on it.
TransferType string `json:"transfer_type"` // The type of transfer restrictions it has. regular (if not present) / locked / blocked
TransferType string `json:"transfer_type"` // The type of transfer restrictions it has. regular / locked / blocked
WorldsQuestTitles []string `json:"world_quest_titles"` // List of world quest titles the server has achieved.
BattleyeProtected bool `json:"battleye_protected"` // The type of BattlEye protection. true if protected / false if "Not protected by BattlEye."
BattleyeDate string `json:"battleye_date"` // The date when BattlEye was added. "" if since release / else show date?
Expand Down Expand Up @@ -70,6 +70,9 @@ func TibiaWorldsWorldImpl(world string, BoxContentHTML string) (WorldResponse, e
insideError error
)

// set default values
WorldsTransferType = "regular"

// Running query over each div
ReaderHTML.Find(".Table1 .InnerTableContainer table tr").EachWithBreak(func(index int, s *goquery.Selection) bool {
// Storing HTML into CreatureDivHTML
Expand Down
4 changes: 2 additions & 2 deletions src/TibiaWorldsWorld_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func TestWorldPremia(t *testing.T) {
assert.Equal("Europe", world.Location)
assert.Equal("Open PvP", world.PvpType)
assert.True(world.PremiumOnly)
assert.Empty(world.TransferType)
assert.Equal("regular", world.TransferType)
assert.Equal(4, len(world.WorldsQuestTitles))
assert.Equal("Rise of Devovorga", world.WorldsQuestTitles[0])
assert.Equal("Bewitched", world.WorldsQuestTitles[1])
Expand Down Expand Up @@ -116,7 +116,7 @@ func TestWorldWintera(t *testing.T) {
assert.Equal("North America", world.Location)
assert.Equal("Open PvP", world.PvpType)
assert.False(world.PremiumOnly)
assert.Empty(world.TransferType)
assert.Equal("regular", world.TransferType)
assert.Equal(4, len(world.WorldsQuestTitles))
assert.Equal("A Piece of Cake", world.WorldsQuestTitles[0])
assert.Equal("Rise of Devovorga", world.WorldsQuestTitles[1])
Expand Down

0 comments on commit b379b68

Please sign in to comment.