Implement Party Room, A bunch of client side changes, Other stuff (#503)

* Fixup Discord links

* Fix required level to chop Dramen tree

* More Discord link fixes

* Show bots as (store)

* Fixup port

move to port 8080 as used by file server

* Fixup report handler

* Some client changes

* minor changes

Show mod status

* Show item value on ground

* Mark stores and players differently on mini map

* Some tidy up

* default to world 1

* Update trade with text

* revert nodeID changes

* Update RS Guide name

* Remove some command aliases

* Log bots and players differently

* Fixup

* minor changes

* Fixup colors

* Update RSInterface.java

* Settings for controlling options

* Add memory command

* Update server skill magic numbers

* Update server skill magic numbers

* Update colors for ground item text

* Update .gitignore

* Update player health value more often

* Add in game item/NPC/object search

* Item amounts and value displayed

* Update examine text

* Start with volume off

* Fixup tab 7 still showing with other interfaces

* Fixup search

* Fixup entering numbers after letter in amounts

* minor fixup

* fix indentation

* change type of value

* Fixup values shown

* Fix when clicking while tab 7 open

* Fixup negative amounts

* Update some method names

* Fixup method name

* tidy up method values

* Initial move for overlays

* Update more method names, variables

* Update debug menu

* Update experience info area

* Update Signlink.java

* more refactoring/deob

* Tidy up

* refresh skills

* Update method name, debug display

* fixup

* Show wrench icon on custom settings tab

* alignment

* Modify zoom

* Use smaller numbers for exp/h

* Update interface command

* tidy up

* Fixup tele location

* Fixup if interface doesn't exist

* Add some interface options

* Update checks

* Open bank interface for item search

TODO:
change title
maybe not display in chat
change options for items?
change command to searchitem - open the bank interface, open a text input interface

* re-fix

* Show open interface ID

* Update bank string shown

* Update search function

* Scroll zooming

* Only fill chat with search if not searching for an item

* add comments

* Change system update message

* Remove fps command

* Increase draw distance

* fixup

* Draw distance option

* [Party Room] Fix party room stairs

* Add new free slots method to check for stackable items counting as a free slot

* [Party Room] Deposit/Withdraw items all working

* [Party Room] Fully working

* [Party Room] Don't spawn balloons on the table

Players cannot pickup the items

* Fixup boundary

* Drop items in random amounts up to 4 stacks

* Update swampy boat to work

* Minor fixup

* Update Game.java

* Move player name up slightly

* Update some naming

* Tidy up

* Add ectoplasm agility shortcuts

* Update ObjectsActions.java

* Ectofuntus stuff

* fixup

* Ectofuntus bone grinder get status

* auto worship

* Allow claiming ecto-tokens

* change variable

* fixup

* Make use of GameConstants.WORLD

* Randomize bot passwords

* Don't show player shops as online

* Update opening oysters

* Update GemCutting.java

* Dragontooth island transport

* Ectofuntus stuff

* More constants

* Bill teach travel to Mos Le'Harmless and back

Also able to explore the whole ship

* Use better looking buttons

* Update .gitignore
This commit is contained in:
Danial
2021-09-29 11:40:34 +13:00
committed by GitHub
parent d30e833dd8
commit 8589277ece
51 changed files with 1756 additions and 717 deletions
+5
View File
@@ -7,3 +7,8 @@
*.iml *.iml
.DS_Store .DS_Store
2006Scape Server/data/logs 2006Scape Server/data/logs
*.class
*.project
2006Scape Client/bin/
*.prefs
*.classpath
@@ -23,7 +23,7 @@ public class ClientSettings {
* on localhost (Assuming you're running Client and LocalGame respectively) * on localhost (Assuming you're running Client and LocalGame respectively)
* *
*/ */
public static String SERVER_IP = "127.0.0.1"; public static String SERVER_IP = "www.2006Scape.org";
/** /**
* The Npc Bits for the Server * The Npc Bits for the Server
*/ */
+71 -71
View File
@@ -50,29 +50,29 @@ public class DrawingArea extends NodeSub {
} }
public static void method335(int i, int j, int k, int l, int i1, int k1) { public static void fillArea(int _color, int _y, int _width, int _height, int _opacity, int _x) {
if (k1 < topX) { if (_x < topX) {
k -= topX - k1; _width -= topX - _x;
k1 = topX; _x = topX;
} }
if (j < topY) { if (_y < topY) {
l -= topY - j; _height -= topY - _y;
j = topY; _y = topY;
} }
if (k1 + k > bottomX) { if (_x + _width > bottomX) {
k = bottomX - k1; _width = bottomX - _x;
} }
if (j + l > bottomY) { if (_y + _height > bottomY) {
l = bottomY - j; _height = bottomY - _y;
} }
int l1 = 256 - i1; int l1 = 256 - _opacity;
int i2 = (i >> 16 & 0xff) * i1; int i2 = (_color >> 16 & 0xff) * _opacity;
int j2 = (i >> 8 & 0xff) * i1; int j2 = (_color >> 8 & 0xff) * _opacity;
int k2 = (i & 0xff) * i1; int k2 = (_color & 0xff) * _opacity;
int k3 = width - k; int k3 = width - _width;
int l3 = k1 + j * width; int l3 = _x + _y * width;
for (int i4 = 0; i4 < l; i4++) { for (int i4 = 0; i4 < _height; i4++) {
for (int j4 = -k; j4 < 0; j4++) { for (int j4 = -_width; j4 < 0; j4++) {
int l2 = (pixels[l3] >> 16 & 0xff) * l1; int l2 = (pixels[l3] >> 16 & 0xff) * l1;
int i3 = (pixels[l3] >> 8 & 0xff) * l1; int i3 = (pixels[l3] >> 8 & 0xff) * l1;
int j3 = (pixels[l3] & 0xff) * l1; int j3 = (pixels[l3] & 0xff) * l1;
@@ -84,26 +84,26 @@ public class DrawingArea extends NodeSub {
} }
} }
public static void method336(int i, int j, int l, int i1, int k) { public static void fillArea(int _height, int _y, int _color, int _width, int _x) {
if (k < topX) { if (_x < topX) {
i1 -= topX - k; _width -= topX - _x;
k = topX; _x = topX;
} }
if (j < topY) { if (_y < topY) {
i -= topY - j; _height -= topY - _y;
j = topY; _y = topY;
} }
if (k + i1 > bottomX) { if (_x + _width > bottomX) {
i1 = bottomX - k; _width = bottomX - _x;
} }
if (j + i > bottomY) { if (_y + _height > bottomY) {
i = bottomY - j; _height = bottomY - _y;
} }
int k1 = width - i1; int k1 = width - _width;
int l1 = k + j * width; int l1 = _x + _y * width;
for (int i2 = -i; i2 < 0; i2++) { for (int i2 = -_height; i2 < 0; i2++) {
for (int j2 = -i1; j2 < 0; j2++) { for (int j2 = -_width; j2 < 0; j2++) {
pixels[l1++] = l; pixels[l1++] = _color;
} }
l1 += k1; l1 += k1;
@@ -111,23 +111,23 @@ public class DrawingArea extends NodeSub {
} }
public static void fillPixels(int i1, int k, int l, int i, int j) { public static void fillPixels(int _y, int _height, int _color, int _x, int _width) {
method339(i1, l, j, i); drawHorizontalLine(_y, _color, _width, _x);
method339(i1 + k - 1, l, j, i); drawHorizontalLine(_y + _height - 1, _color, _width, _x);
method341(i1, l, k, i); drawVerticalLine(_y, _color, _height, _x);
method341(i1, l, k, i + j - 1); drawVerticalLine(_y, _color, _height, _x + _width - 1);
} }
public static void method338(int i, int j, int k, int l, int i1, int j1) { public static void drawFrameRounded(int _y, int _height, int _opacity, int _color, int _width, int _x) {
method340(l, i1, i, k, j1); drawHorizontalLine(_color, _width, _y, _opacity, _x);
method340(l, i1, i + j - 1, k, j1); drawHorizontalLine(_color, _width, _y + _height - 1, _opacity, _x);
if (j >= 3) { if (_height >= 3) {
method342(l, j1, k, i + 1, j - 2); drawVerticalLine(_color, _x, _opacity, _y + 1, _height - 2);
method342(l, j1 + i1 - 1, k, i + 1, j - 2); drawVerticalLine(_color, _x + _width - 1, _opacity, _y + 1, _height - 2);
} }
} }
public static void method339(int i, int j, int k, int l) { public static void drawHorizontalLine(int i, int j, int k, int l) {
if (i < topY || i >= bottomY) { if (i < topY || i >= bottomY) {
return; return;
} }
@@ -145,23 +145,23 @@ public class DrawingArea extends NodeSub {
} }
private static void method340(int i, int j, int k, int l, int i1) { private static void drawHorizontalLine(int _color, int _width, int _y, int _opacity, int _x) {
if (k < topY || k >= bottomY) { if (_y < topY || _y >= bottomY) {
return; return;
} }
if (i1 < topX) { if (_x < topX) {
j -= topX - i1; _width -= topX - _x;
i1 = topX; _x = topX;
} }
if (i1 + j > bottomX) { if (_x + _width > bottomX) {
j = bottomX - i1; _width = bottomX - _x;
} }
int j1 = 256 - l; int j1 = 256 - _opacity;
int k1 = (i >> 16 & 0xff) * l; int k1 = (_color >> 16 & 0xff) * _opacity;
int l1 = (i >> 8 & 0xff) * l; int l1 = (_color >> 8 & 0xff) * _opacity;
int i2 = (i & 0xff) * l; int i2 = (_color & 0xff) * _opacity;
int i3 = i1 + k * width; int i3 = _x + _y * width;
for (int j3 = 0; j3 < j; j3++) { for (int j3 = 0; j3 < _width; j3++) {
int j2 = (pixels[i3] >> 16 & 0xff) * j1; int j2 = (pixels[i3] >> 16 & 0xff) * j1;
int k2 = (pixels[i3] >> 8 & 0xff) * j1; int k2 = (pixels[i3] >> 8 & 0xff) * j1;
int l2 = (pixels[i3] & 0xff) * j1; int l2 = (pixels[i3] & 0xff) * j1;
@@ -171,25 +171,25 @@ public class DrawingArea extends NodeSub {
} }
public static void method341(int i, int j, int k, int l) { public static void drawVerticalLine(int _y, int _color, int _height, int _x) {
if (l < topX || l >= bottomX) { if (_x < topX || _x >= bottomX) {
return; return;
} }
if (i < topY) { if (_y < topY) {
k -= topY - i; _height -= topY - _y;
i = topY; _y = topY;
} }
if (i + k > bottomY) { if (_y + _height > bottomY) {
k = bottomY - i; _height = bottomY - _y;
} }
int j1 = l + i * width; int j1 = _x + _y * width;
for (int k1 = 0; k1 < k; k1++) { for (int k1 = 0; k1 < _height; k1++) {
pixels[j1 + k1 * width] = j; pixels[j1 + k1 * width] = _color;
} }
} }
private static void method342(int i, int j, int k, int l, int i1) { private static void drawVerticalLine(int i, int j, int k, int l, int i1) {
if (j < topX || j >= bottomX) { if (j < topX || j >= bottomX) {
return; return;
} }
@@ -25,7 +25,7 @@ public final class EntityDef {
break; break;
case 945: case 945:
entityDef.name = "2006Scape Guide"; entityDef.name = ClientSettings.SERVER_NAME + " Guide";
break; break;
} }
return entityDef; return entityDef;
@@ -92,10 +92,12 @@ public final class EntityDef {
} }
} }
public static int totalNPCs;
public static void unpackConfig(StreamLoader streamLoader) { public static void unpackConfig(StreamLoader streamLoader) {
stream = new Stream(streamLoader.getDataForName("npc.dat")); stream = new Stream(streamLoader.getDataForName("npc.dat"));
Stream stream2 = new Stream(streamLoader.getDataForName("npc.idx")); Stream stream2 = new Stream(streamLoader.getDataForName("npc.idx"));
int totalNPCs = stream2.readUnsignedWord(); totalNPCs = stream2.readUnsignedWord();
streamIndices = new int[totalNPCs]; streamIndices = new int[totalNPCs];
int i = 2; int i = 2;
for (int j = 0; j < totalNPCs; j++) { for (int j = 0; j < totalNPCs; j++) {
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -7,7 +7,7 @@ final class Item extends Animable {
@Override @Override
public final Model getRotatedModel() { public final Model getRotatedModel() {
ItemDef itemDef = ItemDef.forID(ID); ItemDef itemDef = ItemDef.forID(ID);
return itemDef.method201(anInt1559); return itemDef.method201(amount);
} }
public Item() { public Item() {
@@ -16,5 +16,5 @@ final class Item extends Animable {
public int ID; public int ID;
public int x; public int x;
public int y; public int y;
public int anInt1559; public int amount;
} }
+3 -3
View File
@@ -2103,7 +2103,7 @@ public final class ItemDef {
int j3 = DrawingArea.bottomY; int j3 = DrawingArea.bottomY;
Texture.aBoolean1464 = false; Texture.aBoolean1464 = false;
DrawingArea.initDrawingArea(32, 32, sprite2.pixels); DrawingArea.initDrawingArea(32, 32, sprite2.pixels);
DrawingArea.method336(32, 0, 0, 32, 0); DrawingArea.fillArea(32, 0, 0, 32, 0);
Texture.method364(); Texture.method364();
int k3 = itemDef.modelZoom; int k3 = itemDef.modelZoom;
if (k == -1) { if (k == -1) {
@@ -2372,7 +2372,7 @@ public final class ItemDef {
private int[] originalModelColors; private int[] originalModelColors;
public boolean membersObject; public boolean membersObject;
private int anInt162; private int anInt162;
private int certTemplateID; public int certTemplateID;
private int anInt164; private int anInt164;
private int anInt165; private int anInt165;
private int anInt166; private int anInt166;
@@ -2405,7 +2405,7 @@ public final class ItemDef {
private int anInt197; private int anInt197;
public int modelRotation2; public int modelRotation2;
private int anInt200; private int anInt200;
private int[] stackAmounts; public int[] stackAmounts;
public int team; public int team;
public static int totalItems; public static int totalItems;
private int anInt204; private int anInt204;
+4 -1
View File
@@ -1335,7 +1335,10 @@ public final class Model extends Animable {
int k2 = k1 * j + j2 * k >> 16; int k2 = k1 * j + j2 * k >> 16;
int l2 = anInt1650 * k >> 16; int l2 = anInt1650 * k >> 16;
int i3 = k2 + l2; int i3 = k2 + l2;
if (i3 <= 50 || k2 >= 3500) { // Check distance of model to camera for rendering (default 3500)
int distance = WorldController.drawDistance * 256;
distance *= 1 + (Game.zoom / 10);
if (i3 <= 50 || k2 >= distance) {
return; return;
} }
int j3 = l1 * l + j1 * i1 >> 16; int j3 = l1 * l + j1 * i1 >> 16;
@@ -83,10 +83,12 @@ public final class ObjectDef {
stream = null; stream = null;
} }
public static int totalObjects;
public static void unpackConfig(StreamLoader streamLoader) { public static void unpackConfig(StreamLoader streamLoader) {
stream = new Stream(streamLoader.getDataForName("loc.dat")); stream = new Stream(streamLoader.getDataForName("loc.dat"));
Stream stream = new Stream(streamLoader.getDataForName("loc.idx")); Stream stream = new Stream(streamLoader.getDataForName("loc.idx"));
int totalObjects = stream.readUnsignedWord(); totalObjects = stream.readUnsignedWord();
streamIndices = new int[totalObjects]; streamIndices = new int[totalObjects];
int i = 2; int i = 2;
for (int j = 0; j < totalObjects; j++) { for (int j = 0; j < totalObjects; j++) {
+7 -1
View File
@@ -11,12 +11,14 @@ import java.awt.event.KeyEvent;
import java.awt.event.KeyListener; import java.awt.event.KeyListener;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.MouseListener; import java.awt.event.MouseListener;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
import java.awt.event.MouseMotionListener; import java.awt.event.MouseMotionListener;
import java.awt.event.WindowEvent; import java.awt.event.WindowEvent;
import java.awt.event.WindowListener; import java.awt.event.WindowListener;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class RSApplet extends Applet implements Runnable, MouseListener, MouseMotionListener, KeyListener, FocusListener, WindowListener { public class RSApplet extends Applet implements Runnable, MouseListener, MouseWheelListener, MouseMotionListener, KeyListener, FocusListener, WindowListener {
public static boolean ctrlDown = false; public static boolean ctrlDown = false;
public static boolean shiftDown = false; public static boolean shiftDown = false;
@@ -45,6 +47,7 @@ public class RSApplet extends Applet implements Runnable, MouseListener, MouseMo
public void run() { public void run() {
getGameComponent().addMouseListener(this); getGameComponent().addMouseListener(this);
getGameComponent().addMouseMotionListener(this); getGameComponent().addMouseMotionListener(this);
getGameComponent().addMouseWheelListener(this);
getGameComponent().addKeyListener(this); getGameComponent().addKeyListener(this);
getGameComponent().addFocusListener(this); getGameComponent().addFocusListener(this);
if (gameFrame != null) { if (gameFrame != null) {
@@ -296,6 +299,9 @@ public class RSApplet extends Applet implements Runnable, MouseListener, MouseMo
mouseY = j; mouseY = j;
} }
@Override
public void mouseWheelMoved(MouseWheelEvent e) {}
@Override @Override
public void keyPressed(KeyEvent keyevent) { public void keyPressed(KeyEvent keyevent) {
idleTime = 0; idleTime = 0;
@@ -25,8 +25,6 @@ public final class RSInterface {
rsInterface.id = k; rsInterface.id = k;
rsInterface.parentID = i; rsInterface.parentID = i;
rsInterface.type = stream.readUnsignedByte(); rsInterface.type = stream.readUnsignedByte();
//if(rsInterface.type == 0)
// System.out.println(rsInterface.parentID+":"+k);
rsInterface.atActionType = stream.readUnsignedByte(); rsInterface.atActionType = stream.readUnsignedByte();
rsInterface.anInt214 = stream.readUnsignedWord(); rsInterface.anInt214 = stream.readUnsignedWord();
rsInterface.width = stream.readUnsignedWord(); rsInterface.width = stream.readUnsignedWord();
+12 -12
View File
@@ -404,17 +404,17 @@ public final class Signlink implements Runnable {
public static boolean reporterror = true; public static boolean reporterror = true;
public static String errorname = ""; public static String errorname = "";
public static Midi midii = new Midi(); public static Midi midii = new Midi();
private static int savelen; private static int savelen;
private static String saveReq = null; private static String saveReq = null;
private static byte savebuf[] = null; private static byte savebuf[] = null;
public static boolean play; public static boolean play;
private static int midiPos; private static int midiPos;
public static String midi = null; public static String midi = null;
public static int midiVolume; public static int midiVolume;
public static int midifade; public static int midifade;
private static boolean waveplay; private static boolean waveplay;
private static int wavepos; private static int wavepos;
public static String wave = null; public static String wave = null;
public static int wavevol; public static int wavevol;
} }
@@ -75,16 +75,20 @@ public final class TextDrawingArea extends DrawingArea {
} }
} }
public void method380(String s, int i, int j, int k) { public void textRight(int i, String s, int k, int l) {
method385(j, s, k, i - method384(s)); textLeft(i, s, k, l - method384(s));
} }
public void drawText(int i, String s, int k, int l) { public void textCenter(int i, String s, int k, int l) {
method385(i, s, k, l - method384(s) / 2); textLeft(i, s, k, l - method384(s) / 2);
} }
public void method382(int i, int j, String s, int l, boolean flag) { public void textCenterShadow(int _color, int _x, String s, int _y, boolean _shadow) {
method389(flag, j - getTextWidth(s) / 2, i, s, l); textLeftShadow(_shadow, _x - getTextWidth(s) / 2, _color, s, _y);
}
public void textRightShadow(boolean _shadow, int _x, int _color, String s, int _y) {
textLeftShadow(_shadow, _x - getTextWidth(s), _color, s, _y);
} }
public int getTextWidth(String s) { public int getTextWidth(String s) {
@@ -114,7 +118,7 @@ public final class TextDrawingArea extends DrawingArea {
return j; return j;
} }
public void method385(int i, String s, int j, int l) { public void textLeft(int i, String s, int j, int l) {
if (s == null) { if (s == null) {
return; return;
} }
@@ -180,37 +184,37 @@ public final class TextDrawingArea extends DrawingArea {
} }
public void method389(boolean flag1, int i, int j, String s, int k) { public void textLeftShadow(boolean _shadow, int _x, int _color, String s, int _y) {
aBoolean1499 = false; aBoolean1499 = false;
int l = i; int l = _x;
if (s == null) { if (s == null) {
return; return;
} }
k -= anInt1497; _y -= anInt1497;
for (int i1 = 0; i1 < s.length(); i1++) { for (int i1 = 0; i1 < s.length(); i1++) {
if (s.charAt(i1) == '@' && i1 + 4 < s.length() && s.charAt(i1 + 4) == '@') { if (s.charAt(i1) == '@' && i1 + 4 < s.length() && s.charAt(i1 + 4) == '@') {
int j1 = getColorByName(s.substring(i1 + 1, i1 + 4)); int j1 = getColorByName(s.substring(i1 + 1, i1 + 4));
if (j1 != -1) { if (j1 != -1) {
j = j1; _color = j1;
} }
i1 += 4; i1 += 4;
} else { } else {
char c = s.charAt(i1); char c = s.charAt(i1);
if (c != ' ') { if (c != ' ') {
if (flag1) { if (_shadow) {
method392(aByteArrayArray1491[c], i + anIntArray1494[c] + 1, k + anIntArray1495[c] + 1, anIntArray1492[c], anIntArray1493[c], 0); method392(aByteArrayArray1491[c], _x + anIntArray1494[c] + 1, _y + anIntArray1495[c] + 1, anIntArray1492[c], anIntArray1493[c], 0);
} }
try { try {
method392(aByteArrayArray1491[c], i + anIntArray1494[c], k + anIntArray1495[c], anIntArray1492[c], anIntArray1493[c], j); method392(aByteArrayArray1491[c], _x + anIntArray1494[c], _y + anIntArray1495[c], anIntArray1492[c], anIntArray1493[c], _color);
} catch (Exception e) { } catch (Exception e) {
} }
} }
i += anIntArray1496[c]; _x += anIntArray1496[c];
} }
} }
if (aBoolean1499) { if (aBoolean1499) {
DrawingArea.method339(k + (int) (anInt1497 * 0.69999999999999996D), 0x800000, i - l, l); DrawingArea.drawHorizontalLine(_y + (int) (anInt1497 * 0.69999999999999996D), 0x800000, _x - l, l);
} }
} }
@@ -3,6 +3,7 @@
// Decompiler options: packimports(3) // Decompiler options: packimports(3)
final class WorldController { final class WorldController {
public static int drawDistance = 25;
public WorldController(int ai[][][]) { public WorldController(int ai[][][]) {
int i = 104;// was parameter int i = 104;// was parameter
@@ -794,7 +795,7 @@ final class WorldController {
anInt498 = l; anInt498 = l;
anInt493 = k / 2; anInt493 = k / 2;
anInt494 = l / 2; anInt494 = l / 2;
boolean aflag[][][][] = new boolean[9][32][53][53]; boolean aflag[][][][] = new boolean[9][32][256][256];
for (int i1 = 128; i1 <= 384; i1 += 32) { for (int i1 = 128; i1 <= 384; i1 += 32) {
for (int j1 = 0; j1 < 2048; j1 += 64) { for (int j1 = 0; j1 < 2048; j1 += 64) {
anInt458 = Model.modelIntArray1[i1]; anInt458 = Model.modelIntArray1[i1];
@@ -803,8 +804,8 @@ final class WorldController {
anInt461 = Model.modelIntArray2[j1]; anInt461 = Model.modelIntArray2[j1];
int l1 = (i1 - 128) / 32; int l1 = (i1 - 128) / 32;
int j2 = j1 / 64; int j2 = j1 / 64;
for (int l2 = -26; l2 <= 26; l2++) { for (int l2 = -(drawDistance + 1); l2 <= (drawDistance + 1); l2++) {
for (int j3 = -26; j3 <= 26; j3++) { for (int j3 = -(drawDistance + 1); j3 <= (drawDistance + 1); j3++) {
int k3 = l2 * 128; int k3 = l2 * 128;
int i4 = j3 * 128; int i4 = j3 * 128;
boolean flag2 = false; boolean flag2 = false;
@@ -816,7 +817,7 @@ final class WorldController {
break; break;
} }
aflag[l1][j2][l2 + 25 + 1][j3 + 25 + 1] = flag2; aflag[l1][j2][l2 + drawDistance + 1][j3 + drawDistance + 1] = flag2;
} }
} }
@@ -827,19 +828,19 @@ final class WorldController {
for (int k1 = 0; k1 < 8; k1++) { for (int k1 = 0; k1 < 8; k1++) {
for (int i2 = 0; i2 < 32; i2++) { for (int i2 = 0; i2 < 32; i2++) {
for (int k2 = -25; k2 < 25; k2++) { for (int k2 = -drawDistance; k2 < drawDistance; k2++) {
for (int i3 = -25; i3 < 25; i3++) { for (int i3 = -drawDistance; i3 < drawDistance; i3++) {
boolean flag1 = false; boolean flag1 = false;
label0 : for (int l3 = -1; l3 <= 1; l3++) { label0 : for (int l3 = -1; l3 <= 1; l3++) {
for (int j4 = -1; j4 <= 1; j4++) { for (int j4 = -1; j4 <= 1; j4++) {
if (aflag[k1][i2][k2 + l3 + 25 + 1][i3 + j4 + 25 + 1]) { if (aflag[k1][i2][k2 + l3 + drawDistance + 1][i3 + j4 + drawDistance + 1]) {
flag1 = true; flag1 = true;
} else if (aflag[k1][(i2 + 1) % 31][k2 + l3 + 25 + 1][i3 + j4 + 25 + 1]) { } else if (aflag[k1][(i2 + 1) % 31][k2 + l3 + drawDistance + 1][i3 + j4 + drawDistance + 1]) {
flag1 = true; flag1 = true;
} else if (aflag[k1 + 1][i2][k2 + l3 + 25 + 1][i3 + j4 + 25 + 1]) { } else if (aflag[k1 + 1][i2][k2 + l3 + drawDistance + 1][i3 + j4 + drawDistance + 1]) {
flag1 = true; flag1 = true;
} else { } else {
if (!aflag[k1 + 1][(i2 + 1) % 31][k2 + l3 + 25 + 1][i3 + j4 + 25 + 1]) { if (!aflag[k1 + 1][(i2 + 1) % 31][k2 + l3 + drawDistance + 1][i3 + j4 + drawDistance + 1]) {
continue; continue;
} }
flag1 = true; flag1 = true;
@@ -849,7 +850,7 @@ final class WorldController {
} }
aBooleanArrayArrayArrayArray491[k1][i2][k2 + 25][i3 + 25] = flag1; aBooleanArrayArrayArrayArray491[k1][i2][k2 + drawDistance][i3 + drawDistance] = flag1;
} }
} }
@@ -904,19 +905,19 @@ final class WorldController {
anInt453 = i / 128; anInt453 = i / 128;
anInt454 = j / 128; anInt454 = j / 128;
anInt447 = i1; anInt447 = i1;
anInt449 = anInt453 - 25; anInt449 = anInt453 - drawDistance;
if (anInt449 < 0) { if (anInt449 < 0) {
anInt449 = 0; anInt449 = 0;
} }
anInt451 = anInt454 - 25; anInt451 = anInt454 - drawDistance;
if (anInt451 < 0) { if (anInt451 < 0) {
anInt451 = 0; anInt451 = 0;
} }
anInt450 = anInt453 + 25; anInt450 = anInt453 + drawDistance;
if (anInt450 > anInt438) { if (anInt450 > anInt438) {
anInt450 = anInt438; anInt450 = anInt438;
} }
anInt452 = anInt454 + 25; anInt452 = anInt454 + drawDistance;
if (anInt452 > anInt439) { if (anInt452 > anInt439) {
anInt452 = anInt439; anInt452 = anInt439;
} }
@@ -928,7 +929,7 @@ final class WorldController {
for (int k2 = anInt451; k2 < anInt452; k2++) { for (int k2 = anInt451; k2 < anInt452; k2++) {
Ground class30_sub3 = aclass30_sub3[i2][k2]; Ground class30_sub3 = aclass30_sub3[i2][k2];
if (class30_sub3 != null) { if (class30_sub3 != null) {
if (class30_sub3.anInt1321 > i1 || !aBooleanArrayArray492[i2 - anInt453 + 25][k2 - anInt454 + 25] && anIntArrayArrayArray440[k1][i2][k2] - l < 2000) { if (class30_sub3.anInt1321 > i1 || !aBooleanArrayArray492[i2 - anInt453 + drawDistance][k2 - anInt454 + drawDistance] && anIntArrayArrayArray440[k1][i2][k2] - l < 50) {
class30_sub3.aBoolean1322 = false; class30_sub3.aBoolean1322 = false;
class30_sub3.aBoolean1323 = false; class30_sub3.aBoolean1323 = false;
class30_sub3.anInt1325 = 0; class30_sub3.anInt1325 = 0;
@@ -947,11 +948,11 @@ final class WorldController {
for (int l1 = anInt442; l1 < anInt437; l1++) { for (int l1 = anInt442; l1 < anInt437; l1++) {
Ground aclass30_sub3_1[][] = groundArray[l1]; Ground aclass30_sub3_1[][] = groundArray[l1];
for (int l2 = -25; l2 <= 0; l2++) { for (int l2 = -drawDistance; l2 <= 0; l2++) {
int i3 = anInt453 + l2; int i3 = anInt453 + l2;
int k3 = anInt453 - l2; int k3 = anInt453 - l2;
if (i3 >= anInt449 || k3 < anInt450) { if (i3 >= anInt449 || k3 < anInt450) {
for (int i4 = -25; i4 <= 0; i4++) { for (int i4 = -drawDistance; i4 <= 0; i4++) {
int k4 = anInt454 + i4; int k4 = anInt454 + i4;
int i5 = anInt454 - i4; int i5 = anInt454 - i4;
if (i3 >= anInt449) { if (i3 >= anInt449) {
@@ -995,11 +996,11 @@ final class WorldController {
for (int j2 = anInt442; j2 < anInt437; j2++) { for (int j2 = anInt442; j2 < anInt437; j2++) {
Ground aclass30_sub3_2[][] = groundArray[j2]; Ground aclass30_sub3_2[][] = groundArray[j2];
for (int j3 = -25; j3 <= 0; j3++) { for (int j3 = -drawDistance; j3 <= 0; j3++) {
int l3 = anInt453 + j3; int l3 = anInt453 + j3;
int j4 = anInt453 - j3; int j4 = anInt453 - j3;
if (l3 >= anInt449 || j4 < anInt450) { if (l3 >= anInt449 || j4 < anInt450) {
for (int l4 = -25; l4 <= 0; l4++) { for (int l4 = -drawDistance; l4 <= 0; l4++) {
int j5 = anInt454 + l4; int j5 = anInt454 + l4;
int k5 = anInt454 - l4; int k5 = anInt454 - l4;
if (l3 >= anInt449) { if (l3 >= anInt449) {
@@ -1691,15 +1692,15 @@ final class WorldController {
for (int k = 0; k < j; k++) { for (int k = 0; k < j; k++) {
Class47 class47 = aclass47[k]; Class47 class47 = aclass47[k];
if (class47.anInt791 == 1) { if (class47.anInt791 == 1) {
int l = class47.anInt787 - anInt453 + 25; int l = class47.anInt787 - anInt453 + drawDistance;
if (l < 0 || l > 50) { if (l < 0 || l > 50) {
continue; continue;
} }
int k1 = class47.anInt789 - anInt454 + 25; int k1 = class47.anInt789 - anInt454 + drawDistance;
if (k1 < 0) { if (k1 < 0) {
k1 = 0; k1 = 0;
} }
int j2 = class47.anInt790 - anInt454 + 25; int j2 = class47.anInt790 - anInt454 + drawDistance;
if (j2 > 50) { if (j2 > 50) {
j2 = 50; j2 = 50;
} }
@@ -1731,15 +1732,15 @@ final class WorldController {
continue; continue;
} }
if (class47.anInt791 == 2) { if (class47.anInt791 == 2) {
int i1 = class47.anInt789 - anInt454 + 25; int i1 = class47.anInt789 - anInt454 + drawDistance;
if (i1 < 0 || i1 > 50) { if (i1 < 0 || i1 > 50) {
continue; continue;
} }
int l1 = class47.anInt787 - anInt453 + 25; int l1 = class47.anInt787 - anInt453 + drawDistance;
if (l1 < 0) { if (l1 < 0) {
l1 = 0; l1 = 0;
} }
int k2 = class47.anInt788 - anInt453 + 25; int k2 = class47.anInt788 - anInt453 + drawDistance;
if (k2 > 50) { if (k2 > 50) {
k2 = 50; k2 = 50;
} }
@@ -1771,20 +1772,20 @@ final class WorldController {
} else if (class47.anInt791 == 4) { } else if (class47.anInt791 == 4) {
int j1 = class47.anInt796 - anInt456; int j1 = class47.anInt796 - anInt456;
if (j1 > 128) { if (j1 > 128) {
int i2 = class47.anInt789 - anInt454 + 25; int i2 = class47.anInt789 - anInt454 + drawDistance;
if (i2 < 0) { if (i2 < 0) {
i2 = 0; i2 = 0;
} }
int l2 = class47.anInt790 - anInt454 + 25; int l2 = class47.anInt790 - anInt454 + drawDistance;
if (l2 > 50) { if (l2 > 50) {
l2 = 50; l2 = 50;
} }
if (i2 <= l2) { if (i2 <= l2) {
int i3 = class47.anInt787 - anInt453 + 25; int i3 = class47.anInt787 - anInt453 + drawDistance;
if (i3 < 0) { if (i3 < 0) {
i3 = 0; i3 = 0;
} }
int l3 = class47.anInt788 - anInt453 + 25; int l3 = class47.anInt788 - anInt453 + drawDistance;
if (l3 > 50) { if (l3 > 50) {
l3 = 50; l3 = 50;
} }
@@ -2103,7 +2104,7 @@ final class WorldController {
private int anInt488; private int anInt488;
private final int[][] anIntArrayArray489 = {new int[16], {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1}, {1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0}, {0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1}, {0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1}, {1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0}, {1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1}, {1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1}}; private final int[][] anIntArrayArray489 = {new int[16], {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1}, {1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0}, {0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1}, {0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1}, {1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0}, {1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1}, {1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1}};
private final int[][] anIntArrayArray490 = {{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, {12, 8, 4, 0, 13, 9, 5, 1, 14, 10, 6, 2, 15, 11, 7, 3}, {15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0}, {3, 7, 11, 15, 2, 6, 10, 14, 1, 5, 9, 13, 0, 4, 8, 12}}; private final int[][] anIntArrayArray490 = {{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, {12, 8, 4, 0, 13, 9, 5, 1, 14, 10, 6, 2, 15, 11, 7, 3}, {15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0}, {3, 7, 11, 15, 2, 6, 10, 14, 1, 5, 9, 13, 0, 4, 8, 12}};
private static boolean[][][][] aBooleanArrayArrayArrayArray491 = new boolean[8][32][51][51]; private static boolean[][][][] aBooleanArrayArrayArrayArray491 = new boolean[8][32][256][256];
private static boolean[][] aBooleanArrayArray492; private static boolean[][] aBooleanArrayArray492;
private static int anInt493; private static int anInt493;
private static int anInt494; private static int anInt494;
+1 -1
View File
@@ -69451,7 +69451,7 @@
<npcDefinition> <npcDefinition>
<id>3157</id> <id>3157</id>
<name>Bill Teach</name> <name>Bill Teach</name>
<examine>It's an NPC.</examine> <examine>Bill Teach the pirate.</examine>
<combat>0</combat> <combat>0</combat>
<size>1</size> <size>1</size>
<attackable>false</attackable> <attackable>false</attackable>
+33 -3
View File
@@ -23853,7 +23853,7 @@
"walk": 0, "walk": 0,
"height": 0 "height": 0
}, },
{ {
"maxHit": 0, "maxHit": 0,
"strength": 0, "strength": 0,
"attack": 0, "attack": 0,
@@ -23863,7 +23863,17 @@
"walk": 0, "walk": 0,
"height": 0 "height": 0
}, },
{ {
"maxHit": 0,
"strength": 0,
"attack": 0,
"x": 3792,
"y": 3560,
"id": 1704,
"walk": 0,
"height": 0
},
{
"maxHit": 0, "maxHit": 0,
"strength": 0, "strength": 0,
"attack": 0, "attack": 0,
@@ -23973,7 +23983,7 @@
"walk": 1, "walk": 1,
"height": 0 "height": 0
}, },
{ {
"maxHit": 0, "maxHit": 0,
"strength": 0, "strength": 0,
"attack": 0, "attack": 0,
@@ -23982,6 +23992,26 @@
"id": 3155, "id": 3155,
"walk": 1, "walk": 1,
"height": 0 "height": 0
},
{
"maxHit": 0,
"strength": 0,
"attack": 0,
"x": 3714,
"y": 3499,
"id": 3156,
"walk": 1,
"height": 1
},
{
"maxHit": 0,
"strength": 0,
"attack": 0,
"x": 3683,
"y": 2948,
"id": 3157,
"walk": 1,
"height": 1
}, },
{ {
"maxHit": 0, "maxHit": 0,
@@ -15,8 +15,8 @@ public class GameConstants {
MESSAGE_DELAY = 6000, MAX_PLAYERS = 200, REQ_AMOUNT = 150; MESSAGE_DELAY = 6000, MAX_PLAYERS = 200, REQ_AMOUNT = 150;
public final static boolean SOUND = true, public final static boolean SOUND = true,
GUILDS = true, WORLD_LIST_FIX = false, GUILDS = true,
PARTY_ROOM_DISABLED = true, PARTY_ROOM_DISABLED = false,
PRINT_OBJECT_ID = false, EXPERIMENTS = false; PRINT_OBJECT_ID = false, EXPERIMENTS = false;
public static int[] SIDEBARS = { 2423, 3917, 638, 3213, 1644, 5608, 1151, public static int[] SIDEBARS = { 2423, 3917, 638, 3213, 1644, 5608, 1151,
@@ -24,7 +24,7 @@ public class GameConstants {
public static boolean TUTORIAL_ISLAND = false, public static boolean TUTORIAL_ISLAND = false,
MEMBERS_ONLY = false, sendServerPackets = false, MEMBERS_ONLY = false, sendServerPackets = false,
CLUES_ENABLED = false; CLUES_ENABLED = true;
public final static int[] FUN_WEAPONS = { 2460, 2461, 2462, 2463, 2464, public final static int[] FUN_WEAPONS = { 2460, 2461, 2462, 2463, 2464,
2465, 2466, 2467, 2468, 2469, 2470, 2471, 2471, 2473, 2474, 2475, 2465, 2466, 2467, 2468, 2469, 2470, 2471, 2471, 2473, 2474, 2475,
@@ -52,7 +52,7 @@ public class GameConstants {
public final static int CASTLE_WARS_Y = 3087; public final static int CASTLE_WARS_Y = 3087;
public static double XP_RATE = 1; public static double XP_RATE = 10;
public final static int SAVE_TIMER = 120; // save every x seconds public final static int SAVE_TIMER = 120; // save every x seconds
@@ -231,6 +231,7 @@ public class GameEngine {
CastleWars.process(); CastleWars.process();
FightPits.process(); FightPits.process();
pestControl.process(); pestControl.process();
objectHandler.process();
CycleEventHandler.getSingleton().process(); CycleEventHandler.getSingleton().process();
PlayersOnlineWebsite.addUpdatePlayersOnlineTask(); PlayersOnlineWebsite.addUpdatePlayersOnlineTask();
if(GameConstants.WEBSITE_TOTAL_CHARACTERS_INTEGRATION) { if(GameConstants.WEBSITE_TOTAL_CHARACTERS_INTEGRATION) {
@@ -17,14 +17,13 @@ public class Bot {
public Bot(String username, Integer x, Integer y, Integer z) { public Bot(String username, Integer x, Integer y, Integer z) {
botClient = new Client(null); botClient = new Client(null);
botClient.playerName = username;
botClient.playerName = username; botClient.playerName = username;
botClient.playerName2 = botClient.playerName; botClient.playerName2 = botClient.playerName;
// TODO: randomize the bot passwords
botClient.playerPass = "bot_password";
botClient.properName = Character.toUpperCase(username.charAt(1)) + username.substring(2); botClient.properName = Character.toUpperCase(username.charAt(1)) + username.substring(2);
// TODO: randomize the bot passwords
botClient.playerPass = generatePassword(10);
botClient.saveFile = true; botClient.saveFile = true;
botClient.saveCharacter = true; botClient.saveCharacter = true;
@@ -33,9 +32,11 @@ public class Bot {
botClient.npcCanAttack = false; botClient.npcCanAttack = false;
botClient.canWalkTutorial = true; botClient.canWalkTutorial = true;
botClient.tutorialProgress = 36; botClient.tutorialProgress = 36;
botClient.privateChat = 2;
GameEngine.playerHandler.newPlayerClient(botClient); GameEngine.playerHandler.newPlayerClient(botClient);
loadPlayerInfo(botClient, username, "bot_password", false); // password doesn't matter as it's not doing a real login
loadPlayerInfo(botClient, username, botClient.playerPass, false);
if (x != null) { if (x != null) {
botClient.getPlayerAssistant().movePlayer(x, y, z); botClient.getPlayerAssistant().movePlayer(x, y, z);
@@ -96,4 +97,17 @@ public class Bot {
return price + "gp"; return price + "gp";
} }
} }
public String generatePassword(int targetStringLength) {
int leftLimit = 97; // letter 'a'
int rightLimit = 122; // letter 'z'
Random random = new Random();
StringBuilder buffer = new StringBuilder(targetStringLength);
for (int i = 0; i < targetStringLength; i++) {
int randomLimitedInt = leftLimit + (int)
(random.nextFloat() * (rightLimit - leftLimit + 1));
buffer.append((char) randomLimitedInt);
}
return buffer.toString();
}
} }
@@ -14,7 +14,7 @@ public enum SpellTeleport {
SENNTISTEN(60, 50245, 70, 3321, 3335, 0, new int[][] {{566, 1}, {563, 2}}, "ancient"), SENNTISTEN(60, 50245, 70, 3321, 3335, 0, new int[][] {{566, 1}, {563, 2}}, "ancient"),
KHARYLL(66, 50253, 76, 3493, 3472, 0, new int[][] {{565, 1}, {563, 2}}, "ancient"), KHARYLL(66, 50253, 76, 3493, 3472, 0, new int[][] {{565, 1}, {563, 2}}, "ancient"),
LASSAR(72, 51005, 82, 3006, 3471, 0, new int[][] {{563, 2}, {555, 4}}, "ancient"), LASSAR(72, 51005, 82, 3006, 3471, 0, new int[][] {{563, 2}, {555, 4}}, "ancient"),
DAREEYAK(78, 51013, 88, 3161, 3671, 0, new int[][] {{563, 2}, {554, 3}, {556, 2}}, "ancient"), DAREEYAK(78, 51013, 88, 2966, 3697, 0, new int[][] {{563, 2}, {554, 3}, {556, 2}}, "ancient"),
CARRALLANGAR(84, 51023, 94, 3157, 3669, 0, new int[][] {{566, 2}, {563, 2}}, "ancient"), CARRALLANGAR(84, 51023, 94, 3157, 3669, 0, new int[][] {{566, 2}, {563, 2}}, "ancient"),
ANNAKARL(90, 51031, 100, 3286, 3884, 0, new int[][] {{565, 2}, {563, 2}}, "ancient"), ANNAKARL(90, 51031, 100, 3286, 3884, 0, new int[][] {{565, 2}, {563, 2}}, "ancient"),
GHORROCK(96, 51039, 106, 2977, 3873, 0, new int[][] {{563, 2}, {555, 8}}, "ancient"); GHORROCK(96, 51039, 106, 2977, 3873, 0, new int[][] {{563, 2}, {555, 8}}, "ancient");
@@ -1,6 +1,5 @@
package com.rs2.game.content.random; package com.rs2.game.content.random;
import java.awt.Point;
import java.util.Random; import java.util.Random;
import com.rs2.GameEngine; import com.rs2.GameEngine;
import com.rs2.game.objects.Objects; import com.rs2.game.objects.Objects;
@@ -9,45 +8,61 @@ import com.rs2.game.players.Player;
public class Balloons extends Objects { public class Balloons extends Objects {
static Random r = new Random(); static Random r = new Random();
public static int item, amount; public static int minID = 115;
public static int x, y; public static int maxID = 120;
public int item, amount;
@SuppressWarnings("static-access") public Balloons(int x, int y, int height, int face, int type, int ticks, int item, int amount) {
public Balloons(int id, int x, int y, int height, int face, int type, super(getRandomBalloon(), x, y, height, face, type, ticks);
int ticks, int item, int amount) { GameEngine.objectHandler.addObject(this);
super(id, x, y, height, face, type, ticks); GameEngine.objectHandler.placeObject(this);
this.x = x;
this.y = y;
this.item = item; this.item = item;
this.amount = amount; this.amount = amount;
} }
public static void popBalloon(Player player, int x, int y) { public static Balloons getBalloon(int x, int y, int height, int item, int amount) {
PartyRoom.coords.remove(getCoords()); return new Balloons(x, y, 0, 0, 10, 0, item, amount);
Balloons empty = remove(x, y); }
GameEngine.itemHandler.createGroundItem(player, item, x, y, amount, player.playerId);
item = 0; public static Balloons getBalloon(int x, int y, int item, int amount) {
amount = 0; return getBalloon(x, y, 0, item, amount);
GameEngine.objectHandler.addObject(empty); }
GameEngine.objectHandler.placeObject(empty);
public static Balloons getEmpty(int x, int y, int height) {
return getBalloon(x, y, height, 0, 0);
}
public static Balloons getEmpty(int x, int y) {
return getEmpty(x, y, 0);
}
public void popBalloon(Player player) {
remove();
if (item > 0 && amount > 0) {
GameEngine.itemHandler.createGroundItem(player, item, objectX, objectY, amount, player.playerId);
item = 0;
amount = 0;
}
player.startAnimation(794); player.startAnimation(794);
} }
public static Point getCoords() { public static int getRandomBalloon() {
return new Point(x, y); // between 115 and 122
return 115 + r.nextInt(8);
} }
public static Balloons getBalloon(int item, int amount) { public int getPoppedBalloon() {
return new Balloons(115 + r.nextInt(5), 2730 + r.nextInt(13), // between 115 and 122
3462 + r.nextInt(13), 0, 0, 10, 0, item, amount); return objectId + 8;
} }
public static Balloons getEmpty() { public void remove() {
return new Balloons(115 + r.nextInt(5), 2730 + r.nextInt(13), // Spawn the popped balloons
3462 + r.nextInt(13), 0, 0, 10, 0, 0, 0); Objects poppedBallons = new Objects(getPoppedBalloon(), objectX, objectY, objectHeight, objectFace, objectType, 0);
} GameEngine.objectHandler.addObject(poppedBallons);
GameEngine.objectHandler.placeObject(poppedBallons);
public static Balloons remove(int x, int y) { // Remove the popped balloons
return new Balloons(-1, x, y, 0, 0, 10, 0, 0, 0); Objects empty = new Objects(-1, objectX, objectY, objectHeight, objectFace, objectType, 4);
GameEngine.objectHandler.addObject(empty);
} }
} }
@@ -9,15 +9,18 @@ import com.rs2.game.items.ItemConstants;
import com.rs2.game.items.ItemData; import com.rs2.game.items.ItemData;
import com.rs2.game.objects.Objects; import com.rs2.game.objects.Objects;
import com.rs2.game.players.Player; import com.rs2.game.players.Player;
import com.rs2.game.players.PlayerHandler;
import com.rs2.world.Boundary;
public class PartyRoom { public class PartyRoom {
static int mainInterfaceID = 2156;
static Random r = new Random(); static Random r = new Random();
static int[] roomItems = new int[50]; static int[] roomItems = new int[216];
static int[] roomItemsN = new int[50]; static int[] roomItemsN = new int[216];
static Balloons[][] balloons = new Balloons[15][14];
static Point corner = new Point(2730, 3462);
static long lastAnnouncment; static long lastAnnouncment;
static int announcmentFrequency = 1; // announcment frequency in mins static int announcmentFrequency = 1; // announcment frequency in mins
static ArrayList<Point> coords = new ArrayList<Point>();
public static int getAmount() { public static int getAmount() {
int amount = 0; int amount = 0;
@@ -37,47 +40,76 @@ public class PartyRoom {
} }
public static void dropAll() { public static void dropAll() {
int maxTry = 150;
int trys = 0; int trys = 0;
int amount = getAmount(); int amount = getAmount();
if (amount < 1) { if (amount < 1) {
return; return;
} }
for (int x = 0; x < roomItems.length; x++) { for (int i = 0; i < roomItems.length; i++) {
if (roomItemsN[x] > 0) { int split = r.nextInt(4);
Balloons b = null; while (roomItemsN[i] > 0) {
do { int x = r.nextInt(balloons.length);
b = Balloons.getBalloon(roomItems[x], roomItemsN[x]); int y = r.nextInt(balloons[0].length);
int amt = split > 0 ? Math.max(1, (int) (Math.random() * roomItemsN[i])) : roomItemsN[i];
// If already balloons there, or on the table, retry
while ((balloons[x][y] != null || Boundary.isIn(corner.x + x, corner.y + y, Boundary.PARTY_ROOM_TABLE)) && trys < maxTry) {
x = r.nextInt(balloons.length);
y = r.nextInt(balloons[0].length);
trys++; trys++;
} while (coords.contains(Balloons.getCoords()) && trys < 100); }
GameEngine.objectHandler.addObject(b);
GameEngine.objectHandler.placeObject(b); if (trys >= maxTry) {
break;
}
balloons[x][y] = Balloons.getBalloon(corner.x + x, corner.y + y, roomItems[i], amt);
GameEngine.objectHandler.addObject(balloons[x][y]);
GameEngine.objectHandler.placeObject(balloons[x][y]);
roomItemsN[i] -= amt;
if (roomItemsN[i] <= 0) {
roomItems[i] = 0;
}
split--;
} }
if (trys > 100) {
break;
}
roomItems[x] = 0;
roomItemsN[x] = 0;
} }
trys = 0; trys = 0;
for (int x = 0; x < amount * 2; x++) { for (int i = 0; i < amount * 2; i++) {
Objects o; int x = r.nextInt(balloons.length);
do { int y = r.nextInt(balloons[0].length);
o = Balloons.getEmpty();
} while (coords.contains(new Point(o.objectX, o.objectY)) // If already balloons there, or on the table, retry
&& trys < 100); while ((balloons[x][y] != null || Boundary.isIn(corner.x + x, corner.y + y, Boundary.PARTY_ROOM_TABLE)) && trys < maxTry) {
if (trys > 100) { x = r.nextInt(balloons.length);
y = r.nextInt(balloons[0].length);
trys++;
}
if (trys >= maxTry) {
break; break;
} }
GameEngine.objectHandler.addObject(o);
GameEngine.objectHandler.placeObject(o); balloons[x][y] = Balloons.getEmpty(corner.x + x, corner.y + y);
GameEngine.objectHandler.addObject(balloons[x][y]);
GameEngine.objectHandler.placeObject(balloons[x][y]);
} }
coords.clear();
} }
public static int arraySlot(int[] array, int target) { public static void popBalloon(Player player, int x, int y) {
x = x - corner.x;
y = y - corner.y;
Balloons balloon = balloons[x][y];
if (balloon != null) {
balloon.popBalloon(player);
}
balloons[x][y] = null;
}
public static int arraySlot(int[] array, int itemID) {
int spare = -1; int spare = -1;
for (int x = 0; x < array.length; x++) { for (int x = 0; x < array.length; x++) {
if (array[x] == target) { if (array[x] == itemID && ItemData.itemStackable[itemID]) {
return x; return x;
} else if (spare == -1 && array[x] <= 0) { } else if (spare == -1 && array[x] <= 0) {
spare = x; spare = x;
@@ -90,10 +122,10 @@ public class PartyRoom {
if (!GameConstants.PARTY_ROOM_DISABLED) { if (!GameConstants.PARTY_ROOM_DISABLED) {
updateGlobal(player); updateGlobal(player);
updateDeposit(player); updateDeposit(player);
player.getItemAssistant().resetItems(5064); player.getItemAssistant().resetItems(5064); // Player inventory
player.getPacketSender().sendFrame248(2156, 5063); player.getPacketSender().sendFrame248(mainInterfaceID, 5063); // Party Drop Chest interface, Deposit interface
} else { } else {
player.getPacketSender().sendMessage("The partyroom has been disabled."); player.getPacketSender().sendMessage("The partyroom is currently disabled.");
} }
} }
@@ -103,8 +135,7 @@ public class PartyRoom {
if (ItemData.itemStackable[c.party[x]]) { if (ItemData.itemStackable[c.party[x]]) {
int slot = arraySlot(roomItems, c.party[x]); int slot = arraySlot(roomItems, c.party[x]);
if (slot < 0) { if (slot < 0) {
c.getPacketSender().sendMessage( c.getPacketSender().sendMessage("Theres not enough space left in the chest.");
"Theres not enough space left in the chest.");
break; break;
} }
if (roomItems[slot] != c.party[x]) { if (roomItems[slot] != c.party[x]) {
@@ -118,11 +149,9 @@ public class PartyRoom {
} else { } else {
int left = c.partyN[x]; int left = c.partyN[x];
for (int y = 0; y < left; y++) { for (int y = 0; y < left; y++) {
int slot = arraySlot(roomItems, -2); int slot = arraySlot(roomItems, c.party[x]);
if (slot < 0) { if (slot < 0) {
c.getPacketSender() c.getPacketSender().sendMessage("Theres not enough space left in the chest.");
.sendMessage(
"Theres not enough space left in the chest.");
break; break;
} }
roomItems[slot] = c.party[x]; roomItems[slot] = c.party[x];
@@ -136,14 +165,19 @@ public class PartyRoom {
} }
} }
updateDeposit(c); updateDeposit(c);
updateGlobal(c); updateAll();
} }
// public static void updateAll() { public static void updateAll() {
// for (int x = 0; x < PlayerHandler.getPlayers().length; x++) { for (Player p : PlayerHandler.players) {
// updateGlobal((Client) PlayerHandler.getPlayers()[x]); if (p == null) {
// } continue;
// } }
if (p.lastMainFrameInterface == mainInterfaceID) {
updateGlobal(p);
}
}
}
public static void fix(Player c) { public static void fix(Player c) {
for (int x = 0; x < 8; x++) { for (int x = 0; x < 8; x++) {
@@ -156,7 +190,6 @@ public class PartyRoom {
} }
public static void depositItem(Player player, int id, int amount) { public static void depositItem(Player player, int id, int amount) {
int slot = arraySlot(player.party, id);
for (int i : ItemConstants.ITEM_TRADEABLE) { for (int i : ItemConstants.ITEM_TRADEABLE) {
if (i == id) { if (i == id) {
player.getPacketSender().sendMessage("You can't deposit this item."); player.getPacketSender().sendMessage("You can't deposit this item.");
@@ -167,57 +200,66 @@ public class PartyRoom {
return; return;
} }
} }
if (player.getItemAssistant().getItemAmount(id) < amount) {
amount = player.getItemAssistant().getItemAmount(id); amount = Math.min(player.getItemAssistant().getItemAmount(id), amount);
}
if (!player.getItemAssistant().playerHasItem(id, amount)) { if (!player.getItemAssistant().playerHasItem(id, amount)) {
player.getPacketSender().sendMessage("You don't have that many items!"); player.getPacketSender().sendMessage("You don't have that many items!");
return; return;
} }
if (slot == -1) {
player.getPacketSender().sendMessage("You cant deposit more than 8 items at once."); if (player.getItemAssistant().isStackable(id)) {
return; int slot = arraySlot(player.party, id);
} if (slot == -1) {
player.getItemAssistant().deleteItem(id, amount); player.getPacketSender().sendMessage("You can only deposit up to 8 items at once.");
if (player.party[slot] != id) { return;
player.party[slot] = id; }
player.partyN[slot] = amount;
player.getItemAssistant().deleteItem(id, amount);
if (player.party[slot] != id) {
player.party[slot] = id;
player.partyN[slot] = amount;
} else {
player.party[slot] = id;
player.partyN[slot] += amount;
}
} else { } else {
player.party[slot] = id; for (int i = 0; i < amount; i ++) {
player.partyN[slot] += amount; int slot = arraySlot(player.party, id);
if (slot == -1) {
player.getPacketSender().sendMessage("You can only deposit up to 8 items at once.");
updateDeposit(player);
return;
}
player.getItemAssistant().deleteItem(id, 1);
player.party[slot] = id;
player.partyN[slot] = 1;
}
} }
updateDeposit(player); updateDeposit(player);
} }
public static void withdrawItem(Player c, int slot) { public static void withdrawItem(Player c, int slot, int amount) {
if (c.party[slot] >= 0 && c.getItemAssistant().freeSlots() > 0) { int itemID = c.party[slot];
c.getItemAssistant().addItem(c.party[slot], c.partyN[slot]); amount = Math.min(c.partyN[slot], amount);
c.party[slot] = 0; if (c.party[slot] >= 0 && c.getItemAssistant().freeSlots(itemID, amount) > 0) {
c.partyN[slot] = 0; c.getItemAssistant().addItem(c.party[slot], amount);
c.partyN[slot] -= amount;
if (c.partyN[slot] <= 0) {
c.party[slot] = 0;
}
} }
updateDeposit(c); updateDeposit(c);
updateGlobal(c);
} }
public static void updateDeposit(Player player) { public static void updateDeposit(Player player) {
player.getItemAssistant().resetItems(5064); player.getItemAssistant().resetItems(5064);
for (int x = 0; x < 8; x++) { player.getPacketSender().sendUpdateItems(2274, player.party, player.partyN);
if (player.partyN[x] <= 0) {
itemOnInterface(player, 2274, x, -1, 0);
} else {
itemOnInterface(player, 2274, x, player.party[x], player.partyN[x]);
}
}
} }
public static void updateGlobal(Player player) { public static void updateGlobal(Player player) {
for (int x = 0; x < roomItems.length; x++) { player.getPacketSender().sendUpdateItems(2273, roomItems, roomItemsN);
if (roomItemsN[x] <= 0) {
itemOnInterface(player, 2273, x, -1, 0);
} else {
itemOnInterface(player, 2273, x, roomItems[x], roomItemsN[x]);
}
}
} }
public static void itemOnInterface(Player player, int frame, int slot, int id, int amount) { public static void itemOnInterface(Player player, int frame, int slot, int id, int amount) {
@@ -10,7 +10,7 @@ import com.rs2.game.players.Player;
public class AgilityShortcut { public class AgilityShortcut {
private static final int WALK = 1, MOVE = 2, AGILITY = 3; private static final int WALK = 1, MOVE = 2, AGILITY = 3, DOWN = 4, UP = 5;
private static void handleAgility(Player player, int x, int y, int levelReq, int anim, int walk, String message) { private static void handleAgility(Player player, int x, int y, int levelReq, int anim, int walk, String message) {
if (player.playerLevel[GameConstants.AGILITY] < levelReq) { if (player.playerLevel[GameConstants.AGILITY] < levelReq) {
@@ -18,15 +18,21 @@ public class AgilityShortcut {
return; return;
} }
switch (walk) { switch (walk) {
case 1: case WALK:
player.getPlayerAssistant().walkTo(x, y); player.getPlayerAssistant().walkTo(x, y);
break; break;
case 2: case MOVE:
player.getPlayerAssistant().movePlayer(x, y, player.heightLevel); player.getPlayerAssistant().movePlayer(x, y, player.heightLevel);
break; break;
case 3: case AGILITY:
player.getAgility().walk(x, y, anim, -1); player.getAgility().walk(x, y, anim, -1);
break; break;
case DOWN:
player.getPlayerAssistant().movePlayer(x, y, player.heightLevel - 1);
break;
case UP:
player.getPlayerAssistant().movePlayer(x, y, player.heightLevel + 1);
break;
} }
if (anim != 0 && anim != -1) { if (anim != 0 && anim != -1) {
player.startAnimation(anim); player.startAnimation(anim);
@@ -181,6 +187,18 @@ public class AgilityShortcut {
"You pass through the agility shortcut."); "You pass through the agility shortcut.");
} }
break; break;
case 9307:
if (player.absY == 9888) {
handleAgility(player, 3670, 9888, 58, Agility.CLIMB_UP_EMOTE, UP,
"You jump up the weathered wall.");
}
break;
case 9308:
if (player.absY == 9888) {
handleAgility(player, 3671, 9888, 58, Agility.CLIMB_DOWN_EMOTE, DOWN,
"You jump down the weathered wall.");
}
break;
case 9309: case 9309:
if (player.absY == 3309) { if (player.absY == 3309) {
handleAgility(player, 2948, 3313, 26, 844, MOVE, handleAgility(player, 2948, 3313, 26, 844, MOVE,
@@ -40,8 +40,7 @@ public class GemCutting extends CraftingData {
public void execute(CycleEventContainer container) { public void execute(CycleEventContainer container) {
if (Misc.random(2) == 0 && itemUsed > 1624 && itemUsed < 1630 || usedWith > 1624 && usedWith < 1630 && Misc.random(2) == 0) { if (Misc.random(2) == 0 && itemUsed > 1624 && itemUsed < 1630 || usedWith > 1624 && usedWith < 1630 && Misc.random(2) == 0) {
player.getPacketSender().sendMessage("You fail to cut the gem."); player.getPacketSender().sendMessage("You fail to cut the gem.");
player.getItemAssistant().addItem(1633, 1); player.getItemAssistant().replaceItem(itemId, 1633);
player.getItemAssistant().deleteItem(itemId, 1);
player.getPlayerAssistant().addSkillXP(1, 12); player.getPlayerAssistant().addSkillXP(1, 12);
} }
if (player.isCrafting) { if (player.isCrafting) {
@@ -4,6 +4,7 @@ import com.rs2.GameConstants;
import com.rs2.event.CycleEvent; import com.rs2.event.CycleEvent;
import com.rs2.event.CycleEventContainer; import com.rs2.event.CycleEventContainer;
import com.rs2.event.CycleEventHandler; import com.rs2.event.CycleEventHandler;
import com.rs2.game.items.ItemAssistant;
import com.rs2.game.players.Player; import com.rs2.game.players.Player;
/** /**
@@ -18,13 +19,35 @@ public class Ectofuntus {
* Data storage for ectofuntus * Data storage for ectofuntus
*/ */
public enum EctofuntusData { public enum EctofuntusData {
BONES(526, 4255, 18), BIG_BONES(532, 4257, 60), BABYDRAGON_BONES(534, BONES(526, 4255, 18),
4260, 120), DRAGON_BONES(536, 4261, 288), DAGANNOTH_BONES(6729, BURNT_BONES(528, 4258, 18),
6728, 500); WOLF_BONES(2859, 4262, 18),
BAT_BONES(530, 4256, 21.2),
BIG_BONES(532, 4257, 60),
JOGRE_BONES(3125, 4271, 60),
BURNT_JOGRE_BONES(3127, 4259, 60),
BABY_DRAGON_BONES(534, 4260, 120),
DRAGON_BONES(536, 4261, 288),
SMALL_NINJA_MONKEY_BONES(3179, 4263, 20),
MEDIUM_NINJA_MONKEY_BONES(3180, 4264, 20),
SMALL_ZOMBIE_MONKEY_BONES(3183, 4268, 20),
LARGE_ZOMBIE_MONKEY_BONES(3181, 4269, 20),
GORILLA_MONKEY_BONES(3182, 4265, 20),
BEARDED_GORILLA_MONKEY_BONES(3182, 4266, 20),
MONKEY_BONES(3185, 4267, 20),
SKELETON_BONES(2530, 4270, 20),
ZOGRE_BONES(4812, 4852, 90),
FAYRG_BONES(4830, 4853, 336),
RAURG_BONES(4832, 4854, 384),
OURG_BONES(4834, 4855, 560),
SHAIKAHAN_BONES(3123, 5615, 100),
DAGANNOTH_BONES(6729, 6728, 500),
WYVERN_BONES(6812, 6810, 200);
int boneId, bonemealId, worshipExperience; int boneId, bonemealId;
double worshipExperience;
EctofuntusData(int boneId, int bonemealId, int worshipExperience) { EctofuntusData(int boneId, int bonemealId, double worshipExperience) {
this.boneId = boneId; this.boneId = boneId;
this.bonemealId = bonemealId; this.bonemealId = bonemealId;
this.worshipExperience = worshipExperience; this.worshipExperience = worshipExperience;
@@ -38,26 +61,11 @@ public class Ectofuntus {
return bonemealId; return bonemealId;
} }
public int getWorshipExperience() { public double getWorshipExperience() {
return worshipExperience; return worshipExperience;
} }
} }
/**
* Get the name of the bone used
*
* @param boneId
* @return
*/
public static String getBoneName(int boneId) {
for (EctofuntusData ectofuntus : EctofuntusData.values()) {
if (ectofuntus.boneId == boneId) {
return ectofuntus.name().replaceAll("_", " ").toLowerCase();
}
}
return "";
}
/** /**
* Put bones in the loader * Put bones in the loader
* *
@@ -80,7 +88,7 @@ public class Ectofuntus {
player.getItemAssistant().deleteItem(ectofuntus.getBoneId(), 1); player.getItemAssistant().deleteItem(ectofuntus.getBoneId(), 1);
player.ectofuntusBoneCrusherState = "Loaded"; player.ectofuntusBoneCrusherState = "Loaded";
player.ectofuntusBoneUsed = ectofuntus.getBoneId(); player.ectofuntusBoneUsed = ectofuntus.getBoneId();
player.getPacketSender().sendMessage("You load the " + getBoneName(ectofuntus.getBoneId()) + " into the loader."); player.getPacketSender().sendMessage("You load the " + ItemAssistant.getItemName(ectofuntus.getBoneId()) + " into the loader.");
container.stop(); container.stop();
} }
@@ -158,18 +166,28 @@ public class Ectofuntus {
* @param objectId * @param objectId
* @param itemId * @param itemId
*/ */
public static void handleEctofuntus(Player player, int objectId) { public static void handleEctofuntus(Player player) {
player.turnPlayerTo(3660, 3520); player.turnPlayerTo(3660, 3520);
boolean worshipped = false;
for (final EctofuntusData ectofuntus : EctofuntusData.values()) { for (final EctofuntusData ectofuntus : EctofuntusData.values()) {
if (objectId == ECTOFUNTUS && player.getItemAssistant().playerHasItem(ectofuntus.getBonemealId()) && player.getItemAssistant().playerHasItem(BUCKET_OF_SLIME)) { if (!worshipped && player.getItemAssistant().playerHasItem(ectofuntus.getBonemealId()) && player.getItemAssistant().playerHasItem(BUCKET_OF_SLIME)) {
worshipped = true;
CycleEventHandler.getSingleton().addEvent(player, new CycleEvent() { CycleEventHandler.getSingleton().addEvent(player, new CycleEvent() {
@Override @Override
public void execute(CycleEventContainer container) { public void execute(CycleEventContainer container) {
player.getItemAssistant().deleteItem(ectofuntus.getBonemealId(), 1); if (player.isMoving || !player.getItemAssistant().playerHasItem(ectofuntus.getBonemealId()) || !player.getItemAssistant().playerHasItem(BUCKET_OF_SLIME)) {
container.stop();
return;
}
player.getItemAssistant().replaceItem(ectofuntus.getBonemealId(), 1931);
player.getItemAssistant().replaceItem(BUCKET_OF_SLIME, 1925);// Bucket
player.startAnimation(WORSHIP); player.startAnimation(WORSHIP);
player.getPlayerAssistant().addSkillXP(ectofuntus.getWorshipExperience(), GameConstants.PRAYER); player.getPlayerAssistant().addSkillXP(ectofuntus.getWorshipExperience(), GameConstants.PRAYER);
player.getPacketSender().sendMessage("You pray to the ectofuntus."); player.getPacketSender().sendMessage("You pray to the ectofuntus.");
container.stop(); player.ectofuntusWorshipped++;
if (player.isMoving || !player.getItemAssistant().playerHasItem(ectofuntus.getBonemealId()) || !player.getItemAssistant().playerHasItem(BUCKET_OF_SLIME)) {
container.stop();
}
} }
@Override @Override
@@ -180,6 +198,10 @@ public class Ectofuntus {
}, 3); }, 3);
} }
} }
if (!worshipped) {
player.getPacketSender().sendMessage("You'll need ectoplasm and bonemeal to worship the Ectofuntus.");
}
} }
/** /**
@@ -217,23 +239,25 @@ public class Ectofuntus {
/** /**
* item constants * item constants
*/ */
private final static int POT = 1931; public final static int POT = 1931;
public final static int BUCKET = 1925; public final static int BUCKET = 1925;
private final static int BUCKET_OF_SLIME = 4286; public final static int BUCKET_OF_SLIME = 4286;
/** /**
* object constants * object constants
*/ */
private final static int ECTOFUNTUS = 5282; public final static int ECTOFUNTUS = 5282;
private final static int LOADER = 11162; public final static int LOADER = 11162;
private final static int[] SLIME = { 5461, 5462 }; public final static int GRINDER = 11163;
public final static int BIN = 11164;
public final static int[] SLIME = { 5461, 5462 };
/** /**
* animation constants * animation constants
*/ */
private final static int WORSHIP = 1651; public final static int WORSHIP = 1651;
private final static int WHEEL = 1648; public final static int WHEEL = 1648;
private final static int BONES = 1649; public final static int BONES = 1649;
private final static int BUCKET_FILL = 895; public final static int BUCKET_FILL = 895;
} }
@@ -37,7 +37,7 @@ public class Woodcutting {
MAGIC(new int[] {1306}, 7401, 75, 250, 1513, 150, 3), MAGIC(new int[] {1306}, 7401, 75, 250, 1513, 150, 3),
EVERGREEN(new int[] {1319, 1318, 1315, 1316, 1332}, 1341, 1, 25, 1511, 11, 100), EVERGREEN(new int[] {1319, 1318, 1315, 1316, 1332}, 1341, 1, 25, 1511, 11, 100),
ACHEY(new int[] {2023}, 3371, 1, 25, 1511, 11, 100), ACHEY(new int[] {2023}, 3371, 1, 25, 1511, 11, 100),
DRAMEN(new int[] {1292}, 1341, 1, 25, 771, 45, 100); DRAMEN(new int[] {1292}, 1341, 36, 0, 771, 45, 100);
private int[] treeId; private int[] treeId;
private int stumpId, levelReq, xpRecieved, logRecieved, respawnTime, cutChance; private int stumpId, levelReq, xpRecieved, logRecieved, respawnTime, cutChance;
@@ -14,6 +14,7 @@ import com.rs2.game.content.skills.slayer.Slayer;
import com.rs2.game.content.traveling.CarpetTravel; import com.rs2.game.content.traveling.CarpetTravel;
import com.rs2.game.content.traveling.Sailing; import com.rs2.game.content.traveling.Sailing;
import com.rs2.game.globalworldobjects.PassDoor; import com.rs2.game.globalworldobjects.PassDoor;
import com.rs2.game.items.ItemConstants;
import com.rs2.game.npcs.NpcHandler; import com.rs2.game.npcs.NpcHandler;
import com.rs2.game.objects.impl.OtherObjects; import com.rs2.game.objects.impl.OtherObjects;
import com.rs2.game.players.Player; import com.rs2.game.players.Player;
@@ -4912,6 +4913,72 @@ public class DialogueHandler {
player.nextChat = 0; player.nextChat = 0;
break; break;
case 1390:
if (player.getItemAssistant().playerHasEquipped(ItemConstants.AMULET, 552)) {
sendPlayerChat("Can I have the tokens I have earned?");
player.nextChat = 1391;
} else {
sendNpcChat1("Wooooo. Oooooh!", player.talkingNpc, "Ghost disciple");
player.nextChat = 0;
}
break;
case 1391:
int amount = player.ectofuntusWorshipped * 5;
if (amount <= 0) {
sendNpcChat1("You haven't earned any tokens yet.", player.talkingNpc, "Ghost disciple");
} else if (player.getItemAssistant().freeSlots(4278, amount) <= 0) {
sendNpcChat1("You don't have enough space in your inventory.", player.talkingNpc, "Ghost disciple");
} else {
sendNpcChat1("Certainly, mortal. Here's " + amount + " ecto-tokens.", player.talkingNpc, "Ghost disciple");
player.getItemAssistant().addItem(4278, amount);
player.ectofuntusWorshipped = 0;
}
player.nextChat = 0;
break;
case 1400:
if (!player.getItemAssistant().playerHasEquipped(ItemConstants.AMULET, 552)) {
sendNpcChat1("Wooooo. Oooooh!", player.talkingNpc, "Ghost Captain");
player.nextChat = 0;
} else {
if (player.talkingNpc == 1704) {
sendNpcChat1("Would you like a ride to Port Phasmatys?", player.talkingNpc, "Ghost Captain");
} else {
sendNpcChat1("Would you like a ride to Dragontooth Island?", player.talkingNpc, "Ghost Captain");
}
player.nextChat = 1401;
}
break;
case 1401:
sendOption(
"Yes please." + (player.talkingNpc == 1705 ? " (25 Ecto-tokens)" : ""),
"No thanks.");
player.dialogueAction = 185;
break;
case 1402:
sendNpcChat1("You don't have enough Ecto-tokens.", player.talkingNpc, "Ghost Captain");
player.nextChat = 0;
break;
case 1410:
if (player.talkingNpc == 3157) {
sendNpcChat1("Would you like a ride to Port Phasmatys?", player.talkingNpc, "Bill Teach");
} else {
sendNpcChat1("Would you like a ride to Mos Le'Harmless?", player.talkingNpc, "Bill Teach");
}
player.nextChat = 1411;
break;
case 1411:
sendOption(
"Yes please.",
"No thanks.");
player.dialogueAction = 186;
break;
case 2995: case 2995:
player.canWalkTutorial = false; player.canWalkTutorial = false;
sendStatement( sendStatement(
@@ -561,6 +561,22 @@ public class DialogueOptions {
} else if (player.dialogueAction == 184) { } else if (player.dialogueAction == 184) {
player.getDialogueHandler().sendDialogues(624, player.npcType); player.getDialogueHandler().sendDialogues(624, player.npcType);
return; return;
} else if (player.dialogueAction == 185) {
if (player.talkingNpc == 1704) {
player.getPlayerAssistant().movePlayer(3702, 3487, 0);
} else if (player.getItemAssistant().playerHasItem(4278, 25)) {
// if player has enough ecto tokens
player.getItemAssistant().deleteItem(4278, 25);
player.getPlayerAssistant().movePlayer(3791, 3560, 0);
} else {
player.getDialogueHandler().sendDialogues(1402, player.npcType);
}
} else if (player.dialogueAction == 186) {
if (player.talkingNpc == 3157) {
player.getPlayerAssistant().movePlayer(3714, 3499, 1);
} else {
player.getPlayerAssistant().movePlayer(3683, 2948, 1);
}
} else if (player.dialogueAction == 3204) { } else if (player.dialogueAction == 3204) {
player.getItemAssistant().deleteItem(1929, 1); player.getItemAssistant().deleteItem(1929, 1);
player.getItemAssistant().deleteItem(1933, 1); player.getItemAssistant().deleteItem(1933, 1);
@@ -103,9 +103,13 @@ public class ItemAssistant {
} }
public void replaceItem(int itemToReplace, int replaceWith) { public void replaceItem(int itemToReplace, int replaceWith) {
if(playerHasItem(itemToReplace)) { replaceItem(itemToReplace, replaceWith, 1);
deleteItem(itemToReplace, 1); }
addItem(replaceWith, 1);
public void replaceItem(int itemToReplace, int replaceWith, int amount) {
if(playerHasItem(itemToReplace, amount)) {
deleteItem(itemToReplace, amount);
addItem(replaceWith, amount);
} }
} }
@@ -1705,6 +1709,7 @@ public class ItemAssistant {
} }
public void resetBank() { public void resetBank() {
player.getPacketSender().sendString("The Bank of " + GameConstants.SERVER_NAME, 5383, true);
if (player.getOutStream() != null) { if (player.getOutStream() != null) {
player.getOutStream().createFrameVarSizeWord(53); player.getOutStream().createFrameVarSizeWord(53);
player.getOutStream().writeWord(5382); // bank player.getOutStream().writeWord(5382); // bank
@@ -2480,6 +2485,18 @@ public class ItemAssistant {
return freeS; return freeS;
} }
public int freeSlots(int itemID, int amount) {
int freeS = 0;
for (int i = 0; i < player.playerItems.length; i ++) {
int _id = player.playerItems[i];
int _amt = player.playerItemsN[i];
if (_id <= 0 || (_id == itemID && isStackable(_id) && _amt + amount <= Integer.MAX_VALUE)) {
freeS++;
}
}
return freeS;
}
public int findItem(int id, int[] items, int[] amounts) { public int findItem(int id, int[] items, int[] amounts) {
for (int i = 0; i < player.playerItems.length; i++) { for (int i = 0; i < player.playerItems.length; i++) {
if (items[i] - 1 == id && amounts[i] > 0) { if (items[i] - 1 == id && amounts[i] > 0) {
@@ -104,7 +104,7 @@ public class ItemConstants {
2416, 2417, 88, 1540, 2714, 432, 433, 1555, 1556, 1557, 1558, 1559, 2416, 2417, 88, 1540, 2714, 432, 433, 1555, 1556, 1557, 1558, 1559,
1560, 1561, 1562, 1563, 1564, 1565, 7585, 7584, 300, 775, 776, 777, 1560, 1561, 1562, 1563, 1564, 1565, 7585, 7584, 300, 775, 776, 777,
6180, 6181, 6182, 6183, 6184, 6185, 6186, 6187, 6188, 2528, 4447, 6180, 6181, 6182, 6183, 6184, 6185, 6186, 6187, 6188, 2528, 4447,
290, 666, 667 }; 290, 666, 667, 4251, 4252, 4278};
public final static int[] ITEM_TRADEABLE = { 5317, 3842, 3844, 3840, 8844, 8845, public final static int[] ITEM_TRADEABLE = { 5317, 3842, 3844, 3840, 8844, 8845,
8846, 8847, 8848, 8849, 8850, 10551, 6570, 7462, 7461, 7460, 7459, 8846, 8847, 8848, 8849, 8850, 10551, 6570, 7462, 7461, 7460, 7459,
@@ -120,15 +120,15 @@ public class ItemConstants {
4218, 4219, 4220, 4221, 4222, 4223, 4224, 1555, 1556, 1557, 1558, 4218, 4219, 4220, 4221, 4222, 4223, 4224, 1555, 1556, 1557, 1558,
1559, 1560, 1561, 1562, 1563, 1564, 1565, 7585, 7584, 2714, 432, 1559, 1560, 1561, 1562, 1563, 1564, 1565, 7585, 7584, 2714, 432,
433, 290, 5075, 5074, 5073, 5071, 5070, 7413, 6529, 4067, 2996, 1464, 666, 667, 433, 290, 5075, 5074, 5073, 5071, 5070, 7413, 6529, 4067, 2996, 1464, 666, 667,
2412, 2413, 2414, 771, 772}; 2412, 2413, 2414, 771, 772, 4251, 4252, 4278};
public final static int[] ITEM_UNALCHABLE = { 995, 1555, 1556, 1557, 1558, public final static int[] ITEM_UNALCHABLE = { 995, 1555, 1556, 1557, 1558,
1559, 1560, 1561, 1562, 1563, 1564, 1565, 7583, 1566, 7585, 2528, 1559, 1560, 1561, 1562, 1563, 1564, 1565, 7583, 1566, 7585, 2528,
4214, 4212, 2714, 432, 433, 300, 775, 776, 777, 6180, 6181, 6182, 4214, 4212, 2714, 432, 433, 300, 775, 776, 777, 6180, 6181, 6182,
6183, 6184, 6185, 6186, 6187, 6188, 2528, 4447, 290, 666, 667}; 6183, 6184, 6185, 6186, 6187, 6188, 2528, 4447, 290, 666, 667, 4278};
public final static int[] ITEM_BANKABLE = {2528, 4447}; public final static int[] ITEM_BANKABLE = {2528, 4447};
public final static int[] DESTROYABLE_ITEMS = {775, 776, 777, 2528, 6570, 2714, 432, 433, 300, 666}; public final static int[] DESTROYABLE_ITEMS = {775, 776, 777, 2528, 6570, 2714, 432, 433, 300, 666, 4251, 4252, 4278};
} }
@@ -35,11 +35,11 @@ import com.rs2.util.Misc;
public class UseItem { public class UseItem {
public static void itemOnObject(Player c, int objectID, int objectX, int objectY, int itemId) { public static void itemOnObject(Player c, int objectID, int objectX, int objectY, int itemId) {
final int goodPosXType1 = objectX - 5; final int minX = objectX - 5;
final int goodPosXType2 = objectX + 5; final int maxX = objectX + 5;
final int goodPosYType1 = objectY - 5; final int minY = objectY - 5;
final int goodPosYType2 = objectY + 5; final int maxY = objectY + 5;
if (c.absX >= goodPosXType1 && c.absX <= goodPosXType2 && c.absY >= goodPosYType1 && c.absY <= goodPosYType2) { if (c.absX >= minX && c.absX <= maxX && c.absY >= minY && c.absY <= maxY) {
c.turnPlayerTo(objectX, objectY); c.turnPlayerTo(objectX, objectY);
} else { } else {
c.getPlayerAssistant().playerWalk(objectX, objectY); c.getPlayerAssistant().playerWalk(objectX, objectY);
@@ -1,5 +1,7 @@
package com.rs2.game.items.impl; package com.rs2.game.items.impl;
import com.rs2.game.content.skills.prayer.Ectofuntus;
public class Fillables { public class Fillables {
public static boolean canFill(int id, int oid) { public static boolean canFill(int id, int oid) {
@@ -38,6 +40,8 @@ public class Fillables {
return 1823; return 1823;
case 6667: case 6667:
return 6668; return 6668;
case 4252:
return 4251;
} }
return -1; return -1;
} }
@@ -70,6 +74,8 @@ public class Fillables {
return "waterskin"; return "waterskin";
case 6667: case 6667:
return "fishbowl"; return "fishbowl";
case 4252:
return "ectophial";
} }
return "There was a problem with your current action, please report this to Mod Andrew."; return "There was a problem with your current action, please report this to Mod Andrew.";
} }
@@ -108,6 +114,8 @@ public class Fillables {
case 6232: case 6232:
case 2864: case 2864:
return "fountain"; return "fountain";
case Ectofuntus.ECTOFUNTUS:
return "ectofuntus";
} }
return "Error"; return "Error";
} }
@@ -56,6 +56,13 @@ public class NpcActions {
case 389 : //thormac case 389 : //thormac
player.getDialogueHandler().sendDialogues(3574, npcType); player.getDialogueHandler().sendDialogues(3574, npcType);
break; break;
case 1686 : // Ghost Desciple
player.getDialogueHandler().sendDialogues(1390, npcType);
break;
case 1704 : // Ghost Captain
case 1705 : // Ghost Captain
player.getDialogueHandler().sendDialogues(1400, npcType);
break;
case 2324 : case 2324 :
case 2323 : case 2323 :
@@ -86,6 +93,11 @@ public class NpcActions {
case 2238: case 2238:
player.getDialogueHandler().sendDialogues(3214, npcType); player.getDialogueHandler().sendDialogues(3214, npcType);
break; break;
case 3156 : // Bill Teach
case 3157 : // Bill Teach
player.getDialogueHandler().sendDialogues(1410, npcType);
break;
case 958: case 958:
player.getDialogueHandler().sendDialogues(3208, npcType); player.getDialogueHandler().sendDialogues(3208, npcType);
@@ -12,7 +12,6 @@ import com.rs2.game.content.minigames.PestControl;
import com.rs2.game.content.minigames.castlewars.CastleWarObjects; import com.rs2.game.content.minigames.castlewars.CastleWarObjects;
import com.rs2.game.content.minigames.castlewars.CastleWars; import com.rs2.game.content.minigames.castlewars.CastleWars;
import com.rs2.game.content.quests.QuestRewards; import com.rs2.game.content.quests.QuestRewards;
import com.rs2.game.content.random.Balloons;
import com.rs2.game.content.random.PartyRoom; import com.rs2.game.content.random.PartyRoom;
import com.rs2.game.content.randomevents.FreakyForester; import com.rs2.game.content.randomevents.FreakyForester;
import com.rs2.game.content.skills.agility.AgilityShortcut; import com.rs2.game.content.skills.agility.AgilityShortcut;
@@ -30,6 +29,7 @@ import com.rs2.game.content.traveling.DesertCactus;
import com.rs2.game.globalworldobjects.ClimbOther; import com.rs2.game.globalworldobjects.ClimbOther;
import com.rs2.game.globalworldobjects.PassDoor; import com.rs2.game.globalworldobjects.PassDoor;
import com.rs2.game.globalworldobjects.ClimbOther.ClimbData; import com.rs2.game.globalworldobjects.ClimbOther.ClimbData;
import com.rs2.game.items.ItemAssistant;
import com.rs2.game.items.impl.LightSources; import com.rs2.game.items.impl.LightSources;
import com.rs2.game.npcs.NpcHandler; import com.rs2.game.npcs.NpcHandler;
import com.rs2.game.npcs.impl.MilkCow; import com.rs2.game.npcs.impl.MilkCow;
@@ -91,8 +91,8 @@ public class ObjectsActions {
if (player.getWerewolfAgility().werewolfCourse(objectType)) { if (player.getWerewolfAgility().werewolfCourse(objectType)) {
return; return;
} }
if (objectType >= 115 && objectType <= 121) { if (Boundary.isIn(player, Boundary.PARTY_ROOM) && objectType >= 115 && objectType <= 122) {
Balloons.popBalloon(player, objectX, objectY); PartyRoom.popBalloon(player, objectX, objectY);
return; return;
} }
if (objectType >= 5103 && objectType <= 5107) { if (objectType >= 5103 && objectType <= 5107) {
@@ -123,6 +123,14 @@ public class ObjectsActions {
return; return;
} }
switch (objectType) { switch (objectType) {
case 6969: // Swamp Boaty
if (player.objectX == 3523 && player.objectY == 3284)
player.getPlayerAssistant().movePlayer(3499, 3380, 0);
break;
case 6970: // Swamp Boaty
if (player.objectX == 3498 && player.objectY == 3377)
player.getPlayerAssistant().movePlayer(3522, 3284, 0);
break;
case 6615: case 6615:
if (player.absY == 2809) { if (player.absY == 2809) {
player.getPlayerAssistant().movePlayer(player.absX, 2810, 0); player.getPlayerAssistant().movePlayer(player.absX, 2810, 0);
@@ -130,11 +138,11 @@ public class ObjectsActions {
player.getPlayerAssistant().movePlayer(player.absX, 2809, 0); player.getPlayerAssistant().movePlayer(player.absX, 2809, 0);
} }
break; break;
case 11163: case Ectofuntus.GRINDER:
Ectofuntus.useBoneGrinder(player); Ectofuntus.useBoneGrinder(player);
break; break;
case 11164: case Ectofuntus.BIN:
Ectofuntus.emptyBin(player); Ectofuntus.emptyBin(player);
break; break;
case 6: case 6:
@@ -752,21 +760,8 @@ public class ObjectsActions {
case 5281: case 5281:
player.getPlayerAssistant().movePlayer(3666, 3517, 0); player.getPlayerAssistant().movePlayer(3666, 3517, 0);
break; break;
case 5282: // Ectofuntus Worship case Ectofuntus.ECTOFUNTUS: // Ectofuntus Worship
if (player.getItemAssistant().playerHasItem(4286) && player.getItemAssistant().playerHasItem(4255)) Ectofuntus.handleEctofuntus(player);
{
player.startAnimation(1651);
player.getPacketSender().sendMessage("You put some ectoplasm and bonemeal into the Ectofuntus, and worship it.");
player.getItemAssistant().deleteItem(4286, 1);
player.getItemAssistant().deleteItem(4255, 1);
player.getItemAssistant().addItem(1925, 1);
player.getItemAssistant().addItem(1931, 1);
player.getPlayerAssistant().addSkillXP(18, GameConstants.PRAYER);
}
else
{
player.getPacketSender().sendMessage("You'll need ectoplasm and bonemeal to worship the Ectofuntus.");
}
break; break;
case 12982: case 12982:
@@ -961,6 +956,8 @@ public class ObjectsActions {
case 9326: case 9326:
case 9321: case 9321:
case 993: case 993:
case 9307:
case 9308:
AgilityShortcut.processAgilityShortcut(player); AgilityShortcut.processAgilityShortcut(player);
break; break;
@@ -2644,6 +2641,50 @@ public class ObjectsActions {
if (player.getItemAssistant().hasFreeSlots(1)) if (player.getItemAssistant().hasFreeSlots(1))
player.getItemAssistant().addItem(2413, 1); player.getItemAssistant().addItem(2413, 1);
break; break;
case 11209:
player.getPlayerAssistant().movePlayer(3712, 3496, 1);
break;
case 11210:
player.getPlayerAssistant().movePlayer(3709, 3496, 0);
break;
case 11211:
player.getPlayerAssistant().movePlayer(3684, 2950, 1);
break;
case 11212:
player.getPlayerAssistant().movePlayer(3684, 2953, 0);
break;
case 11289:
if (objectX == 3686 && objectY == 2946)
player.getPlayerAssistant().movePlayer(3687, 2946, 2);
if (objectX == 3686 && objectY == 2950)
player.getPlayerAssistant().movePlayer(3687, 2950, 2);
if (objectX == 3712 && objectY == 3494)
player.getPlayerAssistant().movePlayer(3712, 3493, 2);
if (objectX == 3716 && objectY == 3494)
player.getPlayerAssistant().movePlayer(3716, 3493, 2);
break;
case 11290:
if (objectX == 3686 && objectY == 2946)
player.getPlayerAssistant().movePlayer(3685, 2946, 1);
if (objectX == 3686 && objectY == 2950)
player.getPlayerAssistant().movePlayer(3685, 2950, 1);
if (objectX == 3712 && objectY == 3494)
player.getPlayerAssistant().movePlayer(3712, 3495, 1);
if (objectX == 3716 && objectY == 3494)
player.getPlayerAssistant().movePlayer(3716, 3495, 1);
break;
case 11308:
if (objectX == 3714 && objectY == 3502)
player.getPlayerAssistant().movePlayer(3714, 3503, 1);
if (objectX == 3678 && objectY == 2948)
player.getPlayerAssistant().movePlayer(3677, 2948, 1);
break;
case 11309:
if (objectX == 3714 && objectY == 3502)
player.getPlayerAssistant().movePlayer(3714, 3503, 0);
if (objectX == 3678 && objectY == 2948)
player.getPlayerAssistant().movePlayer(3677, 2948, 0);
break;
} }
} }
@@ -2764,6 +2805,18 @@ public class ObjectsActions {
case 12537: case 12537:
Climbing.climbUp(player); Climbing.climbUp(player);
break; break;
case Ectofuntus.GRINDER:
if (player.ectofuntusBoneCrusherState.equals("Empty")) {
player.getPacketSender().sendMessage("You need to load some bones.");
} else if (player.ectofuntusBoneCrusherState.equals("Loaded")) {
player.getPacketSender().sendMessage(ItemAssistant.getItemName(player.ectofuntusBoneUsed) + " loaded and ready to be grinded.");
} else if (player.ectofuntusBoneCrusherState.equals("Bin")) {
player.getPacketSender().sendMessage("Bonemeal is ready to be collected from the bin.");
} else {
player.getPacketSender().sendMessage("Ghostly forces are playing with the machinery.");
}
break;
case 14921: case 14921:
case 9390: case 9390:
@@ -422,7 +422,7 @@ public class Climbing {
case 1738: case 1738:
if (client.objectX == 2728 && client.objectY == 3460 if (client.objectX == 2728 && client.objectY == 3460
&& client.heightLevel == 0) { && client.heightLevel == 0) {
client.getPlayerAssistant().movePlayer(2749, 3462, 1); client.getPlayerAssistant().movePlayer(2729, 3462, 1);
client.resetWalkingQueue(); client.resetWalkingQueue();
} else if (client.objectX == 2746 && client.objectY == 3460 } else if (client.objectX == 2746 && client.objectY == 3460
&& client.heightLevel == 0) { && client.heightLevel == 0) {
@@ -908,17 +908,17 @@ public abstract class Player {
if (System.currentTimeMillis() - restoreStatsDelay > 60000) { if (System.currentTimeMillis() - restoreStatsDelay > 60000) {
restoreStatsDelay = System.currentTimeMillis(); restoreStatsDelay = System.currentTimeMillis();
for (int level = 0; level < playerLevel.length; level++) { for (int skill = 0; skill < playerLevel.length; skill++) {
if (playerLevel[level] < getLevelForXP(playerXP[level])) { if (playerLevel[skill] < getLevelForXP(playerXP[skill])) {
if (level != 5) { // prayer doesn't restore if (skill != 5) { // prayer doesn't restore
playerLevel[level] += 1; playerLevel[skill] += 1;
getPacketSender().setSkillLevel(level, playerLevel[level], playerXP[level]); getPacketSender().setSkillLevel(skill, playerLevel[skill], playerXP[skill]);
getPlayerAssistant().refreshSkill(level); getPlayerAssistant().refreshSkill(skill);
} }
} else if (playerLevel[level] > getLevelForXP(playerXP[level])) { } else if (playerLevel[skill] > getLevelForXP(playerXP[skill])) {
playerLevel[level] -= 1; playerLevel[skill] -= 1;
getPacketSender().setSkillLevel(level, playerLevel[level], playerXP[level]); getPacketSender().setSkillLevel(skill, playerLevel[skill], playerXP[skill]);
getPlayerAssistant().refreshSkill(level); getPlayerAssistant().refreshSkill(skill);
} }
} }
} }
@@ -1632,7 +1632,7 @@ public abstract class Player {
crystalBowArrowCount, playerMagicBook, teleGfx, teleEndAnimation, crystalBowArrowCount, playerMagicBook, teleGfx, teleEndAnimation,
teleHeight, teleX, teleY, rangeItemUsed, killingNpcIndex, teleHeight, teleX, teleY, rangeItemUsed, killingNpcIndex,
totalDamageDealt, globalDamageDealt, oldNpcIndex, fightMode, attackTimer, totalDamageDealt, globalDamageDealt, oldNpcIndex, fightMode, attackTimer,
bowSpecShot; bowSpecShot, ectofuntusWorshipped;
public boolean magicFailed, oldMagicFailed; public boolean magicFailed, oldMagicFailed;
/** /**
* End * End
@@ -2083,6 +2083,11 @@ public abstract class Player {
if (checkRangeDistance()) { if (checkRangeDistance()) {
distance = gatherRangeDistance(distance); distance = gatherRangeDistance(distance);
} }
return ((objectX-playerX <= distance && objectX-playerX >= -distance) && (objectY-playerY <= distance && objectY-playerY >= -distance));
}
public boolean goodObjectDistance(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));
} }
@@ -127,14 +127,14 @@ public class PlayerAssistant {
private String[][] welcomeMessages = { private String[][] welcomeMessages = {
{"Remember to vote daily to help " + GameConstants.SERVER_NAME + "", "Every vote counts! :)"}, {"Remember to vote daily to help " + GameConstants.SERVER_NAME + "", "Every vote counts! :)"},
{"Not a member of our discord community?", "Join our discord at: https://discord.gg/Nk9WQUK"}, {"Not a member of our discord community?", "Join our discord at: https://discord.gg/hZ6VfWG"},
{"Do you have any bugs that you would like to report?", "Report them on our discord or message a staff member. :)"}, {"Do you have any bugs that you would like to report?", "Report them on our discord or message a staff member. :)"},
{"Want to help the server grow?", "Remember to vote daily and invite your friends!"} {"Want to help the server grow?", "Remember to vote daily and invite your friends!"}
}; };
public void showMap() { public void showMap() {
int posisition = (player.getX() / 64 - 46) + (player.getY() / 64 - 49) * 6; int position = (player.getX() / 64 - 46) + (player.getY() / 64 - 49) * 6;
player.getPacketSender().sendConfig(106, posisition); player.getPacketSender().sendConfig(106, position);
player.getPacketSender().showInterface(5392); player.getPacketSender().showInterface(5392);
} }
@@ -1019,7 +1019,7 @@ public class PlayerAssistant {
for (Player p : PlayerHandler.players) { for (Player p : PlayerHandler.players) {
if (p != null && p.isActive) { if (p != null && p.isActive) {
Client o = (Client) p; Client o = (Client) p;
o.getPlayerAssistant().updatePM(player.playerId, 1); o.getPlayerAssistant().updatePM(player.playerId, GameConstants.WORLD);
} }
} }
boolean pmLoaded = false; boolean pmLoaded = false;
@@ -1028,7 +1028,7 @@ public class PlayerAssistant {
if (friend != 0) { if (friend != 0) {
for (int i2 = 1; i2 < PlayerHandler.players.length; i2++) { for (int i2 = 1; i2 < PlayerHandler.players.length; i2++) {
Player p = PlayerHandler.players[i2]; Player p = PlayerHandler.players[i2];
if (p != null && p.isActive if (p != null && !p.isBot && p.isActive
&& Misc.playerNameToInt64(p.playerName) == friend) { && Misc.playerNameToInt64(p.playerName) == friend) {
Client o = (Client) p; Client o = (Client) p;
if (player.playerRights >= 2 if (player.playerRights >= 2
@@ -1037,7 +1037,7 @@ public class PlayerAssistant {
&& o.getPlayerAssistant() && o.getPlayerAssistant()
.isInPM(Misc .isInPM(Misc
.playerNameToInt64(player.playerName))) { .playerNameToInt64(player.playerName))) {
player.getPacketSender().loadPM(friend, 1); player.getPacketSender().loadPM(friend, GameConstants.WORLD);
pmLoaded = true; pmLoaded = true;
} }
break; break;
@@ -1052,7 +1052,7 @@ public class PlayerAssistant {
Player p = PlayerHandler.players[i1]; Player p = PlayerHandler.players[i1];
if (p != null && p.isActive) { if (p != null && p.isActive) {
Client o = (Client) p; Client o = (Client) p;
o.getPlayerAssistant().updatePM(player.playerId, 1); o.getPlayerAssistant().updatePM(player.playerId, GameConstants.WORLD);
} }
} }
} }
@@ -1819,7 +1819,7 @@ public class PlayerAssistant {
player.getPacketSender().sendMessage("Welcome to @blu@" + GameConstants.SERVER_NAME + "@bla@ - we are currently in Server Stage v@blu@" + GameConstants.TEST_VERSION + "@bla@."); player.getPacketSender().sendMessage("Welcome to @blu@" + GameConstants.SERVER_NAME + "@bla@ - we are currently in Server Stage v@blu@" + GameConstants.TEST_VERSION + "@bla@.");
player.getPacketSender().sendMessage("@red@Did you know?@bla@ We're open source and pull requests are welcome!"); player.getPacketSender().sendMessage("@red@Did you know?@bla@ We're open source and pull requests are welcome!");
player.getPacketSender().sendMessage("Source code: github.com/2006-Scape/2006Scape"); player.getPacketSender().sendMessage("Source code: github.com/2006-Scape/2006Scape");
player.getPacketSender().sendMessage("Discord: discord.gg/4zrA2Wy"); player.getPacketSender().sendMessage("Discord: https://discord.gg/hZ6VfWG");
player.getDialogueHandler().sendDialogues(3115, 2224); player.getDialogueHandler().sendDialogues(3115, 2224);
player.isRunning2 = false; player.isRunning2 = false;
player.autoRet = 1; player.autoRet = 1;
@@ -1972,6 +1972,8 @@ public class PlayerAssistant {
if (skill == 5) { if (skill == 5) {
player.getPacketSender().sendString("" + player.playerLevel[GameConstants.PRAYER] + "/" + getLevelForXP(player.playerXP[GameConstants.PRAYER]) + "", 687);// Prayer player.getPacketSender().sendString("" + player.playerLevel[GameConstants.PRAYER] + "/" + getLevelForXP(player.playerXP[GameConstants.PRAYER]) + "", 687);// Prayer
} }
// Update skill data
player.getPacketSender().setSkillLevel(skill, player.playerLevel[skill], player.playerXP[skill]);
} }
public int getXPForLevel(int level) { public int getXPForLevel(int level) {
@@ -409,6 +409,9 @@ public class PlayerSave {
case "fightMode": case "fightMode":
player.fightMode = Integer.parseInt(token2); player.fightMode = Integer.parseInt(token2);
break; break;
case "ectofuntusWorshipped":
player.ectofuntusWorshipped = Integer.parseInt(token2);
break;
} }
break; break;
case 3: case 3:
@@ -777,6 +780,8 @@ public class PlayerSave {
characterfile.newLine(); characterfile.newLine();
characterfile.write("fightMode = " + player.fightMode); characterfile.write("fightMode = " + player.fightMode);
characterfile.newLine(); characterfile.newLine();
characterfile.write("ectofuntusWorshipped = " + player.ectofuntusWorshipped);
characterfile.newLine();
String voidStatus = ""; String voidStatus = "";
for (int voidS : player.voidStatus){ for (int voidS : player.voidStatus){
voidStatus += voidS + "\t"; voidStatus += voidS + "\t";
@@ -30,29 +30,48 @@ public class PacketSender {
} }
public PacketSender sendUpdateItems(int frame, Item[] items) { public PacketSender sendUpdateItems(int frame, Item[] items) {
player.getOutStream().createFrameVarSizeWord(53); if (player.getOutStream() != null) {
player.getOutStream().writeWord(frame); player.getOutStream().createFrameVarSizeWord(53);
player.getOutStream().writeWord(items.length); player.getOutStream().writeWord(frame);
Item[] var6 = items; player.getOutStream().writeWord(items.length);
}
for (int i = 0; i < items.length; i++) { for (int i = 0; i < items.length; i++) {
Item item = var6[i]; Item item = items[i];
if (item == null) { if (player.getOutStream() != null) {
player.getOutStream().writeByte(0);
player.getOutStream().writeWordBigEndianA(0);
} else {
if (item.getCount() > 254) { if (item.getCount() > 254) {
player.getOutStream().writeByte(255); player.getOutStream().writeByte(255);
player.getOutStream().writeDWord_v2(item.getCount()); player.getOutStream().writeDWord_v2(item.getCount());
} else { } else {
player.getOutStream().writeByte(item.getCount()); player.getOutStream().writeByte(item.getCount());
} }
player.getOutStream().writeWordBigEndianA(item.getId());
} }
int id = item.getId() + 1;
if (item.getCount() < 1) {
id = 0;
}
if (id > GameConstants.ITEM_LIMIT || id < 0) {
id = GameConstants.ITEM_LIMIT;
}
if (player.getOutStream() != null) {
player.getOutStream().writeWordBigEndianA(id);
}
}
if (player.getOutStream() != null) {
player.getOutStream().endFrameVarSizeWord();
player.flushOutStream();
} }
return this; return this;
} }
public PacketSender sendUpdateItems(int frame, int[] itemIDs, int[] itemAmounts) {
Item[] items = new Item[itemIDs.length];
for(int i = 0; i < itemIDs.length; i++) {
items[i] = new Item(itemIDs[i], itemAmounts[i]);
}
return sendUpdateItems(frame, items);
}
public PacketSender loginPlayer() { public PacketSender loginPlayer() {
player.getPlayerAssistant().loginScreen(); player.getPlayerAssistant().loginScreen();
@@ -101,7 +120,7 @@ public class PacketSender {
player.getPacketSender().sendMessage("Welcome to @blu@" + GameConstants.SERVER_NAME + "@bla@ - we are currently in Server Stage v@blu@" + GameConstants.TEST_VERSION + "@bla@."); player.getPacketSender().sendMessage("Welcome to @blu@" + GameConstants.SERVER_NAME + "@bla@ - we are currently in Server Stage v@blu@" + GameConstants.TEST_VERSION + "@bla@.");
player.getPacketSender().sendMessage("@red@Did you know?@bla@ We're open source! Pull requests are welcome"); player.getPacketSender().sendMessage("@red@Did you know?@bla@ We're open source! Pull requests are welcome");
player.getPacketSender().sendMessage("Source code at github.com/2006-Scape/2006Scape"); player.getPacketSender().sendMessage("Source code at github.com/2006-Scape/2006Scape");
player.getPacketSender().sendMessage("Join our Discord: discord.gg/4zrA2Wy"); player.getPacketSender().sendMessage("Join our Discord: https://discord.gg/hZ6VfWG");
/*if (!hasBankpin) { //Kind of annoying. Maybe add Random % 10 or something. /*if (!hasBankpin) { //Kind of annoying. Maybe add Random % 10 or something.
getActionSender().sendMessage("You do not have a bank pin it is highly recommended you set one."); getActionSender().sendMessage("You do not have a bank pin it is highly recommended you set one.");
}*/ }*/
@@ -146,7 +165,7 @@ public class PacketSender {
player.getPacketSender().sendFrame107(); // reset screen player.getPacketSender().sendFrame107(); // reset screen
player.getPacketSender().setChatOptions(0, 0, 0); // reset private messaging options player.getPacketSender().setChatOptions(0, 0, 0); // reset private messaging options
player.correctCoordinates(); player.correctCoordinates();
player.getPacketSender().showOption(4, 0, "Trade With", 3); player.getPacketSender().showOption(4, 0, "Trade with", 3);
player.getPacketSender().showOption(5, 0, "Follow", 4); player.getPacketSender().showOption(5, 0, "Follow", 4);
player.getItemAssistant().resetItems(3214); player.getItemAssistant().resetItems(3214);
player.getItemAssistant().resetBonus(); player.getItemAssistant().resetBonus();
@@ -169,7 +188,7 @@ public class PacketSender {
player.getItemAssistant().addSpecialBar(player.playerEquipment[player.playerWeapon]); player.getItemAssistant().addSpecialBar(player.playerEquipment[player.playerWeapon]);
player.saveTimer = GameConstants.SAVE_TIMER; player.saveTimer = GameConstants.SAVE_TIMER;
player.saveCharacter = true; player.saveCharacter = true;
Misc.println("[REGISTERED]: " + player.playerName + ""); Misc.println((player.isBot ? "[BOT-REGISTERED]" : "[REGISTERED]") + ": " + player.playerName + " (level-" + player.calculateCombatLevel() + ")");
player.handler.updatePlayer(player, player.outStream); player.handler.updatePlayer(player, player.outStream);
player.handler.updateNPC(player, player.outStream); player.handler.updateNPC(player, player.outStream);
player.flushOutStream(); player.flushOutStream();
@@ -304,8 +323,12 @@ public class PacketSender {
return this; return this;
} }
public PacketSender sendString(String s, int id) { //Seems to be about chat messsages public PacketSender sendString(String s, int id) { // Update string in interfaces etc
if(!player.checkPacket126Update(s, id)) { return sendString(s, id, false);
}
public PacketSender sendString(String s, int id, boolean forceSend) { // Update string in interfaces etc
if(!forceSend && !player.checkPacket126Update(s, id)) {
return this; return this;
} }
if (player.getOutStream() != null && player != null) { if (player.getOutStream() != null && player != null) {
@@ -503,8 +526,6 @@ public class PacketSender {
if (player.getOutStream() != null && player != null) { if (player.getOutStream() != null && player != null) {
if (world != 0) { if (world != 0) {
world += 9; world += 9;
} else if (!GameConstants.WORLD_LIST_FIX) {
world += 1;
} }
player.getOutStream().createFrame(50); player.getOutStream().createFrame(50);
player.getOutStream().writeQWord(playerName); player.getOutStream().writeQWord(playerName);
@@ -621,11 +642,9 @@ public class PacketSender {
player.getItemAssistant().rearrangeBank(); player.getItemAssistant().rearrangeBank();
player.getItemAssistant().resetBank(); player.getItemAssistant().resetBank();
player.getItemAssistant().resetTempItems(); player.getItemAssistant().resetTempItems();
player.getOutStream().createFrame(248); sendFrame248(5292, 5063);
player.getOutStream().writeWordA(5292);
player.lastMainFrameInterface = MainFrameIDs.BANK; //Setting it to 5292, since I *think* that's what interface got opened
player.getOutStream().writeWord(5063);
player.flushOutStream(); player.flushOutStream();
player.getPacketSender().sendString("The Bank of " + GameConstants.SERVER_NAME, 5383, true);
player.isBanking = true; player.isBanking = true;
} }
return this; return this;
@@ -1172,15 +1191,7 @@ public class PacketSender {
if (player.heightLevel != height) { if (player.heightLevel != height) {
return this; return this;
} }
player.getOutStream().createFrame(85); return createGroundItem(itemID, itemX, itemY, itemAmount);
player.getOutStream().writeByteC(itemY - 8 * player.mapRegionY);
player.getOutStream().writeByteC(itemX - 8 * player.mapRegionX);
player.getOutStream().createFrame(44);
player.getOutStream().writeWordBigEndianA(itemID);
player.getOutStream().writeWord(itemAmount);
player.getOutStream().writeByte(0);
player.flushOutStream();
return this;
} }
@@ -5,6 +5,7 @@ import com.rs2.game.content.random.PartyRoom;
import com.rs2.game.content.skills.crafting.JewelryMaking; import com.rs2.game.content.skills.crafting.JewelryMaking;
import com.rs2.game.players.Player; import com.rs2.game.players.Player;
import com.rs2.net.packets.PacketType; import com.rs2.net.packets.PacketType;
import com.rs2.world.Boundary;
/** /**
* Bank 10 Items * Bank 10 Items
@@ -19,6 +20,13 @@ public class Bank10 implements PacketType {
player.endCurrentTask(); player.endCurrentTask();
switch (interfaceId) { switch (interfaceId) {
case 2274:
if (Boundary.isIn(player, Boundary.PARTY_ROOM)) {
PartyRoom.withdrawItem(player, removeSlot, 10);
return;
}
break;
case 4233: case 4233:
case 4239: case 4239:
case 4245: case 4245:
@@ -49,7 +57,7 @@ public class Bank10 implements PacketType {
if(!player.getItemAssistant().playerHasItem(removeId)) { if(!player.getItemAssistant().playerHasItem(removeId)) {
return; return;
} }
if (player.inPartyRoom) { if (Boundary.isIn(player, Boundary.PARTY_ROOM)) {
PartyRoom.depositItem(player, removeId, 10); PartyRoom.depositItem(player, removeId, 10);
break; break;
} }
@@ -5,6 +5,7 @@ import com.rs2.game.content.random.PartyRoom;
import com.rs2.game.content.skills.crafting.JewelryMaking; import com.rs2.game.content.skills.crafting.JewelryMaking;
import com.rs2.game.players.Player; import com.rs2.game.players.Player;
import com.rs2.net.packets.PacketType; import com.rs2.net.packets.PacketType;
import com.rs2.world.Boundary;
/** /**
* Bank 5 Items * Bank 5 Items
@@ -19,6 +20,12 @@ public class Bank5 implements PacketType {
player.endCurrentTask(); player.endCurrentTask();
switch (interfaceId) { switch (interfaceId) {
case 2274:
if (Boundary.isIn(player, Boundary.PARTY_ROOM)) {
PartyRoom.withdrawItem(player, removeSlot, 5);
return;
}
break;
case 4233: case 4233:
case 4239: case 4239:
case 4245: case 4245:
@@ -50,7 +57,7 @@ public class Bank5 implements PacketType {
if(!player.getItemAssistant().playerHasItem(removeId)) { if(!player.getItemAssistant().playerHasItem(removeId)) {
return; return;
} }
if (player.inPartyRoom) { if (Boundary.isIn(player, Boundary.PARTY_ROOM)) {
PartyRoom.depositItem(player, removeId, 5); PartyRoom.depositItem(player, removeId, 5);
break; break;
} }
@@ -5,6 +5,7 @@ import com.rs2.game.items.GameItem;
import com.rs2.game.items.ItemData; import com.rs2.game.items.ItemData;
import com.rs2.game.players.Player; import com.rs2.game.players.Player;
import com.rs2.net.packets.PacketType; import com.rs2.net.packets.PacketType;
import com.rs2.world.Boundary;
/** /**
* Bank All Items * Bank All Items
@@ -18,6 +19,12 @@ public class BankAll implements PacketType {
int removeId = player.getInStream().readUnsignedWordA(); int removeId = player.getInStream().readUnsignedWordA();
player.endCurrentTask(); player.endCurrentTask();
switch (interfaceId) { switch (interfaceId) {
case 2274:
if (Boundary.isIn(player, Boundary.PARTY_ROOM)) {
PartyRoom.withdrawItem(player, removeSlot, player.partyN[removeSlot]);
return;
}
break;
// buy x // buy x
case 3900: case 3900:
player.outStream.createFrame(27); player.outStream.createFrame(27);
@@ -51,7 +58,7 @@ public class BankAll implements PacketType {
if(!player.getItemAssistant().playerHasItem(removeId)) { if(!player.getItemAssistant().playerHasItem(removeId)) {
return; return;
} }
if (player.inPartyRoom) { if (Boundary.isIn(player, Boundary.PARTY_ROOM)) {
PartyRoom.depositItem(player, removeId, player.getItemAssistant().itemAmount(player.playerItems[removeSlot])); PartyRoom.depositItem(player, removeId, player.getItemAssistant().itemAmount(player.playerItems[removeSlot]));
break; break;
} }
@@ -76,21 +76,21 @@ public class ClickItem implements PacketType {
return; return;
} }
switch (itemId) { switch (itemId) {
case 4251:
player.getPlayerAssistant().movePlayer(3661, 3526, 0);
player.getItemAssistant().replaceItem(4251, 4252);
break;
case 4079: case 4079:
player.startAnimation(1457); player.startAnimation(1457);
break; break;
case 407: case 407:
if (Misc.random(1) == 0) { int rand = Misc.random(1, 5);
player.getItemAssistant().addItem(409, 1); if (rand <= 2) {
player.getItemAssistant().deleteItem(407, 1); player.getItemAssistant().replaceItem(407, 409);
} else if (rand <= 4) {
player.getItemAssistant().replaceItem(407, 411);
} else { } else {
if (Misc.random(1) == 0) { player.getItemAssistant().replaceItem(407, 413);
player.getItemAssistant().addItem(411, 1);
player.getItemAssistant().deleteItem(409, 1);
} else if (Misc.random(1) == 1) {
player.getItemAssistant().addItem(413, 1);
player.getItemAssistant().deleteItem(407, 1);
}
} }
break; break;
@@ -481,6 +481,15 @@ public class Commands implements PacketType {
player.getPacketSender().sendMessage("Player Must Be Offline."); player.getPacketSender().sendMessage("Player Must Be Offline.");
} }
break; break;
case "mem":
Runtime runtime = Runtime.getRuntime();
int totalMemK = (int) (runtime.totalMemory() / 1024L);
int freeMemK = (int) (runtime.freeMemory() / 1024L);
int usedMemK = (int) totalMemK - freeMemK;
player.getPacketSender().sendMessage("Total memory: " + (totalMemK / 1024) + "MB");
player.getPacketSender().sendMessage("Used memory: " + (usedMemK / 1024) + "MB");
player.getPacketSender().sendMessage("Free memory: " + (freeMemK / 1024) + "MB");
break;
case "update": case "update":
try { try {
if (arguments.length == 0) { if (arguments.length == 0) {
@@ -574,9 +583,24 @@ public class Commands implements PacketType {
if (arguments.length == 0) { if (arguments.length == 0) {
player.getPacketSender().sendMessage("You must specify an id: ::interface id"); player.getPacketSender().sendMessage("You must specify an id: ::interface id");
return; return;
} else if (arguments.length == 1) {
int interface1 = Integer.parseInt(arguments[0]);
player.getPacketSender().showInterface(interface1);
return;
} else if (arguments.length == 2) {
int interface1 = Integer.parseInt(arguments[0]);
int interface2 = Integer.parseInt(arguments[1]);
player.getPacketSender().sendFrame248(interface1, interface2);
return;
} else if (arguments.length == 2) {
int interface1 = Integer.parseInt(arguments[0]);
int interface2 = Integer.parseInt(arguments[1]);
int interface3 = Integer.parseInt(arguments[2]);
player.getPacketSender().sendFrame246(interface1, interface2, interface3);
return;
} else {
player.getPacketSender().sendMessage("Too many IDs specified, maximum of 3");
} }
int interfaceID = Integer.parseInt(arguments[0]);
player.getPacketSender().showInterface(interfaceID);
break; break;
case "gfx": case "gfx":
if (arguments.length == 0) { if (arguments.length == 0) {
@@ -616,7 +640,6 @@ public class Commands implements PacketType {
case "bank": case "bank":
player.getPacketSender().openUpBank(); player.getPacketSender().openUpBank();
break; break;
case "xteletome":
case "teletome": case "teletome":
try { try {
if (arguments.length == 0) { if (arguments.length == 0) {
@@ -637,7 +660,6 @@ public class Commands implements PacketType {
player.getPacketSender().sendMessage("Player is not online."); player.getPacketSender().sendMessage("Player is not online.");
} }
break; break;
case "xteleto":
case "teleto": case "teleto":
if (arguments.length == 0) { if (arguments.length == 0) {
player.getPacketSender().sendMessage("You must specify a player name: ::teleto playername"); player.getPacketSender().sendMessage("You must specify a player name: ::teleto playername");
@@ -5,6 +5,7 @@ import com.rs2.game.content.skills.cooking.Cooking;
import com.rs2.game.content.skills.smithing.Smelting; import com.rs2.game.content.skills.smithing.Smelting;
import com.rs2.game.players.Player; import com.rs2.game.players.Player;
import com.rs2.net.packets.PacketType; import com.rs2.net.packets.PacketType;
import com.rs2.world.Boundary;
public class InterfaceX implements PacketType { public class InterfaceX implements PacketType {
@@ -27,15 +28,21 @@ public class InterfaceX implements PacketType {
} }
} }
switch (player.xInterfaceId) { switch (player.xInterfaceId) {
case 5064: case 2274:
if (player.inPartyRoom) { if (Boundary.isIn(player, Boundary.PARTY_ROOM)) {
PartyRoom.depositItem(player, player.xRemoveId, player.getItemAssistant().itemAmount(player.playerItems[player.xRemoveSlot])); PartyRoom.withdrawItem(player, player.xRemoveSlot, Xamount);
break; return;
} }
break;
case 5064:
if (player.inTrade) { if (player.inTrade) {
player.getPacketSender().sendMessage("You can't store items while trading!"); player.getPacketSender().sendMessage("You can't store items while trading!");
return; return;
} }
if (Boundary.isIn(player, Boundary.PARTY_ROOM)) {
PartyRoom.depositItem(player, player.xRemoveId, Xamount);
return;
}
player.getItemAssistant().bankItem(player.playerItems[player.xRemoveSlot], player.xRemoveSlot, Xamount); player.getItemAssistant().bankItem(player.playerItems[player.xRemoveSlot], player.xRemoveSlot, Xamount);
break; break;
@@ -7,6 +7,7 @@ import com.rs2.game.content.skills.cooking.CookingTutorialIsland;
import com.rs2.game.content.skills.crafting.JewelryMaking; import com.rs2.game.content.skills.crafting.JewelryMaking;
import com.rs2.game.content.skills.crafting.Pottery; import com.rs2.game.content.skills.crafting.Pottery;
import com.rs2.game.content.skills.crafting.Spinning; import com.rs2.game.content.skills.crafting.Spinning;
import com.rs2.game.content.skills.prayer.Ectofuntus;
import com.rs2.game.items.UseItem; import com.rs2.game.items.UseItem;
import com.rs2.game.items.impl.Fillables; import com.rs2.game.items.impl.Fillables;
import com.rs2.game.players.Player; import com.rs2.game.players.Player;
@@ -28,10 +29,19 @@ public class ItemOnObject implements PacketType {
player.objectX = objectX; player.objectX = objectX;
player.objectY = objectY; player.objectY = objectY;
player.endCurrentTask(); player.endCurrentTask();
int distance = 3;
switch (objectId) {
case Ectofuntus.ECTOFUNTUS:
distance = 5;
break;
default:
distance = 3;
break;
}
if (!player.getItemAssistant().playerHasItem(itemId, 1)) { if (!player.getItemAssistant().playerHasItem(itemId, 1)) {
return; return;
} }
if (!player.goodDistance(player.objectX, player.objectY, player.absX, player.absY, 3)) { if (!player.goodDistance(player.objectX, player.objectY, player.absX, player.absY, distance)) {
return; return;
} }
if (player.playerRights == 3) { if (player.playerRights == 3) {
@@ -1,6 +1,7 @@
package com.rs2.net.packets.impl; package com.rs2.net.packets.impl;
import com.rs2.Connection; import com.rs2.Connection;
import com.rs2.GameConstants;
import com.rs2.game.players.Client; import com.rs2.game.players.Client;
import com.rs2.game.players.Player; import com.rs2.game.players.Player;
import com.rs2.game.players.PlayerHandler; import com.rs2.game.players.PlayerHandler;
@@ -41,7 +42,7 @@ public class PrivateMessaging implements PacketType {
Client o = (Client) PlayerHandler.players[i2]; Client o = (Client) PlayerHandler.players[i2];
if (o != null) { if (o != null) {
if (PlayerHandler.players[i2].privateChat == 0 || PlayerHandler.players[i2].privateChat == 1 && o.getPlayerAssistant().isInPM(Misc.playerNameToInt64(player.playerName))) { if (PlayerHandler.players[i2].privateChat == 0 || PlayerHandler.players[i2].privateChat == 1 && o.getPlayerAssistant().isInPM(Misc.playerNameToInt64(player.playerName))) {
player.getPacketSender().loadPM(friendToAdd, 1); player.getPacketSender().loadPM(friendToAdd, GameConstants.WORLD);
break; break;
} }
} }
@@ -134,7 +135,7 @@ public class PrivateMessaging implements PacketType {
&& PlayerHandler.players[i1].isActive) { && PlayerHandler.players[i1].isActive) {
Client o = (Client) PlayerHandler.players[i1]; Client o = (Client) PlayerHandler.players[i1];
if (o != null) { if (o != null) {
o.getPlayerAssistant().updatePM(player.playerId, 1); o.getPlayerAssistant().updatePM(player.playerId, GameConstants.WORLD);
} }
} }
} }
@@ -7,6 +7,7 @@ import com.rs2.game.items.Weight;
import com.rs2.game.items.impl.RareProtection; import com.rs2.game.items.impl.RareProtection;
import com.rs2.game.players.Player; import com.rs2.game.players.Player;
import com.rs2.net.packets.PacketType; import com.rs2.net.packets.PacketType;
import com.rs2.world.Boundary;
/** /**
* Remove Item * Remove Item
@@ -28,6 +29,13 @@ public class RemoveItem implements PacketType {
switch (interfaceId) { switch (interfaceId) {
case 2274:
if (Boundary.isIn(player, Boundary.PARTY_ROOM)) {
PartyRoom.withdrawItem(player, removeSlot, 1);
return;
}
break;
case 4233: case 4233:
case 4239: case 4239:
case 4245: case 4245:
@@ -48,7 +56,7 @@ public class RemoveItem implements PacketType {
break; break;
case 5064: case 5064:
if (player.inPartyRoom) { if (Boundary.isIn(player, Boundary.PARTY_ROOM)) {
PartyRoom.depositItem(player, removeId, 1); PartyRoom.depositItem(player, removeId, 1);
} else { } else {
player.getItemAssistant().bankItem(removeId, removeSlot, 1); player.getItemAssistant().bankItem(removeId, removeSlot, 1);
@@ -133,9 +133,8 @@ public class ReportHandler {
.format(new Date())); .format(new Date()));
String day = new SimpleDateFormat("dd").format(new Date()); String day = new SimpleDateFormat("dd").format(new Date());
bw = new BufferedWriter(new FileWriter( bw = new BufferedWriter(new FileWriter(
"data/Reportabuses/" "data/logs/reports/"
+ file + " month;" + month + " day;" + day + file + ".txt", true));
+ " ms-id;" + time + ".txt", true));
bw.write(data); bw.write(data);
bw.newLine(); bw.newLine();
bw.write(text); bw.write(text);
@@ -14,7 +14,7 @@ import com.rs2.game.players.PlayerHandler;
public class Boundary { public class Boundary {
int minX, minY, highX, highY; int minX, highX, minY, highY;
int height; int height;
/** /**
@@ -29,11 +29,11 @@ public class Boundary {
* The north-east y coordinate * The north-east y coordinate
*/ */
public Boundary(int minX, int highX, int minY, int highY) { public Boundary(int minX, int highX, int minY, int highY) {
this.minX = minX; this.minX = Math.min(minX, highX);
this.minY = minY; this.highX = Math.max(minX, highX);
this.highX = highX; this.minY = Math.min(minY, highY);
this.highY = highY; this.highY = Math.max(minY, highY);
height = -1; this.height = -1;
} }
/** /**
@@ -50,10 +50,10 @@ public class Boundary {
* The height of the boundary * The height of the boundary
*/ */
public Boundary(int minX, int highX, int minY, int highY, int height) { public Boundary(int minX, int highX, int minY, int highY, int height) {
this.minX = minX; this.minX = Math.min(minX, highX);
this.minY = minY; this.highX = Math.max(minX, highX);
this.highX = highX; this.minY = Math.min(minY, highY);
this.highY = highY; this.highY = Math.max(minY, highY);
this.height = height; this.height = height;
} }
@@ -96,6 +96,20 @@ public class Boundary {
return player.getX() >= boundaries.minX && player.getX() <= boundaries.highX && player.getY() >= boundaries.minY && player.getY() <= boundaries.highY; return player.getX() >= boundaries.minX && player.getX() <= boundaries.highX && player.getY() >= boundaries.minY && player.getY() <= boundaries.highY;
} }
/**
*
* @param x
* The x position
* @param y
* The y position
* @param boundaries
* The boundary object
* @return
*/
public static boolean isIn(int x, int y, Boundary boundaries) {
return x >= boundaries.minX && x <= boundaries.highX && y >= boundaries.minY && y <= boundaries.highY;
}
/** /**
* *
* @param npc * @param npc
@@ -287,5 +301,7 @@ public class Boundary {
public static final Boundary FIGHT_CAVES = new Boundary(2360, 2445, 5045, 5125); public static final Boundary FIGHT_CAVES = new Boundary(2360, 2445, 5045, 5125);
public static final Boundary PIRATE_HOUSE = new Boundary(3038, 3044, 3949, 3959); public static final Boundary PIRATE_HOUSE = new Boundary(3038, 3044, 3949, 3959);
public static final Boundary[] FIGHT_PITS = new Boundary[] { new Boundary(2378, 3415, 5133, 5167), new Boundary(2394, 2404, 5169, 5174) }; public static final Boundary[] FIGHT_PITS = new Boundary[] { new Boundary(2378, 3415, 5133, 5167), new Boundary(2394, 2404, 5169, 5174) };
public static final Boundary PARTY_ROOM = new Boundary(2727, 2746, 3460, 3479);
public static final Boundary PARTY_ROOM_TABLE = new Boundary(2735, 2740, 3467, 3468);
} }
@@ -165,7 +165,7 @@ public class ItemHandler {
c.getPacketSender().sendMessage("The cape vanishes as it touches the ground."); c.getPacketSender().sendMessage("The cape vanishes as it touches the ground.");
return; return;
} }
if (itemId > 4705 && itemId < 4760) { if (itemId >= 4708 && itemId <= 4759) {
for (int[] brokenBarrow : brokenBarrows) { for (int[] brokenBarrow : brokenBarrows) {
if (brokenBarrow[0] == itemId) { if (brokenBarrow[0] == itemId) {
itemId = brokenBarrow[1]; itemId = brokenBarrow[1];