forked from Zoinkwiz/quest-helper
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This has been shifted from working in the Runelite repo to being a plugin in the Hub.
- Loading branch information
Showing
69 changed files
with
8,386 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
#Thu Jun 25 09:45:02 BST 2020 | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4.1-all.zip | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
zipStoreBase=GRADLE_USER_HOME |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
displayName=Example | ||
author=Nobody | ||
support= | ||
description=An example greeter plugin | ||
tags= | ||
plugins=com.example.ExamplePlugin | ||
displayName=Quest Helper | ||
author=Zoinkwiz | ||
support=https://github.com/Zoinkwiz/quest-helper | ||
description=A helper for questing | ||
tags=quest,helper | ||
plugins=com.example.QuestHelperPlugin |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* Copyright (c) 2020, Zoinkwiz | ||
* 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 com.questhelper; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
import lombok.Getter; | ||
import net.runelite.api.ItemID; | ||
|
||
public class ItemCollections | ||
{ | ||
@Getter | ||
private static List<Integer> axes = new ArrayList<>(Arrays.asList( | ||
ItemID.BRONZE_AXE, | ||
ItemID.IRON_AXE, | ||
ItemID.STEEL_AXE, | ||
ItemID.BLACK_AXE, | ||
ItemID.MITHRIL_AXE, | ||
ItemID.ADAMANT_AXE, | ||
ItemID.GILDED_AXE, | ||
ItemID.RUNE_AXE, | ||
ItemID.DRAGON_AXE, | ||
ItemID.INFERNAL_AXE, | ||
ItemID._3RD_AGE_AXE, | ||
ItemID.CRYSTAL_AXE) | ||
); | ||
|
||
@Getter | ||
private static List<Integer> pickaxes = new ArrayList<>(Arrays.asList( | ||
ItemID.BRONZE_PICKAXE, | ||
ItemID.IRON_PICKAXE, | ||
ItemID.STEEL_PICKAXE, | ||
ItemID.BLACK_PICKAXE, | ||
ItemID.MITHRIL_PICKAXE, | ||
ItemID.ADAMANT_PICKAXE, | ||
ItemID.GILDED_PICKAXE, | ||
ItemID.RUNE_PICKAXE, | ||
ItemID.DRAGON_PICKAXE, | ||
ItemID.INFERNAL_PICKAXE, | ||
ItemID._3RD_AGE_PICKAXE, | ||
ItemID.CRYSTAL_PICKAXE) | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
/* | ||
* Copyright (c) 2019, 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 com.questhelper; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.Collections; | ||
import java.util.List; | ||
import javax.inject.Inject; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
import net.runelite.api.Client; | ||
import net.runelite.api.InventoryID; | ||
import net.runelite.api.Item; | ||
import net.runelite.api.ItemContainer; | ||
import net.runelite.client.game.ItemManager; | ||
|
||
public class ItemRequirement | ||
{ | ||
@Getter | ||
private final int id; | ||
|
||
private String name; | ||
|
||
@Getter | ||
private final int quantity; | ||
|
||
@Getter | ||
private boolean equip; | ||
|
||
@Setter | ||
@Getter | ||
private String tip; | ||
|
||
private final List<Integer> alternates = new ArrayList<>(); | ||
|
||
public ItemRequirement(String name, int id) | ||
{ | ||
this(name, id, 1); | ||
} | ||
|
||
public ItemRequirement(String name, int id, int quantity) | ||
{ | ||
this.id = id; | ||
this.quantity = quantity; | ||
this.name = name; | ||
equip = false; | ||
} | ||
|
||
public ItemRequirement(String name, int id, int quantity, boolean equip) | ||
{ | ||
this(name, id, quantity); | ||
this.equip = equip; | ||
} | ||
|
||
public void addAlternates(List<Integer> alternates) { | ||
this.alternates.addAll(alternates); | ||
} | ||
|
||
public void addAlternates(Integer... alternates) { | ||
Collections.addAll(this.alternates, alternates); | ||
} | ||
|
||
public void addName(String name) | ||
{ | ||
this.name = name; | ||
} | ||
|
||
public boolean showQuantity() { | ||
return quantity != -1; | ||
} | ||
|
||
public boolean isActualItem() { | ||
return id != -1; | ||
} | ||
|
||
public String getName() | ||
{ | ||
return name; | ||
} | ||
|
||
public ArrayList<Integer> getAllIds() { | ||
ArrayList<Integer> ids = new ArrayList<>(alternates); | ||
ids.add(id); | ||
return ids; | ||
} | ||
|
||
public boolean check(Client client, boolean checkEquippedOnly) | ||
{ | ||
ItemContainer equipped = client.getItemContainer(InventoryID.EQUIPMENT); | ||
int tempQuantity = quantity; | ||
|
||
if(equipped != null) | ||
{ | ||
Item[] equippedItems = equipped.getItems(); | ||
|
||
for (Item item : equippedItems) | ||
{ | ||
if (item.getId() == id || alternates.contains(item.getId())) | ||
{ | ||
if (item.getQuantity() >= tempQuantity) | ||
{ | ||
return true; | ||
} | ||
else | ||
{ | ||
tempQuantity -= item.getQuantity(); | ||
} | ||
} | ||
} | ||
} | ||
|
||
if(!checkEquippedOnly) { | ||
ItemContainer inventory = client.getItemContainer(InventoryID.INVENTORY); | ||
if(inventory != null) | ||
{ | ||
Item[] inventoryItems = inventory.getItems(); | ||
for (Item item : inventoryItems) | ||
{ | ||
if (item.getId() == id || alternates.contains(item.getId())) | ||
{ | ||
if (item.getQuantity() >= tempQuantity) | ||
{ | ||
return true; | ||
} | ||
else | ||
{ | ||
tempQuantity -= item.getQuantity(); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
return false; | ||
} | ||
|
||
public boolean check(Client client) { | ||
return check(client, false); | ||
} | ||
} |
Oops, something went wrong.