diff --git a/src/TibiaWorldsOverview.go b/src/TibiaWorldsOverview.go index 69ed5685..4b3e81b7 100644 --- a/src/TibiaWorldsOverview.go +++ b/src/TibiaWorldsOverview.go @@ -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) diff --git a/src/TibiaWorldsWorld.go b/src/TibiaWorldsWorld.go index 0936a1d8..d6f52b66 100644 --- a/src/TibiaWorldsWorld.go +++ b/src/TibiaWorldsWorld.go @@ -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? @@ -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 diff --git a/src/TibiaWorldsWorld_test.go b/src/TibiaWorldsWorld_test.go index d5dd4ea2..78681f8f 100644 --- a/src/TibiaWorldsWorld_test.go +++ b/src/TibiaWorldsWorld_test.go @@ -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]) @@ -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])