Misc changes (#129)

* fixup "cantattack" command

* remove duplicate code

* fix brimhaven vines

* fixup cluescroll drops

* add clicktotele alias

* check player has an axe

* remove duplicate item id
This commit is contained in:
Danial
2019-10-31 14:21:19 +13:00
committed by Daniel Ginovker
parent 9950dbe315
commit efc6b3c8be
9 changed files with 42 additions and 39 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" project-jdk-name="1.8.0_222" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/CompiledServer" />
</component>
</project>
+13 -6
View File
@@ -6,9 +6,14 @@
</artifacts-to-build>
</component>
<component name="ChangeListManager">
<list default="true" id="e34c4650-a3c9-498e-b05e-c1cbb72d0ad7" name="Default Changelist" comment="">
<list default="true" id="9c1d485e-b413-4c80-b742-7c5a88c1c73c" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/CompiledServer/artifacts/localhost_2006rebotted_jar/2006rebotted.jar" beforeDir="false" afterPath="$PROJECT_DIR$/CompiledServer/artifacts/localhost_2006rebotted_jar/2006rebotted.jar" afterDir="false" />
<change beforePath="$PROJECT_DIR$/2006Redone Server/src/redone/game/npcs/NpcHandler.java" beforeDir="false" afterPath="$PROJECT_DIR$/2006Redone Server/src/redone/game/npcs/NpcHandler.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/2006Redone Server/src/redone/net/packets/impl/Commands.java" beforeDir="false" afterPath="$PROJECT_DIR$/2006Redone Server/src/redone/net/packets/impl/Commands.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/2006Redone Server/src/redone/world/ObjectHandler.java" beforeDir="false" afterPath="$PROJECT_DIR$/2006Redone Server/src/redone/world/ObjectHandler.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/CompiledServer/production/2006rebotted/redone/net/packets/impl/Commands.class" beforeDir="false" afterPath="$PROJECT_DIR$/CompiledServer/production/2006rebotted/redone/net/packets/impl/Commands.class" afterDir="false" />
<change beforePath="$PROJECT_DIR$/CompiledServer/production/2006rebotted/redone/world/ObjectHandler.class" beforeDir="false" afterPath="$PROJECT_DIR$/CompiledServer/production/2006rebotted/redone/world/ObjectHandler.class" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
@@ -23,7 +28,7 @@
<component name="PropertiesComponent">
<property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/2006Redone Client/METAs/Client Meta" />
<property name="project.structure.last.edited" value="Artifacts" />
<property name="project.structure.last.edited" value="Project" />
<property name="project.structure.proportion" value="0.15" />
<property name="project.structure.side.proportion" value="0.2" />
</component>
@@ -39,7 +44,7 @@
</list>
</option>
</component>
<component name="RunManager" selected="Application.Client">
<component name="RunManager" selected="Application.Server">
<configuration name="Client" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="Client" />
<module name="2006rebotted" />
@@ -82,8 +87,8 @@
</list>
<recent_temporary>
<list>
<item itemvalue="Application.FileServer" />
<item itemvalue="Application.Server" />
<item itemvalue="Application.FileServer" />
<item itemvalue="Application.Client" />
</list>
</recent_temporary>
@@ -106,7 +111,9 @@
<map>
<entry key="MAIN">
<value>
<State />
<State>
<option name="COLUMN_ORDER" />
</State>
</value>
</entry>
</map>
@@ -175,7 +175,7 @@ public class Woodcutting {
}
}
public boolean hasAxe(Client player) {
public static boolean hasAxe(Client player) {
for (int i = 0; i < Axe_Settings.length; i++) {
if (player.getItemAssistant().playerHasItem(Axe_Settings[i][0]) || player.playerEquipment[player.playerWeapon] == Axe_Settings[i][0]) {
return true;
@@ -88,7 +88,7 @@ public class Item {
6062 };
public static int rings[] = { 8082, 773, 1635, 1637, 1639, 1641, 1643,
1645, 2550, 2552, 2554, 2556, 2558, 2560, 2562, 2564, 2566, 2568,
2570, 2572, 4202, 4657, 6465, 6737, 6731, 6735, 6735, 6583, 6733 };
2570, 2572, 4202, 4657, 6465, 6737, 6731, 6735, 6583, 6733 };
public static int body[] = { 7608, 2520, 430, 7362, 7364, 636, 638, 640,
642, 644, 8064, 426, 430, 1005, 1757, 7592, 8031, 8027, 6617, 8019,
8014, 8002, 7376, 544, 7372, 7370, 577, 7974, 7970, 7965, 7961,
@@ -935,7 +935,7 @@ public class NpcHandler {
break;
}
if (Misc.random(1, 256) == 1) {
int level = npcs[i].combatLevel;
int level = getNpcListCombat(npcs[i].npcType);
if (level >= 2 && level <= 24) // easy
Server.itemHandler.createGroundItem(c, 2677, npcs[i].absX, npcs[i].absY, 1, c.playerId);
else if (level <= 40) // easy → medium
@@ -944,8 +944,8 @@ public class NpcHandler {
Server.itemHandler.createGroundItem(c, 2678, npcs[i].absX, npcs[i].absY, 1, c.playerId);
else if (level <= 150) // medium → hard
Server.itemHandler.createGroundItem(c, 2678 + Misc.random(0, 1), npcs[i].absX, npcs[i].absY, 1, c.playerId);
else // hard
Server.itemHandler.createGroundItem(c, 2678 + Misc.random(0, 1), npcs[i].absX, npcs[i].absY, 1, c.playerId);
else if (level > 150)// hard
Server.itemHandler.createGroundItem(c, 2679, npcs[i].absX, npcs[i].absY, 1, c.playerId);
}
}
}
@@ -1387,16 +1387,10 @@ public class NpcHandler {
token = token.trim();
token2 = line.substring(spot + 1);
token2 = token2.trim();
token2_2 = token2.replaceAll("\t\t", "\t");
token2_2 = token2_2.replaceAll("\t\t", "\t");
token2_2 = token2_2.replaceAll("\t\t", "\t");
token2_2 = token2_2.replaceAll("\t\t", "\t");
token2_2 = token2_2.replaceAll("\t\t", "\t");
token2_2 = token2.replaceAll("\t+", "\t");
token3 = token2_2.split("\t");
if (token.equals("npc")) {
newNPCList(Integer.parseInt(token3[0]), token3[1],
Integer.parseInt(token3[2]),
Integer.parseInt(token3[3]));
newNPCList(Integer.parseInt(token3[0]), token3[1], Integer.parseInt(token3[2]), Integer.parseInt(token3[3]));
}
} else {
if (line.equals("[ENDOFNPCLIST]")) {
@@ -1,5 +1,6 @@
package redone.game.objects.impl;
import redone.game.content.skills.core.Woodcutting;
import redone.game.players.Client;
/**
@@ -8,6 +9,11 @@ import redone.game.players.Client;
public class BrimhavenVines {
public static void handleBrimhavenVines(Client c, int objectType) {
if (!Woodcutting.hasAxe(c)) {
c.getActionSender().sendMessage("You will need an axe to chop through these!");
return;
}
c.getActionSender().sendMessage("You chop your way through the vines.");
switch (objectType) {
case 12987:
case 12986:
@@ -31,21 +37,23 @@ public class BrimhavenVines {
}
}
public static void moveThroughVinesX(Client c, int originX, int x1, int y1,
int x2, int y2) {
public static void moveThroughVinesX(Client c, int originX, int x1, int y1, int x2, int y2) {
int x = c.getX();
int y = c.getY();
if (c.absX <= originX) {
c.getPlayerAssistant().walkTo(x1, y1);
c.getPlayerAssistant().movePlayer(x + x1, y + y1, 0);
} else {
c.getPlayerAssistant().walkTo(x2, y2);
c.getPlayerAssistant().movePlayer(x + x2, y + y2, 0);
}
}
public static void moveThroughVinesY(Client c, int originY, int x1, int y1,
int x2, int y2) {
public static void moveThroughVinesY(Client c, int originY, int x1, int y1, int x2, int y2) {
int x = c.getX();
int y = c.getY();
if (c.absY <= originY) {
c.getPlayerAssistant().walkTo(x1, y1);
c.getPlayerAssistant().movePlayer(x + x1, y + y1, 0);
} else {
c.getPlayerAssistant().walkTo(x2, y2);
c.getPlayerAssistant().movePlayer(x + x2, y + y2, 0);
}
}
@@ -522,6 +522,7 @@ public class Commands implements PacketType {
public static void developerCommands(Client player, String playerCommand, String[] arguments) {
switch (playerCommand.toLowerCase()) {
case "clicktotele":
case "ctt": // alias
player.clickToTele = !player.clickToTele;
player.getActionSender().sendMessage("Click to teleport: " + (player.clickToTele ? "Enabled" : "Disabled"));
break;
@@ -627,7 +628,7 @@ public class Commands implements PacketType {
}
} catch (Exception ಠ_ಠ) {}
break;
case "cantAttack":
case "cantattack":
player.npcCanAttack = !player.npcCanAttack;
player.getActionSender().sendMessage("Npcs " + (player.npcCanAttack ? "can" : "can no longer") + " attack you.");
break;
@@ -305,9 +305,7 @@ public int itemAmount(String name, int itemId, int itemX, int itemY) {
public ItemList ItemList[] = new ItemList[Constants.ITEM_LIMIT];
public void newItemList(int ItemId, String ItemName,
String ItemDescription, double ShopValue, double LowAlch,
double HighAlch, int Bonuses[]) {
public void newItemList(int ItemId, String ItemName, String ItemDescription, double ShopValue, double LowAlch, double HighAlch, int Bonuses[]) {
// first, search for a free slot
int slot = -1;
for (int i = 0; i < 11740; i++) {
@@ -386,11 +384,7 @@ public int itemAmount(String name, int itemId, int itemX, int itemY) {
token = token.trim();
token2 = line.substring(spot + 1);
token2 = token2.trim();
token2_2 = token2.replaceAll("\t\t", "\t");
token2_2 = token2_2.replaceAll("\t\t", "\t");
token2_2 = token2_2.replaceAll("\t\t", "\t");
token2_2 = token2_2.replaceAll("\t\t", "\t");
token2_2 = token2_2.replaceAll("\t\t", "\t");
token2_2 = token2.replaceAll("\t+", "\t");
token3 = token2_2.split("\t");
if (token.equals("item")) {
int[] Bonuses = new int[12];
@@ -412,8 +406,7 @@ public int itemAmount(String name, int itemId, int itemX, int itemY) {
if (line.equals("[ENDOFITEMLIST]")) {
try {
characterfile.close();
} catch (IOException ioexception) {
}
} catch (IOException ಠ_ಠ) {}
//return true;
}
}