Projectile clipping, PassDoor fix (#176)

* Numbered packet sizes.
Corrected sound packet length to 6 from 5.
Corrected sound packet in server.
Teleport sound now plays correctly.
Corrected modern teleport animation playthrough.
Removed redundant teleport delay.

* Changed sendSound packet size back to 5 and removed type attribute to maintain compatibility with Parabot.

* After running around an object to attack the player will no longer wait a number of ticks to start attacking again.
Fixed an issue where walkTo being called from CycleEvents would not execute correctly.
Player will no longer face a killed npc after it respawns.
Added projectile clipping.
Added a new algorithm for player->player/npc following that accounts for projectile clipping.
This commit is contained in:
mikeysasse
2019-11-11 14:20:02 -06:00
committed by Daniel Ginovker
parent a4e4b89d99
commit c827d46ca0
66 changed files with 1293 additions and 480 deletions
+39
View File
@@ -0,0 +1,39 @@
<component name="ArtifactManager">
<artifact type="jar" name="local_client:jar">
<output-path>$PROJECT_DIR$/CompiledServer/artifacts/local_client_jar</output-path>
<root id="archive" name="2006rebotted.jar">
<element id="module-output" name="2006rebotted" />
<element id="extracted-dir" path="$PROJECT_DIR$/2006Redone file_server/libs/commons-lang3-3.1.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/2006Redone file_server/libs/javac++.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/2006Redone file_server/libs/mina.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/2006Redone file_server/libs/mysql-connector-java-5.1.23-bin.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/2006Redone file_server/libs/netty-3.6.6.Final.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/2006Redone file_server/libs/slf4j-nop.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/2006Redone file_server/libs/slf4j.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/2006Redone file_server/libs/xpp3-1.1.4c.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/2006Redone file_server/libs/xstream-1.4.1.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/2006Redone Server/libs/commons-lang3-3.1.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/2006Redone Server/libs/javac++.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/2006Redone Server/libs/slf4j.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/2006Redone Server/libs/xstream-1.4.1.jar" path-in-jar="/" />
<element id="library" level="project" name="libs" />
<element id="extracted-dir" path="$PROJECT_DIR$/2006Redone Server/libs/mina.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/2006Redone Server/libs/slf4j-nop.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/2006Redone Server/libs/mysql-connector-java-5.1.23-bin.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/2006Redone Server/libs/okio-1.13.0.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/2006Redone Server/libs/xpp3-1.1.4c.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/2006Redone Server/libs/okhttp-3.9.1.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/2006Redone Server/libs/json-20190722.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/2006Redone Server/libs/everythingrs-api.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/2006Redone Server/libs/log4j-api-2.11.0.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/2006Redone Server/libs/netty-3.6.6.Final.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/2006Redone Server/libs/jackson-core-2.9.3.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/2006Redone Server/libs/javacord-api-3.0.4.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/2006Redone Server/libs/javacord-core-3.0.4.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/2006Redone Server/libs/jackson-databind-2.9.3.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/2006Redone Server/libs/nv-websocket-client-2.6.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/2006Redone Server/libs/jackson-annotations-2.9.0.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/2006Redone Server/libs/logging-interceptor-3.9.1.jar" path-in-jar="/" />
</root>
</artifact>
</component>
+16
View File
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CheckStyle-IDEA">
<option name="configuration">
<map>
<entry key="checkstyle-version" value="8.25" />
<entry key="copy-libs" value="true" />
<entry key="location-0" value="BUNDLED:(bundled):Sun Checks" />
<entry key="location-1" value="BUNDLED:(bundled):Google Checks" />
<entry key="scan-before-checkin" value="false" />
<entry key="scanscope" value="JavaOnly" />
<entry key="suppress-errors" value="false" />
</map>
</option>
</component>
</project>
+5
View File
@@ -76,6 +76,11 @@
</list> </list>
</option> </option>
</component> </component>
<component name="ProjectFrameBounds">
<option name="x" value="-7" />
<option name="width" value="1294" />
<option name="height" value="1407" />
</component>
<component name="ProjectId" id="1Sr1PyvKre5eWJ6XgOrqWrHM5hp" /> <component name="ProjectId" id="1Sr1PyvKre5eWJ6XgOrqWrHM5hp" />
<component name="PropertiesComponent"> <component name="PropertiesComponent">
<property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" /> <property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
+6 -2
View File
@@ -9774,8 +9774,10 @@ public class Game extends RSApplet {
int j13 = stream.readUnsignedByte(); int j13 = stream.readUnsignedByte();
int k15 = anInt1268 + (j13 >> 4 & 7); int k15 = anInt1268 + (j13 >> 4 & 7);
int l16 = anInt1269 + (j13 & 7); int l16 = anInt1269 + (j13 & 7);
if (k15 >= 0 && l16 >= 0 && k15 < 104 && l16 < 104)
if (k15 >= 0 && l16 >= 0 && k15 < 104 && l16 < 104) {
method130(-1, -1, j8, i11, l16, k5, plane, k15, 0); method130(-1, -1, j8, i11, l16, k5, plane, k15, 0);
}
return; return;
} }
if (j == 151) { if (j == 151) {
@@ -9787,6 +9789,7 @@ public class Game extends RSApplet {
int i15 = k12 >> 2; int i15 = k12 >> 2;
int k16 = k12 & 3; int k16 = k12 & 3;
int l17 = anIntArray1177[i15]; int l17 = anIntArray1177[i15];
//System.out.println("id: " + j10 + " x:" + (this.baseX + anInt1268) + " y:" + (this.baseY + anInt1269));
if (l4 >= 0 && k7 >= 0 && l4 < 104 && k7 < 104) if (l4 >= 0 && k7 >= 0 && l4 < 104 && k7 < 104)
method130(-1, j10, k16, l17, k7, i15, plane, l4, 0); method130(-1, j10, k16, l17, k7, i15, plane, l4, 0);
return; return;
@@ -10645,7 +10648,7 @@ public class Game extends RSApplet {
} }
if (pktType == 174) { if (pktType == 174) {
int id = inStream.readUnsignedWord(); int id = inStream.readUnsignedWord();
int type = inStream.readUnsignedByte(); int type = /*inStream.readUnsignedByte()*/1;
int delay = inStream.readUnsignedWord(); int delay = inStream.readUnsignedWord();
int volume = inStream.readUnsignedByte(); int volume = inStream.readUnsignedByte();
sound[currentSound] = id; sound[currentSound] = id;
@@ -11420,6 +11423,7 @@ public class Game extends RSApplet {
Signlink.reporterror(s2); Signlink.reporterror(s2);
resetLogout(); resetLogout();
exception.printStackTrace();
} }
return true; return true;
} }
+26 -26
View File
@@ -34,31 +34,31 @@ final class SizeConstants {
173, 228, 121, 83, 133, 68, 0 173, 228, 121, 83, 133, 68, 0
}; };
public static final int[] packetSizes = { public static final int[] packetSizes = {
0, 0, 0, 0, 6, 0, 0, 0, 4, 0, 0, 0, 0, 0, 6, 0, 0, 0, 4, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //10
0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, //20
0, 0, 0, 0, -2, 4, 3, 0, 0, 0, 0, 0, 0, 0, -2, 4, 3, 0, 0, 0, //30
0, 0, 0, 0, 5, 0, 0, 6, 0, 0, 0, 0, 0, 0, 5, 0, 0, 6, 0, 0, //40
9, 0, 0, -2, 0, 0, 0, 0, 0, 0, 9, 0, 0, -2, 0, 0, 0, 0, 0, 0, //50
-2, 1, 0, 0, 2, -2, 0, 0, 0, 0, -2, 1, 0, 0, 2, -2, 0, 0, 0, 0, //60
6, 3, 2, 4, 2, 4, 0, 0, 0, 4, 6, 3, 2, 4, 2, 4, 0, 0, 0, 4, //70
0, -2, 0, 0, 7, 2, 0, 6, 0, 0, 0, -2, 0, 0, 7, 2, 0, 6, 0, 0, //80
0, 0, 0, 0, 0, 0, 0, 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 1, //90
0, 2, 0, 0, -1, 4, 1, 0, 0, 0, 0, 2, 0, 0, -1, 4, 1, 0, 0, 0, //100
1, 0, 0, 0, 2, 0, 0, 15, 0, 0, 1, 0, 0, 0, 2, 0, 0, 15, 0, 0, //110
0, 4, 4, 0, 0, 0, -2, 0, 0, 0, 0, 4, 4, 0, 0, 0, -2, 0, 0, 0, //120
0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, //130
0, 0, 2, 0, 0, 0, 0, 14, 0, 0, 0, 0, 2, 0, 0, 0, 0, 14, 0, 0, //140
0, 4, 0, 0, 0, 0, 3, 0, 0, 0, 0, 4, 0, 0, 0, 0, 3, 0, 0, 0, //150
4, 0, 0, 0, 2, 0, 6, 0, 0, 0, 4, 0, 0, 0, 2, 0, 6, 0, 0, 0, //160
0, 3, 0, 0, 5, 0, 10, 6, 0, 0, 0, 3, 0, 0, 5, 0, 10, 6, 0, 0, //170
0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, //180
0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, //190
4, 0, 0, 0, 0, 0, 3, 0, 2, 0, 4, 0, 0, 0, 0, 0, 3, 0, 2, 0, //200
0, 0, 0, 0, -2, 7, 0, 0, 2, 0, 0, 0, 0, 0, -2, 7, 0, 0, 2, 0, //210
0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, //220
8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, //230
2, -2, 0, 0, 0, 0, 6, 0, 4, 3, 2, -2, 0, 0, 0, 0, 6, 0, 4, 3, //240
0, 0, 0, -1, 6, 0, 0 0, 0, 0, -1, 6, 0, 0//250
}; };
} }
@@ -0,0 +1,7 @@
[2019/10/26] 21:23 michael2 clicked item bones
[2019/10/26] 21:25 michael2 clicked item bones
[2019/10/26] 21:26 michael2 clicked item bones
[2019/10/26] 21:28 michael2 clicked item bones
[2019/10/26] 21:30 michael2 clicked item bones
[2019/10/26] 21:30 michael2 clicked item bones
[2019/10/26] 21:30 michael2 clicked item bones
@@ -0,0 +1,2 @@
[2019/10/28] 15:43 michael8 clicked item herb
[2019/10/28] 15:43 michael8 clicked item bones
@@ -0,0 +1 @@
[2019/10/27] 16:16 michael used command: bank
@@ -0,0 +1 @@
[2019/10/28] 16:52 michael2 used command: bank
@@ -0,0 +1,16 @@
[2019/10/26] 21:23 michael2 dropped 3 iron arrow absX: 3248 absY: 3225
[2019/10/26] 21:24 michael2 dropped 17 bronze arrow absX: 3262 absY: 3228
[2019/10/26] 21:24 michael2 dropped 1 air talisman absX: 3262 absY: 3228
[2019/10/26] 21:26 michael2 dropped 1 bronze longsword absX: 3259 absY: 3229
[2019/10/26] 21:28 michael2 dropped 1 bronze med helm absX: 3251 absY: 3225
[2019/10/26] 21:28 michael2 dropped 1 air talisman absX: 3251 absY: 3225
[2019/10/26] 21:29 michael2 dropped 9 coins absX: 3255 absY: 3223
[2019/10/26] 21:29 michael2 dropped 6 water rune absX: 3255 absY: 3223
[2019/10/26] 21:29 michael2 dropped 1 goblin mail absX: 3255 absY: 3223
[2019/10/26] 21:31 michael2 dropped 1 bronze sq shield absX: 3260 absY: 3228
[2019/10/26] 21:32 michael2 dropped 9 coins absX: 3259 absY: 3227
[2019/10/26] 21:34 michael2 dropped 1 bronze sq shield absX: 3262 absY: 3229
[2019/10/26] 21:34 michael2 dropped 1 bronze sq shield absX: 3255 absY: 3223
[2019/10/26] 21:34 michael2 dropped 1 bronze longsword absX: 3255 absY: 3223
[2019/10/26] 21:35 michael2 dropped 1 raw chicken absX: 3260 absY: 3227
[2019/10/26] 21:51 michael2 dropped 1 ashes absX: 3234 absY: 3218
@@ -0,0 +1,21 @@
[2019/10/27] 18:50 michael5 dropped 1 bronze arrow absX: 3247 absY: 3226
[2019/10/27] 18:50 michael5 dropped 1 bronze arrow absX: 3247 absY: 3226
[2019/10/27] 18:50 michael5 dropped 1 bronze arrow absX: 3247 absY: 3226
[2019/10/27] 18:50 michael5 dropped 2 bronze arrow absX: 3247 absY: 3226
[2019/10/27] 18:50 michael5 dropped 3 bronze arrow absX: 3247 absY: 3226
[2019/10/27] 18:50 michael5 dropped 4 bronze arrow absX: 3247 absY: 3226
[2019/10/27] 18:50 michael5 dropped 5 bronze arrow absX: 3247 absY: 3226
[2019/10/27] 18:50 michael5 dropped 6 bronze arrow absX: 3247 absY: 3226
[2019/10/27] 18:51 michael5 dropped 2 air rune absX: 3248 absY: 3226
[2019/10/27] 18:51 michael5 dropped 5 iron arrow absX: 3248 absY: 3226
[2019/10/27] 18:51 michael5 dropped 1 bronze arrow absX: 3251 absY: 3226
[2019/10/27] 18:51 michael5 dropped 1 bronze arrow absX: 3253 absY: 3225
[2019/10/27] 18:51 michael5 dropped 2 bronze arrow absX: 3252 absY: 3225
[2019/10/27] 18:51 michael5 dropped 3 bronze arrow absX: 3252 absY: 3225
[2019/10/27] 18:51 michael5 dropped 1 bronze arrow absX: 3242 absY: 3225
[2019/10/27] 18:51 michael5 dropped 2 bronze arrow absX: 3242 absY: 3225
[2019/10/27] 18:52 michael5 dropped 3 bronze arrow absX: 3242 absY: 3225
[2019/10/27] 18:52 michael5 dropped 4 bronze arrow absX: 3242 absY: 3225
[2019/10/27] 18:52 michael5 dropped 5 bronze arrow absX: 3242 absY: 3225
[2019/10/27] 18:52 michael5 dropped 6 bronze arrow absX: 3242 absY: 3225
[2019/10/27] 18:55 michael5 dropped 1 ashes absX: 3234 absY: 3230
@@ -0,0 +1,27 @@
[2019/10/28] 13:45 michael6 dropped 1 bronze arrow absX: 3224 absY: 3222
[2019/10/28] 13:45 michael6 dropped 1 bronze arrow absX: 3224 absY: 3224
[2019/10/28] 13:45 michael6 dropped 2 bronze arrow absX: 3224 absY: 3224
[2019/10/28] 13:45 michael6 dropped 3 bronze arrow absX: 3224 absY: 3222
[2019/10/28] 13:45 michael6 dropped 4 bronze arrow absX: 3224 absY: 3224
[2019/10/28] 13:45 michael6 dropped 5 bronze arrow absX: 3224 absY: 3224
[2019/10/28] 13:45 michael6 dropped 6 bronze arrow absX: 3224 absY: 3224
[2019/10/28] 13:45 michael6 dropped 7 bronze arrow absX: 3224 absY: 3224
[2019/10/28] 13:46 michael6 dropped 8 bronze arrow absX: 3224 absY: 3224
[2019/10/28] 13:46 michael6 dropped 9 bronze arrow absX: 3224 absY: 3222
[2019/10/28] 13:46 michael6 dropped 10 bronze arrow absX: 3224 absY: 3224
[2019/10/28] 13:48 michael6 dropped 1 bronze arrow absX: 3220 absY: 3224
[2019/10/28] 13:48 michael6 dropped 1 bronze arrow absX: 3219 absY: 3223
[2019/10/28] 13:48 michael6 dropped 2 bronze arrow absX: 3221 absY: 3223
[2019/10/28] 13:48 michael6 dropped 1 bronze arrow absX: 3221 absY: 3225
[2019/10/28] 13:48 michael6 dropped 1 bronze arrow absX: 3222 absY: 3221
[2019/10/28] 13:48 michael6 dropped 2 bronze arrow absX: 3222 absY: 3221
[2019/10/28] 13:48 michael6 dropped 3 bronze arrow absX: 3222 absY: 3221
[2019/10/28] 13:48 michael6 dropped 4 bronze arrow absX: 3222 absY: 3221
[2019/10/28] 13:48 michael6 dropped 5 bronze arrow absX: 3222 absY: 3221
[2019/10/28] 13:48 michael6 dropped 6 bronze arrow absX: 3222 absY: 3221
[2019/10/28] 13:52 michael6 dropped 1 bronze arrow absX: 3221 absY: 3219
[2019/10/28] 13:52 michael6 dropped 1 bronze arrow absX: 3232 absY: 3219
[2019/10/28] 14:01 michael6 dropped 1 bronze arrow absX: 3217 absY: 3244
[2019/10/28] 14:01 michael6 dropped 1 bronze arrow absX: 3228 absY: 3218
[2019/10/28] 14:01 michael6 dropped 1 bronze arrow absX: 3230 absY: 3218
[2019/10/28] 14:02 michael6 dropped 1 bronze arrow absX: 3232 absY: 3217
@@ -0,0 +1,29 @@
[2019/10/28] 15:09 michael7 dropped 1 bronze arrow absX: 3225 absY: 3223
[2019/10/28] 15:13 michael7 dropped 1 bronze arrow absX: 3225 absY: 3224
[2019/10/28] 15:13 michael7 dropped 1 bronze arrow absX: 3225 absY: 3222
[2019/10/28] 15:18 michael7 dropped 1 bronze arrow absX: 3230 absY: 3219
[2019/10/28] 15:19 michael7 dropped 2 bronze arrow absX: 3230 absY: 3219
[2019/10/28] 15:19 michael7 dropped 1 bronze arrow absX: 3234 absY: 3217
[2019/10/28] 15:19 michael7 dropped 1 bronze arrow absX: 3235 absY: 3221
[2019/10/28] 15:19 michael7 dropped 2 bronze arrow absX: 3235 absY: 3221
[2019/10/28] 15:19 michael7 dropped 1 bronze arrow absX: 3236 absY: 3222
[2019/10/28] 15:19 michael7 dropped 1 bronze arrow absX: 3233 absY: 3222
[2019/10/28] 15:19 michael7 dropped 2 bronze arrow absX: 3233 absY: 3222
[2019/10/28] 15:19 michael7 dropped 3 bronze arrow absX: 3233 absY: 3222
[2019/10/28] 15:19 michael7 dropped 4 bronze arrow absX: 3233 absY: 3222
[2019/10/28] 15:19 michael7 dropped 5 bronze arrow absX: 3233 absY: 3222
[2019/10/28] 15:19 michael7 dropped 6 bronze arrow absX: 3233 absY: 3222
[2019/10/28] 15:19 michael7 dropped 1 bronze arrow absX: 3232 absY: 3220
[2019/10/28] 15:19 michael7 dropped 1 bronze arrow absX: 3233 absY: 3220
[2019/10/28] 15:19 michael7 dropped 2 bronze arrow absX: 3233 absY: 3220
[2019/10/28] 15:20 michael7 dropped 1 bronze arrow absX: 3234 absY: 3218
[2019/10/28] 15:20 michael7 dropped 1 ashes absX: 3230 absY: 3218
[2019/10/28] 15:20 michael7 dropped 3 bronze arrow absX: 3230 absY: 3219
[2019/10/28] 15:20 michael7 dropped 1 bronze arrow absX: 3223 absY: 3228
[2019/10/28] 15:23 michael7 dropped 1 bronze arrow absX: 3223 absY: 3227
[2019/10/28] 15:23 michael7 dropped 2 bronze arrow absX: 3223 absY: 3229
[2019/10/28] 15:23 michael7 dropped 1 bronze arrow absX: 3234 absY: 3218
[2019/10/28] 15:23 michael7 dropped 1 bronze arrow absX: 3236 absY: 3218
[2019/10/28] 15:23 michael7 dropped 1 bronze arrow absX: 3234 absY: 3218
[2019/10/28] 15:23 michael7 dropped 2 bronze arrow absX: 3234 absY: 3218
[2019/10/28] 15:23 michael7 dropped 3 bronze arrow absX: 3234 absY: 3218
@@ -0,0 +1,20 @@
[2019/10/28] 15:25 michael8 dropped 1 bronze arrow absX: 3234 absY: 3226
[2019/10/28] 15:25 michael8 dropped 1 bronze arrow absX: 3234 absY: 3226
[2019/10/28] 15:25 michael8 dropped 1 bronze arrow absX: 3234 absY: 3226
[2019/10/28] 15:29 michael8 dropped 1 bronze arrow absX: 3228 absY: 3219
[2019/10/28] 15:29 michael8 dropped 1 bronze arrow absX: 3226 absY: 3220
[2019/10/28] 15:29 michael8 dropped 2 bronze arrow absX: 3226 absY: 3220
[2019/10/28] 15:29 michael8 dropped 3 bronze arrow absX: 3226 absY: 3220
[2019/10/28] 15:29 michael8 dropped 4 bronze arrow absX: 3228 absY: 3220
[2019/10/28] 15:30 michael8 dropped 1 bronze arrow absX: 3229 absY: 3217
[2019/10/28] 15:30 michael8 dropped 1 bronze arrow absX: 3226 absY: 3218
[2019/10/28] 15:31 michael8 dropped 5 bronze arrow absX: 3226 absY: 3220
[2019/10/28] 15:31 michael8 dropped 6 bronze arrow absX: 3226 absY: 3220
[2019/10/28] 15:31 michael8 dropped 7 bronze arrow absX: 3226 absY: 3220
[2019/10/28] 15:31 michael8 dropped 1 iron dagger absX: 3226 absY: 3220
[2019/10/28] 15:36 michael8 dropped 1 bronze arrow absX: 3219 absY: 3222
[2019/10/28] 15:36 michael8 dropped 2 bronze arrow absX: 3219 absY: 3222
[2019/10/28] 15:36 michael8 dropped 3 bronze arrow absX: 3219 absY: 3222
[2019/10/28] 15:36 michael8 dropped 4 bronze arrow absX: 3219 absY: 3222
[2019/10/28] 15:41 michael8 dropped 1 air talisman absX: 3220 absY: 3222
[2019/10/28] 15:41 michael8 dropped 1 herb absX: 3220 absY: 3222
@@ -0,0 +1,20 @@
[2019/10/26] 21:23 michael2 picked up iron arrow itemX: 3249, itemY: 3225
[2019/10/26] 21:23 michael2 picked up bones itemX: 3249, itemY: 3225
[2019/10/26] 21:24 michael2 picked up bronze arrow itemX: 3261, itemY: 3228
[2019/10/26] 21:24 michael2 picked up bones itemX: 3261, itemY: 3228
[2019/10/26] 21:24 michael2 picked up air talisman itemX: 3261, itemY: 3228
[2019/10/26] 21:26 michael2 picked up bones itemX: 3251, itemY: 3225
[2019/10/26] 21:26 michael2 picked up bones itemX: 3260, itemY: 3229
[2019/10/26] 21:26 michael2 picked up bronze longsword itemX: 3260, itemY: 3229
[2019/10/26] 21:27 michael2 picked up bones itemX: 3262, itemY: 3229
[2019/10/26] 21:28 michael2 picked up bronze med helm itemX: 3250, itemY: 3225
[2019/10/26] 21:28 michael2 picked up bones itemX: 3250, itemY: 3225
[2019/10/26] 21:28 michael2 picked up air talisman itemX: 3250, itemY: 3225
[2019/10/26] 21:30 michael2 picked up bones itemX: 3250, itemY: 3225
[2019/10/26] 21:30 michael2 picked up goblin mail itemX: 3254, itemY: 3223
[2019/10/26] 21:31 michael2 picked up bronze sq shield itemX: 3260, itemY: 3229
[2019/10/26] 21:31 michael2 picked up bones itemX: 3260, itemY: 3229
[2019/10/26] 21:33 michael2 picked up coins itemX: 3261, itemY: 3229
[2019/10/26] 21:34 michael2 picked up bronze sq shield itemX: 3262, itemY: 3230
[2019/10/26] 21:34 michael2 picked up bronze sq shield itemX: 3254, itemY: 3223
[2019/10/26] 21:34 michael2 picked up bronze longsword itemX: 3254, itemY: 3223
@@ -0,0 +1,5 @@
[2019/10/27] 18:51 michael5 picked up bronze arrow itemX: 3248, itemY: 3226
[2019/10/27] 18:51 michael5 picked up air rune itemX: 3248, itemY: 3226
[2019/10/27] 18:51 michael5 picked up bones itemX: 3248, itemY: 3226
[2019/10/27] 18:51 michael5 picked up iron arrow itemX: 3248, itemY: 3226
[2019/10/27] 18:51 michael5 picked up bronze arrow itemX: 3249, itemY: 3226
@@ -0,0 +1,5 @@
[2019/10/28] 13:46 michael6 picked up bronze arrow itemX: 3224, itemY: 3223
[2019/10/28] 13:48 michael6 picked up bronze arrow itemX: 3220, itemY: 3223
[2019/10/28] 13:48 michael6 picked up bronze arrow itemX: 3222, itemY: 3222
[2019/10/28] 13:48 michael6 picked up bronze arrow itemX: 3220, itemY: 3225
[2019/10/28] 13:48 michael6 picked up bronze arrow itemX: 3220, itemY: 3226
@@ -0,0 +1,5 @@
[2019/10/28] 15:19 michael7 picked up bronze arrow itemX: 3234, itemY: 3222
[2019/10/28] 15:19 michael7 picked up bronze arrow itemX: 3234, itemY: 3221
[2019/10/28] 15:19 michael7 picked up bronze arrow itemX: 3234, itemY: 3220
[2019/10/28] 15:19 michael7 picked up bronze arrow itemX: 3235, itemY: 3220
[2019/10/28] 15:19 michael7 picked up bronze arrow itemX: 3234, itemY: 3218
@@ -0,0 +1,4 @@
[2019/10/28] 15:36 michael8 picked up bronze arrow itemX: 3219, itemY: 3221
[2019/10/28] 15:43 michael8 picked up air talisman itemX: 3219, itemY: 3222
[2019/10/28] 15:43 michael8 picked up herb itemX: 3219, itemY: 3222
[2019/10/28] 15:43 michael8 picked up bones itemX: 3219, itemY: 3222
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Main-Class: Client
@@ -21,6 +21,7 @@ import redone.game.content.music.sound.CombatSounds;
import redone.game.content.music.sound.SoundList; import redone.game.content.music.sound.SoundList;
import redone.game.content.skills.slayer.SlayerRequirements; import redone.game.content.skills.slayer.SlayerRequirements;
import redone.game.items.ItemAssistant; import redone.game.items.ItemAssistant;
import redone.game.npcs.Npc;
import redone.game.npcs.NpcHandler; import redone.game.npcs.NpcHandler;
import redone.game.players.Client; import redone.game.players.Client;
import redone.game.players.Player; import redone.game.players.Player;
@@ -430,21 +431,91 @@ public class CombatAssistant {
} }
} }
public void attackingNpcTick() {
int i = c.npcIndex;
if (i > 0 && NpcHandler.npcs[i] != null) {
if (NpcHandler.npcs[i].isDead) {
c.npcIndex = 0;
c.followId2 = 0;
c.faceNpc(0);
return;
}
boolean projectile = c.usingBow || c.usingMagic || c.usingRangeWeapon;
if (projectile && !PathFinder.isProjectilePathClear(c.absX, c.absY, c.heightLevel, NpcHandler.npcs[i].absX, NpcHandler.npcs[i].absY)) {
return;
}
if (!c.goodDistance(c.getX(), c.getY(), NpcHandler.npcs[i].getX(), NpcHandler.npcs[i].getY(), 2) && RangeData.usingHally(c) && !c.usingRangeWeapon && !c.usingBow && !c.usingMagic
|| !c.goodDistance(c.getX(), c.getY(), NpcHandler.npcs[i].getX(), NpcHandler.npcs[i].getY(), 4) && c.usingRangeWeapon&& !c.usingBow && !c.usingMagic
|| !c.goodDistance(c.getX(), c.getY(), NpcHandler.npcs[i].getX(), NpcHandler.npcs[i].getY(), 1)&& !c.usingRangeWeapon && !RangeData.usingHally(c) && !c.usingBow && !c.usingMagic
|| !c.goodDistance(c.getX(), c.getY(), NpcHandler.npcs[i].getX(), NpcHandler.npcs[i].getY(), 8) && (c.usingBow || c.usingMagic)) {
return;
} else {
c.stopMovement();
}
}
}
public void attackingPlayerTick() {
int i = c.playerIndex;
if (i > 0 && PlayerHandler.players[i] != null) {
if (PlayerHandler.players[i].isDead) {
c.playerIndex = 0;
c.followId = 0;
c.faceNpc(0);
return;
}
boolean projectile = c.usingBow || c.usingMagic || c.usingRangeWeapon;
if (projectile && !PathFinder.isProjectilePathClear(c.absX, c.absY, c.heightLevel, PlayerHandler.players[i].absX, PlayerHandler.players[i].absY)) {
return;
}
if (!c.goodDistance(c.getX(), c.getY(),
PlayerHandler.players[i].getX(),
PlayerHandler.players[i].getY(), 4)
&& c.usingRangeWeapon
&& !c.usingBow
&& !c.usingMagic
|| !c.goodDistance(c.getX(), c.getY(),
PlayerHandler.players[i].getX(),
PlayerHandler.players[i].getY(), 2)
&& !c.usingRangeWeapon
&& RangeData.usingHally(c)
&& !c.usingBow
&& !c.usingMagic
|| !c.goodDistance(c.getX(), c.getY(),
PlayerHandler.players[i].getX(),
PlayerHandler.players[i].getY(),
getRequiredDistance())
&& !c.usingRangeWeapon
&& !RangeData.usingHally(c)
&& !c.usingBow
&& !c.usingMagic
|| !c.goodDistance(c.getX(), c.getY(),
PlayerHandler.players[i].getX(),
PlayerHandler.players[i].getY(), 10)
&& (c.usingBow || c.usingMagic)) {
return;
} else {
c.stopMovement();
}
}
}
public void attackNpc(int i) { public void attackNpc(int i) {
// int equippedWeapon = c.playerEquipment[c.playerWeapon]; // int equippedWeapon = c.playerEquipment[c.playerWeapon];
// final int npcId = NPCHandler.npcs[i].npcType; // final int npcId = NPCHandler.npcs[i].npcType;
if (NpcHandler.npcs[i] != null) { if (NpcHandler.npcs[i] != null) {
Npc npc = NpcHandler.npcs[i];
if (NpcHandler.npcs[i].isDead || NpcHandler.npcs[i].MaxHP <= 0) { if (NpcHandler.npcs[i].isDead || NpcHandler.npcs[i].MaxHP <= 0) {
c.usingMagic = false; c.usingMagic = false;
c.faceUpdate(0); c.faceUpdate(0);
c.npcIndex = 0; c.npcIndex = 0;
return; return;
} }
if (c.absY == 3228 && NpcHandler.npcs[i].absY == 3227) { /*if (c.absY == 3224 && NpcHandler.npcs[i].absY == 3225) {
resetPlayerAttack();
return;
}
if (c.absY == 3224 && NpcHandler.npcs[i].absY == 3225) {
resetPlayerAttack(); resetPlayerAttack();
return; return;
} }
@@ -459,7 +530,7 @@ public class CombatAssistant {
if (c.absX == 3252 && c.absY > 3254 && c.absY < 3272 || c.absY == 3254 && c.absX > 3252 && c.absX < 3265) { if (c.absX == 3252 && c.absY > 3254 && c.absY < 3272 || c.absY == 3254 && c.absX > 3252 && c.absX < 3265) {
resetPlayerAttack(); resetPlayerAttack();
return; return;
} }*/
if (c.usingMagic && MagicData.MAGIC_SPELLS[c.spellId][0] == 1171) { if (c.usingMagic && MagicData.MAGIC_SPELLS[c.spellId][0] == 1171) {
if (!NpcHandler.isUndead(i)) { if (!NpcHandler.isUndead(i)) {
c.getActionSender().sendMessage("This spell only affects skeletons, zombies, ghosts and shades."); c.getActionSender().sendMessage("This spell only affects skeletons, zombies, ghosts and shades.");
@@ -546,12 +617,13 @@ public class CombatAssistant {
c.getActionSender().sendMessage("This monster was not spawned for you."); c.getActionSender().sendMessage("This monster was not spawned for you.");
return; return;
} }
c.followId2 = i; c.followId2 = i;
c.followId = 0; c.followId = 0;
if (c.attackTimer <= 0) { if (c.attackTimer <= 0) {
boolean usingBow = false; c.usingBow = false;
c.usingRangeWeapon = false;
boolean usingArrows = false; boolean usingArrows = false;
boolean usingOtherRangeWeapons = false;
boolean usingCross = c.playerEquipment[c.playerWeapon] == 9185; boolean usingCross = c.playerEquipment[c.playerWeapon] == 9185;
c.bonusAttack = 0; c.bonusAttack = 0;
c.rangeItemUsed = 0; c.rangeItemUsed = 0;
@@ -563,13 +635,13 @@ public class CombatAssistant {
if (c.spellId > 0) { if (c.spellId > 0) {
c.usingMagic = true; c.usingMagic = true;
} }
c.attackTimer = getAttackDelay();
c.specAccuracy = 1.0; c.specAccuracy = 1.0;
c.specDamage = 1.0; c.specDamage = 1.0;
if (!c.usingMagic) { if (!c.usingMagic) {
for (int bowId : RangeData.BOWS) { for (int bowId : RangeData.BOWS) {
if (c.playerEquipment[c.playerWeapon] == bowId) { if (c.playerEquipment[c.playerWeapon] == bowId) {
usingBow = true; c.usingBow = true;
for (int arrowId : RangeData.ARROWS) { for (int arrowId : RangeData.ARROWS) {
if (c.playerEquipment[c.playerArrows] == arrowId) { if (c.playerEquipment[c.playerArrows] == arrowId) {
usingArrows = true; usingArrows = true;
@@ -580,44 +652,41 @@ public class CombatAssistant {
for (int otherRangeId : RangeData.OTHER_RANGE_WEAPONS) { for (int otherRangeId : RangeData.OTHER_RANGE_WEAPONS) {
if (c.playerEquipment[c.playerWeapon] == otherRangeId) { if (c.playerEquipment[c.playerWeapon] == otherRangeId) {
usingOtherRangeWeapons = true; c.usingRangeWeapon = true;
} }
} }
} }
if (armaNpc(i) && !usingCross && !usingBow && !c.usingMagic if (armaNpc(i) && !usingCross && !c.usingBow && !c.usingMagic
&& !RangeData.usingCrystalBow(c) && !usingOtherRangeWeapons) { && !RangeData.usingCrystalBow(c) && !c.usingRangeWeapon) {
resetPlayerAttack(); resetPlayerAttack();
return; return;
} }
if (usingOtherRangeWeapons || usingBow if (c.usingRangeWeapon || c.usingBow
&& Constants.combatSounds && Constants.combatSounds
&& NpcHandler.npcs[i].npcType < 3177 && NpcHandler.npcs[i].npcType < 3177
&& NpcHandler.npcs[i].npcType > 3180) { && NpcHandler.npcs[i].npcType > 3180) {
c.getActionSender().sendSound(SoundList.SHOOT_ARROW, c.getActionSender().sendSound(SoundList.SHOOT_ARROW,
100, 0); 100, 0);
} }
if (!c.goodDistance(c.getX(), c.getY(), NpcHandler.npcs[i].getX(), NpcHandler.npcs[i].getY(), 2) && RangeData.usingHally(c) && !usingOtherRangeWeapons && !usingBow && !c.usingMagic || !c.goodDistance(c.getX(), c.getY(), NpcHandler.npcs[i].getX(), NpcHandler.npcs[i].getY(), 4)
&& usingOtherRangeWeapons boolean projectile = c.usingBow || c.usingMagic || c.usingRangeWeapon;
&& !usingBow
&& !c.usingMagic if (projectile && !PathFinder.isProjectilePathClear(c.absX, c.absY, c.heightLevel, npc.absX, npc.absY)) {
|| !c.goodDistance(c.getX(), c.getY(),
NpcHandler.npcs[i].getX(),
NpcHandler.npcs[i].getY(), 1)
&& !usingOtherRangeWeapons
&& !RangeData.usingHally(c)
&& !usingBow
&& !c.usingMagic
|| !c.goodDistance(c.getX(), c.getY(),
NpcHandler.npcs[i].getX(),
NpcHandler.npcs[i].getY(), 8)
&& (usingBow || c.usingMagic)) {
c.attackTimer = 2;
return; return;
} }
if (!c.goodDistance(c.getX(), c.getY(), NpcHandler.npcs[i].getX(), NpcHandler.npcs[i].getY(), 2) && RangeData.usingHally(c) && !c.usingRangeWeapon && !c.usingBow && !c.usingMagic
|| !c.goodDistance(c.getX(), c.getY(), NpcHandler.npcs[i].getX(), NpcHandler.npcs[i].getY(), 4) && c.usingRangeWeapon && !c.usingBow && !c.usingMagic
|| !c.goodDistance(c.getX(), c.getY(), NpcHandler.npcs[i].getX(), NpcHandler.npcs[i].getY(), 1)&& !c.usingRangeWeapon && !RangeData.usingHally(c) && !c.usingBow && !c.usingMagic
|| !c.goodDistance(c.getX(), c.getY(), NpcHandler.npcs[i].getX(), NpcHandler.npcs[i].getY(), 8) && (c.usingBow || c.usingMagic)) {
return;
} else {
c.stopMovement();
}
if (!usingCross if (!usingCross
&& !usingArrows && !usingArrows
&& usingBow && c.usingBow
&& (c.playerEquipment[c.playerWeapon] < 4212 || c.playerEquipment[c.playerWeapon] > 4223)) { && (c.playerEquipment[c.playerWeapon] < 4212 || c.playerEquipment[c.playerWeapon] > 4223)) {
c.getActionSender().sendMessage( c.getActionSender().sendMessage(
"There is no ammo left in your quiver."); "There is no ammo left in your quiver.");
@@ -626,7 +695,7 @@ public class CombatAssistant {
return; return;
} }
if (RangeData.correctBowAndArrows(c) < c.playerEquipment[c.playerArrows] if (RangeData.correctBowAndArrows(c) < c.playerEquipment[c.playerArrows]
&& Constants.CORRECT_ARROWS && usingBow && Constants.CORRECT_ARROWS && c.usingBow
&& !RangeData.usingCrystalBow(c) && !RangeData.usingCrystalBow(c)
&& c.playerEquipment[c.playerWeapon] != 9185) { && c.playerEquipment[c.playerWeapon] != 9185) {
c.getItemAssistant(); c.getItemAssistant();
@@ -653,30 +722,14 @@ public class CombatAssistant {
return; return;
} }
if (usingBow if (c.usingBow
|| c.usingMagic || c.usingMagic
|| usingOtherRangeWeapons || c.usingRangeWeapon
|| c.goodDistance(c.getX(), c.getY(), || c.goodDistance(c.getX(), c.getY(),
NpcHandler.npcs[i].getX(), NpcHandler.npcs[i].getX(),
NpcHandler.npcs[i].getY(), 2) && RangeData.usingHally(c)) { NpcHandler.npcs[i].getY(), 2) && RangeData.usingHally(c)) {
c.stopMovement(); c.stopMovement();
} }
/**
* Npc projectiles
*/
if (PlayerAssistant.pathBlocked(c, NpcHandler.npcs[i])) {
if((c.usingBow || c.usingMagic || usingOtherRangeWeapons || c.autocasting)) {
PathFinder.getPathFinder().findRoute(c, NpcHandler.npcs[i].getX(), NpcHandler.npcs[i].getY(), true, 8, 8);
if(!c.usingBow && !c.usingMagic && !usingOtherRangeWeapons && !c.autocasting) {
PathFinder.getPathFinder().findRoute(c,NpcHandler.npcs[i].getX(), NpcHandler.npcs[i].getY(), true, 1, 1);
c.attackTimer = 0;
return;
}
}
}
if (!checkMagicReqs(c.spellId)) { if (!checkMagicReqs(c.spellId)) {
c.stopMovement(); c.stopMovement();
@@ -685,6 +738,7 @@ public class CombatAssistant {
} }
c.faceUpdate(i); c.faceUpdate(i);
c.attackTimer = getAttackDelay();
NpcHandler.npcs[i].underAttackBy = c.playerId; NpcHandler.npcs[i].underAttackBy = c.playerId;
NpcHandler.npcs[i].lastDamageTaken = System.currentTimeMillis(); NpcHandler.npcs[i].lastDamageTaken = System.currentTimeMillis();
if (c.usingSpecial && !c.usingMagic) { if (c.usingSpecial && !c.usingMagic) {
@@ -729,7 +783,7 @@ public class CombatAssistant {
} }
c.lastWeaponUsed = c.playerEquipment[c.playerWeapon]; c.lastWeaponUsed = c.playerEquipment[c.playerWeapon];
c.lastArrowUsed = c.playerEquipment[c.playerArrows]; c.lastArrowUsed = c.playerEquipment[c.playerArrows];
if (!usingBow && !c.usingMagic && !usingOtherRangeWeapons) { // melee if (!c.usingBow && !c.usingMagic && !c.usingRangeWeapon) { // melee
// hit // hit
// delay // delay
c.hitDelay = getHitDelay(); c.hitDelay = getHitDelay();
@@ -737,7 +791,7 @@ public class CombatAssistant {
c.oldNpcIndex = i; c.oldNpcIndex = i;
} }
if (usingBow && !usingOtherRangeWeapons && !c.usingMagic if (c.usingBow && !c.usingRangeWeapon && !c.usingMagic
|| usingCross) { // range hit delay || usingCross) { // range hit delay
if (usingCross) { if (usingCross) {
c.usingBow = true; c.usingBow = true;
@@ -763,7 +817,7 @@ public class CombatAssistant {
fireProjectileNpc(); fireProjectileNpc();
} }
if (usingOtherRangeWeapons && !c.usingMagic && !usingBow) { // knives, if (c.usingRangeWeapon && !c.usingMagic && !c.usingBow) { // knives,
// darts, // darts,
// etc // etc
// hit // hit
@@ -813,7 +867,7 @@ public class CombatAssistant {
} }
} }
if (usingBow && Constants.CRYSTAL_BOW_DEGRADES) { // crystal if (c.usingBow && Constants.CRYSTAL_BOW_DEGRADES) { // crystal
// bow // bow
// degrading // degrading
if (c.playerEquipment[c.playerWeapon] == 4212) { // new if (c.playerEquipment[c.playerWeapon] == 4212) { // new
@@ -871,13 +925,13 @@ public class CombatAssistant {
int equippedWeapon = c.playerEquipment[c.playerWeapon]; int equippedWeapon = c.playerEquipment[c.playerWeapon];
if (PlayerHandler.players[i] != null) { if (PlayerHandler.players[i] != null) {
if (c.usingMagic && MagicData.MAGIC_SPELLS[c.spellId][0] == 1171) { if (c.usingMagic && MagicData.MAGIC_SPELLS[c.spellId][0] == 1171) {
c.getActionSender().sendMessage("This spell only affects skeletons, zombies, ghosts and shades, not humans."); c.getActionSender().sendMessage("This spell only affects skeletons, zombies, ghosts and shades, not humans.");
resetPlayerAttack(); resetPlayerAttack();
c.stopMovement(); c.stopMovement();
return; return;
} }
if (CastleWars.isInCw(PlayerHandler.players[i]) if (CastleWars.isInCw(PlayerHandler.players[i])
&& CastleWars.isInCw(c)) { && CastleWars.isInCw(c)) {
@@ -935,9 +989,7 @@ public class CombatAssistant {
c.specEffect = 0; c.specEffect = 0;
c.usingRangeWeapon = false; c.usingRangeWeapon = false;
c.rangeItemUsed = 0; c.rangeItemUsed = 0;
boolean usingBow = false;
boolean usingArrows = false; boolean usingArrows = false;
boolean usingOtherRangeWeapons = false;
boolean usingCross = c.playerEquipment[c.playerWeapon] == 9185; boolean usingCross = c.playerEquipment[c.playerWeapon] == 9185;
c.projectileStage = 0; c.projectileStage = 0;
if (c.absX == PlayerHandler.players[i].absX if (c.absX == PlayerHandler.players[i].absX
@@ -953,7 +1005,7 @@ public class CombatAssistant {
if (!c.usingMagic) { if (!c.usingMagic) {
for (int bowId : RangeData.BOWS) { for (int bowId : RangeData.BOWS) {
if (c.playerEquipment[c.playerWeapon] == bowId) { if (c.playerEquipment[c.playerWeapon] == bowId) {
usingBow = true; c.usingBow = true;
for (int arrowId : RangeData.ARROWS) { for (int arrowId : RangeData.ARROWS) {
if (c.playerEquipment[c.playerArrows] == arrowId) { if (c.playerEquipment[c.playerArrows] == arrowId) {
usingArrows = true; usingArrows = true;
@@ -964,7 +1016,7 @@ public class CombatAssistant {
for (int otherRangeId : RangeData.OTHER_RANGE_WEAPONS) { for (int otherRangeId : RangeData.OTHER_RANGE_WEAPONS) {
if (c.playerEquipment[c.playerWeapon] == otherRangeId) { if (c.playerEquipment[c.playerWeapon] == otherRangeId) {
usingOtherRangeWeapons = true; c.usingRangeWeapon = true;
} }
} }
} }
@@ -975,7 +1027,7 @@ public class CombatAssistant {
if (c.spellId > 0) { if (c.spellId > 0) {
c.usingMagic = true; c.usingMagic = true;
} }
c.attackTimer = getAttackDelay();
if (c.duelRule[9]) { if (c.duelRule[9]) {
boolean canUseWeapon = false; boolean canUseWeapon = false;
@@ -991,12 +1043,13 @@ public class CombatAssistant {
return; return;
} }
} }
if (c.duelRule[2] && (usingBow || usingOtherRangeWeapons)) {
if (c.duelRule[2] && (c.usingBow || c.usingRangeWeapon)) {
c.getActionSender().sendMessage( c.getActionSender().sendMessage(
"Range has been disabled in this duel!"); "Range has been disabled in this duel!");
return; return;
} }
if (c.duelRule[3] && !usingBow && !usingOtherRangeWeapons if (c.duelRule[3] && !c.usingBow && !c.usingRangeWeapon
&& !c.usingMagic) { && !c.usingMagic) {
c.getActionSender().sendMessage( c.getActionSender().sendMessage(
"Melee has been disabled in this duel!"); "Melee has been disabled in this duel!");
@@ -1010,34 +1063,40 @@ public class CombatAssistant {
return; return;
} }
boolean projectile = c.usingBow || c.usingMagic || c.usingRangeWeapon;
if (projectile && !PathFinder.isProjectilePathClear(c.absX, c.absY, c.heightLevel, PlayerHandler.players[i].absX, PlayerHandler.players[i].absY)) {
return;
}
if (!c.goodDistance(c.getX(), c.getY(), if (!c.goodDistance(c.getX(), c.getY(),
PlayerHandler.players[i].getX(), PlayerHandler.players[i].getX(),
PlayerHandler.players[i].getY(), 4) PlayerHandler.players[i].getY(), 4)
&& usingOtherRangeWeapons && c.usingRangeWeapon
&& !usingBow && !c.usingBow
&& !c.usingMagic && !c.usingMagic
|| !c.goodDistance(c.getX(), c.getY(), || !c.goodDistance(c.getX(), c.getY(),
PlayerHandler.players[i].getX(), PlayerHandler.players[i].getX(),
PlayerHandler.players[i].getY(), 2) PlayerHandler.players[i].getY(), 2)
&& !usingOtherRangeWeapons && !c.usingRangeWeapon
&& RangeData.usingHally(c) && RangeData.usingHally(c)
&& !usingBow && !c.usingBow
&& !c.usingMagic && !c.usingMagic
|| !c.goodDistance(c.getX(), c.getY(), || !c.goodDistance(c.getX(), c.getY(),
PlayerHandler.players[i].getX(), PlayerHandler.players[i].getX(),
PlayerHandler.players[i].getY(), PlayerHandler.players[i].getY(),
getRequiredDistance()) getRequiredDistance())
&& !usingOtherRangeWeapons && !c.usingRangeWeapon
&& !RangeData.usingHally(c) && !RangeData.usingHally(c)
&& !usingBow && !c.usingBow
&& !c.usingMagic && !c.usingMagic
|| !c.goodDistance(c.getX(), c.getY(), || !c.goodDistance(c.getX(), c.getY(),
PlayerHandler.players[i].getX(), PlayerHandler.players[i].getX(),
PlayerHandler.players[i].getY(), 10) PlayerHandler.players[i].getY(), 10)
&& (usingBow || c.usingMagic)) { && (c.usingBow || c.usingMagic)) {
// c.getPacketDispatcher().sendMessage("Setting attack timer to 1"); // c.getPacketDispatcher().sendMessage("Setting attack timer to 1");
c.attackTimer = 1; //c.attackTimer = 1;
if (!usingBow && !c.usingMagic && !usingOtherRangeWeapons if (!c.usingBow && !c.usingMagic && !c.usingRangeWeapon
&& c.freezeTimer > 0) { && c.freezeTimer > 0) {
resetPlayerAttack(); resetPlayerAttack();
} }
@@ -1046,7 +1105,7 @@ public class CombatAssistant {
if (!usingCross if (!usingCross
&& !usingArrows && !usingArrows
&& usingBow && c.usingBow
&& (c.playerEquipment[c.playerWeapon] < 4212 || c.playerEquipment[c.playerWeapon] > 4223) && (c.playerEquipment[c.playerWeapon] < 4212 || c.playerEquipment[c.playerWeapon] > 4223)
&& !c.usingMagic) { && !c.usingMagic) {
c.getActionSender().sendMessage( c.getActionSender().sendMessage(
@@ -1056,7 +1115,7 @@ public class CombatAssistant {
return; return;
} }
if (RangeData.correctBowAndArrows(c) < c.playerEquipment[c.playerArrows] if (RangeData.correctBowAndArrows(c) < c.playerEquipment[c.playerArrows]
&& Constants.CORRECT_ARROWS && usingBow && Constants.CORRECT_ARROWS && c.usingBow
&& !RangeData.usingCrystalBow(c) && !RangeData.usingCrystalBow(c)
&& c.playerEquipment[c.playerWeapon] != 9185 && c.playerEquipment[c.playerWeapon] != 9185
&& !c.usingMagic) { && !c.usingMagic) {
@@ -1065,12 +1124,12 @@ public class CombatAssistant {
c.getActionSender().sendMessage( c.getActionSender().sendMessage(
"You can't use " "You can't use "
+ ItemAssistant.getItemName( + ItemAssistant.getItemName(
c.playerEquipment[c.playerArrows]) c.playerEquipment[c.playerArrows])
.toLowerCase() .toLowerCase()
+ "s with a " + "s with a "
+ ItemAssistant.getItemName( + ItemAssistant.getItemName(
c.playerEquipment[c.playerWeapon]) c.playerEquipment[c.playerWeapon])
.toLowerCase() + "."); .toLowerCase() + ".");
c.stopMovement(); c.stopMovement();
resetPlayerAttack(); resetPlayerAttack();
return; return;
@@ -1084,25 +1143,11 @@ public class CombatAssistant {
return; return;
} }
if (usingBow || c.usingMagic || usingOtherRangeWeapons if (c.usingBow || c.usingMagic || c.usingRangeWeapon
|| RangeData.usingHally(c)) { || RangeData.usingHally(c)) {
c.stopMovement(); c.stopMovement();
} }
/**
* Player projectiles
*/
if(PlayerAssistant.pathBlocked(c, o)) {
if((c.usingBow || c.usingMagic || usingOtherRangeWeapons || c.autocasting)) {
PathFinder.getPathFinder().findRoute(c, o.absX, o.absY, true, 8, 8);
if(!c.usingBow && !c.usingMagic && !usingOtherRangeWeapons && !c.autocasting) {
PathFinder.getPathFinder().findRoute(c, o.absX, o.absY, true, 1, 1);
c.attackTimer = 0;
return;
}
}
}
if (!checkMagicReqs(c.spellId)) { if (!checkMagicReqs(c.spellId)) {
c.stopMovement(); c.stopMovement();
resetPlayerAttack(); resetPlayerAttack();
@@ -1116,7 +1161,7 @@ public class CombatAssistant {
&& FightPits.getState(c) == null) { && FightPits.getState(c) == null) {
if (!c.attackedPlayers.contains(c.playerIndex) if (!c.attackedPlayers.contains(c.playerIndex)
&& !PlayerHandler.players[c.playerIndex].attackedPlayers && !PlayerHandler.players[c.playerIndex].attackedPlayers
.contains(c.playerId)) { .contains(c.playerId)) {
c.attackedPlayers.add(c.playerIndex); c.attackedPlayers.add(c.playerIndex);
c.isSkulled = true; c.isSkulled = true;
c.skullTimer = Constants.SKULL_TIMER; c.skullTimer = Constants.SKULL_TIMER;
@@ -1183,24 +1228,26 @@ public class CombatAssistant {
0); 0);
} }
} }
c.attackTimer = getAttackDelay();
PlayerHandler.players[i].underAttackBy = c.playerId; PlayerHandler.players[i].underAttackBy = c.playerId;
PlayerHandler.players[i].logoutDelay = System.currentTimeMillis(); PlayerHandler.players[i].logoutDelay = System.currentTimeMillis();
PlayerHandler.players[i].singleCombatDelay = System.currentTimeMillis(); PlayerHandler.players[i].singleCombatDelay = System.currentTimeMillis();
PlayerHandler.players[i].killerId = c.playerId; PlayerHandler.players[i].killerId = c.playerId;
c.lastArrowUsed = 0; c.lastArrowUsed = 0;
c.rangeItemUsed = 0; c.rangeItemUsed = 0;
if (!usingBow && !c.usingMagic && !usingOtherRangeWeapons) { // melee if (!c.usingBow && !c.usingMagic && !c.usingRangeWeapon) { // melee
// hit // hit
// delay; // delay;
c.followId = PlayerHandler.players[c.playerIndex].playerId; c.followId = PlayerHandler.players[c.playerIndex].playerId;
c.getPlayerAssistant().followPlayer(); //c.getPlayerAssistant().followPlayer();
c.hitDelay = getHitDelay(); c.hitDelay = getHitDelay();
c.delayedDamage = Misc.random(meleeMaxHit()); c.delayedDamage = Misc.random(meleeMaxHit());
c.projectileStage = 0; c.projectileStage = 0;
c.oldPlayerIndex = i; c.oldPlayerIndex = i;
} }
if (usingBow && !usingOtherRangeWeapons && !c.usingMagic if (c.usingBow && !c.usingRangeWeapon && !c.usingMagic
|| usingCross) { // range hit delay || usingCross) { // range hit delay
if (c.playerEquipment[c.playerWeapon] >= 4212 if (c.playerEquipment[c.playerWeapon] >= 4212
&& c.playerEquipment[c.playerWeapon] <= 4223) { && c.playerEquipment[c.playerWeapon] <= 4223) {
@@ -1219,7 +1266,7 @@ public class CombatAssistant {
c.usingBow = true; c.usingBow = true;
c.followId = PlayerHandler.players[c.playerIndex].playerId; c.followId = PlayerHandler.players[c.playerIndex].playerId;
c.getPlayerAssistant().followPlayer(); //c.getPlayerAssistant().followPlayer();
c.lastWeaponUsed = c.playerEquipment[c.playerWeapon]; c.lastWeaponUsed = c.playerEquipment[c.playerWeapon];
c.lastArrowUsed = c.playerEquipment[c.playerArrows]; c.lastArrowUsed = c.playerEquipment[c.playerArrows];
c.gfx100(RangeData.getRangeStartGFX(c)); c.gfx100(RangeData.getRangeStartGFX(c));
@@ -1229,12 +1276,12 @@ public class CombatAssistant {
fireProjectilePlayer(); fireProjectilePlayer();
} }
if (usingOtherRangeWeapons) { // knives, darts, etc hit delay if (c.usingRangeWeapon) { // knives, darts, etc hit delay
c.rangeItemUsed = c.playerEquipment[c.playerWeapon]; c.rangeItemUsed = c.playerEquipment[c.playerWeapon];
c.getItemAssistant().deleteEquipment(); c.getItemAssistant().deleteEquipment();
c.usingRangeWeapon = true; c.usingRangeWeapon = true;
c.followId = PlayerHandler.players[c.playerIndex].playerId; c.followId = PlayerHandler.players[c.playerIndex].playerId;
c.getPlayerAssistant().followPlayer(); //c.getPlayerAssistant().followPlayer();
c.gfx100(RangeData.getRangeStartGFX(c)); c.gfx100(RangeData.getRangeStartGFX(c));
if (c.fightMode == 2) { if (c.fightMode == 2) {
c.attackTimer--; c.attackTimer--;
@@ -1307,42 +1354,42 @@ public class CombatAssistant {
} }
} }
if (usingBow && Constants.CRYSTAL_BOW_DEGRADES) { // crystal if (c.usingBow && Constants.CRYSTAL_BOW_DEGRADES) { // crystal
// bow // bow
// degrading // degrading
if (c.playerEquipment[c.playerWeapon] == 4212) { // new if (c.playerEquipment[c.playerWeapon] == 4212) { // new
// crystal // crystal
// bow // bow
// becomes // becomes
// full // full
// bow // bow
// on // on
// the // the
// first // first
// shot // shot
c.getItemAssistant().wearItem(4214, 1, 3); c.getItemAssistant().wearItem(4214, 1, 3);
} }
if (c.crystalBowArrowCount >= 250) { if (c.crystalBowArrowCount >= 250) {
switch (c.playerEquipment[c.playerWeapon]) { switch (c.playerEquipment[c.playerWeapon]) {
case 4223: // 1/10 bow case 4223: // 1/10 bow
c.getItemAssistant().wearItem(-1, 1, 3); c.getItemAssistant().wearItem(-1, 1, 3);
c.getActionSender().sendMessage( c.getActionSender().sendMessage(
"Your crystal bow has fully degraded."); "Your crystal bow has fully degraded.");
if (!c.getItemAssistant().addItem(4207, 1)) { if (!c.getItemAssistant().addItem(4207, 1)) {
Server.itemHandler.createGroundItem(c, 4207, Server.itemHandler.createGroundItem(c, 4207,
c.getX(), c.getY(), 1, c.getId()); c.getX(), c.getY(), 1, c.getId());
} }
c.crystalBowArrowCount = 0; c.crystalBowArrowCount = 0;
break; break;
default: default:
c.getItemAssistant().wearItem( c.getItemAssistant().wearItem(
++c.playerEquipment[c.playerWeapon], 1, 3); ++c.playerEquipment[c.playerWeapon], 1, 3);
c.getActionSender().sendMessage( c.getActionSender().sendMessage(
"Your crystal bow degrades."); "Your crystal bow degrades.");
c.crystalBowArrowCount = 0; c.crystalBowArrowCount = 0;
break; break;
} }
} }
} }
@@ -51,31 +51,37 @@ public class MagicTeleports {
public static final boolean MAGIC_LEVEL_REQUIRED = true, RUNES_REQUIRED = true; public static final boolean MAGIC_LEVEL_REQUIRED = true, RUNES_REQUIRED = true;
public static boolean teleportCheck(Client player) {
if (player.teleTimer > 0) {
return false;
}
return true;
}
public static void paddewwaTeleport(Client player) { public static void paddewwaTeleport(Client player) {
if (System.currentTimeMillis() - player.lastCast < 5000) { if (!teleportCheck(player)) {
return; return;
} }
RandomEventHandler.addRandom(player); RandomEventHandler.addRandom(player);
if (RUNES_REQUIRED) { if (RUNES_REQUIRED) {
if (!CastRequirements.hasRunes(player, new int[][]{{LAW_RUNE, 2}, {FIRE_RUNE, 1}, {AIR_RUNE, 1}})) { if (!CastRequirements.hasRunes(player, new int[][]{{LAW_RUNE, 2}, {FIRE_RUNE, 1}, {AIR_RUNE, 1}})) {
player.getActionSender().sendMessage("You don't have the required runes to cast this spell."); player.getActionSender().sendMessage("You don't have the required runes to cast this spell.");
return; return;
}
}
if (MAGIC_LEVEL_REQUIRED) {
if (player.playerLevel[player.playerMagic] < 54) {
player.getActionSender().sendMessage("You need a magic level of 54 to cast this spell.");
return;
}
}
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 2}, {FIRE_RUNE, 1}, {AIR_RUNE, 1}});
player.getPlayerAssistant().startTeleport(PADDEWWA_X + Misc.random(2), PADDEWWA_Y - Misc.random(2), 0, "ancient");
player.lastCast = System.currentTimeMillis();
player.getPlayerAssistant().addSkillXP(64, player.playerMagic);
} }
}
if (MAGIC_LEVEL_REQUIRED) {
if (player.playerLevel[player.playerMagic] < 54) {
player.getActionSender().sendMessage("You need a magic level of 54 to cast this spell.");
return;
}
}
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 2}, {FIRE_RUNE, 1}, {AIR_RUNE, 1}});
player.getPlayerAssistant().startTeleport(PADDEWWA_X + Misc.random(2), PADDEWWA_Y - Misc.random(2), 0, "ancient");
player.getPlayerAssistant().addSkillXP(64, player.playerMagic);
}
public static void senntisenTeleport(Client player) { public static void senntisenTeleport(Client player) {
if (System.currentTimeMillis() - player.lastCast < 5000) { if (!teleportCheck(player)) {
return; return;
} }
RandomEventHandler.addRandom(player); RandomEventHandler.addRandom(player);
@@ -93,12 +99,11 @@ public class MagicTeleports {
} }
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 2}, {SOUL_RUNE, 1}}); CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 2}, {SOUL_RUNE, 1}});
player.getPlayerAssistant().startTeleport(SENNTISTEN_X + Misc.random(1), SENNTISTEN_Y - Misc.random(1), 0, "ancient"); player.getPlayerAssistant().startTeleport(SENNTISTEN_X + Misc.random(1), SENNTISTEN_Y - Misc.random(1), 0, "ancient");
player.lastCast = System.currentTimeMillis();
player.getPlayerAssistant().addSkillXP(70, player.playerMagic); player.getPlayerAssistant().addSkillXP(70, player.playerMagic);
} }
public static void kharyllTeleport(Client player) { public static void kharyllTeleport(Client player) {
if (System.currentTimeMillis() - player.lastCast < 5000) { if (!teleportCheck(player)) {
return; return;
} }
RandomEventHandler.addRandom(player); RandomEventHandler.addRandom(player);
@@ -116,60 +121,57 @@ public class MagicTeleports {
} }
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 2}, {BLOOD_RUNE, 1}}); CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 2}, {BLOOD_RUNE, 1}});
player.getPlayerAssistant().startTeleport(KHARYRLL_X, KHARYRLL_Y, 0, "ancient"); player.getPlayerAssistant().startTeleport(KHARYRLL_X, KHARYRLL_Y, 0, "ancient");
player.lastCast = System.currentTimeMillis();
player.getPlayerAssistant().addSkillXP(76, player.playerMagic); player.getPlayerAssistant().addSkillXP(76, player.playerMagic);
} }
public static void lassarTeleport(Client player) { public static void lassarTeleport(Client player) {
if (System.currentTimeMillis() - player.lastCast < 5000) { if (!teleportCheck(player)) {
return;
}
RandomEventHandler.addRandom(player);
if (RUNES_REQUIRED) {
if (!CastRequirements.hasRunes(player, new int[][]{{LAW_RUNE, 2}, {WATER_RUNE, 4}})) {
player.getActionSender().sendMessage("You don't have the required runes to cast this spell.");
return; return;
} }
RandomEventHandler.addRandom(player);
if (RUNES_REQUIRED) {
if (!CastRequirements.hasRunes(player, new int[][]{{LAW_RUNE, 2}, {WATER_RUNE, 4}})) {
player.getActionSender().sendMessage("You don't have the required runes to cast this spell.");
return;
}
}
if (MAGIC_LEVEL_REQUIRED) {
if (player.playerLevel[player.playerMagic] < 72) {
player.getActionSender().sendMessage("You need a magic level of 72 to cast this spell.");
return;
}
}
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 2}, {WATER_RUNE, 4}});
player.getPlayerAssistant().startTeleport(LASSAR_X + Misc.random(2), LASSAR_Y - Misc.random(2), 0, "ancient");
player.lastCast = System.currentTimeMillis();
player.getPlayerAssistant().addSkillXP(82, player.playerMagic);
} }
if (MAGIC_LEVEL_REQUIRED) {
if (player.playerLevel[player.playerMagic] < 72) {
player.getActionSender().sendMessage("You need a magic level of 72 to cast this spell.");
return;
}
}
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 2}, {WATER_RUNE, 4}});
player.getPlayerAssistant().startTeleport(LASSAR_X + Misc.random(2), LASSAR_Y - Misc.random(2), 0, "ancient");
player.getPlayerAssistant().addSkillXP(82, player.playerMagic);
}
public static void dareeyakTeleport(Client player) { public static void dareeyakTeleport(Client player) {
if (System.currentTimeMillis() - player.lastCast < 5000) { if (!teleportCheck(player)) {
return; return;
} }
RandomEventHandler.addRandom(player); RandomEventHandler.addRandom(player);
if (RUNES_REQUIRED) { if (RUNES_REQUIRED) {
if (!CastRequirements.hasRunes(player, new int[][]{{LAW_RUNE, 2}, {FIRE_RUNE, 3}, {AIR_RUNE, 2}})) { if (!CastRequirements.hasRunes(player, new int[][]{{LAW_RUNE, 2}, {FIRE_RUNE, 3}, {AIR_RUNE, 2}})) {
player.getActionSender().sendMessage("You don't have the required runes to cast this spell."); player.getActionSender().sendMessage("You don't have the required runes to cast this spell.");
return; return;
}
}
if (MAGIC_LEVEL_REQUIRED) {
if (player.playerLevel[player.playerMagic] < 78) {
player.getActionSender().sendMessage("You need a magic level of 78 to cast this spell.");
return;
}
}
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 2}, {FIRE_RUNE, 3}, {AIR_RUNE, 2}});
player.getPlayerAssistant().startTeleport(
DAREEYAK_X + Misc.random(1),
DAREEYAK_Y - Misc.random(1), 0, "ancient");
player.lastCast = System.currentTimeMillis();
player.getPlayerAssistant().addSkillXP(88, player.playerMagic);
} }
}
if (MAGIC_LEVEL_REQUIRED) {
if (player.playerLevel[player.playerMagic] < 78) {
player.getActionSender().sendMessage("You need a magic level of 78 to cast this spell.");
return;
}
}
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 2}, {FIRE_RUNE, 3}, {AIR_RUNE, 2}});
player.getPlayerAssistant().startTeleport(
DAREEYAK_X + Misc.random(1),
DAREEYAK_Y - Misc.random(1), 0, "ancient");
player.getPlayerAssistant().addSkillXP(88, player.playerMagic);
}
public static void carrallangarTeleport(Client player) { public static void carrallangarTeleport(Client player) {
if (System.currentTimeMillis() - player.lastCast < 5000) { if (!teleportCheck(player)) {
return; return;
} }
RandomEventHandler.addRandom(player); RandomEventHandler.addRandom(player);
@@ -189,12 +191,11 @@ public class MagicTeleports {
} }
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 2}, {SOUL_RUNE, 2}}); CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 2}, {SOUL_RUNE, 2}});
player.getPlayerAssistant().startTeleport(CARRALLANGAR_X + Misc.random(2), CARRALLANGAR_Y - Misc.random(2), 0, "ancient"); player.getPlayerAssistant().startTeleport(CARRALLANGAR_X + Misc.random(2), CARRALLANGAR_Y - Misc.random(2), 0, "ancient");
player.lastCast = System.currentTimeMillis();
player.getPlayerAssistant().addSkillXP(94, player.playerMagic); player.getPlayerAssistant().addSkillXP(94, player.playerMagic);
} }
public static void annakarlTeleport(Client player) { public static void annakarlTeleport(Client player) {
if (System.currentTimeMillis() - player.lastCast < 5000) { if (!teleportCheck(player)) {
return; return;
} }
RandomEventHandler.addRandom(player); RandomEventHandler.addRandom(player);
@@ -212,224 +213,214 @@ public class MagicTeleports {
} }
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 2}, {BLOOD_RUNE, 2}}); CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 2}, {BLOOD_RUNE, 2}});
player.getPlayerAssistant().startTeleport(ANNAKARL_X + Misc.random(1), ANNAKARL_Y - Misc.random(1), 0, "ancient"); player.getPlayerAssistant().startTeleport(ANNAKARL_X + Misc.random(1), ANNAKARL_Y - Misc.random(1), 0, "ancient");
player.lastCast = System.currentTimeMillis();
player.getPlayerAssistant().addSkillXP(100, player.playerMagic); player.getPlayerAssistant().addSkillXP(100, player.playerMagic);
} }
public static void ghorrockTeleport(Client player) { public static void ghorrockTeleport(Client player) {
if (System.currentTimeMillis() - player.lastCast < 5000) { if (!teleportCheck(player)) {
return;
}
RandomEventHandler.addRandom(player);
if (RUNES_REQUIRED) {
if (!CastRequirements.hasRunes(player, new int[][]{{LAW_RUNE, 2}, {WATER_RUNE, 8}})) {
player.getActionSender().sendMessage("You don't have the required runes to cast this spell.");
return; return;
} }
RandomEventHandler.addRandom(player);
if (RUNES_REQUIRED) {
if (!CastRequirements.hasRunes(player, new int[][]{{LAW_RUNE, 2}, {WATER_RUNE, 8}})) {
player.getActionSender().sendMessage("You don't have the required runes to cast this spell.");
return;
}
}
if (MAGIC_LEVEL_REQUIRED) {
if (player.playerLevel[player.playerMagic] < 96) {
player.getActionSender().sendMessage("You need a magic level of 96 to cast this spell.");
return;
}
}
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 2}, {WATER_RUNE, 8}});
player.getPlayerAssistant().startTeleport(GHORROCK_X + Misc.random(3),
GHORROCK_Y - Misc.random(3), 0, "ancient");
player.lastCast = System.currentTimeMillis();
player.getPlayerAssistant().addSkillXP(106, player.playerMagic);
} }
if (MAGIC_LEVEL_REQUIRED) {
if (player.playerLevel[player.playerMagic] < 96) {
player.getActionSender().sendMessage("You need a magic level of 96 to cast this spell.");
return;
}
}
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 2}, {WATER_RUNE, 8}});
player.getPlayerAssistant().startTeleport(GHORROCK_X + Misc.random(3),
GHORROCK_Y - Misc.random(3), 0, "ancient");
player.getPlayerAssistant().addSkillXP(106, player.playerMagic);
}
public static void varrockTeleport(Client player) { public static void varrockTeleport(Client player) {
if (System.currentTimeMillis() - player.lastCast < 5000) { if (!teleportCheck(player)) {
return; return;
} }
RandomEventHandler.addRandom(player); RandomEventHandler.addRandom(player);
if (RUNES_REQUIRED) { if (RUNES_REQUIRED) {
if (!CastRequirements.hasRunes(player, new int[][]{{LAW_RUNE, 1}, {FIRE_RUNE, 1}, {AIR_RUNE, 3}})) { if (!CastRequirements.hasRunes(player, new int[][]{{LAW_RUNE, 1}, {FIRE_RUNE, 1}, {AIR_RUNE, 3}})) {
player.getActionSender().sendMessage("You don't have the required runes to cast this spell."); player.getActionSender().sendMessage("You don't have the required runes to cast this spell.");
return; return;
}
}
if (MAGIC_LEVEL_REQUIRED) {
if (player.playerLevel[player.playerMagic] < 25) {
player.getActionSender().sendMessage("You need a magic level of 25 to cast this spell.");
return;
}
}
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 1}, {FIRE_RUNE, 1}, {AIR_RUNE, 3}});
player.getPlayerAssistant().startTeleport(VARROCK_X + Misc.random(2), VARROCK_Y - Misc.random(2), 0, "modern");
player.lastCast = System.currentTimeMillis();
player.getPlayerAssistant().addSkillXP(35, player.playerMagic);
} }
}
if (MAGIC_LEVEL_REQUIRED) {
if (player.playerLevel[player.playerMagic] < 25) {
player.getActionSender().sendMessage("You need a magic level of 25 to cast this spell.");
return;
}
}
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 1}, {FIRE_RUNE, 1}, {AIR_RUNE, 3}});
player.getPlayerAssistant().startTeleport(VARROCK_X + Misc.random(2), VARROCK_Y - Misc.random(2), 0, "modern");
player.getPlayerAssistant().addSkillXP(35, player.playerMagic);
}
public static void lumbridgeTeleport(Client player) { public static void lumbridgeTeleport(Client player) {
if (System.currentTimeMillis() - player.lastCast < 5000) { if (!teleportCheck(player)) {
return; return;
} }
RandomEventHandler.addRandom(player); RandomEventHandler.addRandom(player);
if (RUNES_REQUIRED) { if (RUNES_REQUIRED) {
if (!CastRequirements.hasRunes(player, new int[][]{{LAW_RUNE, 1}, {EARTH_RUNE, 1}, {AIR_RUNE, 3}})) { if (!CastRequirements.hasRunes(player, new int[][]{{LAW_RUNE, 1}, {EARTH_RUNE, 1}, {AIR_RUNE, 3}})) {
player.getActionSender().sendMessage("You don't have the required runes to cast this spell."); player.getActionSender().sendMessage("You don't have the required runes to cast this spell.");
return; return;
}
}
if (MAGIC_LEVEL_REQUIRED) {
if (player.playerLevel[player.playerMagic] < 32) {
player.getActionSender().sendMessage("You need a magic level of 32 to cast this spell.");
return;
}
}
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 1}, {EARTH_RUNE, 1}, {AIR_RUNE, 3}});
player.getPlayerAssistant().startTeleport(LUMBRIDGE_X, LUMBRIDGE_Y, 0, "modern");
player.lastCast = System.currentTimeMillis();
player.getPlayerAssistant().addSkillXP(35, player.playerMagic);
} }
}
if (MAGIC_LEVEL_REQUIRED) {
if (player.playerLevel[player.playerMagic] < 32) {
player.getActionSender().sendMessage("You need a magic level of 32 to cast this spell.");
return;
}
}
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 1}, {EARTH_RUNE, 1}, {AIR_RUNE, 3}});
player.getPlayerAssistant().startTeleport(LUMBRIDGE_X, LUMBRIDGE_Y, 0, "modern");
player.getPlayerAssistant().addSkillXP(35, player.playerMagic);
}
public static void faladorTeleport(Client player) { public static void faladorTeleport(Client player) {
if (System.currentTimeMillis() - player.lastCast < 5000) { /*if (!teleportCheck(player)) {
return; return;
} }*/
RandomEventHandler.addRandom(player); RandomEventHandler.addRandom(player);
if (RUNES_REQUIRED) { if (RUNES_REQUIRED) {
if (!CastRequirements.hasRunes(player, new int[][]{{LAW_RUNE, 1}, {WATER_RUNE, 1}, {AIR_RUNE, 3}})) { if (!CastRequirements.hasRunes(player, new int[][]{{LAW_RUNE, 1}, {WATER_RUNE, 1}, {AIR_RUNE, 3}})) {
player.getActionSender().sendMessage("You don't have the required runes to cast this spell."); player.getActionSender().sendMessage("You don't have the required runes to cast this spell.");
return; return;
}
}
if (MAGIC_LEVEL_REQUIRED) {
if (player.playerLevel[player.playerMagic] < 37) {
player.getActionSender().sendMessage("You need a magic level of 37 to cast this spell.");
return;
}
}
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 1}, {WATER_RUNE, 1}, {AIR_RUNE, 3}});
player.getPlayerAssistant().startTeleport(FALADOR_X + Misc.random(4), FALADOR_Y - Misc.random(4), 0, "modern");
player.lastCast = System.currentTimeMillis();
player.getPlayerAssistant().addSkillXP(48, player.playerMagic);
} }
}
if (MAGIC_LEVEL_REQUIRED) {
if (player.playerLevel[player.playerMagic] < 37) {
player.getActionSender().sendMessage("You need a magic level of 37 to cast this spell.");
return;
}
}
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 1}, {WATER_RUNE, 1}, {AIR_RUNE, 3}});
player.getPlayerAssistant().startTeleport(FALADOR_X + Misc.random(4), FALADOR_Y - Misc.random(4), 0, "modern");
player.getPlayerAssistant().addSkillXP(48, player.playerMagic);
}
public static void camelotTeleport(Client player) { public static void camelotTeleport(Client player) {
if (System.currentTimeMillis() - player.lastCast < 5000) { if (!teleportCheck(player)) {
return;
}
RandomEventHandler.addRandom(player);
if (RUNES_REQUIRED) {
if (!CastRequirements.hasRunes(player, new int[][]{{LAW_RUNE, 1}, {AIR_RUNE, 5}})) {
player.getActionSender().sendMessage("You don't have the required runes to cast this spell.");
return; return;
} }
RandomEventHandler.addRandom(player);
if (RUNES_REQUIRED) {
if (!CastRequirements.hasRunes(player, new int[][]{{LAW_RUNE, 1}, {AIR_RUNE, 5}})) {
player.getActionSender().sendMessage("You don't have the required runes to cast this spell.");
return;
}
}
if (MAGIC_LEVEL_REQUIRED) {
if (player.playerLevel[player.playerMagic] < 45) {
player.getActionSender().sendMessage("You need a magic level of 45 to cast this spell.");
return;
}
}
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 1}, {AIR_RUNE, 5}});
// 2757, 3479
player.getPlayerAssistant().startTeleport(CAMELOT_X + Misc.random(1), CAMELOT_Y - Misc.random(1), 0, "modern");
player.lastCast = System.currentTimeMillis();
player.getPlayerAssistant().addSkillXP(55.5, player.playerMagic);
} }
if (MAGIC_LEVEL_REQUIRED) {
if (player.playerLevel[player.playerMagic] < 45) {
player.getActionSender().sendMessage("You need a magic level of 45 to cast this spell.");
return;
}
}
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 1}, {AIR_RUNE, 5}});
// 2757, 3479
player.getPlayerAssistant().startTeleport(CAMELOT_X + Misc.random(1), CAMELOT_Y - Misc.random(1), 0, "modern");
player.getPlayerAssistant().addSkillXP(55.5, player.playerMagic);
}
public static void ardougneTeleport(Client player) { public static void ardougneTeleport(Client player) {
if (System.currentTimeMillis() - player.lastCast < 5000) { if (!teleportCheck(player)) {
return;
}
RandomEventHandler.addRandom(player);
if (RUNES_REQUIRED) {
if (!CastRequirements.hasRunes(player, new int[][]{{LAW_RUNE, 2}, {WATER_RUNE, 2}})) {
player.getActionSender().sendMessage("You don't have the required runes to cast this spell.");
return; return;
} }
RandomEventHandler.addRandom(player);
if (RUNES_REQUIRED) {
if (!CastRequirements.hasRunes(player, new int[][]{{LAW_RUNE, 2}, {WATER_RUNE, 2}})) {
player.getActionSender().sendMessage("You don't have the required runes to cast this spell.");
return;
}
}
if (MAGIC_LEVEL_REQUIRED) {
if (player.playerLevel[player.playerMagic] < 51) {
player.getActionSender().sendMessage("You need a magic level of 51 to cast this spell.");
return;
}
}
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 2}, {WATER_RUNE, 2}});
player.getPlayerAssistant().startTeleport(ARDOUGNE_X + Misc.random(4),
ARDOUGNE_Y - Misc.random(4), 0, "modern");
player.lastCast = System.currentTimeMillis();
player.getPlayerAssistant().addSkillXP(61, player.playerMagic);
} }
if (MAGIC_LEVEL_REQUIRED) {
if (player.playerLevel[player.playerMagic] < 51) {
player.getActionSender().sendMessage("You need a magic level of 51 to cast this spell.");
return;
}
}
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 2}, {WATER_RUNE, 2}});
player.getPlayerAssistant().startTeleport(ARDOUGNE_X + Misc.random(4),
ARDOUGNE_Y - Misc.random(4), 0, "modern");
player.getPlayerAssistant().addSkillXP(61, player.playerMagic);
}
public static void watchTowerTeleport(Client player) { public static void watchTowerTeleport(Client player) {
if (System.currentTimeMillis() - player.lastCast < 5000) { if (!teleportCheck(player)) {
return;
}
RandomEventHandler.addRandom(player);
if (RUNES_REQUIRED) {
if (!CastRequirements.hasRunes(player, new int[][]{{LAW_RUNE, 2}, {EARTH_RUNE, 2}})) {
player.getActionSender().sendMessage("You don't have the required runes to cast this spell.");
return; return;
} }
RandomEventHandler.addRandom(player);
if (RUNES_REQUIRED) {
if (!CastRequirements.hasRunes(player, new int[][]{{LAW_RUNE, 2}, {EARTH_RUNE, 2}})) {
player.getActionSender().sendMessage("You don't have the required runes to cast this spell.");
return;
}
}
if (MAGIC_LEVEL_REQUIRED) {
if (player.playerLevel[player.playerMagic] < 58) {
player.getActionSender().sendMessage(
"You need a magic level of 58 to cast this spell.");
return;
}
}
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 2}, {EARTH_RUNE, 2}});
player.getPlayerAssistant().startTeleport(WATCHTOWER_X, WATCHTOWER_Y, 1, "modern");
player.lastCast = System.currentTimeMillis();
player.getPlayerAssistant().addSkillXP(68, player.playerMagic);
} }
if (MAGIC_LEVEL_REQUIRED) {
if (player.playerLevel[player.playerMagic] < 58) {
player.getActionSender().sendMessage(
"You need a magic level of 58 to cast this spell.");
return;
}
}
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 2}, {EARTH_RUNE, 2}});
player.getPlayerAssistant().startTeleport(WATCHTOWER_X, WATCHTOWER_Y, 1, "modern");
player.getPlayerAssistant().addSkillXP(68, player.playerMagic);
}
public static void trollhiemTeleport(Client player) { public static void trollhiemTeleport(Client player) {
if (System.currentTimeMillis() - player.lastCast < 5000) { if (!teleportCheck(player)) {
return;
}
RandomEventHandler.addRandom(player);
if (RUNES_REQUIRED) {
if (!CastRequirements.hasRunes(player, new int[][]{{LAW_RUNE, 2}, {FIRE_RUNE, 2}})) {
player.getActionSender().sendMessage("You don't have the required runes to cast this spell.");
return; return;
} }
RandomEventHandler.addRandom(player);
if (RUNES_REQUIRED) {
if (!CastRequirements.hasRunes(player, new int[][]{{LAW_RUNE, 2}, {FIRE_RUNE, 2}})) {
player.getActionSender().sendMessage("You don't have the required runes to cast this spell.");
return;
}
}
if (MAGIC_LEVEL_REQUIRED) {
if (player.playerLevel[player.playerMagic] < 61) {
player.getActionSender().sendMessage("You need a magic level of 61 to cast this spell.");
return;
}
}
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 2}, {FIRE_RUNE, 2}});
player.getPlayerAssistant().startTeleport(2892 + Misc.random(2),
3679 - Misc.random(2), 0, "modern");
player.lastCast = System.currentTimeMillis();
player.getPlayerAssistant().addSkillXP(68, player.playerMagic);
} }
if (MAGIC_LEVEL_REQUIRED) {
if (player.playerLevel[player.playerMagic] < 61) {
player.getActionSender().sendMessage("You need a magic level of 61 to cast this spell.");
return;
}
}
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 2}, {FIRE_RUNE, 2}});
player.getPlayerAssistant().startTeleport(2892 + Misc.random(2),
3679 - Misc.random(2), 0, "modern");
player.getPlayerAssistant().addSkillXP(68, player.playerMagic);
}
public static void apeAtollTeleport(Client player) { public static void apeAtollTeleport(Client player) {
if (System.currentTimeMillis() - player.lastCast < 5000) { if (!teleportCheck(player)) {
return; return;
} }
RandomEventHandler.addRandom(player); RandomEventHandler.addRandom(player);
if (RUNES_REQUIRED) { if (RUNES_REQUIRED) {
if (!CastRequirements.hasRunes(player, new int[][]{{LAW_RUNE, 2}, {FIRE_RUNE, 2}, {WATER_RUNE, 2}}) || !player.getItemAssistant().playerHasItem(BANANA, 1)) { if (!CastRequirements.hasRunes(player, new int[][]{{LAW_RUNE, 2}, {FIRE_RUNE, 2}, {WATER_RUNE, 2}}) || !player.getItemAssistant().playerHasItem(BANANA, 1)) {
player.getActionSender().sendMessage("You don't have the required items to cast this spell."); player.getActionSender().sendMessage("You don't have the required items to cast this spell.");
return; return;
}
}
if (player.questPoints < 19) {
player.getActionSender().sendMessage("You need " + 19 + " quest points to teleport here.");
return;
}
if (MAGIC_LEVEL_REQUIRED) {
if (player.playerLevel[player.playerMagic] < 64) {
player.getActionSender().sendMessage("You need a magic level of 64 to cast this spell.");
return;
}
}
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 2}, {FIRE_RUNE, 2}, {WATER_RUNE, 2}});
player.getItemAssistant().deleteItem2(BANANA, 1);
player.getPlayerAssistant().startTeleport(2798 + Misc.random(1), 2798 - Misc.random(1), 1, "modern");
player.lastCast = System.currentTimeMillis();
player.getPlayerAssistant().addSkillXP(76, player.playerMagic);
} }
}
if (player.questPoints < 19) {
player.getActionSender().sendMessage("You need " + 19 + " quest points to teleport here.");
return;
}
if (MAGIC_LEVEL_REQUIRED) {
if (player.playerLevel[player.playerMagic] < 64) {
player.getActionSender().sendMessage("You need a magic level of 64 to cast this spell.");
return;
}
}
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 2}, {FIRE_RUNE, 2}, {WATER_RUNE, 2}});
player.getItemAssistant().deleteItem2(BANANA, 1);
player.getPlayerAssistant().startTeleport(2798 + Misc.random(1), 2798 - Misc.random(1), 1, "modern");
player.getPlayerAssistant().addSkillXP(76, player.playerMagic);
}
} }
@@ -36,6 +36,7 @@ public class GateHandler {
private static void openDoubleGate(Client player, int objectId, int objectId2, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4, int face1, int face2) { private static void openDoubleGate(Client player, int objectId, int objectId2, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4, int face1, int face2) {
if (isGate(objectId) && isGate(objectId2) && gateAmount == 0) { if (isGate(objectId) && isGate(objectId2) && gateAmount == 0) {
// open gate from default map object
spawnGate(-1, x3, y3, player.heightLevel, 0); spawnGate(-1, x3, y3, player.heightLevel, 0);
spawnGate(-1, x4, y4, player.heightLevel, 0); spawnGate(-1, x4, y4, player.heightLevel, 0);
spawnGate(objectId, x1, y1, player.heightLevel, face1); spawnGate(objectId, x1, y1, player.heightLevel, face1);
@@ -47,6 +48,7 @@ public class GateHandler {
ObjectManager.doubleGateTicks(player, objectId, x3, y3, x1, y1, x2, y2, player.heightLevel, face2, gateTicks); ObjectManager.doubleGateTicks(player, objectId, x3, y3, x1, y1, x2, y2, player.heightLevel, face2, gateTicks);
ObjectManager.doubleGateTicks(player, objectId2, x4, y4, x1, y1, x2, y2, player.heightLevel, face2, gateTicks); ObjectManager.doubleGateTicks(player, objectId2, x4, y4, x1, y1, x2, y2, player.heightLevel, face2, gateTicks);
} else if (isGate(objectId) && isGate(objectId2) && gateAmount == 2) { } else if (isGate(objectId) && isGate(objectId2) && gateAmount == 2) {
// close gate back to default
ObjectManager.doubleGateTicks(player, objectId, x3, y3, x1, y1, x2, y2, player.heightLevel, face2, 0); ObjectManager.doubleGateTicks(player, objectId, x3, y3, x1, y1, x2, y2, player.heightLevel, face2, 0);
ObjectManager.doubleGateTicks(player, objectId2, x4, y4, x1, y1, x2, y2, player.heightLevel, face2, 0); ObjectManager.doubleGateTicks(player, objectId2, x4, y4, x1, y1, x2, y2, player.heightLevel, face2, 0);
} }
@@ -20,13 +20,17 @@ public class PassDoor {
client.getActionSender().sendMessage("You must wait longer to pass this door."); client.getActionSender().sendMessage("You must wait longer to pass this door.");
return false; return false;
} }
client.getActionSender().object(objectType, client.objectX, client.objectY, height, face1, type);
final int objX = client.objectX;
final int objY = client.objectY;
client.getActionSender().object(objectType, objX, objY, height, face1, type);
client.getPlayerAssistant().walkTo(x, y); client.getPlayerAssistant().walkTo(x, y);
client.stopPlayer = true; client.stopPlayer = true;
CycleEventHandler.getSingleton().addEvent(client, new CycleEvent() { CycleEventHandler.getSingleton().addEvent(client, new CycleEvent() {
@Override @Override
public void execute(CycleEventContainer container) { public void execute(CycleEventContainer container) {
client.getActionSender().object(objectType, client.objectX, client.objectY, height, face2, type); client.getActionSender().object(objectType, objX, objY, height, face2, type);
container.stop(); container.stop();
} }
@@ -96,6 +100,7 @@ public class PassDoor {
if (Position.checkPosition(client, 3108, 3162, 0)) { if (Position.checkPosition(client, 3108, 3162, 0)) {
passThroughDoor(client, objectType, 2, 1, 9, -1, -1, 0); passThroughDoor(client, objectType, 2, 1, 9, -1, -1, 0);
} else if (Position.checkPosition(client, 3107, 3163, 0)) { } else if (Position.checkPosition(client, 3107, 3163, 0)) {
// wizz tower
passThroughDoor(client, objectType, 2, 1, 9, -1, -1, 0); passThroughDoor(client, objectType, 2, 1, 9, -1, -1, 0);
} else { } else {
if (client.heightLevel == 0) { if (client.heightLevel == 0) {
@@ -26,6 +26,7 @@ import redone.game.content.combat.magic.MagicTeleports;
import redone.game.content.combat.prayer.PrayerData; import redone.game.content.combat.prayer.PrayerData;
import redone.game.content.combat.prayer.PrayerDrain; import redone.game.content.combat.prayer.PrayerDrain;
import redone.game.content.combat.range.DwarfCannon; import redone.game.content.combat.range.DwarfCannon;
import redone.game.content.combat.range.RangeData;
import redone.game.content.consumables.Food; import redone.game.content.consumables.Food;
import redone.game.content.consumables.Potions; import redone.game.content.consumables.Potions;
import redone.game.content.guilds.impl.RangersGuild; import redone.game.content.guilds.impl.RangersGuild;
@@ -62,6 +63,7 @@ import redone.game.items.impl.PotionMixing;
import redone.game.items.impl.Teles; import redone.game.items.impl.Teles;
import redone.game.items.impl.Weight; import redone.game.items.impl.Weight;
import redone.game.npcs.NpcActions; import redone.game.npcs.NpcActions;
import redone.game.npcs.NpcHandler;
import redone.game.objects.ObjectsActions; import redone.game.objects.ObjectsActions;
import redone.game.players.antimacro.AntiBotting; import redone.game.players.antimacro.AntiBotting;
import redone.game.shops.ShopAssistant; import redone.game.shops.ShopAssistant;
@@ -394,6 +396,10 @@ public class Client extends Player {
currentTask = CycleEventHandler.getSingleton().addEvent(this, event, ticksBetweenExecution); currentTask = CycleEventHandler.getSingleton().addEvent(this, event, ticksBetweenExecution);
} }
public CycleEventContainer getCurrentTask() {
return currentTask;
}
public void endCurrentTask() { public void endCurrentTask() {
if (currentTask != null && currentTask.isRunning()) { if (currentTask != null && currentTask.isRunning()) {
currentTask.stop(); currentTask.stop();
@@ -1069,11 +1075,11 @@ public class Client extends Player {
teleTimer = 0; teleTimer = 0;
getPlayerAssistant().changeLocation(); getPlayerAssistant().changeLocation();
} }
if (teleTimer == 5) { if (teleTimer == 4) {
teleTimer--; teleTimer--;
getPlayerAssistant().processTeleport(); getPlayerAssistant().processTeleport();
} }
if (teleTimer == 9 && teleGfx > 0) { if (teleTimer == 7 && teleGfx > 0) {
teleTimer--; teleTimer--;
gfx100(teleGfx); gfx100(teleGfx);
} }
@@ -1091,6 +1097,9 @@ public class Client extends Player {
} }
} }
combatAssistant.attackingNpcTick();
combatAssistant.attackingPlayerTick();
if (attackTimer > 0) { if (attackTimer > 0) {
attackTimer--; attackTimer--;
} }
@@ -30,7 +30,7 @@ public abstract class Player {
{2035, 0} {2035, 0}
}; };
public long lastCast = 0, homeTele, lastDesert, eventTimer, lastRunRecovery, public long homeTele, lastDesert, eventTimer, lastRunRecovery,
lastButton, lastFire, lastLight, muteTime, waitTime, miscTimer, lastButton, lastFire, lastLight, muteTime, waitTime, miscTimer,
ladderTimer, webSlashDelay, climbDelay, lastReport = 0, ladderTimer, webSlashDelay, climbDelay, lastReport = 0,
lastPlayerMove, lastPoison, lastPoisonSip, poisonImmune, lastSpear, lastPlayerMove, lastPoison, lastPoisonSip, poisonImmune, lastSpear,
@@ -555,7 +555,7 @@ public class PlayerAssistant {
} }
} }
for (int i = 0; i < path.length; i++) { for (int i = 0; i < path.length; i++) {
if (!Region.getClipping(path[i][0], path[i][1], path[i][2], path[i][3], path[i][4]) && !Region.blockedShot(path[i][0], path[i][1], path[i][2])) { if (!Region.getClipping(path[i][0], path[i][1], path[i][2], path[i][3], path[i][4])/* && !Region.blockedShot(path[i][0], path[i][1], path[i][2])*/) {
return true; return true;
} }
} }
@@ -641,11 +641,11 @@ public class PlayerAssistant {
return false; return false;
} }
} }
for (int i = 0; i < path.length; i++) { /*for (int i = 0; i < path.length; i++) {
if (!Region.blockedShot(path[i][0], path[i][1], path[i][2])) { if (!Region.blockedShot(path[i][0], path[i][1], path[i][2])) {
return true; return true;
} }
} }*/
return false; return false;
} }
@@ -756,9 +756,6 @@ public class PlayerAssistant {
"You are teleblocked and can't teleport."); "You are teleblocked and can't teleport.");
return; return;
} }
if (Constants.SOUND) {
player.getActionSender().sendSound(SoundList.TELEPORT, 100, 0);
}
if (SkillHandler.isSkilling(player)) { if (SkillHandler.isSkilling(player)) {
player.getActionSender().sendMessage( player.getActionSender().sendMessage(
"You can't teleport while skilling!"); "You can't teleport while skilling!");
@@ -782,9 +779,12 @@ public class PlayerAssistant {
player.teleHeight = height; player.teleHeight = height;
// client.resetShaking(); // client.resetShaking();
player.isTeleporting = true; player.isTeleporting = true;
if (Constants.SOUND) {
player.getActionSender().sendSound(SoundList.TELEPORT, 100, 700);
}
if (teleportType.equalsIgnoreCase("modern")) { if (teleportType.equalsIgnoreCase("modern")) {
player.startAnimation(714); player.startAnimation(714, 10);
player.teleTimer = 11; player.teleTimer = 10;
player.teleGfx = 308; player.teleGfx = 308;
player.teleEndAnimation = 715; player.teleEndAnimation = 715;
} }
@@ -2081,6 +2081,42 @@ public class PlayerAssistant {
player.newLocation = 0; player.newLocation = 0;
} }
public int[] getFollowLocation(int x, int y) {
int[] nonDiags = {0, 2, 4, 6};
int[][] nodes = {
{ x + Misc.directionDeltaX[nonDiags[0]], y + Misc.directionDeltaY[nonDiags[0]] },
{ x + Misc.directionDeltaX[nonDiags[1]], y + Misc.directionDeltaY[nonDiags[1]] },
{ x + Misc.directionDeltaX[nonDiags[2]], y + Misc.directionDeltaY[nonDiags[2]] },
{ x + Misc.directionDeltaX[nonDiags[3]], y + Misc.directionDeltaY[nonDiags[3]] }
};
int bestX = 0;
int bestY = 0;
double bestDist = 99999;
boolean projectile = player.usingMagic || player.usingBow || player.usingRangeWeapon;
for (int i = 0; i < nodes.length; i++) {
double dist = Misc.distance(player.absX, player.absY, nodes[i][0], nodes[i][1]);
if (dist < bestDist) {
if (PathFinder.getPathFinder().accessible(player.absX, player.absY, player.heightLevel, nodes[i][0], nodes[i][1])) {
if (!projectile || PathFinder.isProjectilePathClear(nodes[i][0], nodes[i][1], player.heightLevel, x, y)) {
bestDist = dist;
bestX = nodes[i][0];
bestY = nodes[i][1];
}
}
}
}
if (bestX == 0 && bestY == 0) {
bestX = x;
bestY = y;
}
return new int[] {bestX, bestY};
}
public void followPlayer() { public void followPlayer() {
if (PlayerHandler.players[player.followId] == null if (PlayerHandler.players[player.followId] == null
|| PlayerHandler.players[player.followId].isDead) { || PlayerHandler.players[player.followId].isDead) {
@@ -2097,7 +2133,7 @@ public class PlayerAssistant {
int otherX = PlayerHandler.players[player.followId].getX(); int otherX = PlayerHandler.players[player.followId].getX();
int otherY = PlayerHandler.players[player.followId].getY(); int otherY = PlayerHandler.players[player.followId].getY();
boolean sameSpot = player.absX == otherX && player.absY == otherY; /*boolean sameSpot = player.absX == otherX && player.absY == otherY;
if (sameSpot) if (sameSpot)
stepAway(); stepAway();
@@ -2115,7 +2151,7 @@ public class PlayerAssistant {
|| player.autocasting || player.spellId > 0) || player.autocasting || player.spellId > 0)
&& mageDistance; && mageDistance;
boolean playerRanging = player.usingRangeWeapon && rangeWeaponDistance; boolean playerRanging = player.usingRangeWeapon && rangeWeaponDistance;
boolean playerBowOrCross = player.usingBow && bowDistance; boolean playerBowOrCross = player.usingBow && bowDistance;*/
if (!player.goodDistance(otherX, otherY, player.getX(), player.getY(), if (!player.goodDistance(otherX, otherY, player.getX(), player.getY(),
25)) { 25)) {
@@ -2123,8 +2159,12 @@ public class PlayerAssistant {
resetFollow(); resetFollow();
return; return;
} }
int[] follow = getFollowLocation(otherX, otherY);
player.faceUpdate(player.followId + 32768); player.faceUpdate(player.followId + 32768);
if (!sameSpot) { PathFinder.getPathFinder().findRoute(player, follow[0], follow[1], false, 1, 1);
/*if (!sameSpot) {
if (player.playerIndex > 0 && !player.usingSpecial if (player.playerIndex > 0 && !player.usingSpecial
&& player.inWild()) { && player.inWild()) {
if (player.usingSpecial && (playerRanging || playerBowOrCross)) { if (player.usingSpecial && (playerRanging || playerBowOrCross)) {
@@ -2194,30 +2234,28 @@ public class PlayerAssistant {
playerWalk(otherX - 1, otherY + 1); playerWalk(otherX - 1, otherY + 1);
} }
} }
player.faceUpdate(player.followId + 32768); player.faceUpdate(player.followId + 32768);*/
} }
public void followNpc() { public void followNpc() {
if (NpcHandler.npcs[player.followId] == null
|| NpcHandler.npcs[player.followId].isDead) {
resetFollow();
return;
}
Npc npc = NpcHandler.npcs[player.followId2]; Npc npc = NpcHandler.npcs[player.followId2];
if (npc.isDead) { if (npc == null || npc.isDead) {
return; return;
} }
int otherX = NpcHandler.npcs[player.followId2].getX(); int x = NpcHandler.npcs[player.followId2].getX();
int otherY = NpcHandler.npcs[player.followId2].getY(); int y = NpcHandler.npcs[player.followId2].getY();
if (!player.goodDistance(otherX, otherY, player.getX(), player.getY(), if (!player.goodDistance(x, y, player.getX(), player.getY(),25)) {
25)) {
player.followId2 = 0; player.followId2 = 0;
resetFollow(); resetFollow();
return; return;
} }
player.faceUpdate(player.followId2 + 32768);
if (otherX == player.absX && otherY == player.absY) { int[] follow = getFollowLocation(x, y);
player.faceUpdate(player.followId2);
PathFinder.getPathFinder().findRoute(player, follow[0], follow[1], false, 1, 1);
/*if (otherX == player.absX && otherY == player.absY) {
int r = Misc.random(3); int r = Misc.random(3);
switch (r) { switch (r) {
case 0: case 0:
@@ -2251,8 +2289,7 @@ public class PlayerAssistant {
} else if (otherX > player.getX() && otherY < player.getY()) { } else if (otherX > player.getX() && otherY < player.getY()) {
playerWalk(otherX - 1, otherY + 1); playerWalk(otherX - 1, otherY + 1);
} }
} }*/
player.faceUpdate(player.followId2 + 32768);
} }
public int getRunningMove(int i, int j) { public int getRunningMove(int i, int j) {
@@ -4,6 +4,7 @@ import java.net.InetSocketAddress;
import redone.Constants; import redone.Constants;
import redone.Server; import redone.Server;
import redone.event.CycleEventHandler;
import redone.game.content.minigames.castlewars.CastleWars; import redone.game.content.minigames.castlewars.CastleWars;
import redone.game.npcs.Npc; import redone.game.npcs.Npc;
import redone.game.npcs.NpcHandler; import redone.game.npcs.NpcHandler;
@@ -158,19 +159,21 @@ public class PlayerHandler {
continue; continue;
} }
players[i].preProcessing();
while (players[i].processQueuedPackets()) { while (players[i].processQueuedPackets()) {
; ;
} }
players[i].process(); players[i].process();
players[i].postProcessing(); players[i].postProcessing();
players[i].getNextPlayerMovement(); players[i].getNextPlayerMovement();
players[i].preProcessing();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
for (int i = 0; i < PlayerHandler.players.length; i++) { for (int i = 0; i < PlayerHandler.players.length; i++) {
if (players[i] == null || !players[i].isActive) { if (players[i] == null || !players[i].isActive) {
continue; continue;
@@ -244,21 +244,8 @@ public class ActionSender {
public ActionSender frame174(int sound, int vol, int delay) { public ActionSender frame174(int sound, int vol, int delay) {
player.outStream.createFrame(174); player.outStream.createFrame(174);
player.outStream.writeWord(sound); player.outStream.writeWord(sound);
player.outStream.writeByte(vol);
player.outStream.writeWord(delay); player.outStream.writeWord(delay);
player.updateRequired = true; player.outStream.writeByte(vol);
player.appearanceUpdateRequired = true;
return this;
}
public ActionSender frame174(int id, int type, int delay, int volume) {
if (player.outStream != null && player != null && id != -1) {
player.outStream.createFrame(174);
player.outStream.writeWord(id);
player.outStream.writeWord(delay);
player.outStream.writeWord(volume);
player.flushOutStream();
}
return this; return this;
} }
@@ -567,8 +554,6 @@ public class ActionSender {
public ActionSender sendSound(int id, int volume, int delay) { public ActionSender sendSound(int id, int volume, int delay) {
frame174(id, volume, delay); frame174(id, volume, delay);
player.updateRequired = true;
player.appearanceUpdateRequired = true;
return this; return this;
} }
@@ -43,7 +43,7 @@ public class ClickObject implements PacketType {
int[] size = object.getObjectSize(); int[] size = object.getObjectSize();
player.startCurrentTask(1, new CycleEvent() { CycleEvent objectWalkToEvent = new CycleEvent() {
@Override @Override
public void execute(CycleEventContainer container) { public void execute(CycleEventContainer container) {
if (objectX != player.objectX || objectY != player.objectY || objectId != player.objectId) { if (objectX != player.objectX || objectY != player.objectY || objectId != player.objectId) {
@@ -66,7 +66,10 @@ public class ClickObject implements PacketType {
@Override @Override
public void stop() {} public void stop() {}
}); };
player.startCurrentTask(1, objectWalkToEvent);
objectWalkToEvent.execute(player.getCurrentTask()); // cheap hax for instant event execution, since we don't support it
} }
@Override @Override
+20 -4
View File
@@ -19,6 +19,10 @@ public class Misc {
return (int) Math.random() * range; return (int) Math.random() * range;
} }
public static double distance(int x1, int y1, int x2, int y2 ) {
return Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2));
}
public static boolean goodDistance(int objectX, int objectY, int playerX, int playerY, int distance) { public static boolean goodDistance(int objectX, int objectY, int playerX, int playerY, int distance) {
return objectX - playerX <= distance && objectX - playerX >= -distance && objectY - playerY <= distance && objectY - playerY >= -distance; return objectX - playerX <= distance && objectX - playerX >= -distance && objectY - playerY <= distance && objectY - playerY >= -distance;
} }
@@ -255,6 +259,20 @@ public class Misc {
'&', '*', '\\', '\'', '@', '#', '+', '=', '\243', '$', '%', '"', '&', '*', '\\', '\'', '@', '#', '+', '=', '\243', '$', '%', '"',
'[', ']' }; '[', ']' };
public static int[] delta(int x1, int y1, int x2, int y2) {
return new int[] {x2 - x1, y2 - y1};
}
public static int directionFromDelta(int x, int y) {
for (int a = 0; a < directionDeltaX.length; a++) {
if (directionDeltaX[a] == x && directionDeltaY[a] == y) {
return xlateDirectionToClient[a];
}
}
throw new IllegalArgumentException(String.format("Cannot find direction %d %d", x, y));
}
public static int direction(int srcX, int srcY, int x, int y) { public static int direction(int srcX, int srcY, int x, int y) {
double dx = (double) x - srcX, dy = (double) y - srcY; double dx = (double) x - srcX, dy = (double) y - srcY;
double angle = Math.atan(dy / dx); double angle = Math.atan(dy / dx);
@@ -273,10 +291,8 @@ public class Misc {
*/ */
} }
public static byte directionDeltaX[] = new byte[] { 0, 1, 1, 1, 0, -1, -1, public static byte directionDeltaX[] = new byte[] { 0, 1, 1, 1, 0, -1, -1, -1 };
-1 }; public static byte directionDeltaY[] = new byte[] { 1, 1, 0, -1, -1, -1, 0, 1 };
public static byte directionDeltaY[] = new byte[] { 1, 1, 0, -1, -1, -1, 0,
1 };
public static byte xlateDirectionToClient[] = new byte[] { 1, 2, 4, 7, 6, public static byte xlateDirectionToClient[] = new byte[] { 1, 2, 4, 7, 6,
5, 3, 0 }; 5, 3, 0 };
@@ -63,7 +63,9 @@ public class ObjectManager {
}, ticks); }, ticks);
} }
public static void doubleGateTicks(final Client player, final int objectId, final int objectX, final int objectY, final int x1, final int y1, final int x2, final int y2, final int objectH, final int face, int ticks) { public static void doubleGateTicks(final Client player, final int objectId, final int objectX, final int objectY,
final int x1, final int y1, final int x2, final int y2,
final int objectH, final int face, int ticks) {
CycleEventHandler.getSingleton().addEvent(player, new CycleEvent() { CycleEventHandler.getSingleton().addEvent(player, new CycleEvent() {
@Override @Override
public void execute(CycleEventContainer container) { public void execute(CycleEventContainer container) {
@@ -279,6 +279,10 @@ public final class ObjectDef {
return aBoolean767; return aBoolean767;
} }
public boolean isUnshootable() {
return aBoolean757;
}
public boolean aBoolean736; public boolean aBoolean736;
public String name; public String name;
public int anInt744; public int anInt744;
@@ -3,6 +3,7 @@ package redone.world.clip;
import java.util.LinkedList; import java.util.LinkedList;
import redone.game.players.Client; import redone.game.players.Client;
import redone.util.Misc;
public class PathFinder { public class PathFinder {
@@ -209,6 +210,207 @@ public class PathFinder {
} }
} }
public int getRegionCoordinate(int x) {
return (x >> 3) - 6;
}
public int getLocalCoordinate(int x) {
return x - 8 * getRegionCoordinate(x);
}
public boolean accessible(int x, int y, int heightLevel, int destX, int destY) {
destX = destX - 8 * getRegionCoordinate(x);
destY = destY - 8 * getRegionCoordinate(y);
int[][] via = new int[104][104];
int[][] cost = new int[104][104];
LinkedList<Integer> tileQueueX = new LinkedList<Integer>();
LinkedList<Integer> tileQueueY = new LinkedList<Integer>();
for (int xx = 0; xx < 104; xx++) {
for (int yy = 0; yy < 104; yy++) {
cost[xx][yy] = 99999999;
}
}
int curX = getLocalCoordinate(x);
int curY = getLocalCoordinate(y);
via[curX][curY] = 99;
cost[curX][curY] = 0;
int tail = 0;
tileQueueX.add(curX);
tileQueueY.add(curY);
boolean foundPath = false;
int pathLength = 4000;
while (tail != tileQueueX.size() && tileQueueX.size() < pathLength) {
curX = tileQueueX.get(tail);
curY = tileQueueY.get(tail);
int curAbsX = getRegionCoordinate(x) * 8 + curX;
int curAbsY = getRegionCoordinate(y) * 8 + curY;
if (curX == destX && curY == destY) {
foundPath = true;
break;
}
tail = (tail + 1) % pathLength;
int thisCost = cost[curX][curY] + 1;
if (curY > 0
&& via[curX][curY - 1] == 0
&& (Region.getClipping(curAbsX, curAbsY - 1, heightLevel) & 0x1280102) == 0) {
tileQueueX.add(curX);
tileQueueY.add(curY - 1);
via[curX][curY - 1] = 1;
cost[curX][curY - 1] = thisCost;
}
if (curX > 0
&& via[curX - 1][curY] == 0
&& (Region.getClipping(curAbsX - 1, curAbsY, heightLevel) & 0x1280108) == 0) {
tileQueueX.add(curX - 1);
tileQueueY.add(curY);
via[curX - 1][curY] = 2;
cost[curX - 1][curY] = thisCost;
}
if (curY < 104 - 1
&& via[curX][curY + 1] == 0
&& (Region.getClipping(curAbsX, curAbsY + 1, heightLevel) & 0x1280120) == 0) {
tileQueueX.add(curX);
tileQueueY.add(curY + 1);
via[curX][curY + 1] = 4;
cost[curX][curY + 1] = thisCost;
}
if (curX < 104 - 1
&& via[curX + 1][curY] == 0
&& (Region.getClipping(curAbsX + 1, curAbsY, heightLevel) & 0x1280180) == 0) {
tileQueueX.add(curX + 1);
tileQueueY.add(curY);
via[curX + 1][curY] = 8;
cost[curX + 1][curY] = thisCost;
}
if (curX > 0
&& curY > 0
&& via[curX - 1][curY - 1] == 0
&& (Region.getClipping(curAbsX - 1, curAbsY - 1,
heightLevel) & 0x128010e) == 0
&& (Region.getClipping(curAbsX - 1, curAbsY, heightLevel) & 0x1280108) == 0
&& (Region.getClipping(curAbsX, curAbsY - 1, heightLevel) & 0x1280102) == 0) {
tileQueueX.add(curX - 1);
tileQueueY.add(curY - 1);
via[curX - 1][curY - 1] = 3;
cost[curX - 1][curY - 1] = thisCost;
}
if (curX > 0
&& curY < 104 - 1
&& via[curX - 1][curY + 1] == 0
&& (Region.getClipping(curAbsX - 1, curAbsY + 1,
heightLevel) & 0x1280138) == 0
&& (Region.getClipping(curAbsX - 1, curAbsY, heightLevel) & 0x1280108) == 0
&& (Region.getClipping(curAbsX, curAbsY + 1, heightLevel) & 0x1280120) == 0) {
tileQueueX.add(curX - 1);
tileQueueY.add(curY + 1);
via[curX - 1][curY + 1] = 6;
cost[curX - 1][curY + 1] = thisCost;
}
if (curX < 104 - 1
&& curY > 0
&& via[curX + 1][curY - 1] == 0
&& (Region.getClipping(curAbsX + 1, curAbsY - 1,
heightLevel) & 0x1280183) == 0
&& (Region.getClipping(curAbsX + 1, curAbsY, heightLevel) & 0x1280180) == 0
&& (Region.getClipping(curAbsX, curAbsY - 1, heightLevel) & 0x1280102) == 0) {
tileQueueX.add(curX + 1);
tileQueueY.add(curY - 1);
via[curX + 1][curY - 1] = 9;
cost[curX + 1][curY - 1] = thisCost;
}
if (curX < 104 - 1
&& curY < 104 - 1
&& via[curX + 1][curY + 1] == 0
&& (Region.getClipping(curAbsX + 1, curAbsY + 1,
heightLevel) & 0x12801e0) == 0
&& (Region.getClipping(curAbsX + 1, curAbsY, heightLevel) & 0x1280180) == 0
&& (Region.getClipping(curAbsX, curAbsY + 1, heightLevel) & 0x1280120) == 0) {
tileQueueX.add(curX + 1);
tileQueueY.add(curY + 1);
via[curX + 1][curY + 1] = 12;
cost[curX + 1][curY + 1] = thisCost;
}
}
return foundPath;
}
public static boolean isProjectilePathClear(int x0, int y0, int z, int x1, int y1) {
int deltaX = x1 - x0;
int deltaY = y1 - y0;
double error = 0;
final double deltaError = Math.abs(
(deltaY) / (deltaX == 0
? ((double) deltaY)
: ((double) deltaX)));
int x = x0;
int y = y0;
int pX = x;
int pY = y;
boolean incrX = x0 < x1;
boolean incrY = y0 < y1;
while (true) {
if (x != x1) {
x += (incrX ? 1 : -1);
}
if (y != y1) {
error += deltaError;
if (error >= 0.5) {
y += (incrY ? 1 : -1);
error -= 1;
}
}
if (!shootable(x, y, z, pX, pY)) {
return false;
}
if (incrX && incrY
&& x >= x1 && y >= y1) {
break;
} else if (!incrX && !incrY
&& x <= x1 && y <= y1) {
break;
} else if (!incrX && incrY
&& x <= x1 && y >= y1) {
break;
} else if (incrX && !incrY
&& x >= x1 && y <= y1) {
break;
}
pX = x;
pY = y;
}
return true;
}
private static boolean shootable(int x, int y, int z, int px, int py) {
if (x == px && y == py) {
return true;
}
int[] delta1 = Misc.delta(x, y, px, py);
int[] delta2 = Misc.delta(px, py, x, y);
int dir = Misc.directionFromDelta(delta1[0], delta1[1]);
int dir2 = Misc.directionFromDelta(delta2[0], delta2[1]);
if (dir == -1 || dir2 == -1) {
return false;
}
return Region.canMove(x, y, z, dir) && Region.canMove(px, py, z, dir2)
|| Region.canShoot(x, y, z, dir) && Region.canShoot(px, py, z, dir2);
}
public int localize(int x, int mapRegion) { public int localize(int x, int mapRegion) {
return x - 8 * mapRegion; return x - 8 * mapRegion;
} }
@@ -24,10 +24,6 @@ public class Region {
} }
return null; return null;
} }
public static boolean blockedShot(int x, int y, int z) {
return (getClipping(x, y, z) & 0x20000) == 0;
}
public static Objects getObject(int id, int x, int y, int z) { public static Objects getObject(int id, int x, int y, int z) {
Region r = getRegion(x, y); Region r = getRegion(x, y);
@@ -65,7 +61,121 @@ public class Region {
} }
clips[height][x - regionAbsX][y - regionAbsY] |= shift; clips[height][x - regionAbsX][y - regionAbsY] |= shift;
} }
private void addProjectileClip(int x, int y, int height, int shift) {
int regionAbsX = (id >> 8) * 64;
int regionAbsY = (id & 0xff) * 64;
if (projectileClips[height] == null) {
projectileClips[height] = new int[64][64];
}
projectileClips[height][x - regionAbsX][y - regionAbsY] |= shift;
}
public static boolean canMove(int x, int y, int z, int direction) {
if (direction == 6) {
if ((Region.getClipping(x, y - 1, z) & 0x1280102) == 0) {
return true;
}
} else if (direction == 3) {
if ((Region.getClipping(x - 1, y, z) & 0x1280108) == 0) {
return true;
}
} else if (direction == 1) {
if ((Region.getClipping(x, y + 1, z) & 0x1280120) == 0) {
return true;
}
} else if (direction == 4) {
if ((Region.getClipping(x + 1, y, z) & 0x1280180) == 0) {
return true;
}
} else if (direction == 5) {
if ((Region.getClipping(x - 1, y - 1, z) & 0x128010e) == 0
&& (Region.getClipping(x - 1, y, z) & 0x1280108) == 0
&& (Region.getClipping(x, y - 1, z) & 0x1280102) == 0) {
return true;
}
} else if (direction == 0) {
if ((Region.getClipping(x - 1, y + 1, z) & 0x1280138) == 0
&& (Region.getClipping(x - 1, y, z) & 0x1280108) == 0
&& (Region.getClipping(x, y + 1, z) & 0x1280120) == 0) {
return true;
}
} else if (direction == 7) {
if ((Region.getClipping(x + 1, y - 1, z) & 0x1280183) == 0
&& (Region.getClipping(x + 1, y, z) & 0x1280180) == 0
&& (Region.getClipping(x, y - 1, z) & 0x1280102) == 0) {
return true;
}
} else if (direction == 2) {
if ((Region.getClipping(x + 1, y + 1, z) & 0x12801e0) == 0
&& (Region.getClipping(x + 1, y, z) & 0x1280180) == 0
&& (Region.getClipping(x, y + 1, z) & 0x1280120) == 0) {
return true;
}
} else if (direction == -1) {
throw new IllegalArgumentException("Invalid direction: " + direction);
}
return false;
}
public static boolean canShoot(int x, int y, int z, int direction) {
if (direction == 0) {
return !projectileBlockedNorthWest(x, y, z) && !projectileBlockedNorth(x, y, z)
&& !projectileBlockedWest(x, y, z);
} else if (direction == 1) {
return !projectileBlockedNorth(x, y, z);
} else if (direction == 2) {
return !projectileBlockedNorthEast(x, y, z) && !projectileBlockedNorth(x, y, z)
&& !projectileBlockedEast(x, y, z);
} else if (direction == 3) {
return !projectileBlockedWest(x, y, z);
} else if (direction == 4) {
return !projectileBlockedEast(x, y, z);
} else if (direction == 5) {
return !projectileBlockedSouthWest(x, y, z) && !projectileBlockedSouth(x, y, z)
&& !projectileBlockedWest(x, y, z);
} else if (direction == 6) {
return !projectileBlockedSouth(x, y, z);
} else if (direction == 7) {
return !projectileBlockedSouthEast(x, y, z) && !projectileBlockedSouth(x, y, z)
&& !projectileBlockedEast(x, y, z);
}
return false;
}
public static boolean projectileBlockedNorth(int x, int y, int z) {
return (getProjectileClipping(x, y + 1, z) & 0x1280120) != 0;
}
public static boolean projectileBlockedEast(int x, int y, int z) {
return (getProjectileClipping(x + 1, y, z) & 0x1280180) != 0;
}
public static boolean projectileBlockedSouth(int x, int y, int z) {
return (getProjectileClipping(x, y - 1, z) & 0x1280102) != 0;
}
public static boolean projectileBlockedWest(int x, int y, int z) {
return (getProjectileClipping(x - 1, y, z) & 0x1280108) != 0;
}
public static boolean projectileBlockedNorthEast(int x, int y, int z) {
return (getProjectileClipping(x + 1, y + 1, z) & 0x12801e0) != 0;
}
public static boolean projectileBlockedNorthWest(int x, int y, int z) {
return (getProjectileClipping(x - 1, y + 1, z) & 0x1280138) != 0;
}
public static boolean projectileBlockedSouthEast(int x, int y, int z) {
return (getProjectileClipping(x + 1, y - 1, z) & 0x1280183) != 0;
}
public static boolean projectileBlockedSouthWest(int x, int y, int z) {
return (getProjectileClipping(x - 1, y - 1, z) & 0x128010e) != 0;
}
public static boolean canMove(int startX, int startY, int endX, int endY, int height, int xLength, int yLength) { public static boolean canMove(int startX, int startY, int endX, int endY, int height, int xLength, int yLength) {
int diffX = endX - startX; int diffX = endX - startX;
int diffY = endY - startY; int diffY = endY - startY;
@@ -149,6 +259,15 @@ public class Region {
return clips[height][x - regionAbsX][y - regionAbsY]; return clips[height][x - regionAbsX][y - regionAbsY];
} }
private int getProjectileClip(int x, int y, int height) {
int regionAbsX = (id >> 8) * 64;
int regionAbsY = (id & 0xff) * 64;
if (projectileClips[height] == null) {
return 0;
}
return projectileClips[height][x - regionAbsX][y - regionAbsY];
}
private static void addClipping(int x, int y, int height, int shift) { private static void addClipping(int x, int y, int height, int shift) {
int regionX = x >> 3; int regionX = x >> 3;
int regionY = y >> 3; int regionY = y >> 3;
@@ -161,9 +280,23 @@ public class Region {
} }
} }
private static void addProjectileClipping(int x, int y, int height, int shift) {
int regionX = x >> 3;
int regionY = y >> 3;
int regionId = (regionX / 8 << 8) + regionY / 8;
for (Region r : regions) {
if (r.id() == regionId) {
r.addProjectileClip(x, y, height, shift);
break;
}
}
}
private static Region[] regions; private static Region[] regions;
private final int id; private final int id;
private final int[][][] clips = new int[4][][]; private final int[][][] clips = new int[4][][];
private final int[][][] projectileClips = new int[4][][];
private boolean members = false; private boolean members = false;
public Region(int id, boolean members) { public Region(int id, boolean members) {
@@ -298,6 +431,107 @@ public class Region {
} }
} }
private static void addProjectileClippingForVariableObject(int x, int y, int height,
int type, int direction, boolean flag) {
if (type == 0) {
if (direction == 0) {
addProjectileClipping(x, y, height, 128);
addProjectileClipping(x - 1, y, height, 8);
} else if (direction == 1) {
addProjectileClipping(x, y, height, 2);
addProjectileClipping(x, y + 1, height, 32);
} else if (direction == 2) {
addProjectileClipping(x, y, height, 8);
addProjectileClipping(x + 1, y, height, 128);
} else if (direction == 3) {
addProjectileClipping(x, y, height, 32);
addProjectileClipping(x, y - 1, height, 2);
}
} else if (type == 1 || type == 3) {
if (direction == 0) {
addProjectileClipping(x, y, height, 1);
addProjectileClipping(x - 1, y, height, 16);
} else if (direction == 1) {
addProjectileClipping(x, y, height, 4);
addProjectileClipping(x + 1, y + 1, height, 64);
} else if (direction == 2) {
addProjectileClipping(x, y, height, 16);
addProjectileClipping(x + 1, y - 1, height, 1);
} else if (direction == 3) {
addProjectileClipping(x, y, height, 64);
addProjectileClipping(x - 1, y - 1, height, 4);
}
} else if (type == 2) {
if (direction == 0) {
addProjectileClipping(x, y, height, 130);
addProjectileClipping(x - 1, y, height, 8);
addProjectileClipping(x, y + 1, height, 32);
} else if (direction == 1) {
addProjectileClipping(x, y, height, 10);
addProjectileClipping(x, y + 1, height, 32);
addProjectileClipping(x + 1, y, height, 128);
} else if (direction == 2) {
addProjectileClipping(x, y, height, 40);
addProjectileClipping(x + 1, y, height, 128);
addProjectileClipping(x, y - 1, height, 2);
} else if (direction == 3) {
addProjectileClipping(x, y, height, 160);
addProjectileClipping(x, y - 1, height, 2);
addProjectileClipping(x - 1, y, height, 8);
}
}
if (flag) {
if (type == 0) {
if (direction == 0) {
addProjectileClipping(x, y, height, 65536);
addProjectileClipping(x - 1, y, height, 4096);
} else if (direction == 1) {
addProjectileClipping(x, y, height, 1024);
addProjectileClipping(x, y + 1, height, 16384);
} else if (direction == 2) {
addProjectileClipping(x, y, height, 4096);
addProjectileClipping(x + 1, y, height, 65536);
} else if (direction == 3) {
addProjectileClipping(x, y, height, 16384);
addProjectileClipping(x, y - 1, height, 1024);
}
}
if (type == 1 || type == 3) {
if (direction == 0) {
addProjectileClipping(x, y, height, 512);
addProjectileClipping(x - 1, y + 1, height, 8192);
} else if (direction == 1) {
addProjectileClipping(x, y, height, 2048);
addProjectileClipping(x + 1, y + 1, height, 32768);
} else if (direction == 2) {
addProjectileClipping(x, y, height, 8192);
addProjectileClipping(x + 1, y + 1, height, 512);
} else if (direction == 3) {
addProjectileClipping(x, y, height, 32768);
addProjectileClipping(x - 1, y - 1, height, 2048);
}
} else if (type == 2) {
if (direction == 0) {
addProjectileClipping(x, y, height, 66560);
addProjectileClipping(x - 1, y, height, 4096);
addProjectileClipping(x, y + 1, height, 16384);
} else if (direction == 1) {
addProjectileClipping(x, y, height, 5120);
addProjectileClipping(x, y + 1, height, 16384);
addProjectileClipping(x + 1, y, height, 65536);
} else if (direction == 2) {
addProjectileClipping(x, y, height, 20480);
addProjectileClipping(x + 1, y, height, 65536);
addProjectileClipping(x, y - 1, height, 1024);
} else if (direction == 3) {
addProjectileClipping(x, y, height, 81920);
addProjectileClipping(x, y - 1, height, 1024);
addProjectileClipping(x - 1, y, height, 4096);
}
}
}
}
private static void addClippingForSolidObject(int x, int y, int height, private static void addClippingForSolidObject(int x, int y, int height,
int xLength, int yLength, boolean flag) { int xLength, int yLength, boolean flag) {
int clipping = 256; int clipping = 256;
@@ -311,6 +545,19 @@ public class Region {
} }
} }
private static void addProjectileClippingForSolidObject(int x, int y, int height,
int xLength, int yLength, boolean flag) {
int clipping = 256;
if (flag) {
clipping += 0x20000;
}
for (int i = x; i < x + xLength; i++) {
for (int i2 = y; i2 < y + yLength; i2++) {
addProjectileClipping(i, i2, height, clipping);
}
}
}
public static void addObject(int objectId, int x, int y, int height, int type, int direction, boolean startUp) { public static void addObject(int objectId, int x, int y, int height, int type, int direction, boolean startUp) {
if (ObjectDef.getObjectDef(objectId) == null) { if (ObjectDef.getObjectDef(objectId) == null) {
} }
@@ -327,16 +574,26 @@ public class Region {
if (ObjectDef.getObjectDef(objectId).hasActions() if (ObjectDef.getObjectDef(objectId).hasActions()
&& ObjectDef.getObjectDef(objectId).aBoolean767()) { && ObjectDef.getObjectDef(objectId).aBoolean767()) {
addClipping(x, y, height, 0x200000); addClipping(x, y, height, 0x200000);
if (ObjectDef.getObjectDef(objectId).isUnshootable()) {
addProjectileClipping(x, y, height, 0x200000);
}
} }
} else if (type >= 9) { } else if (type >= 9) {
if (ObjectDef.getObjectDef(objectId).aBoolean767()) { if (ObjectDef.getObjectDef(objectId).aBoolean767()) {
addClippingForSolidObject(x, y, height, xLength, yLength, addClippingForSolidObject(x, y, height, xLength, yLength,
ObjectDef.getObjectDef(objectId).solid()); ObjectDef.getObjectDef(objectId).solid());
if (ObjectDef.getObjectDef(objectId).isUnshootable()) {
addProjectileClippingForSolidObject(x, y, height, xLength, yLength,
ObjectDef.getObjectDef(objectId).solid());
}
} }
} else if (type >= 0 && type <= 3) { } else if (type >= 0 && type <= 3) {
if (ObjectDef.getObjectDef(objectId).aBoolean767()) { if (ObjectDef.getObjectDef(objectId).aBoolean767()) {
addClippingForVariableObject(x, y, height, type, direction, addClippingForVariableObject(x, y, height, type, direction,
ObjectDef.getObjectDef(objectId).solid()); ObjectDef.getObjectDef(objectId).solid());
if (ObjectDef.getObjectDef(objectId).isUnshootable()) {
addProjectileClippingForVariableObject(x, y, height, type, direction, ObjectDef.getObjectDef(objectId).solid());
}
} }
} }
Region r = getRegion(x, y); Region r = getRegion(x, y);
@@ -363,6 +620,21 @@ public class Region {
return 0; return 0;
} }
public static int getProjectileClipping(int x, int y, int height) {
if (height > 3) {
height = 0;
}
int regionX = x >> 3;
int regionY = y >> 3;
int regionId = (regionX / 8 << 8) + regionY / 8;
for (Region r : regions) {
if (r.id() == regionId) {
return r.getProjectileClip(x, y, height);
}
}
return 0;
}
public static boolean getClipping(int x, int y, int height, int moveTypeX, public static boolean getClipping(int x, int y, int height, int moveTypeX,
int moveTypeY) { int moveTypeY) {
try { try {
@@ -0,0 +1,2 @@
"C:\Program Files\Java\jdk1.8.0_201\bin\java.exe" -jar 2006rebotted.jar
pause
Binary file not shown.
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Main-Class: Client