raid plugin: add raid scouted/reset events

This commit is contained in:
Trevor
2020-06-24 18:29:14 -04:00
committed by Adam
parent 33992efac7
commit 9e9f428fe7
6 changed files with 88 additions and 3 deletions

View File

@@ -31,7 +31,7 @@ import net.runelite.api.coords.WorldPoint;
import net.runelite.client.plugins.raids.solver.Layout;
import net.runelite.client.plugins.raids.solver.Room;
class Raid
public class Raid
{
@Getter
private final RaidRoom[] rooms = new RaidRoom[16];

View File

@@ -29,7 +29,7 @@ import lombok.RequiredArgsConstructor;
@RequiredArgsConstructor
@Getter
enum RaidRoom
public enum RaidRoom
{
START("Start", RoomType.START),
END("End", RoomType.END),

View File

@@ -77,10 +77,13 @@ import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.chat.QueuedMessage;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.config.RuneLiteConfig;
import net.runelite.client.eventbus.EventBus;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ChatInput;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.events.OverlayMenuClicked;
import net.runelite.client.plugins.raids.events.RaidReset;
import net.runelite.client.plugins.raids.events.RaidScouted;
import net.runelite.client.game.ItemManager;
import net.runelite.client.game.SpriteManager;
import net.runelite.client.input.KeyManager;
@@ -179,6 +182,9 @@ public class RaidsPlugin extends Plugin
@Inject
private ImageCapture imageCapture;
@Inject
private EventBus eventBus;
@Getter
private final Set<String> roomWhitelist = new HashSet<String>();
@@ -506,6 +512,8 @@ public class RaidsPlugin extends Plugin
{
sendRaidLayoutMessage();
}
eventBus.post(new RaidScouted(raid, firstSolve));
}
private void sendRaidLayoutMessage()
@@ -1008,5 +1016,6 @@ public class RaidsPlugin extends Plugin
raid = null;
chestOpened = false;
updateInfoBoxState();
eventBus.post(new RaidReset());
}
}

View File

@@ -30,7 +30,7 @@ import lombok.Getter;
@AllArgsConstructor
@Getter
enum RoomType
public enum RoomType
{
START("Start", '#'),
END("End", '¤'),

View File

@@ -0,0 +1,34 @@
/*
* Copyright (c) 2020, Trevor <https://github.com/Trevor159>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.plugins.raids.events;
/**
* An event that fires when the raid plugin resets
*
* This happens when the player leaves a raid and when the raid plugin turns off
*/
public class RaidReset
{
}

View File

@@ -0,0 +1,42 @@
/*
* Copyright (c) 2020, Trevor <https://github.com/Trevor159>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.plugins.raids.events;
import lombok.Value;
import net.runelite.client.plugins.raids.Raid;
/**
* An event that fires when the player scouts a raid
*
* This will fire every time the raid plugin successfully scouts a raid but mostly fires at LOGGED_IN gamestate changes
* This event only fires in scoutable raids (not challenge mode)
* The raid object is not guaranteed to change in between events
*/
@Value
public class RaidScouted
{
private Raid raid;
private boolean firstScout;
}