Skip to content

Commit

Permalink
Merge pull request #206 from charles-m-knox/teleport-here-admin
Browse files Browse the repository at this point in the history
Add "Teleport here" menu option when in debug mode and player is admin
  • Loading branch information
Promises authored Sep 4, 2024
2 parents 26c3951 + 19f9a93 commit 1019ad9
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 30 deletions.
49 changes: 27 additions & 22 deletions src/main/java/org/runejs/client/ActionRowType.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* These codes are used to determine the behaviour associated with a row
* when a user clicks on it (or when a user left-clicks the entity, if the
* row is the highest priority).
*
*
* @author jameskmonger
*/
public enum ActionRowType {
Expand Down Expand Up @@ -42,6 +42,11 @@ public enum ActionRowType {
*/
WALK_HERE(7),

/**
* Teleport to a tile.
*/
TELEPORT_HERE(1009),

/**
* Drop an item from the inventory.
*/
Expand Down Expand Up @@ -86,10 +91,10 @@ public enum ActionRowType {
* Report a player for abuse.
*/
REPORT_ABUSE(28),

/**
* The initial 'use' to select an item on a widget
*
*
* TODO TODO TODO is this inventory or widget ??
*/
SELECT_ITEM_ON_WIDGET(19),
Expand Down Expand Up @@ -138,7 +143,7 @@ public enum ActionRowType {

/**
* Cast a spell on a widget item.
*
*
* TODO TODO TODO inventory or widget?
*/
CAST_MAGIC_ON_WIDGET_ITEM(37),
Expand All @@ -157,28 +162,28 @@ public enum ActionRowType {
* Interact with a player and choose option 1.
*/
INTERACT_WITH_PLAYER_OPTION_1(10),

/**
* Interact with a player and choose option 2.
*/
INTERACT_WITH_PLAYER_OPTION_2(39),

/**
* Interact with a player and choose option 3.
*/
INTERACT_WITH_PLAYER_OPTION_3(44),

/**
* Interact with a player and choose option 4.
*/
INTERACT_WITH_PLAYER_OPTION_4(14),

/**
* Interact with a player and choose option 5.
*/
INTERACT_WITH_PLAYER_OPTION_5(41),


/**
* Interact with an NPC and choose option 1.
*
Expand Down Expand Up @@ -212,17 +217,17 @@ public enum ActionRowType {
* Interact with an object and choose option 1.
*/
INTERACT_WITH_OBJECT_OPTION_1(16),

/**
* Interact with an object and choose option 2.
*/
INTERACT_WITH_OBJECT_OPTION_2(29),

/**
* Interact with an object and choose option 3.
*/
INTERACT_WITH_OBJECT_OPTION_3(17),

/**
* Interact with an object and choose option 4.
*/
Expand All @@ -244,25 +249,25 @@ public enum ActionRowType {
* Interact with a world item and choose option 2.
*/
INTERACT_WITH_WORLD_ITEM_OPTION_2(38),

/**
* Interact with a world item and choose option 3.
*/
INTERACT_WITH_WORLD_ITEM_OPTION_3(3),

/**
* Interact with a world item and choose option 4.
*/
INTERACT_WITH_WORLD_ITEM_OPTION_4(8),

/**
* Interact with a world item and choose option 5.
*/
INTERACT_WITH_WORLD_ITEM_OPTION_5(36),

/**
* Interact with an item on a V1 widget and choose option 1.
*
*
* For example, the left-click option on an item on a shop interface.
*/
INTERACT_WITH_ITEM_ON_V1_WIDGET_OPTION_1(53),
Expand All @@ -275,10 +280,10 @@ public enum ActionRowType {
* Interact with an item on a V1 widget and choose option 2.
*/
INTERACT_WITH_ITEM_ON_V2_WIDGET_OPTION_1(52),

/**
* Interact with an item on a V1 widget and choose option 3.
*
*
* (jameskmongeR) this one is read on the server as 'option 5' - which is correct?
*/
INTERACT_WITH_ITEM_ON_V2_WIDGET_OPTION_2(6),
Expand All @@ -287,7 +292,7 @@ public enum ActionRowType {
* Interact with an item on a V1 widget and choose option 3.
*/
INTERACT_WITH_ITEM_ON_V2_WIDGET_OPTION_3(31),

/**
* Interact with an item on a V1 widget and choose option 4.
*/
Expand All @@ -297,7 +302,7 @@ public enum ActionRowType {
* Examine an NPC.
*/
EXAMINE_NPC(1001),

/**
* Examine an item.
*/
Expand Down Expand Up @@ -327,7 +332,7 @@ public enum ActionRowType {
* TODO (Jameskmonger) document this
*/
CLOSE_WIDGET(9),

/**
* TODO (Jameskmonger) document this
*/
Expand All @@ -338,7 +343,7 @@ public enum ActionRowType {
/**
* Used to mark actions that are lower priority, i.e.
* they should be displayed lower in the menu.
*
*
* This is used to ensure that left-click is not "Attack" on
* high-level NPCs, for example.
*/
Expand Down
16 changes: 9 additions & 7 deletions src/main/java/org/runejs/client/MovedStatics.java
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ public static boolean method416() {
public static int mixLightnessSigned(int hsl, int lightness) {
if (hsl == -2)
return 12345678;

if (hsl == -1) {
if (lightness < 0)
lightness = 0;
Expand All @@ -666,8 +666,10 @@ public static void method1013() {
String tileCoords = "";
if (Configuration.DEBUG_CONTEXT) {
tileCoords = MessageFormat.format("<col=8F8FFF>({0}, {1})</col>", Integer.toString(Game.currentScene.hoveredTileX + baseX), Integer.toString(Game.currentScene.hoveredTileY + baseY));
if (Game.playerRights >= 2) {
addActionRow(English.teleportHere, 0, (Game.currentScene.hoveredTileX + baseX), (Game.currentScene.hoveredTileY + baseY), ActionRowType.TELEPORT_HERE.getId(), tileCoords);
}
}

addActionRow(English.walkHere, 0, MouseHandler.mouseX, MouseHandler.mouseY, ActionRowType.WALK_HERE.getId(), tileCoords);
}

Expand Down Expand Up @@ -1004,7 +1006,7 @@ public static void handleInterfaceActions(GameInterfaceArea area, int mouseX, in
if(gameInterface.buttonType == 6 && lastContinueTextWidgetId == -1 && adjustedX <= mouseX && adjustedY <= mouseY && mouseX < adjustedX + gameInterface.width && mouseY < gameInterface.height + adjustedY) {
addActionRow(gameInterface.option, 0, 0, gameInterface.id, 54, "");
}

if(gameInterface.type == GameInterfaceType.INVENTORY) {
int i_4_ = 0;
for(int i_5_ = 0; i_5_ < gameInterface.height; i_5_++) {
Expand Down Expand Up @@ -1146,13 +1148,13 @@ public static void handleInterfaceActions(GameInterfaceArea area, int mouseX, in
}
}
}

}

public static void setHighMemory() {
VertexNormal.lowMemory = false;
Scene.lowMemory = false;

}

public static void animateNpcs() {
Expand All @@ -1162,7 +1164,7 @@ public static void animateNpcs() {
if(class40_sub5_sub17_sub4_sub2 != null)
Actor.handleActorAnimation(class40_sub5_sub17_sub4_sub2);
}

}


Expand Down Expand Up @@ -1273,7 +1275,7 @@ public static void handleVarPlayers(int varPlayerIndex) {
break;
Game.oneMouseButton = varPlayerValue;
}

break;
} while(false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.runejs.client.media.renderable.actor.Player;
import org.runejs.client.media.renderable.actor.PlayerAppearance;
import org.runejs.client.message.outbound.chat.*;
import org.runejs.client.message.outbound.console.ConsoleCommandOutboundMessage;
import org.runejs.client.message.outbound.examine.*;
import org.runejs.client.message.outbound.interactions.*;
import org.runejs.client.message.outbound.magic.*;
Expand Down Expand Up @@ -629,6 +630,10 @@ public static void processMenuActions(int arg1) {
atInventoryInterfaceType = 3;
}
}
if(action == ActionRowType.TELEPORT_HERE.getId()) {
ConsoleCommandOutboundMessage newCmd = new ConsoleCommandOutboundMessage("move "+i + " "+i_10_);
OutgoingPackets.sendMessage(newCmd);
}
if(action == ActionRowType.INTERACT_WITH_WORLD_ITEM_OPTION_2.getId()) {
Pathfinding.doWorldItemWalkTo(Player.localPlayer.pathY[0], Player.localPlayer.pathX[0], i, i_10_);
MovedStatics.crossIndex = 0;
Expand Down Expand Up @@ -867,7 +872,7 @@ public static void processMenuActions(int arg1) {
MovedStatics.crossType = 2;
crossY = MouseHandler.clickY;
MovedStatics.crossIndex = 0;

int widgetId = (itemSelectedWidgetId >> 16) & 0xFFFF;
int containerId = itemSelectedWidgetId & 0xFFFF;

Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/runejs/client/language/English.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ public class English {
public static String unexpectedServerResponse = "Unexpected server response";
public static String username = "Username: ";
public static String walkHere = "Walk here";
public static String teleportHere = "Teleport here";
public static String weSuspectSomeoneKnowsYourPassword = "We suspect someone knows your password.";
public static String suffixWishesToDuelWithYou = "wishes to duel with you.";
public static String world = "World";
Expand Down

0 comments on commit 1019ad9

Please sign in to comment.