Skip to content

Commit

Permalink
Add Wise Old Man to XP Updater plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
psikoi authored and Adam- committed Apr 30, 2020
1 parent 1778d5d commit 07b8798
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,15 @@ default boolean templeosrs()
{
return false;
}

@ConfigItem(
position = 3,
keyName = "wiseoldman",
name = "Wise Old Man",
description = "Automatically updates your stats on wiseoldman.net when you log out"
)
default boolean wiseoldman()
{
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,16 @@
import net.runelite.http.api.RuneLiteAPI;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.FormBody;
import okhttp3.HttpUrl;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;

@PluginDescriptor(
name = "XP Updater",
description = "Automatically updates your stats on external xptrackers when you log out",
tags = {"cml", "templeosrs", "temple", "external", "integration"},
tags = {"cml", "crystalmathlabs", "templeosrs", "temple", "wom", "wiseoldman", "wise old man", "external", "integration"},
enabledByDefault = false
)
@Slf4j
Expand Down Expand Up @@ -164,6 +166,29 @@ private void update(String username)

sendRequest("TempleOSRS", request);
}

if (config.wiseoldman())
{
HttpUrl url = new HttpUrl.Builder()
.scheme("https")
.host("wiseoldman.net")
.addPathSegment("api")
.addPathSegment("players")
.addPathSegment("track")
.build();

RequestBody formBody = new FormBody.Builder()
.add("username", username)
.build();

Request request = new Request.Builder()
.header("User-Agent", "RuneLite")
.url(url)
.post(formBody)
.build();

sendRequest("Wise Old Man", request);
}
}

private static void sendRequest(String platform, Request request)
Expand Down

0 comments on commit 07b8798

Please sign in to comment.