Skip to content

Contribution guide

Zoinkwiz edited this page Nov 12, 2020 · 8 revisions

Contribution guide

Getting started

To get started, firstly fork this repository.

Next, it's recommended to use IntelliJ IDEA for coding, but you can use whatever code editor you feel comfortable with.

Coding conventions are the same as Runelite's, which you can see in https://github.com/runelite/runelite/wiki/Code-Conventions.

Make sure you also have Lombok.

To run this, try running the QuestHelperPluginTest file.

Adding a new quest helper

The quests folder contains all the actual helpers themselves. If you were looking to create your own quest helper, you'd create a new folder here for it, then add the files within that. If this is your first quest helper, it'd be recommended to copy the structure of an existing quest helper and go from there.

You can see a template for Quest Helpers in https://github.com/Zoinkwiz/quest-helper/wiki/Template-Quest-Helper.

At the top of a quest helper, you should have the identifier for the quest. For example, for Ernest the Chicken, you would have:

@QuestDescriptor(
	quest = QuestHelperQuest.ERNEST_THE_CHICKEN
)

Objects

Next, you will want to declare all the ItemRequirements, Conditions, QuestSteps and Zones you'll be using in the quest. The important object to know of are:

QuestStep is what defines the actions the player will need to perform. If the player will need to talk to an NPC, you'll use the NpcStep which extends the QuestStep to define which NPC, where the NPC is, and the dialogue to use as a prompt of what to do to the player.

ItemRequirement describes an Item, such as say a Cake, which will typically be used for either displaying requirements, or checking to see if the player has said item.

ConditionForStep is used by a number of Conditions, which are used to describe potentially complex logic fairly easily. For example, you may need to check if the player has 25 death runes, a cat following them, and if they're in the Wizards' Tower. You could define those conditions as an ItemRequirement, a FollowerRequiement, and a ZoneRequirement, all of which extend the ConditionForStep.

Conditions is used for combining various ConditionForStep. For example, to combine the logic above, you could specify new Conditions(LogicType.AND, hasDeathRunes, hasCatFollower, inWizardsTower);.

ConditionalStep is a special type of step which allows you to make use of the ConditionForStep steps in a simple manner. A typical ConditionalStep will look like:

ConditionalStep mySteps = new ConditionalStep(this, getCat);
myStep.addStep(inLumbridgeFloor1AndHasCat, talkToDuke);
myStep.addStep(inLumbridgeAndHasCat, goUpToDuke);

What this is doing is creating the object with a base step, which is getCat. Below that, new steps with conditions are added. This will be checked every tick to see which step to use. The order of checks is from the top step added to the last step added, then finally defaulting the the step you initiated the ConditionalStep with.

Functions

loadSteps

This function is used to return all the quest's steps to be used for running the quest helper. It should return a Map of ints (representing the quest's varbit's current value) and the step to use for it.

getCombatRequirements, getItemRequirements, getItemRecommended

These are used to provide the relevant details for the sidebar's requirements sections.

getPanels

This is used to provide the actual sections of the quest and steps for each section for the sidebar panel.

Making a Pull Request

Once you've made your quest, commit your changes to a branch on your fork, then make a Pull Request to allow for a review of it. Once it's been reviewed, it will be merged in.

Tips for developing

It can be challenging to ensure you're catching all the various changes that occur during a quest, and are properly understanding exactly what changes represent what. There are various things to consider as you develop:

  • Enable the dev tools as described in https://github.com/runelite/runelite/wiki/Using-the-client-developer-tools. These will be your bread and butter for checking out IDs, locations, and variable changes
  • Always have the Var Inspector open. This will catch most changes to varplayers and varbits.
  • Try to predict what will happen, and code ahead of doing actions. If you know you need to go talk to Hans next, and it'll likely progress the quest state, code that and then try doing it.
  • For co-ordinates, if you're in an instance, you'll need to use the 'true' position of the instance to define it. The way I currently do this easily is by shift-right clicking the tile of interest, marking it, then checking in the terminal the true co-ordinates.
  • You should use the north east corner of an object's centre to define its position. You should also use the dev tool's object inspector to view the IDs of objects vs just the examine functionality, as often objects which will change in shape/form will have a NullObjectId which persistents through all its variations.
Clone this wiki locally