loot tracker: ignore player loot in LMS

This commit is contained in:
psikoi
2019-07-20 11:03:56 +01:00
committed by Adam
parent d5bf137ca7
commit 2b7c48e0c8

View File

@@ -27,6 +27,7 @@ package net.runelite.client.plugins.loottracker;
import com.google.common.collect.HashMultiset; import com.google.common.collect.HashMultiset;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Multiset; import com.google.common.collect.Multiset;
import com.google.common.collect.Multisets; import com.google.common.collect.Multisets;
import com.google.inject.Provides; import com.google.inject.Provides;
@@ -87,6 +88,7 @@ import net.runelite.http.api.loottracker.GameItem;
import net.runelite.http.api.loottracker.LootRecord; import net.runelite.http.api.loottracker.LootRecord;
import net.runelite.http.api.loottracker.LootRecordType; import net.runelite.http.api.loottracker.LootRecordType;
import net.runelite.http.api.loottracker.LootTrackerClient; import net.runelite.http.api.loottracker.LootTrackerClient;
import org.apache.commons.lang3.ArrayUtils;
@PluginDescriptor( @PluginDescriptor(
name = "Loot Tracker", name = "Loot Tracker",
@@ -120,6 +122,9 @@ public class LootTrackerPlugin extends Plugin
13113, "Larran's small chest" 13113, "Larran's small chest"
); );
// Last man standing map regions
private static final Set<Integer> LAST_MAN_STANDING_REGIONS = ImmutableSet.of(13658, 13659, 13914, 13915, 13916);
@Inject @Inject
private ClientToolbar clientToolbar; private ClientToolbar clientToolbar;
@@ -322,6 +327,12 @@ public class LootTrackerPlugin extends Plugin
@Subscribe @Subscribe
public void onPlayerLootReceived(final PlayerLootReceived playerLootReceived) public void onPlayerLootReceived(final PlayerLootReceived playerLootReceived)
{ {
// Ignore Last Man Standing player loots
if (isAtLMS())
{
return;
}
final Player player = playerLootReceived.getPlayer(); final Player player = playerLootReceived.getPlayer();
final Collection<ItemStack> items = playerLootReceived.getItems(); final Collection<ItemStack> items = playerLootReceived.getItems();
final String name = player.getName(); final String name = player.getName();
@@ -590,4 +601,22 @@ public class LootTrackerPlugin extends Plugin
return trackerRecords; return trackerRecords;
} }
/**
* Is player at the Last Man Standing minigame
*/
private boolean isAtLMS()
{
final int[] mapRegions = client.getMapRegions();
for (int region : LAST_MAN_STANDING_REGIONS)
{
if (ArrayUtils.contains(mapRegions, region))
{
return true;
}
}
return false;
}
} }