Skip to content

Commit

Permalink
project: Merge upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
Owain94 committed Aug 11, 2020
1 parent 5677e9b commit 9a85c85
Show file tree
Hide file tree
Showing 63 changed files with 456 additions and 303 deletions.
2 changes: 1 addition & 1 deletion achievementdiary/achievementdiary.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

version = "0.0.4"
version = "0.0.5"

project.extra["PluginName"] = "Diary Requirements"
project.extra["PluginDescription"] = "Display level requirements in Achievement Diary interface"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import lombok.AccessLevel;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import net.runelite.api.Client;

@RequiredArgsConstructor
@Getter(AccessLevel.PACKAGE)
Expand All @@ -39,4 +40,9 @@ public String toString()
{
return level + " " + "Combat";
}

public boolean satisfiesRequirement(Client client)
{
return client.getLocalPlayer() == null ? false : client.getLocalPlayer().getCombatLevel() >= level;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@
import javax.inject.Inject;
import net.runelite.api.Client;
import net.runelite.api.FontTypeFace;
import net.runelite.api.QuestState;
import net.runelite.api.ScriptID;
import net.runelite.api.VarPlayer;
import net.runelite.api.events.WidgetLoaded;
import net.runelite.api.util.Text;
import net.runelite.api.widgets.Widget;
Expand Down Expand Up @@ -273,7 +271,7 @@ private Map<String, String> buildRequirements(Collection<DiaryRequirement> requi
assert !req.getRequirements().isEmpty();
for (Requirement ireq : req.getRequirements())
{
boolean satifisfied = satisfiesRequirement(ireq);
boolean satifisfied = ireq.satisfiesRequirement(client);
b.append(satifisfied ? "<col=000080><str>" : "<col=800000>");
b.append(ireq.toString());
b.append(satifisfied ? "</str>" : "<col=000080>");
Expand All @@ -288,44 +286,4 @@ private Map<String, String> buildRequirements(Collection<DiaryRequirement> requi
}
return reqs;
}

private boolean satisfiesRequirement(Requirement r)
{
if (r instanceof OrRequirement)
{
return ((OrRequirement) r).getRequirements()
.stream()
.anyMatch(this::satisfiesRequirement);
}
if (r instanceof SkillRequirement)
{
SkillRequirement s = (SkillRequirement) r;
return client.getRealSkillLevel(s.getSkill()) >= s.getLevel();
}
if (r instanceof CombatLevelRequirement)
{
return client.getLocalPlayer().getCombatLevel() >= ((CombatLevelRequirement) r).getLevel();
}
if (r instanceof QuestRequirement)
{
QuestRequirement q = (QuestRequirement) r;
QuestState state = q.getQuest().getState(client);
if (q.isStarted())
{
return state != QuestState.NOT_STARTED;
}
return state == QuestState.FINISHED;
}
if (r instanceof QuestPointRequirement)
{
return client.getVar(VarPlayer.QUEST_POINTS) >= ((QuestPointRequirement) r).getQp();
}
if (r instanceof FavourRequirement)
{
FavourRequirement f = (FavourRequirement) r;
int realFavour = client.getVar(f.getHouse().getVarbit());
return (realFavour / 10) >= f.getPercent();
}
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import lombok.AccessLevel;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import net.runelite.api.Client;
import net.runelite.api.Favour;

@RequiredArgsConstructor
Expand All @@ -41,4 +42,10 @@ public String toString()
{
return percent + "% " + house.getName() + " favour";
}

public boolean satisfiesRequirement(Client client)
{
int realFavour = client.getVar(house.getVarbit());
return (realFavour / 10) >= percent;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import java.util.List;
import lombok.AccessLevel;
import lombok.Getter;
import net.runelite.api.Client;

public class OrRequirement implements Requirement
{
Expand All @@ -45,4 +46,16 @@ public String toString()
{
return Joiner.on(" or ").join(requirements);
}

public boolean satisfiesRequirement(Client client)
{
for (Requirement r : getRequirements())
{
if (r.satisfiesRequirement(client))
{
return true;
}
}
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
import lombok.AccessLevel;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import net.runelite.api.Client;
import net.runelite.api.VarPlayer;

@RequiredArgsConstructor
@Getter(AccessLevel.PACKAGE)
Expand All @@ -39,4 +41,9 @@ public String toString()
{
return qp + " " + "Quest points";
}

public boolean satisfiesRequirement(Client client)
{
return client.getVar(VarPlayer.QUEST_POINTS) >= qp;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
import lombok.AccessLevel;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import net.runelite.api.Client;
import net.runelite.api.Quest;
import net.runelite.api.QuestState;

@Getter(AccessLevel.PACKAGE)
@RequiredArgsConstructor
Expand All @@ -51,4 +53,14 @@ public String toString()

return quest.getName();
}

public boolean satisfiesRequirement(Client client)
{
QuestState questState = quest.getState(client);
if (started)
{
return questState != QuestState.NOT_STARTED;
}
return questState == QuestState.FINISHED;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,9 @@
*/
package net.runelite.client.plugins.achievementdiary;

public interface Requirement {}
import net.runelite.api.Client;

public interface Requirement
{
boolean satisfiesRequirement(Client client);
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import lombok.AccessLevel;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import net.runelite.api.Client;
import net.runelite.api.Skill;

@RequiredArgsConstructor
Expand All @@ -41,4 +42,9 @@ public String toString()
{
return level + " " + skill.getName();
}

public boolean satisfiesRequirement(Client client)
{
return client.getRealSkillLevel(skill) >= level;
}
}
2 changes: 1 addition & 1 deletion agility/agility.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

version = "0.0.16"
version = "0.0.17"

project.extra["PluginName"] = "Agility"
project.extra["PluginDescription"] = "Show helpful information about agility courses and obstacles"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,16 @@ public Dimension render(Graphics2D graphics)
{
configColor = config.getMarkColor();
}
if (config.highlightPortals() && Obstacles.PORTAL_OBSTACLE_IDS.contains(object.getId()))
if (Obstacles.PORTAL_OBSTACLE_IDS.contains(object.getId()))
{
configColor = config.getPortalsColor();
if (config.highlightPortals())
{
configColor = config.getPortalsColor();
}
else
{
return;
}
}

OverlayUtil.renderClickBox(graphics, mousePosition, objectClickbox, configColor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class AgilitySession
private int totalLaps;
private int lapsTillLevel;
private int lapsTillGoal;
private final EvictingQueue<Duration> lastLapTimes = EvictingQueue.create(10);
private final EvictingQueue<Duration> lastLapTimes = EvictingQueue.create(30);
private int lapsPerHour;

AgilitySession(final Courses course)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,19 @@ class Obstacles
SHELF_18096, FLOORBOARDS_18097, FLOORBOARDS_18098, WASHING_LINE_18099, WASHING_LINE_18100,
NULL_18135, NULL_18136, SHELF_18105, SHELF_18106, SHELF_18107, SHELF_18108, FLOORBOARDS_18109,
FLOORBOARDS_18110, FLOORBOARDS_18112, FLOORBOARDS_18111, FLOORBOARDS_18114, FLOORBOARDS_18113,
NULL_18116, FLOORBOARDS_18117, FLOORBOARDS_18118, STAIRS_DOWN, WALL_17980,
NULL_18116, FLOORBOARDS_18117, FLOORBOARDS_18118, STAIRS_DOWN, WALL_17980, BARRICADE_18054, LADDER_17999,
LADDER_18000, LADDER_18001, LADDER_18002, ROCKY_SURFACE, WALL_39172, WALL_39173,
// Werewolf
STEPPING_STONE_11643, HURDLE, HURDLE_11639, HURDLE_11640, PIPE_11657, SKULL_SLOPE, ZIP_LINE,
ZIP_LINE_11645, ZIP_LINE_11646,
// Prifddinas
LADDER_36221, TIGHTROPE_36225, CHIMNEY_36227, ROOF_EDGE, DARK_HOLE_36229, LADDER_36231, LADDER_36232,
ROPE_BRIDGE_36233, TIGHTROPE_36234, ROPE_BRIDGE_36235, TIGHTROPE_36236, TIGHTROPE_36237, DARK_HOLE_36238
ROPE_BRIDGE_36233, TIGHTROPE_36234, ROPE_BRIDGE_36235, TIGHTROPE_36236, TIGHTROPE_36237, DARK_HOLE_36238,
// Hallowed Sepulchre
GATE_38460, PLATFORM_38455, PLATFORM_38456, PLATFORM_38457, PLATFORM_38458, PLATFORM_38459,
PLATFORM_38470, PLATFORM_38477, STAIRS_38462, STAIRS_38463, STAIRS_38464, STAIRS_38465,
STAIRS_38466, STAIRS_38467, STAIRS_38468, STAIRS_38469, STAIRS_38471, STAIRS_38472,
STAIRS_38473, STAIRS_38474, STAIRS_38475, STAIRS_38476
);

static final Set<Integer> PORTAL_OBSTACLE_IDS = Set.of(
Expand Down
2 changes: 1 addition & 1 deletion banktags/banktags.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

version = "0.0.17"
version = "0.0.18"

project.extra["PluginName"] = "Bank Tags"
project.extra["PluginDescription"] = "Enable tagging of bank items and searching of bank tags"
Expand Down
Loading

0 comments on commit 9a85c85

Please sign in to comment.