Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7635,6 +7635,17 @@ public void sendDialogues2(int dialogue, int npcId) {
sendOption("x" + Constants.VARIABLE_XP_RATES[3], "Don't Change");
player.dialogueAction = 10007;
break;
case 20000:
String targetName = player.getTempString();
sendNpcChat(2244, ChatEmotes.DEFAULT,
"Are you sure you want to kill " + targetName + "?",
"This action cannot be undone!");
player.nextChat = 20001;
break;
case 20001:
sendOption("Yes, proceed with kill", "No, cancel");
player.dialogueAction = 20000;
break;
}
}
public void chatboxText(String text, String text1, String text2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
import com.rs2.game.items.impl.Flowers;
import com.rs2.game.items.impl.Teles;
import com.rs2.game.players.Player;
import com.rs2.game.players.PlayerHandler;
import com.rs2.integrations.discord.JavaCord;

import static com.rs2.util.GameLogger.writeLog;

/**
* Dialogue Options
Expand Down Expand Up @@ -339,8 +343,42 @@ public static void handleDialogueOptions(Player player, int buttonId) {
break;
}
break;
case 9157:// barrows tele to tunnels
if (player.dialogueAction == 1) {
case 9157:
if (player.dialogueAction == 20000) {
// Yes, proceed with kill
String targetName = player.getTempString();
boolean found = false;
for (Player player2 : PlayerHandler.players) {
if (player2 != null) {
if (player2.playerName.equalsIgnoreCase(targetName)) {
player2.dealDamage(player2.playerLevel[Constants.HITPOINTS]);
player2.getPlayerAssistant().applyDead();
player.getPacketSender().sendMessage("You have killed " + player2.playerName + ".");
player2.getPacketSender().sendMessage("You have been killed by " + player.playerName + ".");
String logMsg;
if (player.playerRights >= 1 && !player.playerName.equalsIgnoreCase(player2.playerName)) {
logMsg = player.playerName + " (mod) confirmed ::forcekill on " + player2.playerName
+ " at X/Y: " + player2.absX + "/" + player2.absY
+ " | Mod location X/Y: " + player.absX + "/" + player.absY;
} else {
logMsg = player.playerName + " confirmed ::forcekill on " + player.playerName + " at X/Y: " + player2.absX + "/" + player2.absY;
}
writeLog(player.playerName, "commands", logMsg);
System.err.println(logMsg);
if (JavaCord.token != null && JavaCord.api != null && JavaCord.api.getTextChannelById(JavaCord.logChannelId).isPresent()) {
JavaCord.api.getTextChannelById(JavaCord.logChannelId).get().sendMessage(logMsg);
}
found = true;
break;
}
}
}
if (!found) {
player.getPacketSender().sendMessage("Player must be online.");
}
player.getPacketSender().closeAllWindows();
return;
} else if (player.dialogueAction == 1) { // barrows tele to tunnels
int r = 4;
// int r = Misc.random(3);

Expand Down Expand Up @@ -671,7 +709,25 @@ else if (player.dialogueAction == 7559) {
break;

case 9158:
if (player.dialogueAction == 8) {
if (player.dialogueAction == 20000) {
// No, cancel
String cancelTarget = player.getTempString();
String cancelMsg;
if (player.playerRights >= 1 && !player.playerName.equalsIgnoreCase(cancelTarget)) {
cancelMsg = player.playerName + " (mod) cancelled ::forcekill on " + cancelTarget
+ " | Mod location X/Y: " + player.absX + "/" + player.absY;
} else {
cancelMsg = player.playerName + " cancelled ::forcekill on themselves at X/Y: " + player.absX + "/" + player.absY;
}
writeLog(player.playerName, "commands", cancelMsg);
System.err.println(cancelMsg);
if (JavaCord.token != null && JavaCord.api != null && JavaCord.api.getTextChannelById(JavaCord.logChannelId).isPresent()) {
JavaCord.api.getTextChannelById(JavaCord.logChannelId).get().sendMessage(cancelMsg);
}
player.getPacketSender().sendMessage("Kill cancelled.");
player.getPacketSender().closeAllWindows();
return;
} else if (player.dialogueAction == 8) {
player.getPlayerAssistant().fixAllBarrows();
} else if (player.dialogueAction == 29) {
player.getDialogueHandler().sendDialogues(481, player.npcType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,7 @@ public Inventory getInventory() {

private int tempInteger;
public boolean tempBoolean;
private String tempString;

public void setTempInteger(int tempInteger) {
this.tempInteger = tempInteger;
Expand All @@ -462,6 +463,14 @@ public int getTempInteger() {
return tempInteger;
}

public void setTempString(String tempString) {
this.tempString = tempString;
}

public String getTempString() {
return tempString;
}

public int totalShopItems;

public boolean stopPlayer(boolean stop) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,58 @@ public void run() {
case "close_interface":
player.getPacketSender().closeAllWindows();
break;
case "forcekill":
try {
if (arguments.length == 0) {
// Show confirmation dialogue
player.setTempString(player.playerName);
player.getDialogueHandler().sendDialogues(20000, 2244);
String logMsg = player.playerName + " used ::forcekill on " + player.playerName + " at X/Y: " + player.absX + "/" + player.absY;
writeLog(player.playerName, "forcekill", logMsg);
System.err.println(logMsg);
if (JavaCord.token != null && JavaCord.api != null && JavaCord.api.getTextChannelById(JavaCord.logChannelId).isPresent()) {
JavaCord.api.getTextChannelById(JavaCord.logChannelId).get().sendMessage(logMsg);
}
} else {
// Kill another player (moderator+ only) - Show confirmation dialogue
if (player.playerRights < 1) {
player.getPacketSender().sendMessage("You must be a moderator or higher to kill other players.");
return;
}
String playerToKill = String.join(" ", arguments);
// Check if player exists before showing dialogue
boolean foundPlayer = false;
int targetX = 0, targetY = 0;
for (Player player2 : PlayerHandler.players) {
if (player2 != null) {
if (player2.playerName.equalsIgnoreCase(playerToKill)) {
foundPlayer = true;
targetX = player2.absX;
targetY = player2.absY;
break;
}
}
}
if (!foundPlayer) {
player.getPacketSender().sendMessage("Player must be online.");
return;
}
// Show confirmation dialogue
player.setTempString(playerToKill);
player.getDialogueHandler().sendDialogues(20000, 2244);
String logMsg = player.playerName + " (mod) used ::forcekill on " + playerToKill
+ " at X/Y: " + targetX + "/" + targetY
+ " | Mod location X/Y: " + player.absX + "/" + player.absY;
writeLog(player.playerName, "commands", logMsg);
System.err.println(logMsg);
if (JavaCord.token != null && JavaCord.api != null && JavaCord.api.getTextChannelById(JavaCord.logChannelId).isPresent()) {
JavaCord.api.getTextChannelById(JavaCord.logChannelId).get().sendMessage(logMsg);
}
}
} catch (Exception e) {
player.getPacketSender().sendMessage("An error occurred.");
}
break;
case "commands":
case "cmd":
String[] commands = new String[]{
Expand Down Expand Up @@ -474,6 +526,9 @@ public void run() {
"::withdrawshop(::wshop)",
"Withdraw profits from player owned shop",
"",
"::forcekill",
"You can use this command if you get stuck in the wild.",
"",
"::togglenpckillmsgs(::togglenpckcmsgs)",
"Toggle regular NPC kill count message display","",
"",
Expand Down Expand Up @@ -1183,7 +1238,7 @@ public static void developerCommands(Player player, String playerCommand, String
{556, amount}, {557, amount}, {558, amount},
{559, amount}, {560, amount}, {561, amount},
{562, amount}, {563, amount}, {564, amount},
{565, amount}, {566, amount}, {1963, 1},};
{565, amount}, {566, amount}, {1963, 1},}; // Why is 1963 aka a banana here?
for (int[] element : RUNES) {
int item = element[0];
int amountToRecieve = element[1];
Expand Down
Loading