Merge pull request #909 from Lucwousin/pay-dirt

motherlode: add "pay-dirt!" to motherlode mine
This commit is contained in:
Ganom
2019-07-06 16:38:53 -04:00
committed by GitHub
4 changed files with 95 additions and 4 deletions

View File

@@ -142,4 +142,14 @@ public interface MotherlodeConfig extends Config
return false;
}
@ConfigItem(
keyName = "payDirtMsg",
name = "Pay-dirt!",
description = "Send a public message saying \"Pay-dirt!\" every time a dwarf says \"Pay-dirt!\"",
position = 99
)
default boolean payDirtMsg()
{
return false;
}
}

View File

@@ -26,6 +26,7 @@
*/
package net.runelite.client.plugins.motherlode;
import com.google.common.base.Strings;
import com.google.common.collect.HashMultiset;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Multiset;
@@ -63,6 +64,8 @@ import net.runelite.api.Item;
import net.runelite.api.ItemContainer;
import net.runelite.api.ItemID;
import net.runelite.api.MenuAction;
import net.runelite.api.NPC;
import net.runelite.api.NpcID;
import static net.runelite.api.ObjectID.DEPLETED_VEIN_26665;
import static net.runelite.api.ObjectID.DEPLETED_VEIN_26666;
import static net.runelite.api.ObjectID.DEPLETED_VEIN_26667;
@@ -75,6 +78,7 @@ import static net.runelite.api.ObjectID.ROCKFALL;
import static net.runelite.api.ObjectID.ROCKFALL_26680;
import net.runelite.api.Perspective;
import net.runelite.api.Player;
import net.runelite.api.ScriptID;
import net.runelite.api.Varbits;
import net.runelite.api.WallObject;
import net.runelite.api.coords.LocalPoint;
@@ -89,6 +93,7 @@ import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.ItemContainerChanged;
import net.runelite.api.events.GameTick;
import net.runelite.api.events.MenuOptionClicked;
import net.runelite.api.events.OverheadTextChanged;
import net.runelite.api.events.VarbitChanged;
import net.runelite.api.events.WallObjectChanged;
import net.runelite.api.events.WallObjectDespawned;
@@ -105,6 +110,7 @@ import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.task.Schedule;
import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.client.util.Text;
@PluginDescriptor(
name = "Motherlode Mine",
@@ -212,6 +218,7 @@ public class MotherlodePlugin extends Plugin
private boolean notifyOnIdle;
@Getter(AccessLevel.PACKAGE)
private boolean showTargetVein;
private boolean payDirtMsg;
@Provides
MotherlodeConfig getConfig(ConfigManager configManager)
@@ -321,7 +328,7 @@ public class MotherlodePlugin extends Plugin
period = 1,
unit = ChronoUnit.SECONDS
)
public void checkMining()
void checkMining()
{
if (!inMlm)
{
@@ -722,9 +729,6 @@ public class MotherlodePlugin extends Plugin
/**
* Checks if the given point is "upstairs" in the mlm.
* The upper floor is actually on z=0.
*
* @param localPoint
* @return
*/
boolean isUpstairs(LocalPoint localPoint)
{
@@ -755,5 +759,38 @@ public class MotherlodePlugin extends Plugin
this.showOresFound = config.showOresFound();
this.notifyOnIdle = config.notifyOnIdle();
this.showTargetVein = config.showTargetVein();
this.payDirtMsg = config.payDirtMsg();
}
@Subscribe
private void onOverheadTextChanged(OverheadTextChanged event)
{
if (!payDirtMsg || Strings.isNullOrEmpty(event.getOverheadText()) || !(event.getActor() instanceof NPC))
{
return;
}
switch (((NPC) event.getActor()).getId())
{
case NpcID.MINER_5606:
case NpcID.MINER_5813:
case NpcID.MINER_5814:
case NpcID.MINER_6565:
case NpcID.MINER_6567:
case NpcID.MINER_6568:
case NpcID.MINER_6569:
case NpcID.MINER_6570:
case NpcID.MINER_6571:
case NpcID.MINER_6572:
case NpcID.MINER_6645:
break;
default:
return;
}
if ("pay-dirt!".equals(Text.standardize(event.getOverheadText())))
{
client.runScript(ScriptID.PUBLICMSG, "Pay-dirt!");
}
}
}

View File

@@ -0,0 +1,39 @@
;;;
;
; Copyright (c) 2019, Lucas <https://github.com/Lucwousin>
; 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.
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ;
; Send a public message ;
; ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;
.id 13337
.int_stack_count 0
.string_stack_count 1
.int_var_count 0
.string_var_count 1
sload 0
iconst 0
chat_sendpublic
return