Merge remote-tracking branch 'runelite/master'
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.chatchannel;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.Lists;
|
||||
@@ -36,9 +37,9 @@ import java.util.ArrayDeque;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Deque;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.ListIterator;
|
||||
import javax.inject.Inject;
|
||||
import lombok.AllArgsConstructor;
|
||||
import net.runelite.api.ChatLineBuffer;
|
||||
@@ -101,7 +102,8 @@ public class ChatChannelPlugin extends Plugin
|
||||
{
|
||||
private static final int MAX_CHATS = 10;
|
||||
private static final String RECENT_TITLE = "Recent FCs";
|
||||
private static final int MESSAGE_DELAY = 10;
|
||||
@VisibleForTesting
|
||||
static final int MESSAGE_DELAY = 10;
|
||||
|
||||
@Inject
|
||||
private Client client;
|
||||
@@ -129,7 +131,7 @@ public class ChatChannelPlugin extends Plugin
|
||||
* queue of temporary messages added to the client
|
||||
*/
|
||||
private final Deque<MemberJoinMessage> joinMessages = new ArrayDeque<>();
|
||||
private final Map<ChatPlayer, MemberActivity> activityBuffer = new LinkedHashMap<>();
|
||||
private final List<MemberActivity> activityBuffer = new LinkedList<>();
|
||||
private int joinedTick;
|
||||
|
||||
private boolean kickConfirmed = false;
|
||||
@@ -284,31 +286,38 @@ public class ChatChannelPlugin extends Plugin
|
||||
|
||||
private void queueJoin(ChatPlayer member, MemberActivity.ChatType chatType)
|
||||
{
|
||||
// attempt to filter out world hopping joins
|
||||
if (!activityBuffer.containsKey(member))
|
||||
for (ListIterator<MemberActivity> iter = activityBuffer.listIterator(); iter.hasNext(); )
|
||||
{
|
||||
MemberActivity joinActivity = new MemberActivity(ActivityType.JOINED, chatType,
|
||||
member, client.getTickCount());
|
||||
activityBuffer.put(member, joinActivity);
|
||||
}
|
||||
else
|
||||
{
|
||||
activityBuffer.remove(member);
|
||||
MemberActivity activity = iter.next();
|
||||
|
||||
if (activity.getChatType() == chatType && activity.getMember().compareTo(member) == 0)
|
||||
{
|
||||
iter.remove();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
MemberActivity activity = new MemberActivity(ActivityType.JOINED, chatType,
|
||||
member, client.getTickCount());
|
||||
activityBuffer.add(activity);
|
||||
}
|
||||
|
||||
private void queueLeave(ChatPlayer member, MemberActivity.ChatType chatType)
|
||||
{
|
||||
if (!activityBuffer.containsKey(member))
|
||||
for (ListIterator<MemberActivity> iter = activityBuffer.listIterator(); iter.hasNext(); )
|
||||
{
|
||||
MemberActivity leaveActivity = new MemberActivity(ActivityType.LEFT, chatType,
|
||||
member, client.getTickCount());
|
||||
activityBuffer.put(member, leaveActivity);
|
||||
}
|
||||
else
|
||||
{
|
||||
activityBuffer.remove(member);
|
||||
MemberActivity activity = iter.next();
|
||||
|
||||
if (activity.getChatType() == chatType && activity.getMember().compareTo(member) == 0)
|
||||
{
|
||||
iter.remove();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
MemberActivity activity = new MemberActivity(ActivityType.LEFT, chatType,
|
||||
member, client.getTickCount());
|
||||
activityBuffer.add(activity);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@@ -386,32 +395,33 @@ public class ChatChannelPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
private void addActivityMessages()
|
||||
@VisibleForTesting
|
||||
void addActivityMessages()
|
||||
{
|
||||
if (activityBuffer.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Iterator<MemberActivity> activityIt = activityBuffer.values().iterator();
|
||||
|
||||
while (activityIt.hasNext())
|
||||
for (ListIterator<MemberActivity> iter = activityBuffer.listIterator(); iter.hasNext(); )
|
||||
{
|
||||
MemberActivity activity = activityIt.next();
|
||||
|
||||
if (activity.getTick() < client.getTickCount() - MESSAGE_DELAY)
|
||||
MemberActivity activity = iter.next();
|
||||
if (activity.getTick() >= client.getTickCount() - MESSAGE_DELAY)
|
||||
{
|
||||
activityIt.remove();
|
||||
switch (activity.getChatType())
|
||||
{
|
||||
case FRIENDS_CHAT:
|
||||
addActivityMessage((FriendsChatMember) activity.getMember(), activity.getActivityType());
|
||||
break;
|
||||
case CLAN_CHAT:
|
||||
case GUEST_CHAT:
|
||||
addClanActivityMessage((ClanChannelMember) activity.getMember(), activity.getActivityType(), activity.getChatType());
|
||||
break;
|
||||
}
|
||||
// everything after this is older
|
||||
return;
|
||||
}
|
||||
|
||||
iter.remove();
|
||||
switch (activity.getChatType())
|
||||
{
|
||||
case FRIENDS_CHAT:
|
||||
addActivityMessage((FriendsChatMember) activity.getMember(), activity.getActivityType());
|
||||
break;
|
||||
case CLAN_CHAT:
|
||||
case GUEST_CHAT:
|
||||
addClanActivityMessage((ClanChannelMember) activity.getMember(), activity.getActivityType(), activity.getChatType());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -322,7 +322,7 @@ public class CrypticClue extends ClueScroll implements TextClueScroll, NpcClueSc
|
||||
new CrypticClue("Has no one told you it is rude to ask a lady her age?", "Mawrth", new WorldPoint(2333, 3165, 0), "Talk to Mawrth in Lletya."),
|
||||
new CrypticClue("Elvish onions.", new WorldPoint(3303, 6092, 0), "Dig in the onion patch east of the Prifddinas allotments."),
|
||||
new CrypticClue("Dig by the Giant's Den entrance, looking out over Lake Molch.", new WorldPoint(1418, 3591, 0), "South-east of Lake Molch in Zeah, outside the cave entrance."),
|
||||
new CrypticClue("Search the crates in the fruit store just east of the Hosidius town centre.", CRATES_27533, new WorldPoint(1798, 3612, 0), "Search the crates in the back room of the Hosidius fruit store."),
|
||||
new CrypticClue("Search the crates in the fruit store just east of the Hosidius town centre.", CRATES_27533, new WorldPoint(1799, 3613, 0), "Search the crates in the back room of the Hosidius fruit store."),
|
||||
new CrypticClue("A graceful man of many colours, his crates must be full of many delights.", "Hill Giant", CRATE_42067, new WorldPoint(1506, 3590, 2), "Kill any Hill Giant for a medium key. Then search the crate on the top floor of Osten's clothing shop in Shayzien."),
|
||||
new CrypticClue("Search the basket of apples in an orchard, south of the unknown grave surrounded by white roses.", APPLE_BASKET, new WorldPoint(1718, 3626, 0), "Search the middle apple basket in the apple orchard north of Hosidius."),
|
||||
new CrypticClue("Dig in the lair of red wings, within the temple of the Sun and Moon.", new WorldPoint(1820, 9935, 0), "Forthos Dungeon. In the center of the red dragons.")
|
||||
|
||||
@@ -28,6 +28,7 @@ package net.runelite.client.plugins.xpupdater;
|
||||
|
||||
import com.google.inject.Provides;
|
||||
import java.io.IOException;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Objects;
|
||||
import javax.inject.Inject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -132,53 +133,72 @@ public class XpUpdaterPlugin extends Plugin
|
||||
|
||||
private void update(String username)
|
||||
{
|
||||
String reformedUsername = username.replace(" ", "_");
|
||||
EnumSet<WorldType> worldTypes = client.getWorldType();
|
||||
username = username.replace(" ", "_");
|
||||
updateCml(username, worldTypes);
|
||||
updateTempleosrs(username, worldTypes);
|
||||
updateWom(username, worldTypes);
|
||||
}
|
||||
|
||||
if (config.cml())
|
||||
private void updateCml(String username, EnumSet<WorldType> worldTypes)
|
||||
{
|
||||
if (config.cml()
|
||||
&& !worldTypes.contains(WorldType.LEAGUE)
|
||||
&& !worldTypes.contains(WorldType.DEADMAN)
|
||||
&& !worldTypes.contains(WorldType.TOURNAMENT))
|
||||
{
|
||||
HttpUrl url = new HttpUrl.Builder()
|
||||
.scheme("https")
|
||||
.host("crystalmathlabs.com")
|
||||
.addPathSegment("tracker")
|
||||
.addPathSegment("api.php")
|
||||
.addQueryParameter("type", "update")
|
||||
.addQueryParameter("player", reformedUsername)
|
||||
.build();
|
||||
.scheme("https")
|
||||
.host("crystalmathlabs.com")
|
||||
.addPathSegment("tracker")
|
||||
.addPathSegment("api.php")
|
||||
.addQueryParameter("type", "update")
|
||||
.addQueryParameter("player", username)
|
||||
.build();
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.header("User-Agent", "RuneLite")
|
||||
.url(url)
|
||||
.build();
|
||||
.header("User-Agent", "RuneLite")
|
||||
.url(url)
|
||||
.build();
|
||||
|
||||
sendRequest("CrystalMathLabs", request);
|
||||
}
|
||||
}
|
||||
|
||||
if (config.templeosrs())
|
||||
private void updateTempleosrs(String username, EnumSet<WorldType> worldTypes)
|
||||
{
|
||||
if (config.templeosrs()
|
||||
&& !worldTypes.contains(WorldType.LEAGUE)
|
||||
&& !worldTypes.contains(WorldType.DEADMAN)
|
||||
&& !worldTypes.contains(WorldType.TOURNAMENT))
|
||||
{
|
||||
HttpUrl url = new HttpUrl.Builder()
|
||||
.scheme("https")
|
||||
.host("templeosrs.com")
|
||||
.addPathSegment("php")
|
||||
.addPathSegment("add_datapoint.php")
|
||||
.addQueryParameter("player", reformedUsername)
|
||||
.build();
|
||||
.scheme("https")
|
||||
.host("templeosrs.com")
|
||||
.addPathSegment("php")
|
||||
.addPathSegment("add_datapoint.php")
|
||||
.addQueryParameter("player", username)
|
||||
.build();
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.header("User-Agent", "RuneLite")
|
||||
.url(url)
|
||||
.build();
|
||||
.header("User-Agent", "RuneLite")
|
||||
.url(url)
|
||||
.build();
|
||||
|
||||
sendRequest("TempleOSRS", request);
|
||||
}
|
||||
}
|
||||
|
||||
if (config.wiseoldman())
|
||||
private void updateWom(String username, EnumSet<WorldType> worldTypes)
|
||||
{
|
||||
if (config.wiseoldman()
|
||||
&& !worldTypes.contains(WorldType.LEAGUE)
|
||||
&& !worldTypes.contains(WorldType.DEADMAN)
|
||||
&& !worldTypes.contains(WorldType.TOURNAMENT))
|
||||
{
|
||||
final boolean leagueWorld = client.getWorldType().contains(WorldType.LEAGUE);
|
||||
final String host = leagueWorld ? "trailblazer.wiseoldman.net" : "wiseoldman.net";
|
||||
|
||||
HttpUrl url = new HttpUrl.Builder()
|
||||
.scheme("https")
|
||||
.host(host)
|
||||
.host("wiseoldman.net")
|
||||
.addPathSegment("api")
|
||||
.addPathSegment("players")
|
||||
.addPathSegment("track")
|
||||
|
||||
Reference in New Issue
Block a user