Skip to content

Commit

Permalink
First release!
Browse files Browse the repository at this point in the history
MVP
  • Loading branch information
eugenethreat committed Dec 30, 2020
1 parent 4a3748d commit 41d357b
Show file tree
Hide file tree
Showing 12 changed files with 389 additions and 52 deletions.
45 changes: 28 additions & 17 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ https://nickcano.com/reversing-league-of-legends-client/

https://lcu.vivide.re/ - LCU docs

https://jsoup.org/ - java web scraping

**TODO**:
Spin up Discord API - check if Discord has r/w/x permissions to set runes

Expand All @@ -21,8 +23,6 @@ how to get runes?

get high elo matches, see what they are running via riot api? https://developer.riotgames.com/apis#match-v4/GET_getMatch

clean up making rune pages if pages already exist

**Problems**:

LCU wrapper only runs locally - can't be entirely server side
Expand Down
7 changes: 7 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@
<version>2.8.6</version>
</dependency>

<dependency>
<!-- jsoup HTML parser library @ https://jsoup.org/ -->
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.13.1</version>
</dependency>

</dependencies>

<build>
Expand Down
134 changes: 108 additions & 26 deletions src/main/java/org/example/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import generated.LolPerksPerkPageResource;
import org.example.champs.ChampLoader;
import org.example.puller.RunePuller;
import org.example.runes.RuneFamily;
import org.example.runes.RuneSlots;

Expand All @@ -29,19 +30,7 @@ public class App {
static ChampLoader champLoader = new ChampLoader();
static HashMap<String, String> champNamesAndKeys = champLoader.getChampMap();

static List<Integer> poppyRunes = Arrays.asList(8437, 8446, 8429, 8451, 8345, 8313, 5005, 5008, 5002);
//grasp, demolish,
//perfect timing
//resolve > inspiration

/*
precision: 8000
domination: 8100
sorcery: 8200
inspiration: 8300
resolve: 8400
*/

static RunePuller opggGetter = new RunePuller();

public static void main(String[] args) {

Expand Down Expand Up @@ -161,19 +150,8 @@ public static void setNewPage() {
getApi().executeDelete("/lol-perks/v1/pages");
}

LolPerksPerkPageResource newPage = new LolPerksPerkPageResource();
List<Integer> listOfNewPerks;
String champ = getCurrentChamp();

/*
TODO: Replace this with code that fetches proper runepages for each champ
*/

newPage.name = "Runes: " + champ;
listOfNewPerks = poppyRunes;
newPage.primaryStyleId = 8400;
newPage.subStyleId = 8300;
newPage.selectedPerkIds = listOfNewPerks;
LolPerksPerkPageResource newPage = doTheThing(champ);

getApi().executePost("/lol-perks/v1/pages/", newPage);

Expand All @@ -183,6 +161,108 @@ public static void setNewPage() {
}


}

/*
Gets locked in champ and fetches runes
*/
private static LolPerksPerkPageResource doTheThing(String champ) {
ArrayList<String> runenameStrings = opggGetter.returnRunes(champ);

List<Integer> opRunes = new ArrayList();

//System.out.println(runeNamesAndIds);

for (String str : runenameStrings) {
//System.out.println(str);
str = str.replace(" ", "");
//removes spacing

String res = runeNamesAndIds.get(str);
//System.out.println(res);
if (res != null) {
opRunes.add(Integer.parseInt(res));
//if its not a tertiary
}
}

opRunes.add(5005);
opRunes.add(5008);
opRunes.add(5002);

LolPerksPerkPageResource newPage = new LolPerksPerkPageResource();

//List<Integer> poppyRunes = Arrays.asList(8437, 8446, 8429, 8451, 8345, 8313, 5005, 5008, 5002);
//grasp, demolish,
//perfect timing
//resolve > inspiration
/*
5005, > 10% atck speed
5008, > +9 adaptive force
5002 > +6 armor
*/

newPage.name = "Runes: " + champ;

//GOTTA GET THESE SOMEHOW
/*
precision: 8000
domination: 8100
sorcery: 8200
inspiration: 8300
resolve: 8400
*/

newPage.primaryStyleId = 8000;
newPage.subStyleId = 8100;

//primary id
if (opRunes.contains(8112) || opRunes.contains(8124) || opRunes.contains(8128) || opRunes.contains(9923)) {
System.out.println("domination");
newPage.primaryStyleId = 8100;
} else if (opRunes.contains(8214) || opRunes.contains(8229) || opRunes.contains(8230)) {
System.out.println("sorcery");
newPage.primaryStyleId = 8200;
} else if (opRunes.contains(8351) || opRunes.contains(8360) || opRunes.contains(8358)) {
System.out.println("inspiration");
newPage.primaryStyleId = 8300;
} else if (opRunes.contains(8437) || opRunes.contains(8439) || opRunes.contains(8465)) {
System.out.println("resolve");
newPage.primaryStyleId = 8400;
} else if (opRunes.contains(8005) || opRunes.contains(8008) || opRunes.contains(8021) || opRunes.contains(8010)) {
System.out.println("precision");
newPage.primaryStyleId = 8000;
}


String arbSecond = String.valueOf(opRunes.get(4));
if (arbSecond.matches("81[0-9][0-9]")) {
System.out.println("domination secondary!");
newPage.subStyleId = 8100;
} else if (arbSecond.matches("82[0-9][0-9]")) {
System.out.println("srocery secondary!");
newPage.subStyleId = 8200;

} else if (arbSecond.matches("83[0-9][0-9]")) {
newPage.subStyleId = 8300;

System.out.println("inspiration secondary!");
} else if (arbSecond.matches("84[0-9][0-9]")) {
System.out.println("reoslve secondary!");
newPage.subStyleId = 8400;

} else if (arbSecond.matches("80[0-9][0-9]")) {
System.out.println("precision secondary!");
newPage.subStyleId = 8500;

}

newPage.selectedPerkIds = opRunes;


return newPage;


}

/*
Expand Down Expand Up @@ -217,8 +297,10 @@ public static HashMap<String, String> getPerkNames() {
for (int i = 0; i < s.length; i++) {
for (int j = 0; j < s[i].runes.length; j++) {
String aName = s[i].runes[j].name;
aName = aName.replace("\'", "");
//removes ' for future's market
String anId = s[i].runes[j].id;
runeNamesAndIds.put(anId, aName);
runeNamesAndIds.put(aName, anId);
}
}

Expand Down
Loading

0 comments on commit 41d357b

Please sign in to comment.