mesenhanced: add config.
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package net.runelite.client.plugins.mesenhanced;
|
package net.runelite.client.plugins.mesenhanced;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
import com.google.inject.Provides;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -19,6 +20,7 @@ import net.runelite.api.events.ItemContainerChanged;
|
|||||||
import net.runelite.api.events.MenuEntryAdded;
|
import net.runelite.api.events.MenuEntryAdded;
|
||||||
import net.runelite.api.events.MenuOptionClicked;
|
import net.runelite.api.events.MenuOptionClicked;
|
||||||
import net.runelite.api.widgets.WidgetInfo;
|
import net.runelite.api.widgets.WidgetInfo;
|
||||||
|
import net.runelite.client.config.ConfigManager;
|
||||||
import net.runelite.client.eventbus.EventBus;
|
import net.runelite.client.eventbus.EventBus;
|
||||||
import net.runelite.client.plugins.Plugin;
|
import net.runelite.client.plugins.Plugin;
|
||||||
import net.runelite.client.plugins.PluginDescriptor;
|
import net.runelite.client.plugins.PluginDescriptor;
|
||||||
@@ -52,6 +54,9 @@ public class MesEnhanced extends Plugin
|
|||||||
private Client client;
|
private Client client;
|
||||||
@Inject
|
@Inject
|
||||||
private EventBus eventBus;
|
private EventBus eventBus;
|
||||||
|
@Inject
|
||||||
|
private MesEnhancedConfig config;
|
||||||
|
|
||||||
private boolean tinder;
|
private boolean tinder;
|
||||||
private boolean bones;
|
private boolean bones;
|
||||||
private boolean tick;
|
private boolean tick;
|
||||||
@@ -60,6 +65,12 @@ public class MesEnhanced extends Plugin
|
|||||||
private int bonesIdx;
|
private int bonesIdx;
|
||||||
private int bonesId;
|
private int bonesId;
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
MesEnhancedConfig getConfig(ConfigManager configManager)
|
||||||
|
{
|
||||||
|
return configManager.getConfig(MesEnhancedConfig.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void startUp()
|
public void startUp()
|
||||||
{
|
{
|
||||||
@@ -97,14 +108,21 @@ public class MesEnhanced extends Plugin
|
|||||||
|
|
||||||
private void onMenuEntryAdded(MenuEntryAdded event)
|
private void onMenuEntryAdded(MenuEntryAdded event)
|
||||||
{
|
{
|
||||||
|
if (!config.leftClickLog() && !config.quickBones())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final int id = event.getIdentifier();
|
final int id = event.getIdentifier();
|
||||||
|
|
||||||
if (tinder && event.getType() == MenuOpcode.ITEM_USE.getId() && LIGHTABLE_LOGS.contains(id))
|
if (config.leftClickLog() && tinder && event.getType() == MenuOpcode.ITEM_USE.getId()
|
||||||
|
&& LIGHTABLE_LOGS.contains(id))
|
||||||
{
|
{
|
||||||
event.getMenuEntry().setOption(LIGHT);
|
event.getMenuEntry().setOption(LIGHT);
|
||||||
event.setWasModified(true);
|
event.setWasModified(true);
|
||||||
}
|
}
|
||||||
else if (bones && event.getType() == MenuOpcode.GAME_OBJECT_FIRST_OPTION.getId() && event.getTarget().toLowerCase().contains("altar"))
|
else if (config.quickBones() && bones && event.getType() == MenuOpcode.GAME_OBJECT_FIRST_OPTION.getId()
|
||||||
|
&& event.getTarget().toLowerCase().contains("altar"))
|
||||||
{
|
{
|
||||||
event.getMenuEntry().setOption(QUICK_BONE);
|
event.getMenuEntry().setOption(QUICK_BONE);
|
||||||
event.setWasModified(true);
|
event.setWasModified(true);
|
||||||
@@ -113,20 +131,27 @@ public class MesEnhanced extends Plugin
|
|||||||
|
|
||||||
private void onMenuOptionClicked(MenuOptionClicked event)
|
private void onMenuOptionClicked(MenuOptionClicked event)
|
||||||
{
|
{
|
||||||
|
if (!config.leftClickLog() && !config.quickBones())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final MenuEntry entry = event.getMenuEntry();
|
final MenuEntry entry = event.getMenuEntry();
|
||||||
|
|
||||||
if (tinder && event.getOpcode() == MenuOpcode.ITEM_USE.getId() && event.getOption().equals(LIGHT))
|
if (config.leftClickLog() && tinder && event.getOpcode() == MenuOpcode.ITEM_USE.getId()
|
||||||
|
&& event.getOption().equals(LIGHT))
|
||||||
{
|
{
|
||||||
entry.setOpcode(MenuOpcode.ITEM_USE_ON_WIDGET_ITEM.getId());
|
entry.setOpcode(MenuOpcode.ITEM_USE_ON_WIDGET_ITEM.getId());
|
||||||
client.setSelectedItemWidget(WidgetInfo.INVENTORY.getId());
|
client.setSelectedItemWidget(WidgetInfo.INVENTORY.getId());
|
||||||
client.setSelectedItemSlot(tinderIdx);
|
client.setSelectedItemSlot(tinderIdx);
|
||||||
client.setSelectedItemID(tinderId);
|
client.setSelectedItemID(tinderId);
|
||||||
}
|
}
|
||||||
else if (bones && event.getOption().equals(QUICK_BONE) && tick)
|
else if (config.quickBones() && bones && event.getOption().equals(QUICK_BONE) && tick)
|
||||||
{
|
{
|
||||||
event.consume();
|
event.consume();
|
||||||
}
|
}
|
||||||
else if (bones && event.getOpcode() == MenuOpcode.GAME_OBJECT_FIRST_OPTION.getId() && event.getOption().equals(QUICK_BONE))
|
else if (config.quickBones() && bones && event.getOpcode() == MenuOpcode.GAME_OBJECT_FIRST_OPTION.getId()
|
||||||
|
&& event.getOption().equals(QUICK_BONE))
|
||||||
{
|
{
|
||||||
entry.setOpcode(MenuOpcode.ITEM_USE_ON_GAME_OBJECT.getId());
|
entry.setOpcode(MenuOpcode.ITEM_USE_ON_GAME_OBJECT.getId());
|
||||||
client.setSelectedItemWidget(WidgetInfo.INVENTORY.getId());
|
client.setSelectedItemWidget(WidgetInfo.INVENTORY.getId());
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018, Cas <https://github.com/casvandongen>
|
||||||
|
* 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.mesenhanced;
|
||||||
|
|
||||||
|
import net.runelite.client.config.Config;
|
||||||
|
import net.runelite.client.config.ConfigGroup;
|
||||||
|
import net.runelite.client.config.ConfigItem;
|
||||||
|
|
||||||
|
@ConfigGroup("mesEnhanced")
|
||||||
|
public interface MesEnhancedConfig extends Config
|
||||||
|
{
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "leftClickLog",
|
||||||
|
name = "1 Click Lighting",
|
||||||
|
description = "This will allow you to left click logs to light them.",
|
||||||
|
position = 1
|
||||||
|
)
|
||||||
|
default boolean leftClickLog()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "quickBones",
|
||||||
|
name = "1 Click Bones",
|
||||||
|
description = "This will allow you to left click an altar to use your bones on them.",
|
||||||
|
position = 2
|
||||||
|
)
|
||||||
|
default boolean quickBones()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user