|
10 | 10 | import com.xpdrops.overlay.XpDropOverlayManager; |
11 | 11 | import com.xpdrops.predictedhit.Hit; |
12 | 12 | import com.xpdrops.predictedhit.PredictedHit; |
13 | | -import com.xpdrops.predictedhit.PredictedHitPartyMessage; |
| 13 | +import com.xpdrops.predictedhit.party.PredictedHitPartyManager; |
14 | 14 | import com.xpdrops.predictedhit.XpDropDamageCalculator; |
15 | 15 | import com.xpdrops.predictedhit.npcswithscalingbonus.ChambersLayoutSolver; |
16 | 16 | import lombok.Getter; |
|
45 | 45 | import net.runelite.client.events.ConfigChanged; |
46 | 46 | import net.runelite.client.events.PluginMessage; |
47 | 47 | import net.runelite.client.game.ItemVariationMapping; |
48 | | -import net.runelite.client.party.PartyService; |
49 | | -import net.runelite.client.party.WSClient; |
50 | 48 | import net.runelite.client.plugins.Plugin; |
51 | 49 | import net.runelite.client.plugins.PluginDependency; |
52 | 50 | import net.runelite.client.plugins.PluginDescriptor; |
| 51 | +import net.runelite.client.plugins.party.PartyPlugin; |
53 | 52 | import net.runelite.client.plugins.xptracker.XpTrackerPlugin; |
54 | 53 | import net.runelite.client.util.Text; |
55 | 54 |
|
|
65 | 64 |
|
66 | 65 | import static net.runelite.api.ScriptID.XPDROPS_SETDROPSIZE; |
67 | 66 |
|
| 67 | +// Depends on XpTrackerPlugin for custom xp tracker |
68 | 68 | @PluginDependency(XpTrackerPlugin.class) |
69 | | -// Plugin class and xp drop manager |
| 69 | +// Depends on PartyPlugin for PartyConfig |
| 70 | +@PluginDependency(PartyPlugin.class) |
| 71 | +// Plugin class |
70 | 72 | @PluginDescriptor( |
71 | 73 | name = "Customizable XP drops", |
72 | 74 | description = "Allows one to use fully customizable xp drops independent of the in-game ones" |
@@ -112,10 +114,7 @@ public class CustomizableXpDropsPlugin extends Plugin |
112 | 114 | private Gson gson; |
113 | 115 |
|
114 | 116 | @Inject |
115 | | - private PartyService partyService; |
116 | | - |
117 | | - @Inject |
118 | | - private WSClient wsClient; |
| 117 | + private PredictedHitPartyManager predictedHitPartyManager; |
119 | 118 |
|
120 | 119 | @Provides |
121 | 120 | XpDropsConfig provideConfig(ConfigManager configManager) |
@@ -207,7 +206,7 @@ protected void startUp() |
207 | 206 |
|
208 | 207 | importExport.addImportExportMenuOptions(); |
209 | 208 |
|
210 | | - wsClient.registerMessage(PredictedHitPartyMessage.class); |
| 209 | + predictedHitPartyManager.startUp(); |
211 | 210 |
|
212 | 211 | long totalTime = System.currentTimeMillis() - time; |
213 | 212 | log.debug("Plugin took {}ms to start.", totalTime); |
@@ -248,9 +247,9 @@ else if ((attackStyle == AttackStyle.CASTING) && (castingMode == 1)) |
248 | 247 | protected void shutDown() |
249 | 248 | { |
250 | 249 | xpDropOverlayManager.shutdown(); |
251 | | - setXpTrackerHidden(false); // should be according to varbit? |
| 250 | + setXpTrackerHidden(false); |
252 | 251 | importExport.removeMenuOptions(); |
253 | | - wsClient.unregisterMessage(PredictedHitPartyMessage.class); |
| 252 | + predictedHitPartyManager.shutDown(); |
254 | 253 | } |
255 | 254 |
|
256 | 255 | protected void setXpTrackerHidden(boolean hidden) |
@@ -505,6 +504,7 @@ protected void onStatChanged(StatChanged event) |
505 | 504 | protected void onBeforeRender(BeforeRender beforeRender) |
506 | 505 | { |
507 | 506 | xpDropOverlayManager.update(); |
| 507 | + predictedHitPartyManager.update(); |
508 | 508 | } |
509 | 509 |
|
510 | 510 | @Subscribe |
@@ -623,10 +623,6 @@ private void postPredictedHit(PredictedHit hit) |
623 | 623 | HashMap<String, Object> data = new HashMap<>(); |
624 | 624 | data.put("value", gson.toJson(hit)); |
625 | 625 | eventBus.post(new PluginMessage(namespace, name, data)); |
626 | | - |
627 | | - if (config.predictedHitOverParty() && partyService.isInParty()) |
628 | | - { |
629 | | - partyService.send(new PredictedHitPartyMessage(hit)); |
630 | | - } |
| 626 | + predictedHitPartyManager.postPredictedHit(hit); |
631 | 627 | } |
632 | 628 | } |
0 commit comments