runelite-api: Annotate script ids with their argument counts

The cache-code updater can update these annotations so we know when
a script we call require changes
This commit is contained in:
Max Weber
2019-08-09 05:29:15 -06:00
parent e0dcb668da
commit a019d39361
2 changed files with 67 additions and 3 deletions

View File

@@ -0,0 +1,47 @@
/*
* Copyright (c) 2019 Abex
* 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.api;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.SOURCE)
@Documented
@Target(ElementType.FIELD)
@interface ScriptArguments
{
/**
* The number of int arguments the script takes
*/
int integer() default 0;
/**
* The number of string arguments the script takes
*/
int string() default 0;
}

View File

@@ -34,6 +34,7 @@ public final class ScriptID
* <li> int how far down to scroll </li> * <li> int how far down to scroll </li>
* </ul> * </ul>
*/ */
@ScriptArguments(integer = 3)
public static final int UPDATE_SCROLLBAR = 72; public static final int UPDATE_SCROLLBAR = 72;
/** /**
@@ -43,11 +44,13 @@ public final class ScriptID
* <li> String Message to send </li> * <li> String Message to send </li>
* </ul> * </ul>
*/ */
@ScriptArguments(integer = 1, string = 1)
public static final int CHATBOX_INPUT = 96; public static final int CHATBOX_INPUT = 96;
/** /**
* Rebuilds the chatbox * Rebuilds the chatbox
*/ */
@ScriptArguments()
public static final int BUILD_CHATBOX = 216; public static final int BUILD_CHATBOX = 216;
/** /**
@@ -58,6 +61,7 @@ public final class ScriptID
* <li> String Player to send private message to</li> * <li> String Player to send private message to</li>
* </ul> * </ul>
*/ */
@ScriptArguments(string = 1)
public static final int OPEN_PRIVATE_MESSAGE_INTERFACE = 107; public static final int OPEN_PRIVATE_MESSAGE_INTERFACE = 107;
/** /**
@@ -66,6 +70,7 @@ public final class ScriptID
* <li> String Message Prefix. Only used inside the GE search interfaces * <li> String Message Prefix. Only used inside the GE search interfaces
* </ul> * </ul>
*/ */
@ScriptArguments(string = 1)
public static final int CHAT_TEXT_INPUT_REBUILD = 222; public static final int CHAT_TEXT_INPUT_REBUILD = 222;
/** /**
@@ -73,6 +78,7 @@ public final class ScriptID
* *
* Takes 13 widget ids of various parts of the bank interface * Takes 13 widget ids of various parts of the bank interface
*/ */
@ScriptArguments(integer = 17)
public static final int BANK_LAYOUT = 277; public static final int BANK_LAYOUT = 277;
/** /**
@@ -82,17 +88,20 @@ public final class ScriptID
* <li> int (boolean) Restore to chat view </li> * <li> int (boolean) Restore to chat view </li>
* </ul> * </ul>
*/ */
@ScriptArguments(integer = 2)
public static final int RESET_CHATBOX_INPUT = 299; public static final int RESET_CHATBOX_INPUT = 299;
/** /**
* Readies the chatbox panel for things like the chatbox input * Readies the chatbox panel for things like the chatbox input
* Inverse of RESET_CHATBOX_INPUT * Inverse of RESET_CHATBOX_INPUT
*/ */
@ScriptArguments(integer = 1)
public static final int CLEAR_CHATBOX_PANEL = 677; public static final int CLEAR_CHATBOX_PANEL = 677;
/** /**
* Builds the chatbox input widget * Builds the chatbox input widget
*/ */
@ScriptArguments()
public static final int CHAT_PROMPT_INIT = 223; public static final int CHAT_PROMPT_INIT = 223;
/** /**
@@ -103,19 +112,21 @@ public final class ScriptID
* <li> String Item Name </li> * <li> String Item Name </li>
* </ul> * </ul>
*/ */
@ScriptArguments(integer = 2, string = 1)
public static final int DEATH_KEEP_ITEM_EXAMINE = 1603; public static final int DEATH_KEEP_ITEM_EXAMINE = 1603;
/** /**
* Checks the state of the given stash unit. * Checks the state of the given stash unit.
* <ul> * <ul>
* <li>int (loc) The stash unit object id</li> * <li>int (loc) The stash unit object id</li>
* <li>int Bitpacked stash unit states</li> * <li>int Bitpacked stash unit states</li>
* <li>int Bitpacked stash unit states 2</li> * <li>int Bitpacked stash unit states 2</li>
* <li>int Bitpacked stash unit states 3</li> * <li>int Bitpacked stash unit states 3</li>
* </ul> * </ul>
* *
* Returns a pair of booleans indicating if the stash unit is built and if it is filled * Returns a pair of booleans indicating if the stash unit is built and if it is filled
*/ */
@ScriptArguments(integer = 4)
public static final int WATSON_STASH_UNIT_CHECK = 1479; public static final int WATSON_STASH_UNIT_CHECK = 1479;
/** /**
@@ -128,6 +139,7 @@ public final class ScriptID
* <li> int (QuestState) the normalized state of the quest * <li> int (QuestState) the normalized state of the quest
* </ul> * </ul>
*/ */
@ScriptArguments(integer = 1)
public static final int QUESTLIST_PROGRESS = 2267; public static final int QUESTLIST_PROGRESS = 2267;
/** /**
@@ -137,6 +149,7 @@ public final class ScriptID
* <li> int Number of lines </li> * <li> int Number of lines </li>
* </ul> * </ul>
*/ */
@ScriptArguments(integer = 2)
public static final int DIARY_QUEST_UPDATE_LINECOUNT = 2523; public static final int DIARY_QUEST_UPDATE_LINECOUNT = 2523;
/** /**
@@ -148,6 +161,7 @@ public final class ScriptID
* <li> int Reset zoom position </li> * <li> int Reset zoom position </li>
* </ul> * </ul>
*/ */
@ScriptArguments(integer = 2)
public static final int CAMERA_DO_ZOOM = 42; public static final int CAMERA_DO_ZOOM = 42;
/** /**
@@ -156,11 +170,13 @@ public final class ScriptID
* This is used to eat events when you want a menu action attached to it * This is used to eat events when you want a menu action attached to it
* because you need an op listener attached to it for it to work * because you need an op listener attached to it for it to work
*/ */
@ScriptArguments()
public static final int NULL = 10003; public static final int NULL = 10003;
/** /**
* Send a private message. * Send a private message.
*/ */
@ScriptArguments(string = 2)
public static final int PRIVMSG = 10004; public static final int PRIVMSG = 10004;
/** /**
@@ -171,5 +187,6 @@ public final class ScriptID
* <li>int Amount of exp to drop</li> * <li>int Amount of exp to drop</li>
* </ul> * </ul>
*/ */
@ScriptArguments(integer = 2)
public static final int XPDROP_DISABLED = 2091; public static final int XPDROP_DISABLED = 2091;
} }