Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An attempt to fix a couple of issues #35

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
46 changes: 44 additions & 2 deletions LoLMasteryManager/ChampionGG.vb
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,8 @@ Module ChampionGG

For Each oMasteryNode As HtmlNode In oMasteryRow.SelectNodes("descendant::div[contains(@class, 'mastery-icon')]")

Dim iMasteryID As Integer = CInt(oMasteryNode.Attributes.Item("api-primary-id").Value)
'Dim iMasteryID As Integer = CInt(oMasteryNode.Attributes.Item("api-primary-id").Value)
Dim iMasteryID As Integer = CInt(oMasteryNode.Attributes.Item("data-id").Value)

oMastery = GetMastery(iMasteryID)

Expand Down Expand Up @@ -412,14 +413,17 @@ Module ChampionGG
End Using

Dim oRiotMasteries As Dictionary(Of String, RiotMastery) = JsonConvert.DeserializeObject(Of RiotMasteryListFile)(sJson).Masteries
Dim oRiotTree As RiotMasteryTreeList = JsonConvert.DeserializeObject(Of RiotMasteryListFile)(sJson).Tree

Dim oRiotMastery As RiotMastery = oRiotMasteries(id.ToString)

Dim oMastery As New Mastery

With oMastery
.ID = oRiotMastery.ID
.Name = oRiotMastery.Name
.Tree = oRiotMastery.Tree
'.Tree = oRiotMastery.Tree
.Tree = ExtractTree(oRiotMastery.ID, oRiotTree)
End With

Return oMastery
Expand All @@ -432,6 +436,44 @@ Module ChampionGG

End Function

Private Function ExtractTree(iD As Integer, oRiotTree As RiotMasteryTreeList) As String

For Each oCunningList In oRiotTree.Cunning
For Each oMastery As RiotMasteryIdPrereq In oCunningList
If oMastery IsNot Nothing Then
If oMastery.MasteryId.Equals(Convert.ToString(iD)) Then
Return "Cunning"
End If
End If

Next
Next

For Each oFerocityList In oRiotTree.Ferocity
For Each oMastery As RiotMasteryIdPrereq In oFerocityList
If oMastery IsNot Nothing Then
If oMastery.MasteryId.Equals(Convert.ToString(iD)) Then
Return "Ferocity"
End If
End If

Next
Next

For Each oResolveList In oRiotTree.Resolve
For Each oMastery As RiotMasteryIdPrereq In oResolveList
If oMastery IsNot Nothing Then
If oMastery.MasteryId.Equals(Convert.ToString(iD)) Then
Return "Resolve"
End If
End If

Next
Next

Return ""
End Function

''' <summary>
''' Extracts the number of assigned mastery ranks from the given node.
''' </summary>
Expand Down
170 changes: 90 additions & 80 deletions LoLMasteryManager/Coordinates.json
Original file line number Diff line number Diff line change
@@ -1,87 +1,97 @@
{
"reference_client_size": "1280, 800",
"absolute_coordinates": "true",
"mastery_coordinates_menu": {
"6111": "387, 267",
"6114": "521, 267",
"6121": "422, 339",
"6122": "489, 339",
"6131": "388, 410",
"6134": "522, 410",
"6141": "422, 481",
"6142": "489, 481",
"6151": "388, 552",
"6154": "522, 552",
"6161": "388, 623",
"6162": "455, 623",
"6164": "522, 623",
"6211": "937, 267",
"6212": "1071, 267",
"6221": "972, 339",
"6223": "1039, 339",
"6231": "938, 410",
"6232": "1072, 410",
"6241": "972, 481",
"6242": "1039, 481",
"6251": "938, 552",
"6252": "1072, 552",
"6261": "938, 623",
"6262": "1005, 623",
"6263": "1072, 623",
"6311": "662, 267",
"6312": "796, 267",
"6321": "663, 339",
"6322": "730, 339",
"6323": "797, 339",
"6331": "663, 410",
"6332": "797, 410",
"6342": "697, 481",
"6343": "764, 481",
"6351": "663, 552",
"6352": "797, 552",
"6361": "663, 623",
"6362": "730, 623",
"6363": "797, 623"
"6111": "730,470",
"6114": "865,470",
"6121": "730,545",
"6122": "800,545",
"6123": "865,545",
"6131": "730,615",
"6134": "865,615",
"6141": "770,685",
"6142": "835,685",
"6151": "730,755",
"6154": "865,755",
"6161": "730,830",
"6162": "800,830",
"6164": "865,830",
"6211": "1280,470",
"6212": "1415,470",
"6221": "1320,545",
"6223": "1385,545",
"6231": "1280,615",
"6232": "1415,615",
"6241": "1320,685",
"6242": "1385,685",
"6251": "1280,755",
"6252": "1415,755",
"6261": "1280,830",
"6262": "1350,830",
"6263": "1415,830",
"6311": "1005,470",
"6312": "1140,470",
"6321": "1005,545",
"6322": "1075,545",
"6323": "1140,545",
"6331": "1005,615",
"6332": "1140,615",
"6342": "1040,685",
"6343": "1110,685",
"6351": "1005,755",
"6352": "1140,755",
"6361": "1005,830",
"6362": "1075,830",
"6363": "1140,830",
"Input": "540,445",
"Return": "540,600",
"Save": "540,570"
},
"mastery_coordinates_champion_select": {
"6111": "397, 186",
"6114": "531, 186",
"6121": "432, 258",
"6122": "499, 258",
"6131": "398, 329",
"6134": "532, 329",
"6141": "432, 400",
"6142": "499, 400",
"6151": "398, 471",
"6154": "532, 471",
"6161": "398, 542",
"6162": "465, 542",
"6164": "532, 542",
"6211": "947, 186",
"6212": "1081, 186",
"6221": "982, 258",
"6223": "1049, 258",
"6231": "948, 329",
"6232": "1082, 329",
"6241": "982, 400",
"6242": "1049, 400",
"6251": "948, 471",
"6252": "1082, 471",
"6261": "948, 542",
"6262": "1015, 542",
"6263": "1082, 542",
"6311": "672, 186",
"6312": "806, 186",
"6321": "673, 258",
"6322": "740, 258",
"6323": "807, 258",
"6331": "673, 329",
"6332": "807, 329",
"6342": "707, 400",
"6343": "774, 400",
"6351": "673, 471",
"6352": "807, 471",
"6361": "673, 542",
"6362": "740, 542",
"6363": "807, 542"
"6111": "730, 330",
"6114": "865, 330",
"6121": "730, 400",
"6122": "800, 400",
"6123": "870, 400",
"6131": "730, 475",
"6134": "865, 475",
"6141": "770, 545",
"6142": "840, 545",
"6151": "730, 615",
"6154": "865, 615",
"6161": "730, 690",
"6162": "800, 690",
"6164": "865, 690",
"6211": "1280, 330",
"6212": "1415, 330",
"6221": "1320, 400",
"6223": "1390, 400",
"6231": "1280, 475",
"6232": "1415, 475",
"6241": "1320, 545",
"6242": "1390, 545",
"6251": "1280, 615",
"6252": "1415, 615",
"6261": "1280, 690",
"6262": "1350, 690",
"6263": "1415, 690",
"6311": "1005, 330",
"6312": "1140, 330",
"6321": "1005, 400",
"6322": "1080, 400",
"6323": "1140, 400",
"6331": "1005, 475",
"6332": "1140, 475",
"6342": "1050, 545",
"6343": "1110, 545",
"6351": "1005, 615",
"6352": "1140, 615",
"6361": "1005, 690",
"6362": "1080, 690",
"6363": "1140, 690",
"Input": "540, 305",
"Return": "540,460",
"Save": "540,430"
}
}

39 changes: 38 additions & 1 deletion LoLMasteryManager/Extensions.vb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Public Module Extensions
''' <param name="stat">The stat value to get the abbreviation for.</param>
''' <returns>The abbreviation for the given stat.</returns>
<Extension>
Public Function GetAbbreviation(ByRef stat As Stats) As String
Public Function GetStatAbbreviation(ByRef stat As Stats) As String

Try

Expand Down Expand Up @@ -78,4 +78,41 @@ Public Module Extensions

End Function

<Extension>
Public Function GetRoleAbbreviation(ByRef role As String) As String

Try

Dim sAbbreviation As String

Select Case role

Case "Middle"

sAbbreviation = "MID"

Case "Support"

sAbbreviation = "SUP"

Case "Jungle"

sAbbreviation = "JNG"


Case Else

sAbbreviation = role

End Select

Return sAbbreviation

Catch ex As Exception

Throw

End Try
End Function

End Module
Loading