Set up a server framework, added server317. client317 crashes when doing stuff though, test on 32-bit and pray.

This commit is contained in:
Travis Burtrum 2009-09-21 02:01:58 -04:00
parent 785d578f31
commit bbecdabde1
35 changed files with 23633 additions and 4 deletions

View File

@ -3075,7 +3075,7 @@ public class client extends RSApplet {
int k = menuActionCmd3[i];
int l = menuActionID[i];
int i1 = menuActionCmd1[i];
System.out.println("j:" + j + ", k:" + k + ", l:" + l + ", i1:" + i1);
//System.out.println("j:" + j + ", k:" + k + ", l:" + l + ", i1:" + i1);
if (l >= 2000)
l -= 2000;
if (l == 582) {
@ -5041,7 +5041,7 @@ public class client extends RSApplet {
socketStream.flushInputStream(inStream.buffer, 8);
inStream.currentOffset = 0;
aLong1215 = inStream.readQWord();
debug("aLong1215: " + aLong1215);
//debug("aLong1215: " + aLong1215);
int ai[] = new int[4];
ai[0] = (int) (Math.random() * 99999999D);
ai[1] = (int) (Math.random() * 99999999D);

View File

@ -35,8 +35,8 @@ public class Class72_Sub2 extends Class72
(directcolormodel.createCompatibleSampleModel(anInt1322,
anInt1308),
databufferint, null));
anImage1314 = new BufferedImage(directcolormodel, writableraster,
false, new Hashtable());
// xxx if you set this to another image, it covers the entire screen
anImage1314 = new BufferedImage(directcolormodel, writableraster, false, new Hashtable());
aComponent3290 = component;
method1358(37);
}

611
client508/src/Unknown.java Normal file
View File

@ -0,0 +1,611 @@
/* Unknown - Decompiled by JODE
* Visit http://jode.sourceforge.net/
*/
import java.awt.Image;
public class Unknown
{
public static RSString aRSString_1611;
public int anInt1612;
public static int anInt1613;
public Class124 aClass124_1614;
public static byte aByte1615;
public Class124 aClass124_1616 = null;
public int anInt1617 = 65000;
public static RSString aRSString_1618 = Class112.method1668(43, "(U1");
public static RSString aRSString_1619;
public static int anInt1620;
public static RSString aRSString_1621;
public static Image anImage1622;
public static int anInt1623;
public static int anInt1624;
public static int anInt1625;
public static int anInt1626;
public static int anInt1627;
public static int anInt1628;
public static int anInt1629;
public static void method1498(int i, int i_0_, int i_1_) {
for (int i_2_ = 0; i_2_ < Class86.anInt1582; i_2_++) {
for (int i_3_ = 0; i_3_ < Applet_Sub1.anInt7; i_3_++) {
for (int i_4_ = 0; i_4_ < Class97.anInt1714; i_4_++) {
Class68_Sub1 class68_sub1
= (Class22.aClass68_Sub1ArrayArrayArray484[i_2_][i_3_]
[i_4_]);
if (class68_sub1 != null) {
Class64 class64 = class68_sub1.aClass64_2757;
if (class64 != null
&& class64.aClass1_1181.method58()) {
Class68_Sub27.method1218(class64.aClass1_1181,
i_2_, i_3_, i_4_, 1, 1);
if (class64.aClass1_1184 != null
&& class64.aClass1_1184.method58()) {
Class68_Sub27.method1218(class64.aClass1_1184,
i_2_, i_3_, i_4_, 1,
1);
class64.aClass1_1181.method52((class64
.aClass1_1184),
0, 0, 0, false);
class64.aClass1_1184
= class64.aClass1_1184.method57(i, i_0_,
i_1_);
}
class64.aClass1_1181
= class64.aClass1_1181.method57(i, i_0_, i_1_);
}
for (int i_5_ = 0; i_5_ < class68_sub1.anInt2771;
i_5_++) {
Class69 class69
= class68_sub1.aClass69Array2772[i_5_];
if (class69 != null
&& class69.aClass1_1242.method58()) {
Class68_Sub27.method1218(class69.aClass1_1242,
i_2_, i_3_, i_4_,
(class69.anInt1238
- class69.anInt1254
+ 1),
(class69.anInt1234
- class69.anInt1253
+ 1));
class69.aClass1_1242
= class69.aClass1_1242.method57(i, i_0_,
i_1_);
}
}
Class47 class47 = class68_sub1.aClass47_2777;
if (class47 != null
&& class47.aClass1_931.method58()) {
Class68_Sub20_Sub5.method1062(class47.aClass1_931,
i_2_, i_3_, i_4_);
class47.aClass1_931
= class47.aClass1_931.method57(i, i_0_, i_1_);
}
}
}
}
}
}
public static void method1499(int i, int i_6_, int i_7_, boolean bool,
int i_8_, int i_9_) {
anInt1629++;
Class34.method416(-i_8_ + i_6_, (byte) -17, i_9_,
Class68_Sub22.anIntArrayArray3132[i_7_],
i_6_ + i_8_);
int i_10_ = i;
int i_11_ = i_8_ * i_8_;
int i_12_ = 0;
int i_13_ = i * i;
int i_14_ = i_13_ << -836368127;
int i_15_ = i_11_ << -1735381023;
int i_16_ = i << 669055585;
if (bool != true)
anImage1622 = null;
int i_17_ = (1 - i_16_) * i_11_ - -i_14_;
int i_18_ = -((-1 + i_16_) * i_15_) + i_13_;
int i_19_ = i_11_ << 1641909666;
int i_20_ = i_13_ << -1520285566;
int i_21_ = (3 + (i_12_ << 2113626465)) * i_14_;
int i_22_ = i_19_ * (i_10_ + -1);
int i_23_ = (i_12_ - -1) * i_20_;
int i_24_ = (-3 + (i_10_ << 159282273)) * i_15_;
while ((i_10_ ^ 0xffffffff) < -1) {
i_10_--;
if (i_17_ < 0) {
while (i_17_ < 0) {
i_12_++;
i_18_ += i_23_;
i_23_ += i_20_;
i_17_ += i_21_;
i_21_ += i_20_;
}
}
int i_25_ = -i_10_ + i_7_;
if ((i_18_ ^ 0xffffffff) > -1) {
i_12_++;
i_18_ += i_23_;
i_17_ += i_21_;
i_21_ += i_20_;
i_23_ += i_20_;
}
int i_26_ = i_6_ + i_12_;
int i_27_ = i_6_ - i_12_;
Class34.method416(i_27_, (byte) -17, i_9_,
Class68_Sub22.anIntArrayArray3132[i_25_], i_26_);
i_17_ += -i_22_;
i_22_ -= i_19_;
i_18_ += -i_24_;
i_24_ -= i_19_;
int i_28_ = i_7_ + i_10_;
Class34.method416(i_27_, (byte) -17, i_9_,
Class68_Sub22.anIntArrayArray3132[i_28_], i_26_);
}
}
public static void method1500(int i, int i_29_, int i_30_, int i_31_,
int i_32_, int i_33_, int i_34_, int i_35_,
int i_36_, int i_37_) {
anInt1626++;
Class68_Sub2 class68_sub2 = null;
if (i_29_ != 0)
method1504(-51, 16, 10, 40, -61, null, null, null, null, null,
null, -61, (byte) 4, 55, -127);
for (Class68_Sub2 class68_sub2_38_
= ((Class68_Sub2)
Class68_Sub13_Sub31.aClass16_3963.method293((byte) 76));
class68_sub2_38_ != null;
class68_sub2_38_
= ((Class68_Sub2)
Class68_Sub13_Sub31.aClass16_3963.method290((byte) 14))) {
if (i_35_ == class68_sub2_38_.anInt2789
&& (i ^ 0xffffffff) == (class68_sub2_38_.anInt2791
^ 0xffffffff)
&& (i_32_ ^ 0xffffffff) == (class68_sub2_38_.anInt2784
^ 0xffffffff)
&& (i_31_ ^ 0xffffffff) == (class68_sub2_38_.anInt2786
^ 0xffffffff)) {
class68_sub2 = class68_sub2_38_;
break;
}
}
if (class68_sub2 == null) {
class68_sub2 = new Class68_Sub2();
class68_sub2.anInt2786 = i_31_;
class68_sub2.anInt2791 = i;
class68_sub2.anInt2789 = i_35_;
class68_sub2.anInt2784 = i_32_;
Class68_Sub13_Sub36.method882(class68_sub2, true);
Class68_Sub13_Sub31.aClass16_3963.method286(class68_sub2, true);
}
class68_sub2.anInt2795 = i_30_;
class68_sub2.anInt2790 = i_33_;
class68_sub2.anInt2797 = i_37_;
class68_sub2.anInt2794 = i_36_;
class68_sub2.anInt2787 = i_34_;
}
public static void method1501(byte i) {
aRSString_1619 = null;
anImage1622 = null;
aRSString_1621 = null;
if (i < 99)
method1506(124, 7, 65);
aRSString_1618 = null;
aRSString_1611 = null;
}
public boolean method1502(int i, byte i_39_, int i_40_, byte[] is,
boolean bool) {
anInt1625++;
synchronized (aClass124_1616) {
try {
int i_41_;
if (bool) {
if (aClass124_1614.method1754((byte) 90)
< (long) (i_40_ * 6 + 6))
return false;
aClass124_1614.method1760((long) (6 * i_40_), 1);
aClass124_1614.method1761(0, 6, 0,
Class123.aByteArray2125);
i_41_
= ((Class123.aByteArray2125[5] & 0xff)
+ (((Class123.aByteArray2125[4] & 0xff) << 33133832)
+ (0xff0000
& Class123.aByteArray2125[3] << 1465956592)));
if ((i_41_ ^ 0xffffffff) >= -1
|| ((long) i_41_
> aClass124_1616.method1754((byte) 75) / 520L))
return false;
} else {
i_41_
= (int) ((519L + aClass124_1616.method1754((byte) 51))
/ 520L);
if ((i_41_ ^ 0xffffffff) == -1)
i_41_ = 1;
}
Class123.aByteArray2125[1] = (byte) (i >> 1817621192);
Class123.aByteArray2125[2] = (byte) i;
Class123.aByteArray2125[5] = (byte) i_41_;
Class123.aByteArray2125[0] = (byte) (i >> 1069068976);
Class123.aByteArray2125[3] = (byte) (i_41_ >> -1629510896);
Class123.aByteArray2125[4] = (byte) (i_41_ >> -551024760);
aClass124_1614.method1760((long) (6 * i_40_), 1);
aClass124_1614.method1755(6, 0, 0, Class123.aByteArray2125);
int i_42_ = -90 % ((40 - i_39_) / 54);
int i_43_ = 0;
int i_44_ = 0;
int i_45_;
for (/**/; (i ^ 0xffffffff) < (i_43_ ^ 0xffffffff);
i_43_ += i_45_) {
int i_46_ = 0;
if (bool) {
aClass124_1616.method1760((long) (i_41_ * 520), 1);
try {
aClass124_1616.method1761(0, 8, 0,
Class123.aByteArray2125);
} catch (java.io.EOFException eofexception) {
break;
}
i_45_ = (((Class123.aByteArray2125[0] & 0xff)
<< -765727032)
- -(Class123.aByteArray2125[1] & 0xff));
i_46_ = ((Class123.aByteArray2125[6] & 0xff)
+ (Class123.aByteArray2125[4] << -2029121968
& 0xff0000)
- -(0xff00 & (Class123.aByteArray2125[5]
<< -2088592632)));
int i_47_ = Class123.aByteArray2125[7] & 0xff;
int i_48_ = (((0xff & Class123.aByteArray2125[2])
<< 202860296)
- -(Class123.aByteArray2125[3] & 0xff));
if (i_45_ != i_40_ || i_48_ != i_44_
|| anInt1612 != i_47_)
return false;
if (i_46_ < 0
|| (((long) i_46_ ^ 0xffffffffffffffffL)
< (aClass124_1616.method1754((byte) 116) / 520L
^ 0xffffffffffffffffL)))
return false;
}
if (i_46_ == 0) {
bool = false;
i_46_ = (int) ((519L
+ aClass124_1616.method1754((byte) 82))
/ 520L);
if ((i_46_ ^ 0xffffffff) == -1)
i_46_++;
if ((i_46_ ^ 0xffffffff) == (i_41_ ^ 0xffffffff))
i_46_++;
}
Class123.aByteArray2125[0] = (byte) (i_40_ >> 527566472);
Class123.aByteArray2125[2] = (byte) (i_44_ >> 1676955592);
Class123.aByteArray2125[7] = (byte) anInt1612;
Class123.aByteArray2125[1] = (byte) i_40_;
if ((i - i_43_ ^ 0xffffffff) >= -513)
i_46_ = 0;
Class123.aByteArray2125[6] = (byte) i_46_;
Class123.aByteArray2125[5] = (byte) (i_46_ >> -11962840);
Class123.aByteArray2125[3] = (byte) i_44_;
i_45_ = i + -i_43_;
Class123.aByteArray2125[4] = (byte) (i_46_ >> -1151944720);
i_44_++;
if (i_45_ > 512)
i_45_ = 512;
aClass124_1616.method1760((long) (i_41_ * 520), 1);
aClass124_1616.method1755(8, 0, 0,
Class123.aByteArray2125);
i_41_ = i_46_;
aClass124_1616.method1755(i_45_, 0, i_43_, is);
}
return true;
} catch (java.io.IOException ioexception) {
return false;
}
}
}
public boolean method1503(byte[] is, int i, int i_49_, byte i_50_) {
anInt1624++;
synchronized (aClass124_1616) {
if ((i_49_ ^ 0xffffffff) > -1 || anInt1617 < i_49_)
throw new IllegalArgumentException();
boolean bool = method1502(i_49_, (byte) 123, i, is, true);
if (!bool)
bool = method1502(i_49_, (byte) -109, i, is, false);
int i_51_ = -116 % ((i_50_ - -61) / 47);
return bool;
}
}
public static void method1504
(int i, int i_52_, int i_53_, int i_54_, int i_55_, byte[][][] is,
int[] is_56_, int[] is_57_, int[] is_58_, int[] is_59_, int[] is_60_,
int i_61_, byte i_62_, int i_63_, int i_64_) {
if (i < 0)
i = 0;
else if (i >= Applet_Sub1.anInt7 * 128)
i = Applet_Sub1.anInt7 * 128 - 1;
if (i_53_ < 0)
i_53_ = 0;
else if (i_53_ >= Class97.anInt1714 * 128)
i_53_ = Class97.anInt1714 * 128 - 1;
Class13_Sub2.anInt2651 = Class62.anIntArray1155[i_54_];
Class66.anInt1205 = Class62.anIntArray1167[i_54_];
Class128.anInt2220 = Class62.anIntArray1155[i_55_];
Class16.anInt278 = Class62.anIntArray1167[i_55_];
Class25.anInt518 = i;
Class68_Sub17.anInt3033 = i_52_;
Class68_Sub20_Sub12.anInt4355 = i_53_;
Class68_Sub20_Sub10.anInt4319 = i / 128;
Class68_Sub26.anInt3186 = i_53_ / 128;
Class69.anInt1239
= Class68_Sub20_Sub10.anInt4319 - Class68_Sub20_Sub14.anInt4384;
if (Class69.anInt1239 < 0)
Class69.anInt1239 = 0;
Class85.anInt1557
= Class68_Sub26.anInt3186 - Class68_Sub20_Sub14.anInt4384;
if (Class85.anInt1557 < 0)
Class85.anInt1557 = 0;
Class30.anInt549
= Class68_Sub20_Sub10.anInt4319 + Class68_Sub20_Sub14.anInt4384;
if (Class30.anInt549 > Applet_Sub1.anInt7)
Class30.anInt549 = Applet_Sub1.anInt7;
ISAACRandomGen.anInt1493
= Class68_Sub26.anInt3186 + Class68_Sub20_Sub14.anInt4384;
if (ISAACRandomGen.anInt1493 > Class97.anInt1714)
ISAACRandomGen.anInt1493 = Class97.anInt1714;
int i_65_ = 3500;
for (int i_66_ = 0;
i_66_ < (Class68_Sub20_Sub14.anInt4384
+ Class68_Sub20_Sub14.anInt4384 + 2);
i_66_++) {
for (int i_67_ = 0;
i_67_ < (Class68_Sub20_Sub14.anInt4384
+ Class68_Sub20_Sub14.anInt4384 + 2);
i_67_++) {
int i_68_ = ((i_66_ - Class68_Sub20_Sub14.anInt4384 << 7)
- (Class25.anInt518 & 0x7f));
int i_69_ = ((i_67_ - Class68_Sub20_Sub14.anInt4384 << 7)
- (Class68_Sub20_Sub12.anInt4355 & 0x7f));
int i_70_ = (Class68_Sub20_Sub10.anInt4319
- Class68_Sub20_Sub14.anInt4384 + i_66_);
int i_71_ = (Class68_Sub26.anInt3186
- Class68_Sub20_Sub14.anInt4384 + i_67_);
if (i_70_ >= 0 && i_71_ >= 0 && i_70_ < Applet_Sub1.anInt7
&& i_71_ < Class97.anInt1714) {
int i_72_;
if (Class68_Sub13_Sub14.anIntArrayArrayArray3671 != null)
i_72_
= (Class68_Sub13_Sub14.anIntArrayArrayArray3671[0]
[i_70_][i_71_]) - Class68_Sub17.anInt3033 + 128;
else
i_72_ = (Class74.anIntArrayArrayArray1335[0][i_70_]
[i_71_]) - Class68_Sub17.anInt3033 + 128;
int i_73_
= (Class74.anIntArrayArrayArray1335[3][i_70_][i_71_]
- Class68_Sub17.anInt3033 - 1000);
Class68_Sub13_Sub18.aBooleanArrayArray3738[i_66_][i_67_]
= Class68_Sub20_Sub12.method1151(i_68_, i_73_, i_72_,
i_69_, i_65_);
} else
Class68_Sub13_Sub18.aBooleanArrayArray3738[i_66_][i_67_]
= false;
}
}
for (int i_74_ = 0;
i_74_ < (Class68_Sub20_Sub14.anInt4384
+ Class68_Sub20_Sub14.anInt4384 + 1);
i_74_++) {
for (int i_75_ = 0;
i_75_ < (Class68_Sub20_Sub14.anInt4384
+ Class68_Sub20_Sub14.anInt4384 + 1);
i_75_++)
Class68_Sub9.aBooleanArrayArray2887[i_74_][i_75_]
= (Class68_Sub13_Sub18.aBooleanArrayArray3738[i_74_][i_75_]
|| (Class68_Sub13_Sub18.aBooleanArrayArray3738
[i_74_ + 1][i_75_])
|| (Class68_Sub13_Sub18.aBooleanArrayArray3738[i_74_]
[i_75_ + 1])
|| (Class68_Sub13_Sub18.aBooleanArrayArray3738
[i_74_ + 1][i_75_ + 1]));
}
Class68_Sub13_Sub10.anIntArray3591 = is_56_;
Class68_Sub22.anIntArray3137 = is_57_;
Class55.anIntArray2042 = is_58_;
Class68_Sub16.anIntArray3029 = is_59_;
Class53.anIntArray1020 = is_60_;
Class68_Sub20_Sub8.method1095();
Class20.method324(i, i_52_, i_53_, is, i_61_, i_62_, i_63_, i_64_);
}
public static void method1505(byte i) {
if (i >= -1)
method1499(125, 31, 8, true, -92, -128);
for (int i_76_ = 0; i_76_ < Class68_Sub20_Sub16.anInt4418; i_76_++) {
int i_77_ = PacketStream.anIntArray4110[i_76_];
Class1_Sub6_Sub1 class1_sub6_sub1 = Class102.aClass1_Sub6_Sub1Array1746[i_77_];
int i_78_ = Class68_Sub13_Sub8.inStream.readUnsignedByte(-6677);
if ((i_78_ & 0x10) != 0) {
class1_sub6_sub1.anInt2525 = Class68_Sub13_Sub8.inStream.readUnsignedWord(1355769544);
if (class1_sub6_sub1.anInt2525 == 65535)
class1_sub6_sub1.anInt2525 = -1;
}
if ((i_78_ & 0x8) != 0) {
if (class1_sub6_sub1.aClass80_3395.method1444(0))
Class68_Sub13_Sub4.method717(class1_sub6_sub1, 2);
class1_sub6_sub1.aClass80_3395 = (Class68_Sub13_Sub11.method753(Class68_Sub13_Sub8.inStream.readUnsignedWordBigEndian(119), 18));
class1_sub6_sub1.anInt2530 = class1_sub6_sub1.aClass80_3395.anInt1409;
class1_sub6_sub1.anInt2565 = class1_sub6_sub1.aClass80_3395.anInt1467;
class1_sub6_sub1.anInt2574 = class1_sub6_sub1.aClass80_3395.anInt1447;
class1_sub6_sub1.anInt2543 = class1_sub6_sub1.aClass80_3395.anInt1440;
class1_sub6_sub1.anInt2532 = class1_sub6_sub1.aClass80_3395.anInt1410;
class1_sub6_sub1.anInt2564 = class1_sub6_sub1.aClass80_3395.anInt1421;
class1_sub6_sub1.anInt2581 = class1_sub6_sub1.aClass80_3395.anInt1456;
class1_sub6_sub1.anInt2544 = class1_sub6_sub1.aClass80_3395.anInt1451;
class1_sub6_sub1.anInt2563 = class1_sub6_sub1.aClass80_3395.anInt1415;
if (class1_sub6_sub1.aClass80_3395.method1444(0))
Class52.method543(19395, class1_sub6_sub1.anIntArray2570[0], class1_sub6_sub1, null, 0, class1_sub6_sub1.anIntArray2523[0], GameSocket.anInt1149, null);
}
if ((0x40 & i_78_) != 0) {
class1_sub6_sub1.aRSString_2576 = Class68_Sub13_Sub8.inStream.readString(127);
class1_sub6_sub1.anInt2569 = 100;
}
if ((i_78_ & 0x1) != 0) {
int i_79_ = Class68_Sub13_Sub8.inStream.readUnsignedWordA();
if (i_79_ == 65535)
i_79_ = -1;
int i_80_ = Class68_Sub13_Sub8.inStream.readUnsignedByte(-6677);
Class101.method1625(0, i_79_, class1_sub6_sub1, i_80_);
}
if ((i_78_ & 0x2) != 0) {
class1_sub6_sub1.anInt2552 = Class68_Sub13_Sub8.inStream.readUnsignedWordA();
int i_81_ = Class68_Sub13_Sub8.inStream.readDWord_v2(false);
class1_sub6_sub1.anInt2541 = (i_81_ & 0xffff) + Class68_Sub3.anInt2812;
class1_sub6_sub1.anInt2586 = 0;
if (class1_sub6_sub1.anInt2552 == 65535)
class1_sub6_sub1.anInt2552 = -1;
class1_sub6_sub1.anInt2560 = i_81_ >> 1453284944;
class1_sub6_sub1.anInt2578 = 0;
if (Class68_Sub3.anInt2812 < class1_sub6_sub1.anInt2541)
class1_sub6_sub1.anInt2578 = -1;
}
if ((0x20 & i_78_) != 0) {
int i_82_ = Class68_Sub13_Sub8.inStream.readUnsignedByte(-6677);
int i_83_ = Class68_Sub13_Sub8.inStream.readUnsignedByteS();
class1_sub6_sub1.method149(i_82_, false, Class68_Sub3.anInt2812, i_83_);
}
if ((i_78_ & 0x80) != 0) {
class1_sub6_sub1.anInt2526 = Class68_Sub13_Sub8.inStream.readUnsignedWordA();
class1_sub6_sub1.anInt2572 = Class68_Sub13_Sub8.inStream.readUnsignedWordBigEndianA();
}
if ((0x4 & i_78_) != 0) {
int i_84_ = Class68_Sub13_Sub8.inStream.readUnsignedByte(-6677);
int i_85_ = Class68_Sub13_Sub8.inStream.readUnsignedByte(-6677);
class1_sub6_sub1.method149(i_84_, false, Class68_Sub3.anInt2812, i_85_);
class1_sub6_sub1.anInt2534 = Class68_Sub3.anInt2812 + 300;
class1_sub6_sub1.anInt2547 = Class68_Sub13_Sub8.inStream.readUnsignedByteS();
}
}
anInt1623++;
}
public String toString() {
anInt1628++;
return "Cache:" + anInt1612;
}
public static long method1506(int i, int i_86_, int i_87_) {
Class68_Sub1 class68_sub1
= Class22.aClass68_Sub1ArrayArrayArray484[i][i_86_][i_87_];
if (class68_sub1 == null || class68_sub1.aClass47_2777 == null)
return 0L;
return class68_sub1.aClass47_2777.aLong943;
}
public byte[] method1507(int i, boolean bool) {
anInt1627++;
synchronized (aClass124_1616) {
try {
if (aClass124_1614.method1754((byte) 101) < (long) (6 + i * 6))
return null;
aClass124_1614.method1760((long) (i * 6), 1);
aClass124_1614.method1761(0, 6, 0, Class123.aByteArray2125);
int i_88_
= ((Class123.aByteArray2125[1] << -503326744 & 0xff00)
+ (((Class123.aByteArray2125[0] & 0xff) << -1643323344)
- -(0xff & Class123.aByteArray2125[2])));
int i_89_
= ((Class123.aByteArray2125[5] & 0xff)
+ (Class123.aByteArray2125[3] << -1717736080 & 0xff0000)
+ ((Class123.aByteArray2125[4] & 0xff) << 1834419496));
if (bool != true)
return null;
if ((i_88_ ^ 0xffffffff) > -1 || anInt1617 < i_88_)
return null;
if (i_89_ <= 0
|| ((aClass124_1616.method1754((byte) 104) / 520L
^ 0xffffffffffffffffL)
> ((long) i_89_ ^ 0xffffffffffffffffL)))
return null;
byte[] is = new byte[i_88_];
int i_90_ = 0;
int i_91_ = 0;
while (i_88_ > i_90_) {
if (i_89_ == 0)
return null;
aClass124_1616.method1760((long) (520 * i_89_), 1);
int i_92_ = i_88_ + -i_90_;
if (i_92_ > 512)
i_92_ = 512;
aClass124_1616.method1761(0, i_92_ + 8, 0,
Class123.aByteArray2125);
int i_93_
= ((0xff & Class123.aByteArray2125[6])
+ ((0xff0000
& Class123.aByteArray2125[4] << -600163600)
- -(0xff00 & (Class123.aByteArray2125[5]
<< -554764568))));
int i_94_
= (((Class123.aByteArray2125[0] & 0xff) << -974042584)
- -(0xff & Class123.aByteArray2125[1]));
int i_95_ = ((0xff & Class123.aByteArray2125[3])
+ ((0xff & Class123.aByteArray2125[2])
<< -1322389528));
int i_96_ = 0xff & Class123.aByteArray2125[7];
if (i_94_ != i || i_95_ != i_91_
|| (anInt1612 ^ 0xffffffff) != (i_96_ ^ 0xffffffff))
return null;
if (i_93_ < 0
|| ((long) i_93_
> aClass124_1616.method1754((byte) 67) / 520L))
return null;
i_89_ = i_93_;
for (int i_97_ = 0;
(i_92_ ^ 0xffffffff) < (i_97_ ^ 0xffffffff); i_97_++)
is[i_90_++] = Class123.aByteArray2125[i_97_ - -8];
i_91_++;
}
return is;
} catch (java.io.IOException ioexception) {
return null;
}
}
}
public static byte[] method1508(byte[] is, boolean bool) {
int i = is.length;
anInt1613++;
byte[] is_98_ = new byte[i];
if (bool != false)
method1508(null, true);
Class39.method465(is, 0, is_98_, 0, i);
return is_98_;
}
public Unknown(int i, Class124 class124, Class124 class124_99_,
int i_100_) {
aClass124_1614 = null;
try {
anInt1612 = i;
anInt1617 = i_100_;
aClass124_1614 = class124_99_;
aClass124_1616 = class124;
} catch (RuntimeException runtimeexception) {
throw Class107.method1652(runtimeexception,
("p.<init>(" + i + ','
+ (class124 != null ? "{...}" : "null")
+ ','
+ (class124_99_ != null ? "{...}"
: "null")
+ ',' + i_100_ + ')'));
}
}
static {
aByte1615 = (byte) 0;
aRSString_1619 = Class112.method1668(43, "(U3");
aRSString_1611
= Class112.method1668(43, "m-Ochte mit Ihnen handeln)3");
aRSString_1621 = Class112.method1668(43, "<br>(X");
}
}

151
server317/autospawn.cfg Executable file
View File

@ -0,0 +1,151 @@
//------NpcID---CoordX--CoordY--Height--RangeX1-RangeY1-RangeX2-RangeY2-WalkType-Descrption
spawn = 494 3256 3418 0 0 0 0 0 1 Varrock East Bank Male Banker
spawn = 494 3254 3418 0 0 0 0 0 1 Varrock East Bank Male Banker
spawn = 494 3253 3418 0 0 0 0 0 1 Varrock East Bank Male Banker
spawn = 495 3252 3418 0 0 0 0 0 1 Varrock East Bank Female Banker
spawn = 495 3254 3417 0 0 0 0 0 1 Varrock East Bank Female Banker
spawn = 494 3187 3436 0 0 0 0 0 1 Varrock West Bank Male Banker
spawn = 495 3187 3438 0 0 0 0 0 1 Varrock West Bank Female Banker
spawn = 494 3187 3440 0 0 0 0 0 1 Varrock West Bank Male Banker
spawn = 494 3187 3442 0 0 0 0 0 1 Varrock West Bank Male Banker
spawn = 494 3187 3444 0 0 0 0 0 1 Varrock West Bank Male Banker
spawn = 495 3187 3446 0 0 0 0 0 1 Varrock West Bank Female Banker
spawn = 494 2945 3366 0 0 0 0 0 1 Falador West Bank Male Banker
spawn = 494 2946 3366 0 0 0 0 0 1 Falador West Bank Male Banker
spawn = 495 2947 3366 0 0 0 0 0 1 Falador West Bank Female Banker
spawn = 494 2948 3366 0 0 0 0 0 1 Falador West Bank Male Banker
spawn = 494 2949 3366 0 0 0 0 0 1 Falador West Bank Male Banker
spawn = 494 3011 3353 0 0 0 0 0 1 Falador East Bank Male Banker
spawn = 495 3012 3353 0 0 0 0 0 1 Falador East Bank Female Banker
spawn = 494 3013 3353 0 0 0 0 0 1 Falador East Bank Male Banker
spawn = 494 3014 3353 0 0 0 0 0 1 Falador East Bank Male Banker
spawn = 495 3015 3353 0 0 0 0 0 1 Falador East Bank Female Banker
spawn = 494 3090 3245 0 0 0 0 0 1 Draynor Village Bank Male Banker
spawn = 495 3090 3243 0 0 0 0 0 1 Draynor Village Bank Female Banker
spawn = 495 3090 3242 0 0 0 0 0 1 Draynor Village Bank Female Banker
spawn = 494 3088 3242 0 0 0 0 0 1 Draynor Village Bank Male Banker
spawn = 496 3267 3169 0 0 0 0 0 1 Al-Kharid Bank Male Banker
spawn = 497 3267 3168 0 0 0 0 0 1 Al-Kharid Bank Female Banker
spawn = 496 3267 3167 0 0 0 0 0 1 Al-Kharid Bank Male Banker
spawn = 497 3267 3166 0 0 0 0 0 1 Al-Kharid Bank Female Banker
spawn = 496 3267 3164 0 0 0 0 0 1 Al-Kharid Bank Male Banker
spawn = 494 3096 3489 0 0 0 0 0 1 Edgeville Bank Male Banker
spawn = 495 3096 3491 0 0 0 0 0 1 Edgeville Bank Female Banker
spawn = 495 3096 3492 0 0 0 0 0 1 Edgeville Bank Female Banker
spawn = 494 3098 3492 0 0 0 0 0 1 Edgeville Bank Male Banker
spawn = 368 3263 3407 0 0 0 0 0 1 Varrock Gate Guard at Magic Shop
spawn = 1834 3170 3176 0 0 0 0 0 1 Lumbridge Swamp Candle Seller
spawn = 925 3267 3229 0 0 0 0 0 1 Al-Kharid Gate Guard
spawn = 925 3267 3226 0 0 0 0 0 1 Al-Kharid Gate Guard
spawn = 925 3268 3229 0 0 0 0 0 1 Al-Kharid Gate Guard
spawn = 925 3268 3226 0 0 0 0 0 1 Al-Kharid Gate Guard
spawn = 1862 3304 3211 0 0 0 0 0 1 Al-Kharid Ali
spawn = 309 3104 3424 0 0 0 0 0 1 Barbarian Village Fishing Lure & Bait
spawn = 309 3104 3425 0 0 0 0 0 1 Barbarian Village Fishing Lure & Bait
spawn = 309 3110 3432 0 0 0 0 0 1 Barbarian Village Fishing Lure & Bait
spawn = 309 3110 3433 0 0 0 0 0 1 Barbarian Village Fishing Lure & Bait
spawn = 309 3110 3434 0 0 0 0 0 1 Barbarian Village Fishing Lure & Bait
spawn = 316 3085 3231 0 0 0 0 0 1 Draynor Village Fishing Net & Bait
spawn = 316 3085 3230 0 0 0 0 0 1 Draynor Village Fishing Net & Bait
spawn = 316 3267 3148 0 0 0 0 0 1 Al-Kharid Fishing Net & Bait
spawn = 316 3268 3147 0 0 0 0 0 1 Al-Kharid Fishing Net & Bait
spawn = 316 3275 3140 0 0 0 0 0 1 Al-Kharid Fishing Net & Bait
spawn = 316 2921 3178 0 0 0 0 0 1 Karamja Island Fishing Net & Bait
spawn = 316 2924 3181 0 0 0 0 0 1 Karamja Island Fishing Net & Bait
spawn = 316 2923 3180 0 0 0 0 0 1 Karamja Island Fishing Net & Bait
spawn = 312 2925 3181 0 0 0 0 0 1 Karamja Island Fishing Cage & Harpoon
spawn = 312 2926 3180 0 0 0 0 0 1 Karamja Island Fishing Cage & Harpoon
spawn = 312 2926 3179 0 0 0 0 0 1 Karamja Island Fishing Cage & Harpoon
spawn = 312 2923 3179 0 0 0 0 0 1 Karamja Island Fishing Cage & Harpoon
spawn = 844 2681 3325 0 2686 3327 3318 2679 1 East Ardougne Essence Wizard
spawn = 553 3253 3402 0 3255 3404 3250 3399 1 Varrock Aubury at Magic shop
spawn = 522 3217 3416 0 3220 3420 3213 3411 1 Varrock General Store Shop Keeper
spawn = 523 3217 3416 0 3220 3420 3213 3411 1 Varrock General Store Shop Assistant
spawn = 300 3104 9571 0 3107 9574 3096 9566 1 Draynor Village Essence Wizard Tower
spawn = 462 2591 3086 0 2596 3092 2585 3083 1 Yannile Essence Wizard Guild
spawn = 175 3250 3392 0 3254 3398 3248 3386 1 Varrock Mugger at Magic Shop
spawn = 9 3271 3427 0 3276 3431 3268 3426 1 Varrock West Exit Guard
spawn = 9 3271 3430 0 3276 3431 3268 3426 1 Varrock West Exit Guard
spawn = 526 2958 3387 0 2960 3390 2953 3385 1 Falador General Store Shop Keeper
spawn = 527 2958 3387 0 2960 3390 2953 3385 1 Falador General Store Shop Keeper
spawn = 577 2975 3383 0 2979 3386 2972 3383 1 Falador Shield Shop
spawn = 580 2950 3387 0 2952 3390 2948 3385 1 Falador Mace Shop
spawn = 9 2962 3381 0 2969 3384 2958 3376 1 Falador Center Guard
spawn = 9 2968 3381 0 3385 3384 2958 3376 1 Falador Center Guard
spawn = 9 2965 3384 0 3385 3384 2958 3376 1 Falador Center Guard
spawn = 9 2964 3396 0 2968 3398 2963 3391 1 Falador North Exit Guard
spawn = 9 2967 3396 0 2968 3398 2963 3391 1 Falador North Exit Guard
spawn = 538 3075 3429 0 3077 3431 3073 3427 1 Barbarian Village Helmet Shop
spawn = 546 3203 3434 0 3204 3437 3201 3431 1 Varrock Staff Shop
spawn = 548 3206 3417 0 3208 3421 3202 3414 1 Varrock Cloth Shop
spawn = 551 3206 3398 0 3209 3404 3202 3395 1 Varrock Sword Shop Shop Keeper
spawn = 552 3206 3398 0 3209 3404 3202 3395 1 Varrock Sword Shop Shop Assitant
spawn = 549 3229 3439 0 3232 3442 3225 3433 1 Varrock Armor Shop
spawn = 550 3232 3425 0 3235 3427 3230 3421 1 Varrock Archery Shop
spawn = 584 2946 3335 0 2946 3337 2944 3332 1 Falador Gem Store
spawn = 581 2971 3313 0 2976 3314 2969 3310 1 Falador Chainmail Shop
spawn = 585 2949 3205 0 2952 3208 2946 3202 1 Rimmington Crafting Shop
spawn = 530 2947 3216 0 0 0 0 0 1 Rimmington General Store Shop Keeper
spawn = 531 2948 3216 0 0 0 0 0 1 Rimmington General Store Shop Keeper
spawn = 1860 2957 3204 0 2960 3205 2953 3202 1 Rimmington Archery Shop
spawn = 557 3014 3206 0 3016 3210 3012 3203 1 Port Sarim Food Shop
spawn = 558 3014 3224 0 3017 3229 3011 3220 1 Port Sarim Fishing Shop
spawn = 559 3028 3247 0 3030 3253 3023 3245 1 Port Sarim Battleaxe Shop
spawn = 556 3013 3246 0 3015 3248 3012 3244 1 Port Sarim Jewelery Shop
spawn = 583 3015 3258 0 3016 3261 3011 3257 1 Port Sarim Magic Shop
spawn = 520 3212 3246 0 3214 3250 3208 3242 1 Lumbridge General Store Shop Keeper
spawn = 521 3212 3246 0 3214 3250 3208 3242 1 Lumbridge General Store Shop Assistant
spawn = 519 3231 3203 0 3233 3205 3228 3201 1 Lumbridge Axe Shop
spawn = 541 3288 3189 0 3290 3192 3285 3187 1 Al-Kharid Scimitar Shop
spawn = 545 3320 3194 0 3323 3197 3318 3191 1 Al-Kharid Crafting Shop
spawn = 524 3315 3180 0 3318 3186 3312 3178 1 Al-Kharid General Sote Shop Keeper
spawn = 525 3315 3180 0 3318 3186 3312 3178 1 Al-Kharid General Store Shop Assistant
spawn = 542 3316 3175 0 3318 3177 3114 3173 1 Al-Kharid Legs Shop
spawn = 544 3315 3163 0 3318 3165 3313 3160 1 Al-Kharid Skirt Shop
spawn = 1 3238 3405 0 3240 3408 3236 3403 1 Varrock West From Magic Shop Man
spawn = 3 3238 3405 0 3240 3408 3236 3403 1 Varrock West From Magic Shop Man
spawn = 9 3274 3421 0 3276 3423 3273 3420 1 Varrock East Exit Guard
spawn = 2 3261 3398 0 3263 3403 3260 3396 1 Varrock Man East from Magic Shop
spawn = 1 3245 3394 0 3347 3396 3243 3393 1 Varrock Man South West from Magic Shop
spawn = 8 3235 3384 0 3238 3386 3233 3382 1 Varrock Thief South-South West from Magic Shop
spawn = 87 3295 3379 0 3299 3383 3290 3377 1 West Varrock Rat
spawn = 1268 2663 3716 0 2666 3719 2661 3713 1 Rellekka Rock Crab
spawn = 1266 2666 3715 0 2668 3717 2664 3713 1 Rellekka Rock Crab
spawn = 1268 2669 3718 0 2671 3719 2667 3712 1 Rellekka Rock Crab
spawn = 1268 2673 3716 0 2675 3718 2671 3712 1 Rellekka Rock Crab
spawn = 1268 2676 3713 0 2678 3715 2674 3711 1 Rellekka Rock Crab
spawn = 1268 2677 3717 0 2680 3720 2674 3714 1 Rellekka Rock Crab
spawn = 1266 2683 3716 0 2685 3718 2681 3714 1 Rellekka Rock Crab
spawn = 1268 2687 3724 0 2689 3726 2685 3722 1 Rellekka Rock Crab
spawn = 1268 2670 3727 0 2672 3729 2668 3725 1 Rellekka Rock Crab
spawn = 1266 2677 3721 0 2679 3722 2675 3718 1 Rellekka Rock Crab
spawn = 1266 2681 3733 0 2683 3734 2679 3730 1 Rellekka Rock Crab
spawn = 1266 2675 3729 0 2677 3731 2673 3727 1 Rellekka Rock Crab
spawn = 1266 2671 3724 0 2673 3727 2669 3723 1 Rellekka Rock Crab
spawn = 1268 2680 3728 0 2682 3730 2678 3726 1 Rellekka Rock Crab
spawn = 41 3230 3299 0 3237 3301 3225 3292 1 Lumbridge Chicken
spawn = 7 3228 3290 0 3230 3294 3225 3287 1 Lumbridge Farmer at Chickens
spawn = 41 3231 3298 0 3237 3301 3225 3292 1 Lumbridge Chicken
spawn = 41 3229 3298 0 3237 3301 3225 3292 1 Lumbridge Chicken
spawn = 41 3226 3296 0 3237 3301 3225 3292 1 Lumbridge Chicken
spawn = 41 3233 3294 0 3237 3301 3225 3292 1 Lumbridge Chicken
spawn = 41 3233 3300 0 3237 3301 3225 3292 1 Lumbridge Chicken
spawn = 41 3227 3300 0 3237 3301 3225 3292 1 Lumbridge Chicken
spawn = 41 3230 3296 0 3237 3301 3225 3292 1 Lumbridge Chicken
spawn = 1767 3254 3256 0 3256 3258 3253 3255 2 Lumbridge Cow
spawn = 81 3260 3260 0 3262 3262 3258 3258 2 Lumbridge Cow
spawn = 397 3255 3259 0 3257 3261 3253 3257 2 Lumbridge Cow
spawn = 397 3263 3260 0 3265 3262 3261 3258 2 Lumbridge Cow
spawn = 81 3259 3266 0 3261 3268 3257 3264 2 Lumbridge Cow
spawn = 1767 3262 3271 0 3264 3273 3260 3269 2 Lumbridge Cow
spawn = 1766 3257 3273 0 3259 3275 3255 3271 2 Lumbridge Cow
spawn = 397 3255 3279 0 3257 3277 3253 3277 2 Lumbridge Cow
spawn = 1767 3257 3293 0 3259 3295 3255 3291 2 Lumbridge Cow
spawn = 81 3253 3289 0 3255 3291 3251 3287 2 Lumbridge Cow
spawn = 81 3248 3284 0 3250 3286 3246 3282 2 Lumbridge Cow
spawn = 1766 3248 3288 0 3250 3290 3246 3286 2 Lumbridge Cow
spawn = 1767 3243 3296 0 3245 3298 3241 3294 2 Lumbridge Cow
spawn = 397 3244 3289 0 3246 3291 3242 3287 2 Lumbridge Cow
spawn = 397 3263 3293 0 3265 3295 3261 3291 2 Lumbridge Cow
spawn = 1768 3263 3288 0 3265 3290 3261 3286 2 Lumbridge Cow
spawn = 81 3262 3283 0 3264 3285 3260 3281 2 Lumbridge Cow

View File

@ -0,0 +1,77 @@
[ACCOUNT]
character-username = Usename Here
character-password = password here
[CHARACTER]
character-height = 0
character-posx = 3216
character-posy = 3418
character-rights = 3
character-ismember = 1
character-messages = 0
character-lastconnection = localhost
character-lastlogin = 20060028
character-energy = 100
character-gametime = 0
character-gamecount = 10424
[EQUIPMENT]
character-equip = 0 -1 0
character-equip = 1 -1 0
character-equip = 2 -1 0
character-equip = 3 -1 0
character-equip = 4 -1 0
character-equip = 5 -1 0
character-equip = 6 -1 0
character-equip = 7 -1 0
character-equip = 8 -1 0
character-equip = 9 -1 0
character-equip = 10 -1 0
character-equip = 11 -1 0
character-equip = 12 -1 0
character-equip = 13 -1 0
[LOOK]
character-look = 0 0
character-look = 1 7
character-look = 2 8
character-look = 3 9
character-look = 4 5
character-look = 5 0
[SKILLS]
character-skill = 0 1 0
character-skill = 1 1 0
character-skill = 2 1 0
character-skill = 3 1 0
character-skill = 4 1 0
character-skill = 5 1 0
character-skill = 6 1 0
character-skill = 7 1 0
character-skill = 8 1 0
character-skill = 9 1 0
character-skill = 10 1 0
character-skill = 11 1 0
character-skill = 12 1 0
character-skill = 13 1 0
character-skill = 14 1 0
character-skill = 15 1 0
character-skill = 16 1 0
character-skill = 17 1 0
character-skill = 18 1 0
character-skill = 19 1 0
character-skill = 20 1 0
character-skill = 21 1 0
character-skill = 22 1 0
character-skill = 23 1 0
character-skill = 24 1 0
[ITEMS]
[BANK]
[FRIENDS]
[IGNORES]
[EOF]

View File

@ -0,0 +1,78 @@
[ACCOUNT]
character-username = thisistheusernameplace
character-password = thisisthepasswordplace
[CHARACTER]
character-height = 0
character-posx = 3287
character-posy = 3366
character-rights = 3
character-ismember = 1
character-messages = 0
character-lastconnection = localhost
character-lastlogin = 20060028
character-energy = 0
character-gametime = 0
character-gamecount = 10988
[EQUIPMENT]
character-equip = 0 -1 0
character-equip = 1 -1 0
character-equip = 2 -1 0
character-equip = 3 1265 1
character-equip = 4 -1 0
character-equip = 5 -1 0
character-equip = 6 -1 0
character-equip = 7 -1 0
character-equip = 8 -1 0
character-equip = 9 -1 0
character-equip = 10 -1 0
character-equip = 11 -1 0
character-equip = 12 -1 0
character-equip = 13 -1 0
[LOOK]
character-look = 0 0
character-look = 1 7
character-look = 2 8
character-look = 3 9
character-look = 4 5
character-look = 5 0
[SKILLS]
character-skill = 0 99 14000000
character-skill = 1 99 14000000
character-skill = 2 99 14000000
character-skill = 3 99 14000000
character-skill = 4 99 14000000
character-skill = 5 99 14000000
character-skill = 6 99 14000000
character-skill = 7 99 14000000
character-skill = 8 99 14000000
character-skill = 9 99 14000000
character-skill = 10 99 14000000
character-skill = 11 99 14000000
character-skill = 12 99 14000000
character-skill = 13 99 14000000
character-skill = 14 99 14000000
character-skill = 15 99 14000000
character-skill = 16 99 14000000
character-skill = 17 99 14000000
character-skill = 18 99 14000000
character-skill = 19 99 14000000
character-skill = 20 99 14000000
character-skill = 21 99 14000000
character-skill = 22 99 14000000
character-skill = 23 99 14000000
character-skill = 24 99 14000000
[ITEMS]
[BANK]
[FRIENDS]
[IGNORES]
[EOF]

View File

@ -0,0 +1,78 @@
[ACCOUNT]
character-username = whitefang
character-password = password
[CHARACTER]
character-height = 0
character-posx = 3035
character-posy = 9846
character-rights = 3
character-ismember = 1
character-messages = 0
character-lastconnection = localhost
character-lastlogin = 20060028
character-energy = 0
character-gametime = 0
character-gamecount = 10988
[EQUIPMENT]
character-equip = 0 -1 0
character-equip = 1 -1 0
character-equip = 2 -1 0
character-equip = 3 -1 0
character-equip = 4 -1 0
character-equip = 5 -1 0
character-equip = 6 -1 0
character-equip = 7 -1 0
character-equip = 8 -1 0
character-equip = 9 -1 0
character-equip = 10 -1 0
character-equip = 11 -1 0
character-equip = 12 -1 0
character-equip = 13 -1 0
[LOOK]
character-look = 0 0
character-look = 1 7
character-look = 2 8
character-look = 3 9
character-look = 4 5
character-look = 5 0
[SKILLS]
character-skill = 0 99 14000000
character-skill = 1 99 14000000
character-skill = 2 99 14000000
character-skill = 3 99 14000000
character-skill = 4 99 14000000
character-skill = 5 99 14000000
character-skill = 6 99 14000000
character-skill = 7 99 14000000
character-skill = 8 99 14000000
character-skill = 9 99 14000000
character-skill = 10 99 14000000
character-skill = 11 99 14000000
character-skill = 12 99 14000000
character-skill = 13 99 14000000
character-skill = 14 99 14000000
character-skill = 15 99 14000000
character-skill = 16 99 14000000
character-skill = 17 99 14000000
character-skill = 18 99 14000000
character-skill = 19 99 14000000
character-skill = 20 99 14000000
character-skill = 21 99 14000000
character-skill = 22 99 14000000
character-skill = 23 99 14000000
character-skill = 24 99 14000000
[ITEMS]
[BANK]
[FRIENDS]
[IGNORES]
[EOF]

BIN
server317/data/notes.dat Executable file

Binary file not shown.

BIN
server317/data/sellable.dat Executable file

Binary file not shown.

BIN
server317/data/stackable.dat Executable file

Binary file not shown.

BIN
server317/data/tradeable.dat Executable file

Binary file not shown.

BIN
server317/data/twohanded.dat Executable file

Binary file not shown.

18
server317/dialogues.cfg Executable file
View File

@ -0,0 +1,18 @@
//npc speaks
//---------id---type----nextdia-dialoguetext1-------------------------------------------dialoguetext2-------------------dialoguetext3
dialogue = 1 1 2 Good_day,_how_can_I_help_you? EMPTY EMPTY
dialogue = 3 1 4 Do_you_want_to_buy_some_runes? EMPTY EMPTY
dialogue = 6 1 0 Well,_if_you_find_somone_who_does_want_runes,_please send_them_my_way. EMPTY
//player speaks (same as 1)
//---------id---type----nextdia-dialoguetext1-------------------------------------------dialoguetext2-------------------dialoguetext3
dialogue = 5 3 6 Oh_it's_a_rune_shop._No_thank_you,_then. EMPTY EMPTY
//player must choose
//---------id---type----nexto1--nexto2--nexto3--swclose-swfar---question------------------------option1-----------------------------------------option2-----------------------------------------option3
dialogue = 2 2 -1 -2 0 1 0 What_would_you_like_to_say? I'd_like_to_access_my_bank_account,_please. I'd_like_to_check_my_PIN_settings. EMPTY
dialogue = 4 2 -3 5 0 1 0 Select_an_Option Yes_please! Oh_it's_a_rune_shop._No_thank_you,_then. EMPTY
[ENDOFDIALOGUELIST]

196
server317/drops.cfg Executable file
View File

@ -0,0 +1,196 @@
//-----ItemID---CoordX--CoordY--Amount--Height--Type
drop = 1923 3208 3214 1 0 2 Lumbridge Castle Bowl
drop = 1931 3209 3214 1 0 2 Lumbridge Castle Pot
drop = 1935 3211 3212 1 0 2 Lumbridge Castle Jug
drop = 558 3206 3208 1 0 1 Lumbridge Castle Mind Rune
drop = 882 3205 3227 1 0 1 Lumbridge Castle Bronze Arrow
drop = 946 3224 3202 1 0 1 Lumbridge Castle Knife
drop = 1205 3213 3216 1 1 2 Lumbridge Castle Bronze Dagger
drop = 1511 3205 3226 1 2 1 Lumbridge Castle Logs
drop = 1511 3205 3224 1 2 1 Lumbridge Castle Logs
drop = 1511 3208 3225 1 2 1 Lumbridge Castle Logs
drop = 1511 3209 3224 1 2 1 Lumbridge Castle Logs
drop = 1931 3148 3211 1 0 1 Lumbridge Swamp Pot
drop = 1939 3164 3187 1 0 1 Lumbridge Swamp Tar
drop = 1939 3164 3180 1 0 1 Lumbridge Swamp Tar
drop = 1939 3171 3177 1 0 1 Lumbridge Swamp Tar
drop = 1939 3173 3178 1 0 1 Lumbridge Swamp Tar
drop = 1939 3171 3191 1 0 1 Lumbridge Swamp Tar
drop = 1939 3179 3190 1 0 1 Lumbridge Swamp Tar
drop = 1939 3181 3193 1 0 1 Lumbridge Swamp Tar
drop = 1939 3183 3180 1 0 1 Lumbridge Swamp Tar
drop = 1939 3193 3181 1 0 1 Lumbridge Swamp Tar
drop = 1939 3194 3168 1 0 1 Lumbridge Swamp Tar
drop = 1939 3191 3162 1 0 1 Lumbridge Swamp Tar
drop = 1939 3189 3163 1 0 1 Lumbridge Swamp Tar
drop = 1939 3185 3161 1 0 1 Lumbridge Swamp Tar
drop = 1939 3182 3165 1 0 1 Lumbridge Swamp Tar
drop = 1939 3173 3166 1 0 1 Lumbridge Swamp Tar
drop = 1939 3170 3167 1 0 1 Lumbridge Swamp Tar
drop = 1939 3164 3169 1 0 1 Lumbridge Swamp Tar
drop = 1059 3234 3151 1 0 1 Lumbridge Swamp Leather Gloves
drop = 556 3150 3247 1 0 1 West Lumbridge Air Rune
drop = 1944 3229 3299 1 0 1 Lumbridge Farm Egg
drop = 1944 3226 3301 1 0 1 Lumbridge Farm Egg
drop = 1925 3225 3294 1 0 1 Lumbridge Farm Bucket
drop = 555 3298 3316 4 0 1 Al-Kharid Mine Water Rune
drop = 554 3304 3311 3 0 1 Al-Kharid Mine Fire Rune
drop = 1925 3307 3198 1 0 1 Al-Kharid Bucket
drop = 1061 3302 3190 1 0 1 Al-Kharid Leather Boots
drop = 1937 3302 3170 1 0 2 Al-Kharid Jug Of Water
drop = 1965 3285 3175 1 0 2 Al-Kharid Cabbage
drop = 1422 3220 3137 1 0 1 South Al-Kharid Bronze Mace
drop = 1931 3232 3399 1 0 2 Varrock Pot
drop = 1511 3243 3395 1 0 1 Varrock Logs
drop = 1511 3243 3397 1 0 1 Varrock Logs
drop = 1129 3244 3398 1 0 1 Varrock Leather Body
drop = 1935 3272 3409 1 0 2 Varrock Jug
drop = 1279 3254 3451 1 0 3 Varrock Iron Sword
drop = 1153 3254 3452 1 0 3 Varrock Iron Full Helm
drop = 1115 3254 3453 1 0 3 Varrock Iron Platebody
drop = 952 3218 3412 1 1 1 Varrock Spade
drop = 946 3218 3418 1 1 1 Varrock Knife
drop = 33 3208 3395 1 1 2 Varrock Lit Candle
drop = 2313 3222 3494 1 0 2 Varrock Castle Pie Dish
drop = 559 3194 3495 2 0 1 Varrock Castle Body Rune
drop = 995 3228 3504 3 0 1 Varrock Castle Coins
drop = 995 3232 3500 4 0 1 Varrock Castle Coins
drop = 995 3274 9870 1 0 1 Varrock Sewers Coins
drop = 559 3226 9910 1 0 1 Varrock Sewers Body Rune
drop = 558 3224 9910 1 0 1 Varrock Sewers Mind Rune
drop = 995 3167 9897 8 0 1 Varrock Sewers Coins
drop = 995 3173 9897 1 0 1 Varrock Sewers Coins
drop = 995 3173 9881 7 0 1 Varrock Sewers Coins
drop = 995 3169 9880 5 0 1 Varrock Sewers Coins
drop = 557 3185 9888 6 0 1 Varrock Sewers Earth Rune
drop = 946 3218 9887 1 0 1 Varrock Sewers Knife
drop = 223 3179 9881 1 0 1 Varrock Sewers Red Spiders' Eggs
drop = 223 3177 9880 1 0 1 Varrock Sewers Red Spiders' Eggs
drop = 1349 3162 9888 1 0 1 Varrock Sewers Iron Axe
drop = 1951 3278 3374 1 0 1 South Varrock Redberries
drop = 1951 3271 3366 1 0 1 South Varrock Redberries
drop = 1951 3267 3371 1 0 1 South Varrock Redberries
drop = 753 3277 3370 1 0 1 South Varrock Cadava Berries
drop = 753 3273 3375 1 0 1 South Varrock Cadava Berries
drop = 1171 3204 3515 1 0 1 North Varrock Wooden Shield
drop = 557 3195 3515 1 0 1 North Varrock Earth Rune
drop = 1573 3152 3401 1 0 1 East Varrock Doogle Leaves
drop = 1573 3151 3399 1 0 1 East Varrock Doogle Leaves
drop = 1573 3152 3399 1 0 1 East Varrock Doogle Leaves
drop = 1573 3156 3401 1 0 1 East Varrock Doogle Leaves
drop = 1573 3157 3400 1 0 1 East Varrock Doogle Leaves
drop = 1973 3143 3452 1 0 2 Cooking Guild Chocolat Bar
drop = 2313 3142 3447 1 1 2 Cooking Guild Pie Dish
drop = 1955 3141 3447 1 1 2 Cooking Guild Cooking Apple
drop = 1955 3140 3447 1 1 2 Cooking Guild Cooking Apple
drop = 1887 3141 3452 1 1 2 Cooking Guild Cake Tin
drop = 1923 3140 3447 1 1 2 Cooking Guild Bowl
drop = 1931 3144 3449 1 2 2 Cooking Guild Pot
drop = 1987 3144 3450 1 2 2 Cooking Guild Grapes
drop = 1955 3140 3447 1 2 2 Cooking Guild Cooking Apple
drop = 1935 3141 3447 1 2 2 Cooking Guild Jug
drop = 1511 3302 3507 1 0 1 Lumber Yard Logs
drop = 1511 3301 3507 1 0 1 Lumber Yard Logs
drop = 1511 3302 3510 1 0 1 Lumber Yard Logs
drop = 1511 3299 3511 1 0 1 Lumber Yard Logs
drop = 1511 3310 3504 1 0 1 Lumber Yard Logs
drop = 1511 3311 3503 1 0 1 Lumber Yard Logs
drop = 1511 3303 3502 1 0 1 Lumber Yard Logs
drop = 1511 3303 3503 1 0 1 Lumber Yard Logs
drop = 1734 3286 3491 1 0 1 West Lumber Yard
drop = 1420 3111 3517 1 0 1 Edgeville Iron Mace
drop = 1059 3097 3486 1 0 1 Edgeville LEather Gloves
drop = 526 3093 9879 1 0 1 Edgeville Sewers Bones
drop = 526 3093 9884 1 0 1 Edgeville Sewers Bones
drop = 526 3098 9886 1 0 1 Edgeville Sewers Bones
drop = 526 3116 9891 1 0 1 Edgeville Sewers Bones
drop = 526 3119 9894 1 0 1 Edgeville Sewers Bones
drop = 526 3120 9894 1 0 1 Edgeville Sewers Bones
drop = 526 3122 9891 1 0 1 Edgeville Sewers Bones
drop = 995 3088 9898 4 0 1 Edgeville Sewers Coins
drop = 995 3088 9899 1 0 1 Edgeville Sewers Coins
drop = 995 3091 9899 1 0 1 Edgeville Sewers Coins
drop = 526 3097 9901 1 0 1 Edgeville Sewers Bones
drop = 526 3094 9906 1 0 1 Edgeville Sewers Bones
drop = 882 3135 9916 1 0 1 Edgeville Sewers Bronze Arrow
drop = 882 3130 9903 3 0 1 Edgeville Sewers Bronze Arrow
drop = 1009 3122 9881 1 0 1 Edgeville Sewers Brass Necklace
drop = 983 3131 9862 1 0 1 Edgeville Sewers Brass Key
drop = 526 3110 9825 1 0 1 Edgeville Sewers Bones
drop = 526 3107 9823 1 0 1 Edgeville Sewers Bones
drop = 526 3109 9823 1 0 1 Edgeville Sewers Bones
drop = 526 3101 9825 1 0 1 Edgeville Sewers Bones
drop = 1265 3081 3429 1 0 2 Barbarian Village Bronze Pickaxe
drop = 1931 3074 3431 1 0 1 Barbarian Village Pot
drop = 1917 3077 3439 1 0 2 Barbarian Village Beer
drop = 1917 3080 3441 1 0 2 Barbarian Village Beer
drop = 1917 3077 3443 1 0 2 Barbarian Village Beer
drop = 2142 3077 3441 1 0 2 Barbarian Village Cooekd Meat
drop = 2142 3080 3443 1 0 2 Barbarian Village Cooekd Meat
drop = 544 3055 3487 1 0 2 Monastery Monk's Robe
drop = 542 3055 3488 1 0 2 Monastery Monk's Robe
drop = 995 3003 9801 1 0 1 Dwarven Mine Coins
drop = 995 3001 9798 1 0 1 Dwarven Mine Coins
drop = 1103 2985 9817 1 0 1 Dwarven Mine Bronze Chainbody
drop = 2313 2993 9847 1 0 2 Dwarven Mine Pie Dish
drop = 1265 3009 3342 1 0 2 Falador Bronze Pickaxe
drop = 882 2944 3332 2 0 1 Falador Bronze Arrow
drop = 2140 2975 3381 1 1 1 Falador Cooked Chicken
drop = 1351 2970 3376 1 1 1 Falador Bronze Axe
drop = 2347 2975 3368 1 1 1 Falador Hammer
drop = 952 2981 3369 1 0 2 Falador Spade
drop = 1925 2958 3510 1 0 1 Goblin Village Bucket
drop = 1595 2928 3290 1 0 2 Crafting Guild Amulet Mould
drop = 1935 2936 3292 1 0 2 Crafting Guild Jug
drop = 1755 2935 3286 1 0 2 Crafting Guild Chisel
drop = 2347 2934 3286 1 0 2 Crafting Guild Hammer
drop = 5523 2935 3282 1 1 2 Crafting Guild Tiara Mould
drop = 1592 2935 3283 1 1 2 Crafting Guild Ring Mould
drop = 1735 2930 3285 1 1 2 Crafting Guild Shears
drop = 1599 2931 3287 1 1 2 Crafting Guild Holy Mould
drop = 1597 2932 3287 1 1 2 Crafting Guild Necklace Mould
drop = 231 2917 3274 1 0 1 West Crafting Guild Snape Grass
drop = 231 2907 3295 1 0 1 West Crafting Guild Snape Grass
drop = 231 2906 3297 1 0 1 West Crafting Guild Snape Grass
drop = 882 2957 3205 1 0 2 Rimmington Bronze Arrow
drop = 1511 2958 3205 1 0 2 Rimmington Logs
drop = 1511 2959 3205 1 0 1 Rimmington Logs
drop = 1265 2963 3216 1 0 2 Rimmington Bronze Pickaxe
drop = 1321 3265 3211 1 1 2 Rimmington Bronze Scimitar
drop = 1005 3009 3204 1 0 2 Port Sarim White Apron
drop = 1963 3009 3207 1 0 2 Port Sarim Banana
drop = 877 3016 3244 1 1 1 Port Sarim Bolts
drop = 877 3028 3259 1 1 1 Port Sarim Bolts
drop = 1925 3026 3289 1 0 1 South Falador Farm bucket
drop = 1944 3016 3295 1 0 1 South Falador Farm Egg
drop = 1944 3017 3295 1 0 1 South Falador Farm Egg
drop = 276 3111 3367 1 0 1 Draynor Manor Rubber Tube
drop = 273 3097 3366 1 0 1 Draynor Manor Poison
drop = 277 3092 9755 1 0 1 Draynor Manor Oil Can
drop = 272 3108 3356 1 1 1 Draynor Manor Fish Food
drop = 590 3112 3369 1 2 1 Draynor Manor Tinderbox
drop = 1139 3076 9777 1 0 1 Draynor Manor Bronze Med Helm
drop = 1925 3121 3359 1 0 1 Draynor Manor Bucket
drop = 952 3120 3359 1 0 1 Draynor Manor Spade
drop = 1139 3122 3360 1 0 1 Draynor Manor Bronze Med Helm
drop = 1735 3126 3356 1 0 1 Draynor Manor Shears
drop = 1967 3084 3363 1 0 1 Draynor Manor Cabbage
drop = 1967 3085 3363 1 0 1 Draynor Manor Cabbage
drop = 1967 3085 3364 1 0 1 Draynor Manor Cabbage
drop = 1967 3085 3365 1 0 1 Draynor Manor Cabbage
drop = 1967 3086 3363 1 0 1 Draynor Manor Cabbage
drop = 1967 3086 3364 1 0 1 Draynor Manor Cabbage
drop = 1967 3086 3365 1 0 1 Draynor Manor Cabbage
drop = 1511 3089 3365 1 0 1 Draynor Village Logs
drop = 1511 3089 3266 1 0 1 Draynor Village Logs
drop = 1982 3085 3261 1 0 1 Draynor Village Tomato
drop = 1985 3083 3260 1 0 1 Draynor Village Cheese
drop = 1061 3111 3156 1 0 1 Wizard Tower Leather Boots
drop = 1511 3106 3160 1 0 1 Wizard Tower Logs
drop = 1511 3106 3159 1 0 1 Wizard Tower Logs
drop = 1511 3105 3159 1 0 1 Wizard Tower Logs
drop = 553 3120 9567 1 0 1 Wizard Tower Skull
drop = 1061 3112 3155 1 1 1 Wizard Tower Leather Boots
[ENDOFDROPLIST]

6545
server317/item.cfg Executable file

File diff suppressed because it is too large Load Diff

2637
server317/npc.cfg Executable file

File diff suppressed because it is too large Load Diff

50
server317/npcdrops.cfg Executable file
View File

@ -0,0 +1,50 @@
//--------NPCID---------DropType--------Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount
npcdrop = 1 1 995 3 995 4 995 5 995 6 995 7 995 8 995 9 995 10 995 11 995 12 995 13 995 14 995 15
npcdrop = 1 2 1203 1 882 7 877 1 877 2 877 3
npcdrop = 1 3 1139 1 1137 1
npcdrop = 1 4 557 4 563 1 565 1 554 6 562 2 558 9
npcdrop = 1 5 199 1 1061 1 313 1 1440 1 1446 1 438 1 436 1 1965 1 2677 1
npcdrop = 3 1 995 3 995 4 995 5 995 6 995 7 995 8 995 9 995 10 995 11 995 12 995 13 995 14 995 15
npcdrop = 3 2 1203 1 882 7 877 1 877 2 877 3
npcdrop = 3 3 1139 1 1137 1
npcdrop = 3 4 557 4 563 1 565 1 554 6 562 2 558 9
npcdrop = 3 5 199 1 1061 1 313 1 1440 1 1446 1 438 1 436 1 1965 1 2677 1
npcdrop = 7 1 995 3 995 4 995 5 995 6 995 7 995 8 995 9 995 10 995 11 995 12 995 13 995 14 995 15
npcdrop = 7 2 882 7 1203 1
npcdrop = 7 3 1139 1
npcdrop = 7 4 557 4 554 6 562 2 558 9
npcdrop = 7 5 436 1 2677 1 1440 1 313 1 5345 1 199 1 5341 1 5329 1 5318 1 5318 2 5318 3 5318 4 5320 1 5320 2 5324 1 5324 2 5324 3 5322 1 5322 2 5319 2 5319 3 5323 1 5343 1 5340 1
npcdrop = 9 1 995 1 995 2 995 3 995 4 995 5 995 6 995 7 995 8 995 9 995 10 995 11 995 12 995 13 995 14 995 15 995 16 995 17 995 18 995 19 995 20 995 21 995 22 995 23 995 24 995 25 995 26 995 27 995 28 995 29 995 30
npcdrop = 9 2 1203 1 888 1 886 5 884 1 882 1 882 2
npcdrop = 9 3 1139 1
npcdrop = 9 4 562 1 556 6 557 3 554 2 561 1 565 1
npcdrop = 9 5 1146 1 1462 1 5318 4 5319 4 5324 4 5322 3 5320 3 440 1 2678 1 1947 1
npcdrop = 8 1 995 3 995 4 995 5 995 6 995 7 995 8 995 9 995 10 995 11 995 12 995 13 995 14 995 15
npcdrop = 8 2 1203 1
npcdrop = 8 3 1139 1
npcdrop = 8 4 558 9 557 4 554 6 562 2 563 2
npcdrop = 8 5 199 1 882 7 313 1 436 1 2677 1 1965 1 1440 1
npcdrop = 41 0 526 1 2138 1
npcdrop = 41 5 314 3 314 4 314 5 314 6 314 7 314 8 314 9 314 10 314 11 314 12 314 13 314 14 314 15
npcdrop = 81 0 526 1 2132 1 1739 1
npcdrop = 175 1 995 1 995 2 995 3 995 4 995 5 995 6 995 7 995 8 995 9 995 10 995 11 995 12 995 13 995 14 995 15 995 16 995 17 995 18 995 19 995 20 995 21 995 22
npcdrop = 175 3 1139 1
npcdrop = 175 4 559 8 557 5 558 1 558 2 558 3 558 4 558 5 556 9 555 6
npcdrop = 175 5 954 1 313 1 946 1 436 1 3049 1 2677 1
npcdrop = 397 0 526 1 2132 1 1739 1
npcdrop = 1267 0 -1 -1
npcdrop = 1267 1 995 4 995 5 995 6 995 7 995 8 995 9 995 10 995 11 995 12 995 13 995 14 995 15 995 16 995 17 995 18 995 19 995 20 995 21 995 22 995 23 995 24 995 25 995 26 995 27 995 28 995 29 995 30 995 31 995 32 995 33 995 34 995 35 995 36 995 37 995 38 995 39 995 40 995 41 995 42 995 43 995 44 995 45 995 46 995 47 995 48 995 49 995 50 995 51 995 52 995 53 995 54 995 55 995 56 995 57 995 58 995 59 995 60 995 61 995 62 995 63 995 64
npcdrop = 1267 2 830 5
npcdrop = 1267 3 561 4
npcdrop = 1267 5 526 1 313 10 1265 1 405 1 2677 1 403 2 401 1 1267 1 440 1 407 1 407 2 411 1 438 1 1969 1 45 1 409 1 453 2 436 3 1462 1 1454 1 1607 1 1605 1 1603 1 1601 1 985 1 987 1 2366 1
npcdrop = 1265 0 -1 -1
npcdrop = 1265 1 995 4 995 5 995 6 995 7 995 8 995 9 995 10 995 11 995 12 995 13 995 14 995 15 995 16 995 17 995 18 995 19 995 20 995 21 995 22 995 23 995 24 995 25 995 26 995 27 995 28 995 29 995 30 995 31 995 32 995 33 995 34 995 35 995 36 995 37 995 38 995 39 995 40 995 41 995 42 995 43 995 44 995 45 995 46 995 47 995 48 995 49 995 50 995 51 995 52 995 53 995 54 995 55 995 56 995 57 995 58 995 59 995 60 995 61 995 62 995 63 995 64
npcdrop = 1265 2 830 5
npcdrop = 1265 3 561 4
npcdrop = 1265 5 526 1 313 10 1265 1 405 1 2677 1 403 2 401 1 1267 1 440 1 407 1 407 2 411 1 438 1 1969 1 45 1 409 1 453 2 436 3 1462 1 1454 1 1607 1 1605 1 1603 1 1601 1 985 1 987 1 2366 1
npcdrop = 1766 0 526 1 2132 1 1739 1
npcdrop = 1767 0 526 1 2132 1 1739 1
npcdrop = 1768 0 526 1 2132 1 1739 1
[ENDOFNPCDROPLIST]

31
server317/shops.cfg Executable file
View File

@ -0,0 +1,31 @@
//-----ShopID---ShopName----------------------------------------Sell----Buy-----Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount--Item----Amount
shop = 1 Varrock_General_Store 1 1 1931 5 1935 2 1735 2 1925 3 1923 2 1887 2 590 2 1755 2 2347 5 550 5
shop = 2 Aubury's_Rune_Store 2 2 554 5000 555 5000 556 5000 557 5000 558 5000 559 5000 562 500 560 200
shop = 3 Falador_General_Store 1 1 1931 5 1935 2 1735 2 1925 3 1923 2 1887 2 590 2 1755 2 2347 5 550 5
shop = 4 Cassie's_Shield_Shop 2 2 1171 5 1173 4 1189 3 1175 2 1191 2 1177 0 1193 0 1181 0
shop = 5 Flynn's_Mace_Market 2 2 1422 5 1420 4 1424 4 1428 3 1430 1
shop = 6 Helmet_Shop. 2 2 1139 5 1137 3 1141 3 1143 2 1145 1 1155 4 1153 3 1157 3 1159 2 1161 1
shop = 7 Zaff's_Superior_Staffs! 2 2 1391 5 1379 5 1389 5 1381 2 1383 2 1385 2 1387 2
shop = 8 Thessalia_Fine_Clothes 2 2 1005 3 1129 12 1059 10 1061 10 1757 1 1013 5 1015 3 1011 2 1007 4 950 5 428 3 426 3
shop = 9 Varrock_Swordshop. 2 2 1277 5 1279 4 1281 4 1283 3 1285 3 1287 2 1291 4 1293 3 1295 3 1297 2 1299 2 1301 1 1205 10 1203 6 1207 5 1217 4 1209 3 1211 2
shop = 11 Lowe's_Archery_Emporium 2 2 882 2000 884 1500 886 1000 888 800 890 600 877 1500 841 4 839 4 843 3 845 3 849 2 847 2 853 1 851 1 837 2
shop = 12 Herquin's_Gems. 2 2 1623 0 1621 0 1619 0 1617 0 1607 0 1605 0 1603 0 1601 0
shop = 13 Wayne's_Chains!_-_Chainmail_specialist. 2 2 1103 3 1101 2 1105 1 1107 1 1109 1 1111 1
shop = 14 Rommik's_Crafty_Supplies. 2 2 1755 3 1592 2 1597 1 1595 1 1733 1 1734 1 1599 1 5523 1
shop = 15 Rimmington_General_Store 1 1 1931 5 1935 2 1735 2 1925 3 1923 2 1887 2 590 2 1755 2 2347 5 550 5
shop = 16 Brian's_Archery_Supplies. 2 2 886 1500 888 1000 890 800 843 4 845 4 849 3 847 3 853 2 851 2
shop = 17 Food_Store 2 2 1933 3 2132 1 2138 1 1965 3 1963 3 1951 1 2309 0 1973 1 1985 3 1982 3 1942 1
shop = 18 Gerrant's_Fishy_Business. 2 2 303 5 307 5 309 5 311 2 301 2 313 1500 314 1000 317 0 327 200 345 0 321 0 335 0 349 0 331 0 359 0 377 0 371 0
shop = 19 Brian's_Battleaxe_Bazaar. 2 2 1375 4 1363 3 1365 3 1367 1 1369 1 1371 1
shop = 20 Grums_Gold_Exchange. 2 2 1375 4 1363 3 1365 3 1367 1 1369 1 1371 1
shop = 21 Betty's Magic Emporium. 2 2 554 5000 555 5000 556 5000 557 5000 558 5000 559 5000 562 500 560 200 221 300 579 1 1017 1
shop = 22 Lumbridge_General_Store 1 1 1931 5 1935 2 1735 2 1925 3 1923 2 1887 2 590 2 1755 2 2347 5 550 5
shop = 23 Bob's_Brilliant_Axes. 2 2 1265 5 1351 10 1349 5 1353 3 1363 5 1365 2 1369 1
shop = 24 Zeke's_Superior_Scimitars. 2 2 1321 5 1323 3 1325 2 1329 1
shop = 25 Dommik's Crafting Store. 2 2 1755 2 1592 4 1597 2 1595 2 1733 3 1734 100 1599 3 5523 10
shop = 26 Al-Kharid_General_Store 1 1 1931 5 1935 2 1735 2 1925 3 1923 2 1887 2 590 2 1755 2 2347 5 550 5
shop = 27 Louie's_Armoured_Legs_Bazaar 2 2 1075 5 1067 3 1069 2 1077 1 1071 1 1073 1
shop = 28 Rannaerl's_Super_Skirt_Store. 2 2 1087 5 1081 3 1083 2 1089 1 1085 1 1091 1
[ENDOFSHOPLIST]

8975
server317/src/ClientHandler.java Executable file

File diff suppressed because it is too large Load Diff

172
server317/src/Cryption.java Executable file
View File

@ -0,0 +1,172 @@
public class Cryption {
public Cryption(int ai[]) {
cryptArray = new int[256];
keySetArray = new int[256];
for (int i = 0; i < ai.length; i++)
keySetArray[i] = ai[i];
initializeKeySet();
}
public int getNextKey() {
if (keyArrayIdx-- == 0) {
generateNextKeySet();
keyArrayIdx = 255;
}
return keySetArray[keyArrayIdx];
}
public void generateNextKeySet() {
cryptVar2 += ++cryptVar3;
for (int i = 0; i < 256; i++) {
int j = cryptArray[i];
if ((i & 3) == 0)
cryptVar1 ^= cryptVar1 << 13;
else if ((i & 3) == 1)
cryptVar1 ^= cryptVar1 >>> 6;
else if ((i & 3) == 2)
cryptVar1 ^= cryptVar1 << 2;
else if ((i & 3) == 3)
cryptVar1 ^= cryptVar1 >>> 16;
cryptVar1 += cryptArray[i + 128 & 0xff];
int k;
cryptArray[i] = k = cryptArray[(j & 0x3fc) >> 2] + cryptVar1 + cryptVar2;
keySetArray[i] = cryptVar2 = cryptArray[(k >> 8 & 0x3fc) >> 2] + j;
}
}
public void initializeKeySet() {
int i1;
int j1;
int k1;
int l1;
int i2;
int j2;
int k2;
int l = i1 = j1 = k1 = l1 = i2 = j2 = k2 = 0x9e3779b9;
for (int i = 0; i < 4; i++) {
l ^= i1 << 11;
k1 += l;
i1 += j1;
i1 ^= j1 >>> 2;
l1 += i1;
j1 += k1;
j1 ^= k1 << 8;
i2 += j1;
k1 += l1;
k1 ^= l1 >>> 16;
j2 += k1;
l1 += i2;
l1 ^= i2 << 10;
k2 += l1;
i2 += j2;
i2 ^= j2 >>> 4;
l += i2;
j2 += k2;
j2 ^= k2 << 8;
i1 += j2;
k2 += l;
k2 ^= l >>> 9;
j1 += k2;
l += i1;
}
for (int j = 0; j < 256; j += 8) {
l += keySetArray[j];
i1 += keySetArray[j + 1];
j1 += keySetArray[j + 2];
k1 += keySetArray[j + 3];
l1 += keySetArray[j + 4];
i2 += keySetArray[j + 5];
j2 += keySetArray[j + 6];
k2 += keySetArray[j + 7];
l ^= i1 << 11;
k1 += l;
i1 += j1;
i1 ^= j1 >>> 2;
l1 += i1;
j1 += k1;
j1 ^= k1 << 8;
i2 += j1;
k1 += l1;
k1 ^= l1 >>> 16;
j2 += k1;
l1 += i2;
l1 ^= i2 << 10;
k2 += l1;
i2 += j2;
i2 ^= j2 >>> 4;
l += i2;
j2 += k2;
j2 ^= k2 << 8;
i1 += j2;
k2 += l;
k2 ^= l >>> 9;
j1 += k2;
l += i1;
cryptArray[j] = l;
cryptArray[j + 1] = i1;
cryptArray[j + 2] = j1;
cryptArray[j + 3] = k1;
cryptArray[j + 4] = l1;
cryptArray[j + 5] = i2;
cryptArray[j + 6] = j2;
cryptArray[j + 7] = k2;
}
for (int k = 0; k < 256; k += 8) {
l += cryptArray[k];
i1 += cryptArray[k + 1];
j1 += cryptArray[k + 2];
k1 += cryptArray[k + 3];
l1 += cryptArray[k + 4];
i2 += cryptArray[k + 5];
j2 += cryptArray[k + 6];
k2 += cryptArray[k + 7];
l ^= i1 << 11;
k1 += l;
i1 += j1;
i1 ^= j1 >>> 2;
l1 += i1;
j1 += k1;
j1 ^= k1 << 8;
i2 += j1;
k1 += l1;
k1 ^= l1 >>> 16;
j2 += k1;
l1 += i2;
l1 ^= i2 << 10;
k2 += l1;
i2 += j2;
i2 ^= j2 >>> 4;
l += i2;
j2 += k2;
j2 ^= k2 << 8;
i1 += j2;
k2 += l;
k2 ^= l >>> 9;
j1 += k2;
l += i1;
cryptArray[k] = l;
cryptArray[k + 1] = i1;
cryptArray[k + 2] = j1;
cryptArray[k + 3] = k1;
cryptArray[k + 4] = l1;
cryptArray[k + 5] = i2;
cryptArray[k + 6] = j2;
cryptArray[k + 7] = k2;
}
generateNextKeySet();
keyArrayIdx = 256;
}
public int keyArrayIdx = 0;
public int keySetArray[] = null;
public int cryptArray[] = null;
public int cryptVar1 = 0;
public int cryptVar2 = 0;
public int cryptVar3 = 0;
}

View File

@ -0,0 +1,145 @@
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
public class DialogueHandler {
public static int maxDialogues = 1000;
public static int[] DialogueType = new int[maxDialogues];
public static int[] DialogueNextDia = new int[maxDialogues];
public static int[][] DialogueNextOption = new int[maxDialogues][4];
public static int[][] DialogueSword = new int[maxDialogues][3];
public static String[][] DialogueText = new String[maxDialogues][4];
public static String[] DialogueQuestion = new String[maxDialogues];
DialogueHandler() {
for (int i = 0; i < maxDialogues; i++) {
DialogueType[i] = -1;
DialogueNextDia[i] = -1;
DialogueNextOption[i][0] = 0;
DialogueNextOption[i][1] = 0;
DialogueNextOption[i][2] = 0;
DialogueNextOption[i][3] = 0;
DialogueSword[i][0] = -1;
DialogueSword[i][1] = -1;
DialogueSword[i][2] = -1;
DialogueText[i][0] = "";
DialogueText[i][1] = "";
DialogueText[i][2] = "";
DialogueText[i][3] = "";
DialogueQuestion[i] = "";
}
loadDialogues(server.workingDir + "dialogues.cfg");
}
public void NewDialogue(int ID, int Type, int NextDia, String Text1, String Text2, String Text3) {
Text1 = Text1.replaceAll("EMPTY", "");
Text1 = Text1.replaceAll("_", " ");
Text2 = Text2.replaceAll("EMPTY", "");
Text2 = Text2.replaceAll("_", " ");
Text3 = Text3.replaceAll("EMPTY", "");
Text3 = Text3.replaceAll("_", " ");
DialogueType[ID] = Type;
DialogueNextDia[ID] = NextDia;
DialogueText[ID][1] = Text1;
DialogueText[ID][2] = Text2;
DialogueText[ID][3] = Text3;
}
public void NewDialogue(int ID, int Type, int NextOption1, int NextOption2, int NextOption3, int SWClose, int SWFar, String Question, String Option1, String Option2, String Option3) {
Option1 = Option1.replaceAll("EMPTY", "");
Option1 = Option1.replaceAll("_", " ");
Option2 = Option2.replaceAll("EMPTY", "");
Option2 = Option2.replaceAll("_", " ");
Option3 = Option3.replaceAll("EMPTY", "");
Option3 = Option3.replaceAll("_", " ");
Question = Question.replaceAll("EMPTY", "");
Question = Question.replaceAll("_", " ");
misc.println("T" + ID + ":" + Type);
DialogueType[ID] = Type;
DialogueNextOption[ID][1] = NextOption1;
DialogueNextOption[ID][2] = NextOption2;
DialogueNextOption[ID][3] = NextOption3;
DialogueText[ID][1] = Option1;
DialogueText[ID][2] = Option2;
DialogueText[ID][3] = Option3;
DialogueQuestion[ID] = Question;
DialogueSword[ID][1] = SWClose;
DialogueSword[ID][2] = SWFar;
}
public boolean loadDialogues(String FileName) {
String line = "";
String token = "";
String token2 = "";
String token2_2 = "";
String[] token3 = new String[10];
boolean EndOfFile = false;
int ReadMode = 0;
BufferedReader characterfile = null;
try {
characterfile = new BufferedReader(new FileReader(FileName));
} catch (FileNotFoundException fileex) {
misc.println(FileName + ": file not found.");
return false;
}
try {
line = characterfile.readLine();
} catch (IOException ioexception) {
misc.println(FileName + ": error loading file.");
return false;
}
while (EndOfFile == false && line != null) {
line = line.trim();
int spot = line.indexOf("=");
if (spot > -1) {
token = line.substring(0, spot);
token = token.trim();
token2 = line.substring(spot + 1);
token2 = token2.trim();
token2_2 = token2.replaceAll("\t\t", "\t");
token2_2 = token2_2.replaceAll("\t\t", "\t");
token2_2 = token2_2.replaceAll("\t\t", "\t");
token2_2 = token2_2.replaceAll("\t\t", "\t");
token2_2 = token2_2.replaceAll("\t\t", "\t");
token2_2 = token2_2.replaceAll("\t\t", "\t");
token2_2 = token2_2.replaceAll("\t\t", "\t");
token2_2 = token2_2.replaceAll("\t\t", "\t");
token2_2 = token2_2.replaceAll("\t\t", "\t");
token2_2 = token2_2.replaceAll("\t\t", "\t");
token3 = token2_2.split("\t");
if (token.equals("dialogue")) {
if (Integer.parseInt(token3[1]) == 1 || Integer.parseInt(token3[1]) == 3) {
NewDialogue(Integer.parseInt(token3[0]), Integer.parseInt(token3[1]), Integer.parseInt(token3[2]), token3[3], token3[4], token3[5]);
} else if (Integer.parseInt(token3[1]) == 2) {
NewDialogue(Integer.parseInt(token3[0]), Integer.parseInt(token3[1]), Integer.parseInt(token3[2]), Integer.parseInt(token3[3]), Integer.parseInt(token3[4]), Integer.parseInt(token3[5]), Integer.parseInt(token3[6]), token3[7], token3[8], token3[9], token3[10]);
}
}
} else {
if (line.equals("[ENDOFDIALOGUELIST]")) {
try {
characterfile.close();
} catch (IOException ioexception) {
}
return true;
}
}
try {
line = characterfile.readLine();
} catch (IOException ioexception1) {
EndOfFile = true;
}
}
try {
characterfile.close();
} catch (IOException ioexception) {
}
return false;
}
public void println(String str) {
System.out.println(str);
}
}

225
server317/src/ItemHandler.java Executable file
View File

@ -0,0 +1,225 @@
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
public class ItemHandler {
public static int DropItemCount = 0;
public static int MaxDropItems = 100000;
public static int MaxListedItems = 10000;
//process() is called evry 500 ms
public static int MaxDropShowDelay = 120; //120 * 500 = 60000 / 1000 = 60s
public static int SDID = 90; //90 * 500 = 45000 / 1000 = 45s
//SDID = Standard Drop Items Delay
public static int[] DroppedItemsID = new int[MaxDropItems];
public static int[] DroppedItemsX = new int[MaxDropItems];
public static int[] DroppedItemsY = new int[MaxDropItems];
public static int[] DroppedItemsN = new int[MaxDropItems];
public static int[] DroppedItemsH = new int[MaxDropItems];
public static int[] DroppedItemsDDelay = new int[MaxDropItems];
public static int[] DroppedItemsSDelay = new int[MaxDropItems];
public static int[] DroppedItemsDropper = new int[MaxDropItems];
public static int[] DroppedItemsDeletecount = new int[MaxDropItems];
public static boolean[] DroppedItemsAlwaysDrop = new boolean[MaxDropItems];
public ItemList ItemList[] = new ItemList[MaxListedItems];
ItemHandler() {
for (int i = 0; i < MaxDropItems; i++) {
ResetItem(i);
}
for (int i = 0; i < MaxListedItems; i++) {
ItemList[i] = null;
}
loadItemList(server.workingDir + "item.cfg");
loadDrops(server.workingDir + "drops.cfg");
}
public void process() {
for (int i = 0; i < MaxDropItems; i++) {
if (DroppedItemsID[i] > -1) {
if (DroppedItemsDDelay[i] > -10) {
DroppedItemsDDelay[i]--;
}
if (DroppedItemsSDelay[i] < (MaxDropShowDelay + 10)) {
DroppedItemsSDelay[i]++;
}
if (DroppedItemsSDelay[i] >= MaxDropShowDelay && DroppedItemsAlwaysDrop[i] == false) {
for (int j = 1; j < server.playerHandler.maxPlayers; j++) {
if (server.playerHandler.players[j] != null) {
server.playerHandler.players[j].MustDelete[i] = true;
}
}
}
}
}
}
public void ResetItem(int ArrayID) {
DroppedItemsID[ArrayID] = -1;
DroppedItemsX[ArrayID] = -1;
DroppedItemsY[ArrayID] = -1;
DroppedItemsN[ArrayID] = -1;
DroppedItemsH[ArrayID] = -1;
DroppedItemsDDelay[ArrayID] = -1;
DroppedItemsSDelay[ArrayID] = 0;
DroppedItemsDropper[ArrayID] = -1;
DroppedItemsDeletecount[ArrayID] = 0;
DroppedItemsAlwaysDrop[ArrayID] = false;
}
public boolean loadDrops(String FileName) {
String line = "";
String token = "";
String token2 = "";
String token2_2 = "";
String[] token3 = new String[10];
boolean EndOfFile = false;
int ReadMode = 0;
BufferedReader characterfile = null;
try {
characterfile = new BufferedReader(new FileReader(FileName));
} catch (FileNotFoundException fileex) {
misc.printlnTag(FileName + ": file not found.");
return false;
}
try {
line = characterfile.readLine();
} catch (IOException ioexception) {
misc.printlnTag(FileName + ": error loading file.");
return false;
}
while (EndOfFile == false && line != null) {
line = line.trim();
int spot = line.indexOf("=");
if (spot > -1) {
token = line.substring(0, spot);
token = token.trim();
token2 = line.substring(spot + 1);
token2 = token2.trim();
token2_2 = token2.replaceAll("\t\t", "\t");
token2_2 = token2_2.replaceAll("\t\t", "\t");
token2_2 = token2_2.replaceAll("\t\t", "\t");
token2_2 = token2_2.replaceAll("\t\t", "\t");
token2_2 = token2_2.replaceAll("\t\t", "\t");
token3 = token2_2.split("\t");
if (token.equals("drop")) {
DroppedItemsID[DropItemCount] = Integer.parseInt(token3[0]);
DroppedItemsX[DropItemCount] = Integer.parseInt(token3[1]);
DroppedItemsY[DropItemCount] = Integer.parseInt(token3[2]);
DroppedItemsN[DropItemCount] = Integer.parseInt(token3[3]);
DroppedItemsH[DropItemCount] = Integer.parseInt(token3[4]);
DroppedItemsAlwaysDrop[DropItemCount] = true;
DropItemCount++;
}
} else {
if (line.equals("[ENDOFDROPLIST]")) {
try {
characterfile.close();
} catch (IOException ioexception) {
}
return true;
}
}
try {
line = characterfile.readLine();
} catch (IOException ioexception1) {
EndOfFile = true;
}
}
try {
characterfile.close();
} catch (IOException ioexception) {
}
return false;
}
public void newItemList(int ItemId, String ItemName, String ItemDescription, double ShopValue, double LowAlch, double HighAlch, int Bonuses[]) {
// first, search for a free slot
int slot = -1;
for (int i = 0; i < MaxListedItems; i++) {
if (ItemList[i] == null) {
slot = i;
break;
}
}
if (slot == -1) return; // no free slot found
ItemList newItemList = new ItemList(ItemId);
newItemList.itemName = ItemName;
newItemList.itemDescription = ItemDescription;
newItemList.ShopValue = ShopValue;
newItemList.LowAlch = LowAlch;
newItemList.HighAlch = HighAlch;
newItemList.Bonuses = Bonuses;
ItemList[slot] = newItemList;
}
public boolean loadItemList(String FileName) {
String line = "";
String token = "";
String token2 = "";
String token2_2 = "";
String[] token3 = new String[10];
boolean EndOfFile = false;
int ReadMode = 0;
BufferedReader characterfile = null;
try {
characterfile = new BufferedReader(new FileReader(FileName));
} catch (FileNotFoundException fileex) {
misc.printlnTag(FileName + ": file not found.");
return false;
}
try {
line = characterfile.readLine();
} catch (IOException ioexception) {
misc.printlnTag(FileName + ": error loading file.");
return false;
}
while (EndOfFile == false && line != null) {
line = line.trim();
int spot = line.indexOf("=");
if (spot > -1) {
token = line.substring(0, spot);
token = token.trim();
token2 = line.substring(spot + 1);
token2 = token2.trim();
token2_2 = token2.replaceAll("\t\t", "\t");
token2_2 = token2_2.replaceAll("\t\t", "\t");
token2_2 = token2_2.replaceAll("\t\t", "\t");
token2_2 = token2_2.replaceAll("\t\t", "\t");
token2_2 = token2_2.replaceAll("\t\t", "\t");
token3 = token2_2.split("\t");
if (token.equals("item")) {
int[] Bonuses = new int[12];
for (int i = 0; i < 12; i++) {
if (token3[(6 + i)] != null) {
Bonuses[i] = Integer.parseInt(token3[(6 + i)]);
} else {
break;
}
}
newItemList(Integer.parseInt(token3[0]), token3[1].replaceAll("_", " "), token3[2].replaceAll("_", " "), Double.parseDouble(token3[4]), Double.parseDouble(token3[4]), Double.parseDouble(token3[6]), Bonuses);
}
} else {
if (line.equals("[ENDOFITEMLIST]")) {
try {
characterfile.close();
} catch (IOException ioexception) {
}
return true;
}
}
try {
line = characterfile.readLine();
} catch (IOException ioexception1) {
EndOfFile = true;
}
}
try {
characterfile.close();
} catch (IOException ioexception) {
}
return false;
}
}

13
server317/src/ItemList.java Executable file
View File

@ -0,0 +1,13 @@
public class ItemList {
public int itemId;
public String itemName;
public String itemDescription;
public double ShopValue;
public double LowAlch;
public double HighAlch;
public int[] Bonuses = new int[100];
public ItemList(int _itemId) {
itemId = _itemId;
}
}

229
server317/src/Items.java Executable file
View File

@ -0,0 +1,229 @@
// a collection of item methods
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
public class Items {
//Few item types for equipping
public static int capes[] = {6111, 6570, 6568, 1007, 1019, 1021, 1023, 1027, 1029, 1031, 1052, 2412, 2413, 2414, 4304, 4315, 4317, 4319, 4321, 4323, 4325, 4327, 4329, 4331, 4333, 4335, 4337, 4339, 4341, 4343, 4345, 4347, 4349, 4351, 4353, 4355, 4357, 4359, 4361, 4363, 4365, 4367, 4369, 4371, 4373, 4375, 4377, 4379, 4381, 4383, 4385, 4387, 4389, 4391, 4393, 4395, 4397, 4399, 4401, 4403, 4405, 4407, 4409, 4411, 4413, 4514, 4516, 6070, 6568, 6570};
public static int boots[] = {6061, 6106, 88, 89, 626, 628, 630, 632, 634, 1061, 1837, 1846, 2577, 2579, 2894, 2904, 2914, 2924, 2934, 3061, 3105, 3107, 3791, 4097, 4107, 4117, 4119, 4121, 4123, 4125, 4127, 4129, 4131, 4310, 5064, 5345, 5557, 6069, 6106, 6143, 6145, 6147, 6328};
public static int gloves[] = {2491, 1065, 2487, 2489, 3060, 1495, 775, 777, 778, 6708, 1059, 1063, 1065, 1580, 2487, 2489, 2491, 2902, 2912, 2922, 2932, 2942, 3060, 3799, 4095, 4105, 4115, 4308, 5556, 6068, 6110, 6149, 6151, 6153};
public static int shields[] = {1171, 1173, 1175, 1177, 1179, 1181, 1183, 1185, 1187, 1189, 1191, 1193, 1195, 1197, 1199, 1201, 1540, 2589, 2597, 2603, 2611, 2621, 2629, 2659, 2667, 2675, 2890, 3122, 3488, 3758, 3839, 3840, 3841, 3842, 3843, 3844, 4072, 4156, 4224, 4225, 4226, 4227, 4228, 4229, 4230, 4231, 4232, 4233, 4234, 4302, 4507, 4512, 6215, 6217, 6219, 6221, 6223, 6225, 6227, 6229, 6231, 6233, 6235, 6237, 6239, 6241, 6243, 6245, 6247, 6249, 6251, 6253, 6255, 6257, 6259, 6261, 6263, 6265, 6267, 6269, 6271, 6273, 6275, 6277, 6279, 6524};
public static int hats[] = {4732, 4753, 4611, 6188, 6182, 4511, 4056, 4071, 4724, 2639, 2641, 2643, 2665, 6109, 5525, 5527, 5529, 5531, 5533, 5535, 5537, 5539, 5541, 5543, 5545, 5547, 5549, 5551, 74, 579, 656, 658, 660, 662, 664, 740, 1017, 1037, 1038, 1040, 1042, 1044, 1046, 1048, 1050, 1053, 1055, 1057, 1137, 1139, 1141, 1143, 1145, 1147, 1149, 1151, 1153, 1155, 1157, 1159, 1161, 1163, 1165, 1506, 1949, 2422, 2581, 2587, 2595, 2605, 2613, 2619, 2627, 2631, 2633, 2635, 2637, 2651, 2657, 2673, 2900, 2910, 2920, 2930, 2940, 2978, 2979, 2980, 2981, 2982, 2983, 2984, 2985, 2986, 2987, 2988, 2989, 2990, 2991, 2992, 2993, 2994, 2995, 3057, 3385, 3486, 3748, 3749, 3751, 3753, 3755, 3797, 4041, 4042, 4071, 4089, 4099, 4109, 4164, 4302, 4506, 4511, 4513, 4515, 4551, 4567, 4708, 4716, 4724, 4745, 4753, 4856, 4857, 4858, 4859, 4880, 4881, 4882, 4883, 4904, 4905, 4906, 4907, 4952, 4953, 4954, 4955, 4976, 4977, 4978, 4979, 5013, 5014, 5554, 5574, 6109, 6128, 6131, 6137, 6182, 6188, 6335, 6337, 6339, 6345, 6355, 6365, 6375, 6382, 6392, 6400};
public static int amulets[] = {6585, 86, 87, 295, 421, 552, 589, 1478, 1692, 1694, 1696, 1698, 1700, 1702, 1704, 1706, 1708, 1710, 1712, 1725, 1727, 1729, 1731, 4021, 4081, 4250, 4677, 6040, 6041, 6208};
public static int arrows[] = {78, 598, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 890, 891, 892, 893, 942, 2532, 2533, 2534, 2535, 2536, 2537, 2538, 2539, 2540, 2541, 2866, 4160, 4172, 4173, 4174, 4175, 4740, 5616, 5617, 5618, 5619, 5620, 5621, 5622, 5623, 5624, 5625, 5626, 5627, 6061, 6062};
public static int rings[] = {773, 1635, 1637, 1639, 1641, 1643, 1645, 2550, 2552, 2554, 2556, 2558, 2560, 2562, 2564, 2566, 2568, 2570, 2572, 4202, 4657, 6465};
public static int body[] = {1035, 540, 5553, 4757, 1833, 6388, 6384, 2501, 2499, 1355, 4111, 4101, 4091, 6186, 6184, 6180, 3058, 4509, 4504, 4069, 4728, 4736, 4712, 6107, 2661, 3140, 1101, 1103, 1105, 1107, 1109, 1111, 1113, 1115, 1117, 1119, 1121, 1123, 1125, 1127, 1129, 1131, 1133, 1135, 2499, 2501, 2503, 2583, 2591, 2599, 2607, 2615, 2623, 2653, 2669, 3387, 3481, 4712, 4720, 4728, 4749, 4892, 4893, 4894, 4895, 4916, 4917, 4918, 4919, 4964, 4965, 4966, 4967, 6107, 6133, 6322};
public static int legs[] = {426, 1835, 538, 1033, 5555, 4759, 6386, 6390, 2503, 2497, 2495, 2493, 1099, 4113, 4103, 4093, 6187, 6185, 6181, 3059, 4510, 4505, 4070, 6108, 538, 542, 548, 1011, 1013, 1015, 1067, 1069, 1071, 1073, 1075, 1077, 1079, 1081, 1083, 1085, 1087, 1089, 1091, 1093, 2585, 2593, 2601, 2609, 2617, 2625, 2655, 2663, 2671, 3059, 3389, 3472, 3473, 3474, 3475, 3476, 3477, 3478, 3479, 3480, 3483, 3485, 3795, 4087, 4585, 4712, 4714, 4722, 4730, 4738, 4751, 4759, 4874, 4875, 4876, 4877, 4898, 4899, 4900, 4901, 4922, 4923, 4924, 4925, 4946, 4947, 4948, 4949, 4970, 4971, 4972, 4973, 4994, 4995, 4996, 4997, 5048, 5050, 5052, 5576, 6107, 6130, 6187, 6390, 6386, 6390, 6396, 6404};
public static int platebody[] = {1035, 540, 5553, 4757, 1833, 1835, 6388, 6384, 2503, 2501, 2499, 1355, 4111, 4101, 4091, 6186, 6184, 6180, 3058, 4509, 4504, 4069, 4728, 4736, 4712, 6107, 2661, 3140, 1115, 1117, 1119, 1121, 1123, 1125, 1127, 2583, 2591, 2599, 2607, 2615, 2623, 2653, 2669, 3481, 4720, 4728, 4749, 2661};
public static int fullHelm[] = {4732, 4753, 6188, 4511, 4056, 4071, 4724, 6109, 2665, 1153, 1155, 1157, 1159, 1161, 1163, 1165, 2587, 2595, 2605, 2613, 2619, 2627, 2657, 2673, 3486, 6402, 6394};
public static int fullMask[] = {4732, 5554, 4753, 4611, 6188, 3507, 4511, 4056, 4071, 4724, 2665, 6109, 1053, 1055, 1057};
//All other IDs are weapons (I hope)
public static int crackers[] = {1038, 1040, 1042, 1044, 1046, 1048};
public static int normal_gems[] = {1623, 1621, 1619, 1617};
public static int shilo_gems[] = {1623, 1621, 1619, 1617, 1625, 1627, 1629};
/*Any Sea - ID 1*/
public static int fishing_net[] = {317, 321};
public static int fishing_net_lvl[] = {1, 15};
public static int fishing_net_xp[] = {10, 40};
/*Any Sea - ID 2*/
public static int fishing_rod1[] = {327, 345};
public static int fishing_rod1_lvl[] = {5, 10};
public static int fishing_rod1_xp[] = {10, 30};
/*Lumby Swamp - ID 3*/
public static int fishing_rod2[] = {3379, 5001};
public static int fishing_rod2_lvl[] = {28, 36};
public static int fishing_rod2_xp[] = {65, 80};
/*Any River - ID 4*/
public static int fishing_fly[] = {335, 349, 331};
public static int fishing_fly_lvl[] = {20, 25, 30};
public static int fishing_fly_xp[] = {50, 60, 70};
/*Catherby, relekka and fishing guild - ID 5*/
public static int fishing_big_net[] = {353, 407, 405, 401, 341, 363};
public static int fishing_big_net_lvl[] = {16, 16, 16, 16, 23, 46};
public static int fishing_big_net_xp[] = {20, 10, 10, 1, 45, 100};
/*karamja, fishing guild, caatherby and rellekka - ID 6*/
public static int fishing_harpoon[] = {359, 371};
public static int fishing_harpoon_lvl[] = {35, 50};
public static int fishing_harpoon_xp[] = {80, 100};
public static int smithing_frame[][][] = {
{{1205, 1, 1, 1, 1125, 1094}, {1351, 1, 1, 1, 1126, 1091}, {1422, 1, 2, 1, 1129, 1093}, {1139, 1, 3, 1, 1127, 1102}, {1277, 1, 3, 1, 1128, 1085}, {819, 10, 4, 1, 1124, 1107}, {4819, 15, 4, 1, 13357, 13358}, {39, 15, 5, 1, 1130, 1108}, {1321, 1, 5, 2, 1116, 1087}, {1291, 1, 6, 2, 1089, 1086}, {1155, 1, 7, 2, 1113, 1103}, {864, 5, 7, 1, 1131, 1106}, {1173, 1, 8, 2, 1114, 1104}, {1337, 1, 9, 3, 1118, 1083}, {1375, 1, 10, 3, 1095, 1092}, {1103, 1, 11, 3, 1109, 1098}, {1189, 1, 12, 3, 1115, 1105}, {3095, 1, 13, 2, 8428, 8429}, {1307, 1, 14, 3, 1090, 1088}, {1087, 1, 16, 3, 1111, 1100}, {1075, 1, 16, 3, 1110, 1099}, {1117, 1, 18, 5, 1112, 1101},/*Specials*/{1794, 1, 4, 1, 1132, 1096}},
{{1203, 1, 15, 1, 1125, 1094}, {1349, 1, 16, 1, 1126, 1091}, {1420, 1, 17, 1, 1129, 1093}, {1137, 1, 18, 1, 1127, 1102}, {1279, 1, 19, 1, 1128, 1085}, {820, 10, 19, 1, 1124, 1107}, {4820, 15, 19, 1, 13357, 13358}, {40, 15, 20, 1, 1130, 1108}, {1323, 1, 20, 2, 1116, 1087}, {1293, 1, 21, 2, 1089, 1086}, {1153, 1, 22, 2, 1113, 1103}, {863, 5, 22, 1, 1131, 1106}, {1175, 1, 23, 2, 1114, 1104}, {1335, 1, 24, 3, 1118, 1083}, {1363, 1, 25, 3, 1095, 1092}, {1101, 1, 26, 3, 1109, 1098}, {1191, 1, 27, 3, 1115, 1105}, {3096, 1, 28, 2, 8428, 8429}, {1309, 1, 29, 3, 1090, 1088}, {1081, 1, 31, 3, 1111, 1100}, {1067, 1, 31, 3, 1110, 1099}, {1115, 1, 33, 5, 1112, 1101},/*Specials*/{4540, 1, 26, 1, 11459, 11461}},
{{1207, 1, 30, 1, 1125, 1094}, {1353, 1, 31, 1, 1126, 1091}, {1424, 1, 32, 1, 1129, 1093}, {1141, 1, 33, 1, 1127, 1102}, {1281, 1, 34, 1, 1128, 1085}, {821, 10, 34, 1, 1124, 1107}, {1539, 15, 34, 1, 13357, 13358}, {41, 15, 35, 1, 1130, 1108}, {1325, 1, 35, 2, 1116, 1087}, {1295, 1, 36, 2, 1089, 1086}, {1157, 1, 37, 2, 1113, 1103}, {865, 5, 37, 1, 1131, 1106}, {1177, 1, 38, 2, 1114, 1104}, {1339, 1, 39, 3, 1118, 1083}, {1365, 1, 40, 3, 1095, 1092}, {1105, 1, 41, 3, 1109, 1098}, {1193, 1, 42, 3, 1115, 1105}, {3097, 1, 43, 2, 8428, 8429}, {1311, 1, 44, 3, 1090, 1088}, {1083, 1, 46, 3, 1111, 1100}, {1069, 1, 46, 3, 1110, 1099}, {1119, 1, 48, 5, 1112, 1101},/*Specials*/{4544, 1, 49, 1, 11459, 11461}, {2370, 1, 36, 1, 1135, 1134}},
{{1209, 1, 50, 1, 1125, 1094}, {1355, 1, 51, 1, 1126, 1091}, {1428, 1, 52, 1, 1129, 1093}, {1143, 1, 53, 1, 1127, 1102}, {1285, 1, 53, 1, 1128, 1085}, {822, 10, 54, 1, 1124, 1107}, {4822, 15, 54, 1, 13357, 13358}, {42, 15, 55, 1, 1130, 1108}, {1329, 1, 55, 2, 1116, 1087}, {1299, 1, 56, 2, 1089, 1086}, {1159, 1, 57, 2, 1113, 1103}, {866, 5, 57, 1, 1131, 1106}, {1181, 1, 58, 2, 1114, 1104}, {1343, 1, 59, 3, 1118, 1083}, {1369, 1, 60, 3, 1095, 1092}, {1109, 1, 61, 3, 1109, 1098}, {1197, 1, 62, 3, 1115, 1105}, {3099, 1, 63, 2, 8428, 8429}, {1315, 1, 64, 3, 1090, 1088}, {1085, 1, 66, 3, 1111, 1100}, {1071, 1, 66, 3, 1110, 1099}, {1121, 1, 68, 5, 1112, 1101}},
{{1211, 1, 70, 1, 1125, 1094}, {1357, 1, 71, 1, 1126, 1091}, {1430, 1, 72, 1, 1129, 1093}, {1145, 1, 73, 1, 1127, 1102}, {1287, 1, 74, 1, 1128, 1085}, {823, 10, 74, 1, 1124, 1107}, {4823, 15, 74, 1, 13357, 13358}, {43, 15, 75, 1, 1130, 1108}, {1331, 1, 75, 2, 1116, 1087}, {1301, 1, 76, 2, 1089, 1086}, {1161, 1, 77, 2, 1113, 1103}, {867, 5, 77, 1, 1131, 1106}, {1183, 1, 78, 2, 1114, 1104}, {1345, 1, 79, 3, 1118, 1083}, {1371, 1, 80, 3, 1095, 1092}, {1111, 1, 81, 3, 1109, 1098}, {1199, 1, 82, 3, 1115, 1105}, {3100, 1, 83, 2, 8428, 8429}, {1317, 1, 84, 3, 1090, 1088}, {1091, 1, 86, 3, 1111, 1100}, {1073, 1, 86, 3, 1110, 1099}, {1123, 1, 88, 5, 1112, 1101}},
{{1213, 1, 85, 1, 1125, 1094}, {1359, 1, 86, 1, 1126, 1091}, {1432, 1, 87, 1, 1129, 1093}, {1147, 1, 88, 1, 1127, 1102}, {1289, 1, 89, 1, 1128, 1085}, {824, 10, 89, 1, 1124, 1107}, {4824, 15, 89, 1, 13357, 13358}, {44, 15, 90, 1, 1130, 1108}, {1333, 1, 90, 2, 1116, 1087}, {1303, 1, 91, 2, 1089, 1086}, {1163, 1, 92, 2, 1113, 1103}, {868, 5, 92, 1, 1131, 1106}, {1185, 1, 93, 2, 1114, 1104}, {1347, 1, 94, 3, 1118, 1083}, {1373, 1, 95, 3, 1095, 1092}, {1113, 1, 96, 3, 1109, 1098}, {1201, 1, 97, 3, 1115, 1105}, {3101, 1, 98, 2, 8428, 8429}, {1319, 1, 99, 3, 1090, 1088}, {1093, 1, 99, 3, 1111, 1100}, {1079, 1, 99, 3, 1110, 1099}, {1127, 1, 99, 5, 1112, 1101}}
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
// dagger axe mace medium sword dart tips nails arrow heads scimitar long sword full helmet knives square warhammer battle axe chain kite claws 2-handed skirt legs body lantern/wire studs
};
public static int SmithingItems[][] = new int[5][5];
public static boolean[] itemStackable = new boolean[7000];
public static boolean[] itemIsNote = new boolean[7000];
public static boolean[] itemTwoHanded = new boolean[7000];
public static boolean[] itemTradeable = new boolean[7000];
public static boolean[] itemSellable = new boolean[7000];
static {
int counter = 0;
int c;
try {
FileInputStream dataIn = new FileInputStream(new File(server.workingDir + "data/stackable.dat"));
while ((c = dataIn.read()) != -1) {
if (c == 0)
itemStackable[counter] = false;
else
itemStackable[counter] = true;
counter++;
}
dataIn.close();
} catch (IOException e) {
System.out.println("Critical error while loading stackabledata! Trace:");
e.printStackTrace();
}
counter = 0;
try {
FileInputStream dataIn = new FileInputStream(new File(server.workingDir + "data/notes.dat"));
while ((c = dataIn.read()) != -1) {
if (c == 0)
itemIsNote[counter] = true;
else
itemIsNote[counter] = false;
counter++;
}
dataIn.close();
} catch (IOException e) {
System.out.println("Critical error while loading notedata! Trace:");
e.printStackTrace();
}
counter = 0;
try {
FileInputStream dataIn = new FileInputStream(new File(server.workingDir + "data/twohanded.dat"));
while ((c = dataIn.read()) != -1) {
if (c == 0)
itemTwoHanded[counter] = false;
else
itemTwoHanded[counter] = true;
counter++;
}
dataIn.close();
} catch (IOException e) {
System.out.println("Critical error while loading twohanded! Trace:");
e.printStackTrace();
}
counter = 0;
try {
FileInputStream dataIn = new FileInputStream(new File(server.workingDir + "data/tradeable.dat"));
while ((c = dataIn.read()) != -1) {
if (c == 0)
itemTradeable[counter] = false;
else
itemTradeable[counter] = true;
counter++;
}
dataIn.close();
} catch (IOException e) {
System.out.println("Critical error while loading tradeable! Trace:");
e.printStackTrace();
}
counter = 0;
try {
FileInputStream dataIn = new FileInputStream(new File(server.workingDir + "data/sellable.dat"));
while ((c = dataIn.read()) != -1) {
if (c == 0)
itemSellable[counter] = true;
else
itemSellable[counter] = false;
counter++;
}
dataIn.close();
} catch (IOException e) {
System.out.println("Critical error while loading sellable! Trace:");
e.printStackTrace();
}
}
public static int randomCape() {
return capes[(int) (Math.random() * capes.length)];
}
public static int randomBoots() {
return boots[(int) (Math.random() * boots.length)];
}
public static int randomGloves() {
return gloves[(int) (Math.random() * gloves.length)];
}
public static int randomShield() {
return shields[(int) (Math.random() * shields.length)];
}
public static int randomHat() {
return hats[(int) (Math.random() * hats.length)];
}
public static int randomAmulet() {
return amulets[(int) (Math.random() * amulets.length)];
}
public static int randomArrows() {
return arrows[(int) (Math.random() * arrows.length)];
}
public static int randomRing() {
return rings[(int) (Math.random() * rings.length)];
}
public static int randomBody() {
return body[(int) (Math.random() * body.length)];
}
public static int randomLegs() {
return legs[(int) (Math.random() * legs.length)];
}
public static int randomPHat() {
return crackers[(int) (Math.random() * crackers.length)];
}
public static int randomNGems() {
return normal_gems[(int) (Math.random() * normal_gems.length)];
}
public static int randomSGems() {
return shilo_gems[(int) (Math.random() * shilo_gems.length)];
}
public static boolean isPlate(int itemID) {
for (int i = 0; i < platebody.length; i++)
if (platebody[i] == itemID)
return true;
return false;
}
public static boolean isFullHelm(int itemID) {
for (int i = 0; i < fullHelm.length; i++)
if (fullHelm[i] == itemID)
return true;
return false;
}
public static boolean isFullMask(int itemID) {
for (int i = 0; i < fullMask.length; i++)
if (fullMask[i] == itemID)
return true;
return false;
}
}

14
server317/src/NPCDrops.java Executable file
View File

@ -0,0 +1,14 @@
public class NPCDrops {
public int npcId;
public int DropType;
public int[] Items = new int[100];
public int[] ItemsN = new int[100];
public NPCDrops(int _npcId) {
npcId = _npcId;
for (int i = 0; i < Items.length; i++) {
Items[i] = -1;
ItemsN[i] = 0;
}
}
}

829
server317/src/NPCHandler.java Executable file
View File

@ -0,0 +1,829 @@
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
public class NPCHandler {
public static int maxNPCs = 10000;
public static int maxListedNPCs = 10000;
public static int maxNPCDrops = 10000;
public NPCs npcs[] = new NPCs[maxNPCs];
public NPCList NpcList[] = new NPCList[maxListedNPCs];
public NPCDrops NpcDrops[] = new NPCDrops[maxNPCDrops];
NPCHandler() {
for (int i = 0; i < maxNPCs; i++) {
npcs[i] = null;
}
for (int i = 0; i < maxListedNPCs; i++) {
NpcList[i] = null;
}
for (int i = 0; i < maxNPCDrops; i++) {
NpcDrops[i] = null;
}
loadNPCList(server.workingDir + "npc.cfg");
loadNPCDrops(server.workingDir + "npcdrops.cfg");
loadAutoSpawn(server.workingDir + "autospawn.cfg");
}
public void newNPC(int npcType, int x, int y, int heightLevel, int rangex1, int rangey1, int rangex2, int rangey2, int WalkingType, int HP) {
// first, search for a free slot
int slot = -1;
for (int i = 1; i < maxNPCs; i++) {
if (npcs[i] == null) {
slot = i;
break;
}
}
if (slot == -1) return; // no free slot found
NPCs newNPC = new NPCs(slot, npcType);
newNPC.absX = x;
newNPC.absY = y;
newNPC.makeX = x;
newNPC.makeY = y;
newNPC.moverangeX1 = rangex1;
newNPC.moverangeY1 = rangey1;
newNPC.moverangeX2 = rangex2;
newNPC.moverangeY2 = rangey2;
newNPC.walkingType = WalkingType;
newNPC.HP = HP;
newNPC.MaxHP = HP;
newNPC.MaxHit = (int) Math.floor((HP / 10));
if (newNPC.MaxHit < 1) {
newNPC.MaxHit = 1;
}
newNPC.heightLevel = heightLevel;
npcs[slot] = newNPC;
}
public void newNPCList(int npcType, String npcName, int combat, int HP) {
// first, search for a free slot
int slot = -1;
for (int i = 0; i < maxListedNPCs; i++) {
if (NpcList[i] == null) {
slot = i;
break;
}
}
if (slot == -1) return; // no free slot found
NPCList newNPCList = new NPCList(npcType);
newNPCList.npcName = npcName;
newNPCList.npcCombat = combat;
newNPCList.npcHealth = HP;
NpcList[slot] = newNPCList;
}
public void newNPCDrop(int npcType, int dropType, int Items[], int ItemsN[]) {
// first, search for a free slot
int slot = -1;
for (int i = 0; i < maxNPCDrops; i++) {
if (NpcDrops[i] == null) {
slot = i;
break;
}
}
if (slot == -1) return; // no free slot found
NPCDrops newNPCDrop = new NPCDrops(npcType);
newNPCDrop.DropType = dropType;
newNPCDrop.Items = Items;
newNPCDrop.ItemsN = ItemsN;
NpcDrops[slot] = newNPCDrop;
}
public boolean IsInWorldMap(int coordX, int coordY) {
for (int i = 0; i < worldmap[0].length; i++) {
if (worldmap[0][i] == coordX && worldmap[1][i] == coordY) {
return true;
}
}
return false;
}
public boolean IsInWorldMap2(int coordX, int coordY) {
for (int i = 0; i < worldmap2[0].length; i++) {
if (worldmap2[0][i] == coordX && worldmap2[1][i] == coordY) {
return true;
}
}
return false;
}
public boolean IsInRange(int NPCID, int MoveX, int MoveY) {
int NewMoveX = (npcs[NPCID].absX + MoveX);
int NewMoveY = (npcs[NPCID].absY + MoveY);
if (NewMoveX <= npcs[NPCID].moverangeX1 && NewMoveX >= npcs[NPCID].moverangeX2 && NewMoveY <= npcs[NPCID].moverangeY1 && NewMoveY >= npcs[NPCID].moverangeY2)
{
if ((npcs[NPCID].walkingType == 1 && IsInWorldMap(NewMoveX, NewMoveY) == true) || (npcs[NPCID].walkingType == 2 && IsInWorldMap2(NewMoveX, NewMoveY) == false))
{
if (MoveX == MoveY) {
if ((IsInWorldMap(NewMoveX, npcs[NPCID].absY) == true && IsInWorldMap(npcs[NPCID].absX, NewMoveY) == true) || (IsInWorldMap2(NewMoveX, npcs[NPCID].absY) == false && IsInWorldMap2(npcs[NPCID].absX, NewMoveY) == false))
{
return true;
}
return false;
}
return true;
}
}
return false;
}
public void process() {
for (int i = 0; i < maxNPCs; i++) {
if (npcs[i] == null) continue;
npcs[i].clearUpdateFlags();
}
for (int i = 0; i < maxNPCs; i++) {
if (npcs[i] != null) {
if (npcs[i].actionTimer > 0) {
npcs[i].actionTimer--;
}
if (npcs[i].IsDead == false) {
if (npcs[i].npcType == 1268 || npcs[i].npcType == 1266) {
for (int j = 1; j < server.playerHandler.maxPlayers; j++) {
if (server.playerHandler.players[j] != null) {
if (GoodDistance(npcs[i].absX, npcs[i].absY, server.playerHandler.players[j].absX, server.playerHandler.players[j].absY, 2) == true && npcs[i].IsClose == false)
{
npcs[i].actionTimer = 10;
npcs[i].IsClose = true;
}
}
}
if (npcs[i].actionTimer == 0 && npcs[i].IsClose == true) {
for (int j = 1; j < server.playerHandler.maxPlayers; j++) {
if (server.playerHandler.players[j] != null) {
server.playerHandler.players[j].RebuildNPCList = true;
}
}
int old1 = (npcs[i].npcType - 1);
int old2 = npcs[i].makeX;
int old3 = npcs[i].makeY;
int old4 = npcs[i].heightLevel;
int old5 = npcs[i].moverangeX1;
int old6 = npcs[i].moverangeY1;
int old7 = npcs[i].moverangeX2;
int old8 = npcs[i].moverangeY2;
int old9 = npcs[i].walkingType;
int old10 = npcs[i].MaxHP;
npcs[i] = null;
newNPC(old1, old2, old3, old4, old5, old6, old7, old8, old9, old10);
}
} else
if (npcs[i].RandomWalk == true && misc.random2(10) == 1 && npcs[i].moverangeX1 > 0 && npcs[i].moverangeY1 > 0 && npcs[i].moverangeX2 > 0 && npcs[i].moverangeY2 > 0)
{ //Move NPCs
int MoveX = misc.random(1);
int MoveY = misc.random(1);
int Rnd = misc.random2(4);
if (Rnd == 1) {
MoveX = -(MoveX);
MoveY = -(MoveY);
} else if (Rnd == 2) {
MoveX = -(MoveX);
} else if (Rnd == 3) {
MoveY = -(MoveY);
}
if (IsInRange(i, MoveX, MoveY) == true) {
npcs[i].moveX = MoveX;
npcs[i].moveY = MoveY;
}
npcs[i].updateRequired = true;
} else if (npcs[i].RandomWalk == false && npcs[i].IsUnderAttack == true) {
AttackPlayer(i);
}
if (npcs[i].RandomWalk == true) {
npcs[i].getNextNPCMovement();
}
if (npcs[i].npcType == 81 || npcs[i].npcType == 397 || npcs[i].npcType == 1766 || npcs[i].npcType == 1767 || npcs[i].npcType == 1768)
{
if (misc.random2(50) == 1) {
npcs[i].updateRequired = true;
npcs[i].textUpdateRequired = true;
npcs[i].textUpdate = "Moo";
}
}
} else if (npcs[i].IsDead == true) {
if (npcs[i].actionTimer == 0 && npcs[i].DeadApply == false && npcs[i].NeedRespawn == false) {
if (npcs[i].npcType == 81 || npcs[i].npcType == 397 || npcs[i].npcType == 1766 || npcs[i].npcType == 1767 || npcs[i].npcType == 1768)
{
npcs[i].animNumber = 0x03E; //cow dead
} else if (npcs[i].npcType == 41) {
npcs[i].animNumber = 0x039; //chicken dead
} else if (npcs[i].npcType == 87) {
npcs[i].animNumber = 0x08D; //rat dead
} else {
npcs[i].animNumber = 0x900; //human dead
}
npcs[i].updateRequired = true;
npcs[i].animUpdateRequired = true;
npcs[i].DeadApply = true;
npcs[i].actionTimer = 10;
} else if (npcs[i].actionTimer == 0 && npcs[i].DeadApply == true && npcs[i].NeedRespawn == false) {
MonsterDropItems(i);
npcs[i].NeedRespawn = true;
npcs[i].actionTimer = 60;
npcs[i].absX = npcs[i].makeX;
npcs[i].absY = npcs[i].makeY;
npcs[i].HP = npcs[i].MaxHP;
npcs[i].animNumber = 0x328;
npcs[i].updateRequired = true;
npcs[i].animUpdateRequired = true;
} else if (npcs[i].actionTimer == 0 && npcs[i].NeedRespawn == true) {
for (int j = 1; j < server.playerHandler.maxPlayers; j++) {
if (server.playerHandler.players[j] != null) {
server.playerHandler.players[j].RebuildNPCList = true;
}
}
int old1 = npcs[i].npcType;
if (old1 == 1267 || old1 == 1265) {
old1 += 1;
}
int old2 = npcs[i].makeX;
int old3 = npcs[i].makeY;
int old4 = npcs[i].heightLevel;
int old5 = npcs[i].moverangeX1;
int old6 = npcs[i].moverangeY1;
int old7 = npcs[i].moverangeX2;
int old8 = npcs[i].moverangeY2;
int old9 = npcs[i].walkingType;
int old10 = npcs[i].MaxHP;
npcs[i] = null;
newNPC(old1, old2, old3, old4, old5, old6, old7, old8, old9, old10);
}
}
}
}
}
public void MonsterDropItems(int NPCID) {
int Drop = misc.random2(5);
boolean Go = true;
int ArrayID = GetNPCDropArrayID(npcs[NPCID].npcType, 0);
int rnd = 0;
int FirstDrop = 526; //Normal Bones
int FirstDropN = 1;
int SecondDrop = -1;
int SecondDropN = -1;
if (ArrayID != -1) {
for (int i = (NpcDrops[ArrayID].Items.length - 1); i >= 0; i--) {
if (NpcDrops[ArrayID].Items[i] > -1) {
FirstDrop = NpcDrops[ArrayID].Items[i];
FirstDropN = NpcDrops[ArrayID].ItemsN[i];
if (FirstDrop != -1 && FirstDropN != -1) {
if (Items.itemStackable[FirstDrop] == true || Items.itemIsNote[FirstDrop] == true) {
Go = true;
while (Go == true) {
if (IsDropping == false) {
MonsterDropItem(FirstDrop, FirstDropN, NPCID);
Go = false;
}
}
} else {
for (int j = FirstDropN; j > 0; j--) {
Go = true;
while (Go == true) {
if (IsDropping == false) {
MonsterDropItem(FirstDrop, 1, NPCID);
Go = false;
}
}
}
}
}
}
}
} else {
MonsterDropItem(FirstDrop, FirstDropN, NPCID);
}
ArrayID = GetNPCDropArrayID(npcs[NPCID].npcType, Drop);
if (ArrayID != -1) {
rnd = misc.random2(NpcDrops[ArrayID].Items.length);
SecondDrop = NpcDrops[ArrayID].Items[rnd];
SecondDropN = NpcDrops[ArrayID].ItemsN[rnd];
}
if (SecondDrop > -1 && SecondDropN > -1) {
if (Items.itemStackable[SecondDrop] == true || Items.itemIsNote[SecondDrop] == true) {
Go = true;
while (Go == true) {
if (IsDropping == false) {
MonsterDropItem(SecondDrop, SecondDropN, NPCID);
Go = false;
}
}
} else {
for (int i = SecondDropN; i > 0; i--) {
Go = true;
while (Go == true) {
if (IsDropping == false) {
MonsterDropItem(SecondDrop, 1, NPCID);
Go = false;
}
}
}
}
}
}
public static boolean IsDropping = false;
public void MonsterDropItem(int newItemID, int newItemAmount, int NPCID) {
if (IsDropping == false) {
IsDropping = true;
int Maxi = server.itemHandler.DropItemCount;
for (int i = 0; i <= Maxi; i++) {
if (server.itemHandler.DroppedItemsID[i] > 0) {
} else {
server.itemHandler.DroppedItemsID[i] = newItemID;
server.itemHandler.DroppedItemsX[i] = npcs[NPCID].absX;
server.itemHandler.DroppedItemsY[i] = npcs[NPCID].absY;
server.itemHandler.DroppedItemsN[i] = newItemAmount;
server.itemHandler.DroppedItemsH[i] = npcs[NPCID].heightLevel;
server.itemHandler.DroppedItemsDDelay[i] = server.itemHandler.SDID;
server.itemHandler.DroppedItemsDropper[i] = GetNpcKiller(NPCID);
server.itemHandler.DropItemCount++;
if (i == Maxi) {
if (server.itemHandler.DropItemCount >= (server.itemHandler.MaxDropItems + 1)) {
server.itemHandler.DropItemCount = 0;
println("! Notify item resterting !");
}
}
break;
}
}
IsDropping = false;
}
}
public int GetNpcKiller(int NPCID) {
int Killer = 0;
int Count = 0;
for (int i = 1; i < server.playerHandler.maxPlayers; i++) {
if (Killer == 0) {
Killer = i;
Count = 1;
} else {
if (npcs[NPCID].Killing[i] > npcs[NPCID].Killing[Killer]) {
Killer = i;
Count = 1;
} else if (npcs[NPCID].Killing[i] == npcs[NPCID].Killing[Killer]) {
Count++;
}
}
}
if (Count > 1 && npcs[NPCID].Killing[npcs[NPCID].StartKilling] == npcs[NPCID].Killing[Killer]) {
Killer = npcs[NPCID].StartKilling;
}
return Killer;
}
/*
WORLDMAP: (walk able places)
01 - Aubury
02 - Varrock Mugger
03 - Lowe
04 - Horvik
05 - Varrock General Store
06 - Thessalia
07 - Varrock Sword Shop
08 - Varrock East Exit Guards
09 - Falador General Store
10 - Falador Shield Shop
11 - Falador Mace Shop
12 - Falador Center Guards
13 - Falador North Exit Guards
14 - Barbarian Village Helmet Shop
15 - Varrock Staff Shop
16 - Al-Kharid Skirt Shop
17 - Al-Kharid Crafting Shop
18 - Al-Kharid General Store
19 - Al-Kharid Leg Shop
20 - Al-Kharid Scimitar Shop
21 - Lumbridge Axe Shop
22 - Lumbridge General Store
23 - Port Sarim Battleaxe Shop
24 - Port Sarim Magic Shop
25 - Port Sarim Jewelery Shop
26 - Port Sarim Fishing Shop
27 - Port Sarim Food Shop
28 - Rimmington Crafting Shop
29 - Rommington Archery Shop
30 - Npc's around and in varrock
31 - Npc's at Rellekka
32 - Npc's around and in lumbridge
33 -
34 -
35 -
36 -
37 -
38 -
39 -
40 -
*/
public static int worldmap[][] = {
{
/* 01 */ 3252, 3453, 3252, 3453, 3252, 3253, 3254, 3252, 3253, 3254, 3255, 3252, 3253, 3252, 3253,
/* 02 */ 3248, 3249, 3250, 3251, 3252, 3253, 3254, 3248, 3249, 3250, 3251, 3252, 3253, 3254, 3248, 3249, 3250, 3251, 3252, 3254, 3248, 3249, 3250, 3251, 3252, 3253, 3254, 3248, 3249, 3250, 3251, 3252, 3253, 3254, 3248, 3249, 3250, 3251, 3252, 3253, 3254, 3248, 3249, 3250, 3251, 3252, 3254, 3248, 3249, 3250, 3251, 3252, 3253, 3254, 3248, 3249, 3250, 3251, 3252, 3253, 3254, 3248, 3249, 3250, 3251, 3252, 3253, 3254, 3248, 3249, 3250, 3251, 3252, 3253, 3254, 3248, 3249, 3250, 3251, 3252, 3253, 3254, 3248, 3249, 3250, 3251, 3252, 3253, 3254,
/* 03 */ 3235, 3234, 3233, 3232, 3231, 3230, 3235, 3230, 3235, 3234, 3233, 3232, 3231, 3230, 3234, 3232, 3231, 3234, 3233, 3232, 3231, 3234, 3233, 3232, 3233, 3231,
/* 04 */ 3231, 3230, 3229, 3232, 3231, 3230, 3229, 3229, 3228, 3227, 3229, 3227, 3232, 3231, 3230, 3229, 3228, 3227, 3232, 3231, 3230, 3229, 3228, 3227, 3226, 3225, 3232, 3231, 3230, 3229, 3228, 3227, 3225, 3232, 3231, 3230, 3229, 3228, 3227, 3225, 3232, 3229, 3228, 3227, 3226, 3232, 3231, 3230, 3229,
/* 05 */ 3217, 3216, 3215, 3214, 3219, 3218, 3217, 3216, 3219, 3218, 3217, 3219, 3217, 3216, 3215, 3219, 3218, 3217, 3216, 3215, 3214, 3220, 3219, 3217, 3216, 3215, 3214, 3219, 3217, 3216, 3215, 3214, 3219, 3217, 3216, 3215, 3214, 3218, 3217,
/* 06 */ 3207, 3206, 3205, 3208, 3207, 3206, 3203, 3207, 3206, 3205, 3204, 3203, 3207, 3206, 3205, 3204, 3203, 3202, 3208, 3207, 3206, 3205, 3208, 3207, 3206, 3207,
/* 07 */ 3206, 3204, 3203, 3202, 3209, 3208, 3207, 3205, 3203, 3208, 3207, 3206, 3205, 3203, 3208, 3207, 3206, 3205, 3204, 3203, 3202, 3208, 3207, 3206, 3205, 3203, 3207, 3206, 3203, 3206, 3203, 3206, 3205, 3205, 3205,
/* 08 */ 3268, 3268, 3268, 3268, 3268, 3269, 3269, 3269, 3269, 3269, 3270, 3270, 3270, 3270, 3270, 3271, 3271, 3271, 3271, 3271, 3272, 3272, 3272, 3272, 3272, 3273, 3273, 3273, 3273, 3273, 3274, 3274, 3274, 3274, 3274, 3275, 3275, 3275, 3276, 3276, 3276, 3276, 3273, 3274, 3275, 3276, 3273, 3274, 3275, 3273,
/* 09 */ 2958, 2957, 2959, 2958, 2957, 2959, 2958, 2957, 2959, 2958, 2957, 2956, 2955, 2954, 2953, 2960, 2959, 2956, 2955, 2953, 2960, 2959, 2957, 2956, 2953,
/* 10 */ 2979, 2977, 2976, 2975, 2974, 2973, 2972, 2979, 2978, 2977, 2972, 2972, 2974, 2973, 2972,
/* 11 */ 2952, 2950, 2949, 2948, 2952, 2951, 2950, 2949, 2948, 2952, 2951, 2950, 2949, 2948, 2952, 2951, 2950, 2949, 2948, 2952, 2952, 2951,
/* 12 */ 2969, 2967, 2966, 2965, 2964, 2963, 2962, 2961, 2960, 2959, 2958, 2969, 2968, 2967, 2966, 2965, 2964, 2963, 2962, 2961, 2960, 2959, 2958, 2969, 2968, 2967, 2966, 2965, 2964, 2963, 2962, 2961, 2960, 2959, 2958, 2969, 2968, 2967, 2966, 2965, 2964, 2963, 2962, 2961, 2960, 2959, 2958, 2969, 2968, 2967, 2966, 2965, 2964, 2963, 2962, 2961, 2960, 2959, 2958, 2969, 2968, 2967, 2966, 2964, 2963, 2962, 2961, 2960, 2959, 2958, 2969, 2968, 2967, 2966, 2965, 2964, 2963, 2962, 2961, 2960, 2959, 2958, 2969, 2968, 2967, 2966, 2965, 2964, 2963, 2962, 2961, 2960, 2959, 2958, 2969, 2968, 2967, 2966, 2965, 2964, 2963, 2962, 2961, 2960, 2959, 2958,
/* 13 */ 2968, 2967, 2966, 2965, 2964, 2963, 2967, 2966, 2965, 2964, 2966, 2965, 2967, 2966, 2965, 2964, 2968, 2967, 2966, 2965, 2964, 2963, 2968, 2967, 2966, 2965, 2964, 2963, 2967, 2966, 2965, 2964, 2968, 2967, 2966, 2965, 2964, 2963,
/* 14 */ 3076, 3074, 3076, 3075, 3074, 3077, 3076, 3075, 3074, 3073, 3077, 3074, 3077, 3076, 3075, 3074,
/* 15 */ 3204, 3204, 3203, 3202, 3201, 3204, 3203, 3202, 3201, 3203, 3201, 3203, 3202, 3201, 3204, 3203, 3201, 3204,
/* 16 */ 3315, 3316, 3313, 3314, 3315, 3317, 3318, 3314, 3317, 3314, 3315, 3316, 3317, 3313, 3314, 3315, 3316, 3317, 3318, 3314, 3315, 3316, 3317,
/* 17 */ 3319, 3320, 3323, 3318, 3319, 3320, 3322, 3323, 3318, 3319, 3320, 3321, 3322, 3323, 3319, 3320, 3321, 3322, 3319, 3320, 3322, 3323, 3318, 3319, 3320, 3323, 3319, 3320,
/* 18 */ 3315, 3316, 3312, 3313, 3314, 3315, 3316, 3312, 3313, 3314, 3315, 3316, 3317, 3312, 3313, 3314, 3315, 3316, 3317, 3318, 3312, 3313, 3314, 3316, 3317, 3312, 3313, 3314, 3316, 3317, 3312, 3313, 3314, 3316, 3317, 3314, 3317, 3315,
/* 19 */ 3314, 3315, 3316, 3318, 3315, 3316, 3317, 3318, 3314, 3315, 3316, 3317, 3318, 3314, 3315, 3316, 3314, 3315,
/* 20 */ 3287, 3288, 3289, 3285, 3286, 3287, 3288, 3289, 3290, 3287, 3288, 3289, 3290, 3287, 3288, 3289, 3290, 3286, 3287, 3288, 3287,
/* 21 */ 3229, 3232, 3228, 3229, 3230, 3231, 3232, 3233, 3228, 3230, 3231, 3232, 3233, 3228, 3230, 3231, 3232, 3232,
/* 22 */ 3210, 3211, 3209, 3210, 3211, 3212, 3214, 3209, 3211, 3212, 3213, 3214, 3209, 3211, 3212, 3213, 3209, 3210, 3211, 3212, 3213, 3214, 3209, 3211, 3212, 3213, 3209, 3210, 3211, 3212, 3213, 3209, 3211, 3213,
/* 23 */ 3026, 3028, 3024, 3025, 3026, 3027, 3028, 3029, 3025, 3026, 3027, 3028, 3029, 3030, 3024, 3025, 3028, 3029, 3030, 3024, 3025, 3028, 3029, 3024, 3025, 3026, 3027, 3028, 3029, 3028, 3029, 3030, 3025, 3026, 3027, 3028, 3029,
/* 24 */ 3012, 3013, 3014, 3015, 3016, 3012, 3015, 3016, 3012, 3015, 3016, 3011, 3012, 3013, 3014, 3015, 3012,
/* 25 */ 3012, 3014, 3012, 3013, 3014, 3015, 3012, 3013, 3014, 3015, 3012, 3013, 3015, 3012, 3013, 3014,
/* 26 */ 3013, 3014, 3013, 3014, 3013, 3014, 3015, 3016, 3012, 3013, 3014, 3015, 3016, 3017, 3012, 3013, 3014, 3015, 3011, 3012, 3013, 3014, 3015, 3016, 3011, 3012, 3013, 3014, 3015, 3016, 3011, 3016, 3011, 3013, 3014, 3015, 3016, 3013, 3014, 3016,
/* 27 */ 3012, 3014, 3012, 3013, 3014, 3015, 3016, 3012, 3015, 3012, 3013, 3014, 3015, 3016, 3013, 3014, 3015, 3013, 3014, 3013, 3013,
/* 28 */ 2946, 2947, 2952, 2946, 2947, 2950, 2951, 2952, 2946, 2948, 2949, 2950, 2951, 2946, 2948, 2949, 2950, 2951, 2946, 2947, 2948, 2949, 2950, 2951, 2948, 2949, 2948, 2949,
/* 29 */ 2955, 2958, 2959, 2954, 2955, 2956, 2957, 2958, 2959, 2953, 2954, 2956, 2957, 2958, 2957, 2958, 2959,
/* 30 */ 3236, 3236, 3237, 3238, 3239, 3237, 3238, 3239, 3240, 3236, 3237, 3238, 3239, 3240, 3236, 3237, 3238, 3239, 3237, 3238,/**/3245, 3246, 3243, 3244, 3245, 3246, 3243, 3244, 3245, 3246, 3247, 3246, 3247,/**/3261, 3260, 3261, 3262, 3260, 3261, 3263, 3260, 3263, 3260, 3263, 3260, 3263, 3260, 3261, 3262, 3263, 3260, 3261, 3263,/**/3234, 3235, 3238, 3233, 3234, 3235, 3236, 3237, 3238, 3235, 3233, 3234, 3235, 3236, 3233, 3234, 3235, 3236, 3237, 3238,/**/3290, 3291, 3292, 3293, 3294, 3297, 3298, 3299, 3290, 3291, 3292, 3293, 3294, 3295, 3296, 3297, 3298, 3299, 3290, 3291, 3292, 3293, 3294, 3295, 3296, 3297, 3298, 3299, 3290, 3293, 3294, 3295, 3296, 3297, 3298, 3299, 3290, 3293, 3294, 3295, 3296, 3297, 3298, 3299, 3290, 3291, 3292, 3293, 3294, 3295, 3296, 3297, 3298, 3299, 3290, 3291, 3292, 3293, 3294, 3295, 3296, 3297, 3298, 3299,
/* 31 */ 2662, 2663, 2661, 2662, 2663, 2661, 2662, 2663, 2661, 2662, 2663, 2662, 2663, 2664, 2665, 2666, 2665, 2666,/**/2664, 2665, 2666, 2664, 2665, 2666, 2664, 2665, 2666, 2664, 2665, 2666, 2664, 2665, 2666,/**/2679, 2680, 2679, 2680, 2676, 2677, 2678, 2679, 2680, 2676, 2677, 2678, 2679, 2680, 2676, 2677, 2678, 2679, 2680, 2674, 2675, 2676, 2677, 2678, 2679, 2680, 2675, 2676, 2677, 2678, 2679, 2680,/**/2667, 2668, 2669, 2670, 2671, 2667, 2668, 2669, 2670, 2671, 2667, 2668, 2669, 2670, 2671, 2667, 2668, 2669, 2670, 2671, 2667, 2668, 2669, 2670, 2671, 2667, 2668, 2669, 2670, 2671, 2667, 2668, 2669, 2670, 2671, 2667, 2668, 2669, 2670, 2671,/**/2681, 2682, 2683, 2684, 2685, 2681, 2682, 2683, 2684, 2685, 2681, 2682, 2683, 2684, 2685, 2681, 2682, 2683, 2684, 2685, 2681, 2682, 2683, 2684, 2685,/**/2675, 2676, 2677, 2678, 2679, 2675, 2676, 2677, 2678, 2679, 2675, 2676, 2677, 2678, 2679, 2676, 2677, 2678, 2679, 2677, 2678, 2679,/**/
2672, 2673, 2674, 2675, 2672, 2673, 2674, 2675, 2672, 2673, 2674, 2675, 2672, 2673, 2674, 2675, 2672, 2673, 2674, 2675, 2672, 2673, 2674, 2675, 2672, 2673, 2674, 2675,/**/2674, 2675, 2676, 2677, 2678, 2674, 2675, 2676, 2677, 2678, 2674, 2675, 2676, 2677, 2678, 2674, 2675, 2676, 2677, 2678, 2674, 2675, 2677, 2678,/**/2685, 2686, 2687, 2688, 2689, 2685, 2686, 2687, 2688, 2689, 2685, 2686, 2687, 2688, 2689, 2685, 2686, 2687, 2688, 2689, 2685, 2686, 2687, 2688, 2689,/**/2668, 2669, 2670, 2671, 2672, 2668, 2669, 2670, 2671, 2672, 2668, 2669, 2670, 2671, 2672, 2668, 2669, 2670, 2671, 2672, 2668, 2669, 2670, 2671, 2672,/**/2679, 2680, 2681, 2682, 2683, 2679, 2680, 2681, 2682, 2683, 2679, 2680, 2681, 2682, 2683, 2679, 2680, 2681, 2682, 2683, 2679, 2680, 2681, 2682, 2683,/**/2673, 2674, 2675, 2673, 2674, 2675, 2676, 2677, 2673, 2674, 2675, 2676, 2677, 2673, 2674, 2675, 2676, 2677, 2673, 2674, 2675, 2676, 2677,/**/2669, 2670, 2671, 2672, 2669, 2670, 2671, 2672, 2673, 2669, 2670, 2671, 2672, 2673, 2669, 2670, 2671, 2672, 2673, 2669, 2670, 2671, 2672, 2673,/**/
2680, 2681, 2682, 2679, 2680, 2681, 2682, 2678, 2679, 2680, 2681, 2682, 2678, 2679, 2680, 2681, 2682, 2678, 2679, 2680, 2681, 2682,
/* 32 */ 3228, 3229, 3226, 3227, 3228, 3225, 3226, 3228, 3229, 3226, 3227, 3228, 3229, 3230, 3225, 3226, 3227, 3228, 3229, 3230, 3225, 3229, 3225, 3226, 3227, 3228, 3229, 3226,/**/3232, 3233, 3234, 3235, 3236, 3237, 3232, 3233, 3234, 3235, 3236, 3231, 3232, 3233, 3234, 3235, 3236, 3227, 3228, 3229, 3231, 3232, 3233, 3234, 3235, 3236, 3225, 3226, 3227, 3228, 3229, 3230, 3231, 3233, 3234, 3235, 3236, 3225, 3226, 3227, 3228, 3229, 3230, 3231, 3232, 3233, 3234, 3235, 3236, 3225, 3228, 3229, 3230, 3231, 3232, 3235, 3236, 3237, 3225, 3227, 3228, 3229, 3230, 3231, 3232, 3233, 3235, 3236, 3237, 3225, 3227, 3228, 3229, 3230, 3231, 3232, 3233, 3235, 3236, 3231, 3235,
},
{
/* 01 */ 3404, 3404, 3403, 3403, 4302, 4302, 4302, 3401, 3401, 3401, 3401, 3400, 3400, 3399, 3399,
/* 02 */ 3398, 3398, 3398, 3398, 3398, 3398, 3398, 3397, 3397, 3397, 3397, 3397, 3397, 3397, 3396, 3396, 3396, 3396, 3396, 3396, 3395, 3395, 3395, 3395, 3395, 3395, 3395, 3394, 3394, 3394, 3394, 3394, 3394, 3394, 3393, 3393, 3393, 3393, 3393, 3393, 3393, 3392, 3392, 3392, 3392, 3392, 3392, 3391, 3391, 3391, 3391, 3391, 3391, 3391, 3390, 3390, 3390, 3390, 3390, 3390, 3390, 3389, 3389, 3389, 3389, 3389, 3389, 3389, 3388, 3388, 3388, 3388, 3388, 3388, 3388, 3387, 3387, 3387, 3387, 3387, 3387, 3387, 3386, 3386, 3386, 3386, 3386, 3386, 3386,
/* 03 */ 3421, 3421, 3421, 3421, 3421, 3421, 3422, 3422, 3423, 3423, 3423, 3423, 3423, 3423, 3424, 3424, 3424, 3425, 3425, 3425, 3425, 3426, 3426, 3426, 3427, 3427,
/* 04 */ 3433, 3433, 3433, 3434, 3434, 3434, 3434, 3435, 3435, 3435, 3436, 3436, 3437, 3437, 3437, 3437, 3437, 3437, 3438, 3438, 3438, 3438, 3438, 3438, 3438, 3438, 3439, 3439, 3439, 3439, 3439, 3439, 3439, 3440, 3440, 3440, 3440, 3440, 3440, 3440, 3441, 3441, 3441, 3441, 3441, 3442, 3442, 3442, 3442,
/* 05 */ 3411, 3411, 3411, 3411, 3412, 3412, 3412, 3412, 3413, 3413, 3413, 3414, 3414, 3414, 3414, 3415, 3415, 3415, 3415, 3415, 3415, 3416, 3416, 3416, 3416, 3416, 3416, 3417, 3417, 3417, 3417, 3417, 3418, 3418, 3418, 3418, 3418, 3419, 3419,
/* 06 */ 3414, 3414, 3414, 3415, 3415, 3415, 3415, 3416, 3416, 3416, 3416, 3416, 3417, 3417, 3417, 3417, 3417, 3417, 3418, 3418, 3418, 3418, 3419, 3419, 3419, 3420,
/* 07 */ 3495, 3495, 3495, 3495, 3396, 3396, 3396, 3396, 3396, 3397, 3397, 3397, 3397, 3397, 3398, 3398, 3398, 3398, 3398, 3398, 3398, 3399, 3399, 3399, 3399, 3399, 3400, 3400, 3400, 3401, 3401, 3402, 3402, 3403, 3404,
/* 08 */ 3426, 3427, 3428, 3429, 3430, 3426, 3427, 3428, 3429, 3430, 3426, 3427, 3428, 3429, 3430, 3426, 3427, 3428, 3429, 3430, 3426, 3427, 3428, 3429, 3430, 3426, 3427, 3428, 3429, 3430, 3426, 3427, 3428, 3429, 3430, 3227, 3228, 3229, 3426, 3427, 3430, 3420, 3421, 3421, 3421, 3421, 3422, 3422, 3422, 3423,
/* 09 */ 3385, 3385, 3386, 3386, 3386, 3387, 3387, 3387, 3388, 3388, 3388, 3388, 3388, 3388, 3388, 3389, 3389, 3389, 3389, 3389, 3390, 3390, 3390, 3390, 3390,
/* 10 */ 3383, 3383, 3383, 3383, 3383, 3383, 3383, 3384, 3384, 3384, 3384, 3385, 3386, 3386, 3386,
/* 11 */ 3385, 3385, 3385, 3385, 3386, 3386, 3386, 3386, 3386, 3387, 3387, 3387, 3387, 3387, 3388, 3388, 3388, 3388, 3388, 3389, 3390, 3390,
/* 12 */ 3376, 3376, 3376, 3376, 3376, 3376, 3376, 3376, 3376, 3376, 3376, 3377, 3377, 3377, 3377, 3377, 3377, 3377, 3377, 3377, 3377, 3377, 3377, 3378, 3378, 3378, 3378, 3378, 3378, 3378, 3378, 3378, 3378, 3378, 3378, 3379, 3379, 3379, 3379, 3379, 3379, 3379, 3379, 3379, 3379, 3379, 3379, 3380, 3380, 3380, 3380, 3380, 3380, 3380, 3380, 3380, 3380, 3380, 3380, 3381, 3381, 3381, 3381, 3381, 3381, 3381, 3381, 3381, 3381, 3381, 3382, 3382, 3382, 3382, 3382, 3382, 3382, 3382, 3382, 3382, 3382, 3382, 3383, 3383, 3383, 3383, 3383, 3383, 3383, 3383, 3383, 3383, 3383, 3383, 3384, 3384, 3384, 3384, 3384, 3384, 3384, 3384, 3384, 3384, 3384, 3384,
/* 13 */ 3391, 3391, 3391, 3391, 3391, 3391, 3392, 3392, 3392, 3392, 3393, 3393, 3394, 3394, 3394, 3394, 3395, 3395, 3395, 3395, 3395, 3395, 3396, 3396, 3396, 3396, 3396, 3396, 3397, 3397, 3397, 3397, 3398, 3398, 3398, 3398, 3398, 3398,
/* 14 */ 3427, 3427, 3428, 3428, 3428, 3429, 3429, 3429, 3429, 3429, 3430, 3430, 3431, 3431, 3431, 3431,
/* 15 */ 3431, 3432, 3432, 3432, 3432, 3433, 3433, 3433, 3433, 3434, 3434, 3435, 3435, 3435, 3436, 3436, 3436, 3437,
/* 16 */ 3160, 3160, 3161, 3161, 3161, 3161, 3161, 3162, 3162, 3163, 3163, 3163, 3163, 3164, 3164, 3164, 3164, 3164, 3164, 3165, 3165, 3165, 3165,
/* 17 */ 3191, 3191, 3191, 3192, 3192, 3192, 3192, 3192, 3193, 3193, 3193, 3193, 3193, 3193, 3194, 3194, 3194, 3194, 3195, 3195, 3195, 3195, 3196, 3196, 3196, 3196, 3197, 3197,
/* 18 */ 3178, 3178, 3179, 3179, 3179, 3179, 3179, 3180, 3180, 3180, 3180, 3180, 3180, 3181, 3181, 3181, 3181, 3181, 3181, 3181, 3182, 3182, 3182, 3182, 3182, 3183, 3183, 3183, 3183, 3183, 3184, 3184, 3184, 3184, 3184, 3185, 3185, 3186,
/* 19 */ 3173, 3173, 3173, 3173, 3174, 3174, 3174, 3174, 3175, 3175, 3175, 3175, 3175, 3176, 3176, 3176, 3177, 3177,
/* 20 */ 3187, 3187, 3187, 3188, 3188, 3188, 3188, 3188, 3188, 3189, 3189, 3189, 3189, 3190, 3190, 3190, 3190, 3191, 3191, 3191, 3192,
/* 21 */ 3201, 3201, 3202, 3202, 3202, 3202, 3202, 3202, 3203, 3203, 3203, 3203, 3203, 3204, 3204, 3204, 3204, 3205,
/* 22 */ 3243, 3243, 3244, 3244, 3244, 3244, 3244, 3245, 3245, 3245, 3245, 3245, 3246, 3246, 3246, 3246, 3247, 3247, 3247, 3247, 3247, 3247, 3248, 3248, 3248, 3248, 3249, 3249, 3249, 3249, 3249, 3250, 3250, 3250,
/* 23 */ 3245, 3245, 3246, 3246, 3246, 3246, 3246, 3246, 3247, 3247, 3247, 3247, 3247, 3247, 3248, 3248, 3248, 3248, 3248, 3249, 3249, 3249, 3249, 3250, 3250, 3250, 3250, 3250, 3250, 3251, 3251, 3251, 3252, 3252, 3252, 3252, 3252,
/* 24 */ 3257, 3257, 3257, 3257, 3257, 3258, 3258, 3258, 3259, 3259, 3259, 3260, 3260, 3260, 3260, 3260, 3261,
/* 25 */ 3244, 3244, 3245, 3245, 3245, 3245, 3246, 3246, 3246, 3246, 3247, 3247, 3247, 3248, 3248, 3248,
/* 26 */ 3220, 3220, 3221, 3221, 3222, 3222, 3222, 3222, 3223, 3223, 3223, 3223, 3223, 3223, 3224, 3224, 3224, 3224, 3225, 3225, 3225, 3225, 3225, 3225, 3226, 3226, 3226, 3226, 3226, 3226, 3227, 3227, 3228, 3228, 3228, 3228, 3228, 3229, 3229, 3229,
/* 27 */ 3203, 3203, 3204, 3204, 3204, 3204, 3204, 3205, 3205, 3206, 3206, 3206, 3206, 3206, 3207, 3207, 3207, 3208, 3208, 3209, 3210,
/* 28 */ 3202, 3202, 3202, 3203, 3203, 3203, 3203, 3203, 3204, 3204, 3204, 3204, 3204, 3205, 3205, 3205, 3205, 3205, 3206, 3206, 3206, 3206, 3206, 3206, 3207, 3207, 3208, 3208,
/* 29 */ 3202, 3202, 3202, 3203, 3203, 3203, 3203, 3203, 3203, 3204, 3204, 3204, 3204, 3204, 3205, 3205, 3205,
/* 30 */ 3403, 3404, 3404, 3404, 3404, 3405, 3405, 3405, 3405, 3406, 3406, 3406, 3406, 3406, 3407, 3407, 3407, 3407, 3408, 3408,/**/3393, 3393, 3394, 3394, 3394, 3394, 3395, 3395, 3395, 3395, 3395, 3396, 3396,/**/3396, 3397, 3397, 3397, 3398, 3398, 3398, 3399, 3399, 3400, 3400, 3401, 3401, 3402, 3402, 3402, 3402, 3403, 3403, 3403,/**/3382, 3382, 3382, 3383, 3383, 3383, 3383, 3383, 3383, 3384, 3385, 3385, 3385, 3385, 3386, 3386, 3386, 3386, 3386, 3386,/**/3377, 3377, 3377, 3377, 3377, 3377, 3377, 3377, 3378, 3378, 3378, 3378, 3378, 3378, 3378, 3378, 3378, 3378, 3379, 3379, 3379, 3379, 3379, 3379, 3379, 3379, 3379, 3379, 3380, 3380, 3380, 3380, 3380, 3380, 3380, 3380, 3381, 3381, 3381, 3381, 3381, 3381, 3381, 3381, 3382, 3382, 3382, 3382, 3382, 3382, 3382, 3382, 3382, 3382, 3383, 3383, 3383, 3383, 3383, 3383, 3383, 3383, 3383, 3383,
/* 31 */ 3713, 3713, 3714, 3714, 3714, 3715, 3715, 3715, 3716, 3716, 3716, 3717, 3717, 3718, 3718, 3718, 3719, 3719,/**/3713, 3713, 3713, 3714, 3714, 3714, 3715, 3715, 3715, 3716, 3716, 3716, 3717, 3717, 3717,/**/3714, 3714, 3715, 3715, 3716, 3716, 3716, 3716, 3716, 3717, 3717, 3717, 3717, 3717, 3718, 3718, 3718, 3718, 3718, 3719, 3719, 3719, 3719, 3719, 3719, 3719, 3720, 3720, 3720, 3720, 3720, 3720,/**/3712, 3712, 3712, 3712, 3712, 3713, 3713, 3713, 3713, 3713, 3714, 3714, 3714, 3714, 3714, 3715, 3715, 3715, 3715, 3715, 3716, 3716, 3716, 3716, 3716, 3717, 3717, 3717, 3717, 3717, 3718, 3718, 3718, 3718, 3718, 3719, 3719, 3719, 3719, 3719,/**/3714, 3714, 3714, 3714, 3714, 3715, 3715, 3715, 3715, 3715, 3716, 3716, 3716, 3716, 3716, 3717, 3717, 3717, 3717, 3717, 3718, 3718, 3718, 3718, 3718,/**/3718, 3718, 3718, 3718, 3718, 3719, 3719, 3719, 3719, 3719, 3720, 3720, 3720, 3720, 3720, 3721, 3721, 3721, 3721, 3722, 3722, 3722,/**/
3712, 3712, 3712, 3712, 3713, 3713, 3713, 3713, 3714, 3714, 3714, 3714, 3715, 3715, 3715, 3715, 3716, 3716, 3716, 3716, 3717, 3717, 3717, 3717, 3718, 3718, 3718, 3718,/**/3711, 3711, 3711, 3711, 3711, 3712, 3712, 3712, 3712, 3712, 3713, 3713, 3713, 3713, 3713, 3714, 3714, 3714, 3714, 3714, 3715, 3715, 3715, 3715, 3715,/**/3722, 3722, 3722, 3722, 3722, 3723, 3723, 3723, 3723, 3723, 3724, 3724, 3724, 3724, 3724, 3725, 3725, 3725, 3725, 3725, 3726, 3726, 3726, 3726, 3726,/**/3725, 3725, 3725, 3725, 3725, 3726, 3726, 3726, 3726, 3726, 3727, 3727, 3727, 3727, 3727, 3728, 3728, 3728, 3728, 3728, 3729, 3729, 3729, 3729, 3729,/**/3730, 3730, 3730, 3730, 3730, 3731, 3731, 3731, 3731, 3731, 3732, 3732, 3732, 3732, 3732, 3733, 3733, 3733, 3733, 3733, 3734, 3734, 3734, 3734, 3734,/**/3727, 3727, 3727, 3728, 3728, 3728, 3728, 3728, 3729, 3729, 3729, 3729, 3729, 3730, 3730, 3730, 3730, 3730, 3731, 3731, 3731, 3731, 3731,/**/3723, 3723, 3723, 3723, 3724, 3724, 3724, 3724, 3724, 3725, 3725, 3725, 3725, 3725, 3726, 3726, 3726, 3726, 3726, 3727, 3727, 3727, 3727, 3727,/**/
3726, 3726, 3726, 3727, 3727, 3727, 3727, 3728, 3728, 3728, 3728, 3728, 3729, 3729, 3729, 3729, 3729, 3730, 3730, 3730, 3730, 3730,
/* 32 */ 3287, 3287, 3288, 3288, 3288, 3289, 3289, 3289, 3289, 3290, 3290, 3290, 3290, 3290, 3291, 3291, 3291, 3291, 3291, 3291, 3292, 3292, 3293, 3293, 3293, 3293, 3293, 3294,/**/3292, 3292, 3292, 3292, 3292, 3292, 3293, 3293, 3293, 3293, 3293, 3294, 3294, 3294, 3294, 3294, 3294, 3295, 3295, 3295, 3295, 3295, 3295, 3295, 3295, 3295, 3296, 3296, 3296, 3296, 3296, 3296, 3296, 3296, 3296, 3296, 3296, 3297, 3297, 3297, 3297, 3297, 3297, 3297, 3297, 3297, 3297, 3297, 3297, 3298, 3298, 3298, 3298, 3298, 3298, 3298, 3298, 3298, 3299, 3299, 3299, 3299, 3299, 3299, 3299, 3299, 3299, 3299, 3299, 3300, 3300, 3300, 3300, 3300, 3300, 3300, 3300, 3300, 3300, 3301, 3301,
},
};
/*
WORLDMAP 2: (not-walk able places)
01 - Lumbridge cows
*/
public static int worldmap2[][] = {
{
/* 01 */ 3257, 3258, 3260, 3261, 3261, 3262, 3261, 3262, 3257, 3258, 3257, 3258, 3254, 3255, 3254, 3255, 3252, 3252, 3250, 3251, 3250, 3251, 3249, 3250, 3249, 3250, 3242, 3242, 3243, 3243, 3257, 3244, 3245, 3244, 3245, 3247, 3248, 3250, 3251, 3255, 3256, 3255, 3256, 3259, 3260,
},
{
/* 01 */ 3256, 3256, 3256, 3256, 3266, 3266, 3267, 3267, 3270, 3270, 3271, 3271, 3272, 3272, 3273, 3273, 3275, 3276, 3277, 3277, 3278, 3278, 3279, 3279, 3280, 3280, 3285, 3286, 3289, 3290, 3289, 3297, 3297, 3298, 3298, 3298, 3298, 3297, 3297, 3297, 3297, 3298, 3298, 3297, 3297,
},
};
public boolean AttackPlayer(int NPCID) {
int Player = npcs[NPCID].StartKilling;
if (server.playerHandler.players[Player] == null) {
ResetAttackPlayer(NPCID);
return false;
} else if (server.playerHandler.players[Player].DirectionCount < 2) {
return false;
}
int EnemyX = server.playerHandler.players[Player].absX;
int EnemyY = server.playerHandler.players[Player].absY;
int EnemyHP = server.playerHandler.players[Player].playerLevel[server.playerHandler.players[Player].playerHitpoints];
int EnemyMaxHP = getLevelForXP(server.playerHandler.players[Player].playerXP[server.playerHandler.players[Player].playerHitpoints]);
boolean RingOfLife = false;
if (server.playerHandler.players[Player].playerEquipment[server.playerHandler.players[Player].playerRing] == 2570)
{
RingOfLife = true;
}
int hitDiff = 0;
hitDiff = misc.random(npcs[NPCID].MaxHit);
if (GoodDistance(npcs[NPCID].absX, npcs[NPCID].absY, EnemyX, EnemyY, 1) == true) {
if (npcs[NPCID].actionTimer == 0) {
if (RingOfLife == true && EnemyHP <= (int) ((double) ((double) EnemyMaxHP / 10.0) + 0.5)) {
server.playerHandler.players[Player].SafeMyLife = true;
} else {
if (server.playerHandler.players[Player].IsDead == true) {
ResetAttackPlayer(NPCID);
} else {
if (npcs[NPCID].npcType == 81 || npcs[NPCID].npcType == 397 || npcs[NPCID].npcType == 1766 || npcs[NPCID].npcType == 1767 || npcs[NPCID].npcType == 1768)
{
npcs[NPCID].animNumber = 0x03B; //cow attack
} else if (npcs[NPCID].npcType == 41) {
npcs[NPCID].animNumber = 0x037; //chicken attack
} else if (npcs[NPCID].npcType == 87) {
npcs[NPCID].animNumber = 0x08A; //rat attack
} else {
npcs[NPCID].animNumber = 0x326; //human attack
}
npcs[NPCID].animUpdateRequired = true;
npcs[NPCID].updateRequired = true;
if ((EnemyHP - hitDiff) < 0) {
hitDiff = EnemyHP;
}
server.playerHandler.players[Player].hitDiff = hitDiff;
server.playerHandler.players[Player].updateRequired = true;
server.playerHandler.players[Player].hitUpdateRequired = true;
server.playerHandler.players[Player].appearanceUpdateRequired = true;
npcs[NPCID].actionTimer = 7;
}
}
return true;
}
}
return false;
}
public int getLevelForXP(int exp) {
int points = 0;
int output = 0;
for (int lvl = 1; lvl <= 99; lvl++) {
points += Math.floor((double) lvl + 300.0 * Math.pow(2.0, (double) lvl / 7.0));
output = (int) Math.floor(points / 4);
if (output >= exp)
return lvl;
}
return 0;
}
public boolean GoodDistance(int objectX, int objectY, int playerX, int playerY, int distance) {
for (int i = 0; i <= distance; i++) {
for (int j = 0; j <= distance; j++) {
if ((objectX + i) == playerX && ((objectY + j) == playerY || (objectY - j) == playerY || objectY == playerY))
{
return true;
} else
if ((objectX - i) == playerX && ((objectY + j) == playerY || (objectY - j) == playerY || objectY == playerY))
{
return true;
} else
if (objectX == playerX && ((objectY + j) == playerY || (objectY - j) == playerY || objectY == playerY))
{
return true;
}
}
}
return false;
}
public boolean ResetAttackPlayer(int NPCID) {
npcs[NPCID].IsUnderAttack = false;
npcs[NPCID].StartKilling = 0;
npcs[NPCID].RandomWalk = true;
npcs[NPCID].animNumber = 0x328;
npcs[NPCID].animUpdateRequired = true;
npcs[NPCID].updateRequired = true;
return true;
}
public boolean loadAutoSpawn(String FileName) {
String line = "";
String token = "";
String token2 = "";
String token2_2 = "";
String[] token3 = new String[10];
boolean EndOfFile = false;
int ReadMode = 0;
BufferedReader characterfile = null;
try {
characterfile = new BufferedReader(new FileReader(FileName));
} catch (FileNotFoundException fileex) {
misc.printlnTag(FileName + ": file not found.");
return false;
}
try {
line = characterfile.readLine();
} catch (IOException ioexception) {
misc.printlnTag(FileName + ": error loading file.");
return false;
}
while (EndOfFile == false && line != null) {
line = line.trim();
int spot = line.indexOf("=");
if (spot > -1) {
token = line.substring(0, spot);
token = token.trim();
token2 = line.substring(spot + 1);
token2 = token2.trim();
token2_2 = token2.replaceAll("\t\t", "\t");
token2_2 = token2_2.replaceAll("\t\t", "\t");
token2_2 = token2_2.replaceAll("\t\t", "\t");
token2_2 = token2_2.replaceAll("\t\t", "\t");
token2_2 = token2_2.replaceAll("\t\t", "\t");
token3 = token2_2.split("\t");
if (token.equals("spawn")) {
newNPC(Integer.parseInt(token3[0]), Integer.parseInt(token3[1]), Integer.parseInt(token3[2]), Integer.parseInt(token3[3]), Integer.parseInt(token3[4]), Integer.parseInt(token3[5]), Integer.parseInt(token3[6]), Integer.parseInt(token3[7]), Integer.parseInt(token3[8]), GetNpcListHP(Integer.parseInt(token3[0])));
}
} else {
if (line == null) {
try {
characterfile.close();
} catch (IOException ioexception) {
}
return true;
}
}
try {
line = characterfile.readLine();
} catch (IOException ioexception1) {
EndOfFile = true;
}
}
try {
characterfile.close();
} catch (IOException ioexception) {
}
return false;
}
public int GetNpcListHP(int NpcID) {
for (int i = 0; i < maxListedNPCs; i++) {
if (NpcList[i] != null) {
if (NpcList[i].npcId == NpcID) {
return NpcList[i].npcHealth;
}
}
}
return 0;
}
public boolean loadNPCList(String FileName) {
String line = "";
String token = "";
String token2 = "";
String token2_2 = "";
String[] token3 = new String[10];
boolean EndOfFile = false;
int ReadMode = 0;
BufferedReader characterfile = null;
try {
characterfile = new BufferedReader(new FileReader(FileName));
} catch (FileNotFoundException fileex) {
misc.printlnTag(FileName + ": file not found.");
return false;
}
try {
line = characterfile.readLine();
} catch (IOException ioexception) {
misc.printlnTag(FileName + ": error loading file.");
return false;
}
while (EndOfFile == false && line != null) {
line = line.trim();
int spot = line.indexOf("=");
if (spot > -1) {
token = line.substring(0, spot);
token = token.trim();
token2 = line.substring(spot + 1);
token2 = token2.trim();
token2_2 = token2.replaceAll("\t\t", "\t");
token2_2 = token2_2.replaceAll("\t\t", "\t");
token2_2 = token2_2.replaceAll("\t\t", "\t");
token2_2 = token2_2.replaceAll("\t\t", "\t");
token2_2 = token2_2.replaceAll("\t\t", "\t");
token3 = token2_2.split("\t");
if (token.equals("npc")) {
newNPCList(Integer.parseInt(token3[0]), token3[1], Integer.parseInt(token3[2]), Integer.parseInt(token3[3]));
}
} else {
if (line.equals("[ENDOFNPCLIST]")) {
try {
characterfile.close();
} catch (IOException ioexception) {
}
return true;
}
}
try {
line = characterfile.readLine();
} catch (IOException ioexception1) {
EndOfFile = true;
}
}
try {
characterfile.close();
} catch (IOException ioexception) {
}
return false;
}
public boolean loadNPCDrops(String FileName) {
String line = "";
String token = "";
String token2 = "";
String token2_2 = "";
String[] token3 = new String[10];
boolean EndOfFile = false;
int ReadMode = 0;
BufferedReader characterfile = null;
try {
characterfile = new BufferedReader(new FileReader(FileName));
} catch (FileNotFoundException fileex) {
misc.printlnTag(FileName + ": file not found.");
return false;
}
try {
line = characterfile.readLine();
} catch (IOException ioexception) {
misc.printlnTag(FileName + ": error loading file.");
return false;
}
while (EndOfFile == false && line != null) {
line = line.trim();
int spot = line.indexOf("=");
if (spot > -1) {
token = line.substring(0, spot);
token = token.trim();
token2 = line.substring(spot + 1);
token2 = token2.trim();
token2_2 = token2.replaceAll("\t\t", "\t");
token2_2 = token2_2.replaceAll("\t\t", "\t");
token2_2 = token2_2.replaceAll("\t\t", "\t");
token2_2 = token2_2.replaceAll("\t\t", "\t");
token2_2 = token2_2.replaceAll("\t\t", "\t");
token3 = token2_2.split("\t");
if (token.equals("npcdrop")) {
int[] Items = new int[100];
int[] ItemsN = new int[100];
for (int i = 0; i < ((token3.length - 2) / 2); i++) {
if (token3[(2 + (i * 2))] != null) {
Items[i] = Integer.parseInt(token3[(2 + (i * 2))]);
ItemsN[i] = Integer.parseInt(token3[(3 + (i * 2))]);
} else {
break;
}
}
newNPCDrop(Integer.parseInt(token3[0]), Integer.parseInt(token3[1]), Items, ItemsN);
}
} else {
if (line.equals("[ENDOFNPCDROPLIST]")) {
try {
characterfile.close();
} catch (IOException ioexception) {
}
return true;
}
}
try {
line = characterfile.readLine();
} catch (IOException ioexception1) {
EndOfFile = true;
}
}
try {
characterfile.close();
} catch (IOException ioexception) {
}
return false;
}
public int GetNPCDropArrayID(int NPCID, int DropType) {
for (int i = 0; i < maxNPCDrops; i++) {
if (NpcDrops[i] != null) {
if (NpcDrops[i].npcId == NPCID && NpcDrops[i].DropType == DropType) {
return i;
}
}
}
return -1;
}
public void println(String str) {
System.out.println(str);
}
}

10
server317/src/NPCList.java Executable file
View File

@ -0,0 +1,10 @@
public class NPCList {
public int npcId;
public String npcName;
public int npcCombat;
public int npcHealth;
public NPCList(int _npcId) {
npcId = _npcId;
}
}

142
server317/src/NPCs.java Executable file
View File

@ -0,0 +1,142 @@
public class NPCs {
public int npcId;
public int npcType;
public int absX, absY;
public int heightLevel;
public int makeX, makeY, moverangeX1, moverangeY1, moverangeX2, moverangeY2, moveX, moveY, direction, walkingType;
public int spawnX, spawnY;
public int HP, MaxHP, hitDiff, MaxHit, animNumber, actionTimer, StartKilling;
public boolean IsDead, DeadApply, NeedRespawn, IsUnderAttack, IsClose;
public int[] Killing = new int[server.playerHandler.maxPlayers];
public boolean RandomWalk;
public boolean dirUpdateRequired;
public boolean animUpdateRequired;
public boolean hitUpdateRequired;
public boolean updateRequired;
public boolean textUpdateRequired;
public String textUpdate;
public NPCs(int _npcId, int _npcType) {
npcId = _npcId;
npcType = _npcType;
direction = -1;
IsDead = false;
DeadApply = false;
actionTimer = 0;
RandomWalk = true;
StartKilling = 0;
IsUnderAttack = false;
IsClose = false;
for (int i = 0; i < Killing.length; i++) {
Killing[i] = 0;
}
}
public void updateNPCMovement(stream str) {
if (direction == -1) {
// don't have to update the npc position, because the npc is just standing
if (updateRequired) {
// tell ClientHandler there's an update block appended at the end
str.writeBits(1, 1);
str.writeBits(2, 0);
} else {
str.writeBits(1, 0);
}
} else {
// send "walking packet"
str.writeBits(1, 1);
str.writeBits(2, 1); // updateType
str.writeBits(3, misc.xlateDirectionToClient[direction]);
if (updateRequired) {
str.writeBits(1, 1); // tell ClientHandler there's an update block appended at the end
} else {
str.writeBits(1, 0);
}
}
}
public void appendNPCUpdateBlock(stream str) {
if (!updateRequired) return; // nothing required
int updateMask = 0;
if (textUpdateRequired) updateMask |= 1;
if (animUpdateRequired) updateMask |= 0x10;
if (hitUpdateRequired) updateMask |= 0x40;
if (dirUpdateRequired) updateMask |= 0x20;
/*if(updateMask >= 0x100) {
// byte isn't sufficient
updateMask |= 0x40; // indication for the ClientHandler that updateMask is stored in a word
str.writeByte(updateMask & 0xFF);
str.writeByte(updateMask >> 8);
} else {*/
str.writeByte(updateMask);
//}
// now writing the various update blocks itself - note that their order crucial
if (textUpdateRequired) {
str.writeString(textUpdate);
}
if (animUpdateRequired) appendAnimUpdate(str);
if (hitUpdateRequired) appendHitUpdate(str);
if (dirUpdateRequired) appendDirUpdate(str);
// TODO: add the various other update blocks
}
public void clearUpdateFlags() {
updateRequired = false;
textUpdateRequired = false;
hitUpdateRequired = false;
animUpdateRequired = false;
dirUpdateRequired = false;
textUpdate = null;
moveX = 0;
moveY = 0;
direction = -1;
}
// returns 0-7 for next walking direction or -1, if we're not moving
public int getNextWalkingDirection() {
int dir;
dir = misc.direction(absX, absY, (absX + moveX), (absY + moveY));
if (dir == -1) return -1;
dir >>= 1;
absX += moveX;
absY += moveY;
return dir;
}
public void getNextNPCMovement() {
direction = -1;
direction = getNextWalkingDirection();
}
protected void appendHitUpdate(stream str) {
try {
HP -= hitDiff;
if (HP <= 0) {
IsDead = true;
}
str.writeByteC(hitDiff); // What the perseon got 'hit' for
if (hitDiff > 0) {
str.writeByteS(1); // 0: red hitting - 1: blue hitting
} else {
str.writeByteS(0); // 0: red hitting - 1: blue hitting
}
str.writeByteS(HP); // Their current hp, for HP bar
str.writeByteC(MaxHP); // Their max hp, for HP bar
} catch (Exception e) {
e.printStackTrace();
}
}
public void appendAnimUpdate(stream str) {
str.writeWordBigEndian(animNumber);
str.writeByte(1);
}
public void appendDirUpdate(stream str) {
str.writeWord(direction);
}
}

490
server317/src/PlayerHandler.java Executable file
View File

@ -0,0 +1,490 @@
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Calendar;
import java.util.GregorianCalendar;
public class PlayerHandler {
// Remark: the player structures are just a temporary solution for now
// Later we will avoid looping through all the players for each player
// by making use of a hash table maybe based on map regions (8x8 granularity should be ok)
public static final int maxPlayers = 512;
public static Players players[] = new Players[maxPlayers];
public int playerSlotSearchStart = 1; // where we start searching at when adding a new player
public static String kickNick = "";
public static boolean kickAllPlayers = false;
public static String messageToAll = "";
public static int playerCount = 0;
public static String playersCurrentlyOn[] = new String[maxPlayers];
public static boolean updateAnnounced;
public static boolean updateRunning;
public static int updateSeconds;
public static long updateStartTime;
PlayerHandler() {
for (int i = 0; i < maxPlayers; i++) {
players[i] = null;
}
}
// a new ClientHandler connected
public void newPlayerClient(java.net.Socket s, String connectedFrom) {
// first, search for a free slot
//int slot = -1, i = playerSlotSearchStart;
int slot = -1, i = 1;
do {
if (players[i] == null) {
slot = i;
break;
}
i++;
if (i >= maxPlayers) i = 0; // wrap around
// } while(i != playerSlotSearchStart);
} while (i <= maxPlayers);
ClientHandler newClient = new ClientHandler(s, slot);
newClient.handler = this;
(new Thread(newClient)).start();
if (slot == -1) return; // no free slot found - world is full
players[slot] = newClient;
players[slot].connectedFrom = connectedFrom;
// start at next slot when issuing the next search to speed it up
playerSlotSearchStart = slot + 1;
if (playerSlotSearchStart > maxPlayers) playerSlotSearchStart = 1;
// Note that we don't use slot 0 because playerId zero does not function
// properly with the ClientHandler.
}
public void destruct() {
for (int i = 0; i < maxPlayers; i++) {
if (players[i] == null) continue;
players[i].destruct();
players[i] = null;
}
}
public static int getPlayerCount() {
return playerCount;
}
public void updatePlayerNames() {
playerCount = 0;
for (int i = 0; i < maxPlayers; i++) {
if (players[i] != null) {
playersCurrentlyOn[i] = players[i].playerName;
playerCount++;
} else
playersCurrentlyOn[i] = "";
}
}
public static boolean isPlayerOn(String playerName) {
for (int i = 0; i < maxPlayers; i++) {
if (playersCurrentlyOn[i] != null) {
if (playersCurrentlyOn[i].equalsIgnoreCase(playerName)) return true;
}
}
return false;
}
public void process() {
updatePlayerNames();
if (messageToAll.length() > 0) {
int msgTo = 1;
do {
if (players[msgTo] != null) {
players[msgTo].globalMessage = messageToAll;
}
msgTo++;
} while (msgTo < maxPlayers);
messageToAll = "";
}
if (kickAllPlayers == true) {
int kickID = 1;
do {
if (players[kickID] != null) {
players[kickID].isKicked = true;
}
kickID++;
} while (kickID < maxPlayers);
kickAllPlayers = false;
}
// at first, parse all the incoming data
// this has to be seperated from the outgoing part because we have to keep all the player data
// static, so each ClientHandler gets exactly the same and not the one clients are ahead in time
// than the other ones.
for (int i = 0; i < maxPlayers; i++) {
if (players[i] == null || !players[i].isActive) continue;
players[i].actionAmount--;
players[i].preProcessing();
while (players[i].process()) ;
players[i].postProcessing();
players[i].getNextPlayerMovement();
if (players[i].playerName.equalsIgnoreCase(kickNick)) {
players[i].kick();
kickNick = "";
}
if (players[i].disconnected) {
if (players[i].savefile) {
if (saveGame(players[i])) {
System.out.println("Game saved for player " + players[i].playerName);
} else {
System.out.println("Could not save for " + players[i].playerName);
}
;
} else {
System.out.println("Did not save for " + players[i].playerName);
}
removePlayer(players[i]);
players[i] = null;
}
}
// loop through all players and do the updating stuff
for (int i = 0; i < maxPlayers; i++) {
if (players[i] == null || !players[i].isActive) continue;
Calendar cal = new GregorianCalendar();
int day = cal.get(Calendar.DAY_OF_MONTH);
int month = cal.get(Calendar.MONTH);
int year = cal.get(Calendar.YEAR);
players[i].playerLastLogin = ((year * 10000) + (month * 100) + day);
if (players[i].disconnected) {
if (players[i].savefile) {
if (saveGame(players[i])) {
System.out.println("Game saved for player " + players[i].playerName);
} else {
System.out.println("Could not save for " + players[i].playerName);
}
;
} else {
System.out.println("Did not save for " + players[i].playerName);
}
removePlayer(players[i]);
players[i] = null;
} else {
if (!players[i].initialized) {
players[i].initialize();
players[i].initialized = true;
} else {
players[i].update();
}
}
}
if (updateRunning && !updateAnnounced) {
updateAnnounced = true;
}
if (updateRunning && System.currentTimeMillis() - updateStartTime > (updateSeconds * 1000)) {
kickAllPlayers = true;
server.ShutDown = true;
}
// post processing
for (int i = 0; i < maxPlayers; i++) {
if (players[i] == null || !players[i].isActive) continue;
players[i].clearUpdateFlags();
}
}
public void updateNPC(Players plr, stream str) {
updateBlock.currentOffset = 0;
str.createFrameVarSizeWord(65);
str.initBitAccess();
str.writeBits(8, plr.npcListSize);
int size = plr.npcListSize;
plr.npcListSize = 0;
for (int i = 0; i < size; i++) {
if (plr.RebuildNPCList == false && plr.withinDistance(plr.npcList[i]) == true) {
plr.npcList[i].updateNPCMovement(str);
plr.npcList[i].appendNPCUpdateBlock(updateBlock);
plr.npcList[plr.npcListSize++] = plr.npcList[i];
} else {
int id = plr.npcList[i].npcId;
plr.npcInListBitmap[id >> 3] &= ~(1 << (id & 7)); // clear the flag
str.writeBits(1, 1);
str.writeBits(2, 3); // tells ClientHandler to remove this npc from list
}
}
// iterate through all npcs to check whether there's new npcs to add
for (int i = 0; i < NPCHandler.maxNPCs; i++) {
if (server.npcHandler.npcs[i] != null) {
int id = server.npcHandler.npcs[i].npcId;
if (plr.RebuildNPCList == false && (plr.npcInListBitmap[id >> 3] & (1 << (id & 7))) != 0) {
// npc already in npcList
} else if (plr.withinDistance(server.npcHandler.npcs[i]) == false) {
// out of sight
} else {
plr.addNewNPC(server.npcHandler.npcs[i], str, updateBlock);
}
}
}
plr.RebuildNPCList = false;
if (updateBlock.currentOffset > 0) {
str.writeBits(14, 16383); // magic EOF - needed only when npc updateblock follows
str.finishBitAccess();
// append update block
str.writeBytes(updateBlock.buffer, updateBlock.currentOffset, 0);
} else {
str.finishBitAccess();
}
str.endFrameVarSizeWord();
}
private stream updateBlock = new stream(new byte[10000]);
// should actually be moved to ClientHandler.java because it's very ClientHandler specific
public void updatePlayer(Players plr, stream str) {
updateBlock.currentOffset = 0;
if (updateRunning && !updateAnnounced) {
str.createFrame(114);
str.writeWordBigEndian(updateSeconds * 50 / 30);
}
// update thisPlayer
plr.updateThisPlayerMovement(str); // handles walking/running and teleporting
// do NOT send chat text back to thisPlayer!
boolean saveChatTextUpdate = plr.chatTextUpdateRequired;
plr.chatTextUpdateRequired = false;
plr.appendPlayerUpdateBlock(updateBlock);
plr.chatTextUpdateRequired = saveChatTextUpdate;
str.writeBits(8, plr.playerListSize);
int size = plr.playerListSize;
// update/remove players that are already in the playerList
plr.playerListSize = 0; // we're going to rebuild the list right away
for (int i = 0; i < size; i++) {
// this update packet does not support teleporting of other players directly
// instead we're going to remove this player here and readd it right away below
if (plr.didTeleport == false && plr.withinDistance(plr.playerList[i]) == true) {
plr.playerList[i].updatePlayerMovement(str);
plr.playerList[i].appendPlayerUpdateBlock(updateBlock);
plr.playerList[plr.playerListSize++] = plr.playerList[i];
} else {
int id = plr.playerList[i].playerId;
plr.playerInListBitmap[id >> 3] &= ~(1 << (id & 7)); // clear the flag
str.writeBits(1, 1);
str.writeBits(2, 3); // tells ClientHandler to remove this char from list
}
}
// iterate through all players to check whether there's new players to add
for (int i = 0; i < maxPlayers; i++) {
if (players[i] == null || players[i].isActive == false || players[i] == plr) {
//not existing, not active or you are that player
} else {
int id = players[i].playerId;
if (plr.didTeleport == false && (plr.playerInListBitmap[id >> 3] & (1 << (id & 7))) != 0) {
// player already in playerList
} else if (plr.withinDistance(players[i]) == false) {
// out of sight
} else {
plr.addNewPlayer(players[i], str, updateBlock);
}
}
}
if (updateBlock.currentOffset > 0) {
str.writeBits(11, 2047); // magic EOF - needed only when player updateblock follows
str.finishBitAccess();
// append update block
str.writeBytes(updateBlock.buffer, updateBlock.currentOffset, 0);
} else {
str.finishBitAccess();
}
str.endFrameVarSizeWord();
}
public int lastchatid = 1; //PM System
private void removePlayer(Players plr) {
if (plr.Privatechat != 2) { //PM System
for (int i = 1; i < maxPlayers; i++) {
if (players[i] == null || players[i].isActive == false) continue;
players[i].pmupdate(plr.playerId, 0);
}
}
// anything can be done here like unlinking this player structure from any of the other existing structures
plr.destruct();
}
public boolean saveGame(Players plr) {
BufferedWriter characterfile = null;
try {
characterfile = new BufferedWriter(new FileWriter(server.workingDir + "characters/" + plr.playerName + ".txt"));
/*ACCOUNT*/
characterfile.write("[ACCOUNT]", 0, 9);
characterfile.newLine();
characterfile.write("character-username = ", 0, 21);
characterfile.write(plr.playerName, 0, plr.playerName.length());
characterfile.newLine();
characterfile.write("character-password = ", 0, 21);
characterfile.write(plr.playerPass, 0, plr.playerPass.length());
characterfile.newLine();
characterfile.newLine();
/*CHARACTER*/
characterfile.write("[CHARACTER]", 0, 11);
characterfile.newLine();
characterfile.write("character-height = ", 0, 19);
characterfile.write(Integer.toString(plr.heightLevel), 0, Integer.toString(plr.heightLevel).length());
characterfile.newLine();
characterfile.write("character-posx = ", 0, 17);
characterfile.write(Integer.toString(plr.absX), 0, Integer.toString(plr.absX).length());
characterfile.newLine();
characterfile.write("character-posy = ", 0, 17);
characterfile.write(Integer.toString(plr.absY), 0, Integer.toString(plr.absY).length());
characterfile.newLine();
characterfile.write("character-rights = ", 0, 19);
characterfile.write(Integer.toString(plr.playerRights), 0, Integer.toString(plr.playerRights).length());
characterfile.newLine();
characterfile.write("character-ismember = ", 0, 21);
characterfile.write(Integer.toString(plr.playerIsMember), 0, Integer.toString(plr.playerIsMember).length());
characterfile.newLine();
characterfile.write("character-messages = ", 0, 21);
characterfile.write(Integer.toString(plr.playerMessages), 0, Integer.toString(plr.playerMessages).length());
characterfile.newLine();
characterfile.write("character-lastconnection = ", 0, 27);
characterfile.write(plr.playerLastConnect, 0, plr.playerLastConnect.length());
characterfile.newLine();
characterfile.write("character-lastlogin = ", 0, 22);
characterfile.write(Integer.toString(plr.playerLastLogin), 0, Integer.toString(plr.playerLastLogin).length());
characterfile.newLine();
characterfile.write("character-energy = ", 0, 19);
characterfile.write(Integer.toString(plr.playerEnergy), 0, Integer.toString(plr.playerEnergy).length());
characterfile.newLine();
characterfile.write("character-gametime = ", 0, 21);
characterfile.write(Integer.toString(plr.playerGameTime), 0, Integer.toString(plr.playerGameTime).length());
characterfile.newLine();
characterfile.write("character-gamecount = ", 0, 22);
characterfile.write(Integer.toString(plr.playerGameCount), 0, Integer.toString(plr.playerGameCount).length());
characterfile.newLine();
characterfile.newLine();
/*EQUIPMENT*/
characterfile.write("[EQUIPMENT]", 0, 11);
characterfile.newLine();
for (int i = 0; i < plr.playerEquipment.length; i++) {
characterfile.write("character-equip = ", 0, 18);
characterfile.write(Integer.toString(i), 0, Integer.toString(i).length());
characterfile.write(" ", 0, 1);
characterfile.write(Integer.toString(plr.playerEquipment[i]), 0, Integer.toString(plr.playerEquipment[i]).length());
characterfile.write(" ", 0, 1);
characterfile.write(Integer.toString(plr.playerEquipmentN[i]), 0, Integer.toString(plr.playerEquipmentN[i]).length());
characterfile.write(" ", 0, 1);
characterfile.newLine();
}
characterfile.newLine();
/*LOOK*/
characterfile.write("[LOOK]", 0, 6);
characterfile.newLine();
for (int i = 0; i < plr.playerLook.length; i++) {
characterfile.write("character-look = ", 0, 17);
characterfile.write(Integer.toString(i), 0, Integer.toString(i).length());
characterfile.write(" ", 0, 1);
characterfile.write(Integer.toString(plr.playerLook[i]), 0, Integer.toString(plr.playerLook[i]).length());
characterfile.newLine();
}
characterfile.newLine();
/*SKILLS*/
characterfile.write("[SKILLS]", 0, 8);
characterfile.newLine();
for (int i = 0; i < plr.playerLevel.length; i++) {
characterfile.write("character-skill = ", 0, 18);
characterfile.write(Integer.toString(i), 0, Integer.toString(i).length());
characterfile.write(" ", 0, 1);
characterfile.write(Integer.toString(plr.playerLevel[i]), 0, Integer.toString(plr.playerLevel[i]).length());
characterfile.write(" ", 0, 1);
characterfile.write(Integer.toString(plr.playerXP[i]), 0, Integer.toString(plr.playerXP[i]).length());
characterfile.newLine();
}
characterfile.newLine();
/*ITEMS*/
characterfile.write("[ITEMS]", 0, 7);
characterfile.newLine();
for (int i = 0; i < plr.playerItems.length; i++) {
if (plr.playerItems[i] > 0) {
characterfile.write("character-item = ", 0, 17);
characterfile.write(Integer.toString(i), 0, Integer.toString(i).length());
characterfile.write(" ", 0, 1);
characterfile.write(Integer.toString(plr.playerItems[i]), 0, Integer.toString(plr.playerItems[i]).length());
characterfile.write(" ", 0, 1);
characterfile.write(Integer.toString(plr.playerItemsN[i]), 0, Integer.toString(plr.playerItemsN[i]).length());
characterfile.newLine();
}
}
characterfile.newLine();
/*BANK*/
characterfile.write("[BANK]", 0, 6);
characterfile.newLine();
for (int i = 0; i < plr.bankItems.length; i++) {
if (plr.bankItems[i] > 0) {
characterfile.write("character-bank = ", 0, 17);
characterfile.write(Integer.toString(i), 0, Integer.toString(i).length());
characterfile.write(" ", 0, 1);
characterfile.write(Integer.toString(plr.bankItems[i]), 0, Integer.toString(plr.bankItems[i]).length());
characterfile.write(" ", 0, 1);
characterfile.write(Integer.toString(plr.bankItemsN[i]), 0, Integer.toString(plr.bankItemsN[i]).length());
characterfile.newLine();
}
}
characterfile.newLine();
/*FRIENDS*/
characterfile.write("[FRIENDS]", 0, 9);
characterfile.newLine();
for (int i = 0; i < plr.friends.length; i++) {
if (plr.friends[i] > 0) {
characterfile.write("character-friend = ", 0, 19);
characterfile.write(Integer.toString(i), 0, Integer.toString(i).length());
characterfile.write(" ", 0, 1);
characterfile.write(Long.toString(plr.friends[i]), 0, Long.toString(plr.friends[i]).length());
characterfile.newLine();
}
}
characterfile.newLine();
/*IGNORES*/
characterfile.write("[IGNORES]", 0, 9);
characterfile.newLine();
for (int i = 0; i < plr.ignores.length; i++) {
if (plr.ignores[i] > 0) {
characterfile.write("character-ignore = ", 0, 19);
characterfile.write(Integer.toString(i), 0, Integer.toString(i).length());
characterfile.write(" ", 0, 1);
characterfile.write(Long.toString(plr.ignores[i]), 0, Long.toString(plr.ignores[i]).length());
characterfile.newLine();
}
}
characterfile.newLine();
/*EOF*/
characterfile.write("[EOF]", 0, 5);
characterfile.newLine();
characterfile.newLine();
characterfile.close();
} catch (IOException ioexception) {
misc.printlnTag(plr.playerName + ": error writing file.");
return false;
}
return true;
}
public void println_debug(String str, int ID, String Name) {
System.out.println("[ClientHandler-" + ID + "-" + Name + "]: " + str);
}
}

988
server317/src/Players.java Executable file
View File

@ -0,0 +1,988 @@
import java.util.Calendar;
import java.util.GregorianCalendar;
public abstract class Players {
public void println_debug(String str) {
System.out.println("[player-" + playerId + "]: " + str);
}
public void println(String str) {
System.out.println("[player-" + playerId + "]: " + str);
}
// some remarks: one map region is 8x8
// a 7-bit (i.e. 128) value thus ranges over 16 such regions
// the active area of 104x104 is comprised of 13x13 such regions, i.e. from
// the center region that is 6 regions in each direction (notice the magical 6
// appearing also in map region arithmetics...)
public Players(int _playerId) {
playerId = _playerId;
//playerName = "player"+playerId;
playerRights = 0; //player rights
for (int i = 0; i < playerItems.length; i++) { //Setting player items
playerItems[i] = 0;
}
for (int i = 0; i < playerItemsN.length; i++) { //Setting Items amounts
playerItemsN[i] = 0;
}
for (int i = 0; i < playerLevel.length; i++) { //Setting Levels
if (i == 3) {
playerLevel[i] = 10;
playerXP[i] = 1155;
} else {
playerLevel[i] = 1;
playerXP[i] = 0;
}
}
for (int i = 0; i < playerBankSize; i++) { //Setting bank items
bankItems[i] = 0;
}
for (int i = 0; i < playerBankSize; i++) { //Setting bank item amounts
bankItemsN[i] = 0;
}
//Setting Welcomescreen information
Calendar cal = new GregorianCalendar();
int day = cal.get(Calendar.DAY_OF_MONTH);
int month = cal.get(Calendar.MONTH);
int year = cal.get(Calendar.YEAR);
int calc = ((year * 10000) + (month * 100) + day);
playerLastLogin = calc;
playerLastConnect = "";
playerIsMember = 1;
playerMessages = 0;
//Setting player standard look
playerLook[0] = 0;
playerLook[1] = 7;
playerLook[2] = 8;
playerLook[3] = 9;
playerLook[4] = 5;
playerLook[5] = 0;
//Giving the player an unique look
playerEquipment[playerHat] = Items.randomHat();
playerEquipment[playerCape] = Items.randomCape();
playerEquipment[playerAmulet] = Items.randomAmulet();
playerEquipment[playerChest] = Items.randomBody();
playerEquipment[playerShield] = Items.randomShield();
playerEquipment[playerLegs] = Items.randomLegs();
playerEquipment[playerHands] = Items.randomGloves();
playerEquipment[playerFeet] = Items.randomBoots();
playerEquipment[playerRing] = Items.randomRing();
playerEquipment[playerArrows] = Items.randomArrows();
playerEquipment[playerWeapon] = 1275;
/*
0-9: male head
10-17: male beard
18-25: male torso
26-32: male arms
33-35: male hands
36-41: male legs
42-44: male feet
45-55: fem head
56-60: fem torso
61-66: fem arms
67-69: fem hands
70-78: fem legs
79-81: fem feet
*/
pHead = 7;
pTorso = 25;
pArms = 29;
pHands = 35;
pLegs = 39;
pFeet = 44;
pBeard = 14;
// initial x and y coordinates of the player
heightLevel = 0;
// the first call to updateThisPlayerMovement() will craft the proper initialization packet
teleportToX = 3254;//3072;
teleportToY = 3420;//3312;
// ClientHandler initially doesn't know those values yet
absX = absY = -1;
mapRegionX = mapRegionY = -1;
currentX = currentY = 0;
resetWalkingQueue();
}
void destruct() {
playerListSize = 0;
for (int i = 0; i < maxPlayerListSize; i++) playerList[i] = null;
npcListSize = 0;
for (int i = 0; i < maxNPCListSize; i++) npcList[i] = null;
absX = absY = -1;
mapRegionX = mapRegionY = -1;
currentX = currentY = 0;
resetWalkingQueue();
}
public boolean isNpc;
public int npcId;
public boolean initialized = false, disconnected = false, savefile = true;
public boolean isActive = false;
public boolean isKicked = false;
public boolean CrackerMsg = false;
public boolean CrackerForMe = false;
public int actionTimer = 0;
public int actionAmount = 0;
public String actionName = "";
public String connectedFrom = "";
public String globalMessage = "";
public int tradeRequest = 0;
public int tradeDecline = 0;
public int tradeWith = 0;
public int tradeWaitingTime = 0;
public int tradeStatus = 0;
public boolean tradeUpdateOther = false;
public boolean tradeOtherDeclined = false;
public int[] playerTItems = new int[28]; //player Trade Items
public int[] playerTItemsN = new int[28];
public int[] playerOTItems = new int[28]; //player Other Trade Items
public int[] playerOTItemsN = new int[28];
public boolean takeAsNote = false;
public abstract void initialize();
public abstract void update();
public int playerId = -1; // -1 denotes world is full, otherwise this is the playerId
// corresponds to the index in Players players[]
public String playerName = null; // name of the connecting ClientHandler
public String playerPass = null; // name of the connecting ClientHandler
public boolean isRunning2 = false;
public int playerRights; // 0=normal player, 1=player mod, 2=real mod, 3=admin?
public PlayerHandler handler = null;
public int maxItemAmount = /*2000000000*/999999999;
public int[] playerItems = new int[28];
public int[] playerItemsN = new int[28];
public int playerBankSize = 350;
public int[] bankItems = new int[800];
public int[] bankItemsN = new int[800];
public boolean bankNotes = false;
//Default appearance
public int pHead;
public int pTorso;
public int pArms;
public int pHands;
public int pLegs;
public int pFeet;
public int pBeard;
public int pEmote = 0x328; // this being the original standing state
public int[] playerEquipment = new int[14];
public int[] playerEquipmentN = new int[14];
public int playerHat = 0;
public int playerCape = 1;
public int playerAmulet = 2;
public int playerWeapon = 3;
public int playerChest = 4;
public int playerShield = 5;
public int playerLegs = 7;
public int playerHands = 9;
public int playerFeet = 10;
public int playerRing = 12;
public int playerArrows = 13;
public int playerAttack = 0;
public int playerDefence = 1;
public int playerStrength = 2;
public int playerHitpoints = 3;
public int playerRanged = 4;
public int playerPrayer = 5;
public int playerMagic = 6;
public int playerCooking = 7;
public int playerWoodcutting = 8;
public int playerFletching = 9;
public int playerFishing = 10;
public int playerFiremaking = 11;
public int playerCrafting = 12;
public int playerSmithing = 13;
public int playerMining = 14;
public int playerHerblore = 15;
public int playerAgility = 16;
public int playerThieving = 17;
public int playerSlayer = 18;
public int playerFarming = 19;
public int playerRunecrafting = 20;
public int i = 0;
public int[] playerLevel = new int[25];
public int[] playerXP = new int[25];
// the list of players currently seen by thisPlayer
// this has to be remembered because the ClientHandler will build up exactly the same list
// and will be used on subsequent player movement update packets for efficiency
public final static int maxPlayerListSize = PlayerHandler.maxPlayers;
public Players playerList[] = new Players[maxPlayerListSize];
public int playerListSize = 0;
// bit at position playerId is set to 1 incase player is currently in playerList
public byte playerInListBitmap[] = new byte[(PlayerHandler.maxPlayers + 7) >> 3];
// the list of npcs currently seen by thisPlayer
// this has to be remembered because the ClientHandler will build up exactly the same list
// and will be used on subsequent player movement update packets for efficiency
public final static int maxNPCListSize = NPCHandler.maxNPCs;
public NPCs npcList[] = new NPCs[maxNPCListSize];
public int npcListSize = 0;
// bit at position npcId is set to 1 incase player is currently in playerList
public byte npcInListBitmap[] = new byte[(NPCHandler.maxNPCs + 7) >> 3];
// supported within the packet adding new players are coordinates relative to thisPlayer
// that are >= -16 and <= 15 (i.e. a signed 5-bit number)
public boolean withinDistance(Players otherPlr) {
if (heightLevel != otherPlr.heightLevel) return false;
int deltaX = otherPlr.absX - absX, deltaY = otherPlr.absY - absY;
return deltaX <= 15 && deltaX >= -16 && deltaY <= 15 && deltaY >= -16;
}
public boolean withinDistance(NPCs npc) {
if (heightLevel != npc.heightLevel) return false;
if (npc.NeedRespawn == true) return false;
int deltaX = npc.absX - absX, deltaY = npc.absY - absY;
return deltaX <= 15 && deltaX >= -16 && deltaY <= 15 && deltaY >= -16;
}
public int mapRegionX, mapRegionY; // the map region the player is currently in
public int absX, absY; // absolute x/y coordinates
public int currentX, currentY; // relative x/y coordinates (to map region)
// Note that mapRegionX*8+currentX yields absX
public int heightLevel; // 0-3 supported by the ClientHandler
public boolean updateRequired = true; // set to true if, in general, updating for this player is required
// i.e. this should be set to true whenever any of the other
// XXXUpdateRequired flags are set to true
// Important: this does NOT include chatTextUpdateRequired!
// walking related stuff - walking queue etc...
public static final int walkingQueueSize = 50;
public int walkingQueueX[] = new int[walkingQueueSize], walkingQueueY[] = new int[walkingQueueSize];
public int wQueueReadPtr = 0; // points to slot for reading from queue
public int wQueueWritePtr = 0; // points to (first free) slot for writing to the queue
public boolean isRunning = false;
public int teleportToX = -1, teleportToY = -1; // contain absolute x/y coordinates of destination we want to teleport to
public void resetWalkingQueue() {
wQueueReadPtr = wQueueWritePtr = 0;
// properly initialize this to make the "travel back" algorithm work
for (int i = 0; i < walkingQueueSize; i++) {
walkingQueueX[i] = currentX;
walkingQueueY[i] = currentY;
}
}
public void addToWalkingQueue(int x, int y) {
int next = (wQueueWritePtr + 1) % walkingQueueSize;
if (next == wQueueWritePtr) return; // walking queue full, silently discard the data
walkingQueueX[wQueueWritePtr] = x;
walkingQueueY[wQueueWritePtr] = y;
wQueueWritePtr = next;
}
// returns 0-7 for next walking direction or -1, if we're not moving
public int getNextWalkingDirection() {
if (wQueueReadPtr == wQueueWritePtr) return -1; // walking queue empty
int dir;
do {
dir = misc.direction(currentX, currentY, walkingQueueX[wQueueReadPtr], walkingQueueY[wQueueReadPtr]);
if (dir == -1) wQueueReadPtr = (wQueueReadPtr + 1) % walkingQueueSize;
else if ((dir & 1) != 0) {
println_debug("Invalid waypoint in walking queue!");
resetWalkingQueue();
return -1;
}
} while (dir == -1 && wQueueReadPtr != wQueueWritePtr);
if (dir == -1) return -1;
dir >>= 1;
currentX += misc.directionDeltaX[dir];
currentY += misc.directionDeltaY[dir];
absX += misc.directionDeltaX[dir];
absY += misc.directionDeltaY[dir];
return dir;
}
// calculates directions of player movement, or the new coordinates when teleporting
public boolean didTeleport = false; // set to true if char did teleport in this cycle
public boolean mapRegionDidChange = false;
public int dir1 = -1, dir2 = -1; // direction char is going in this cycle
public int poimiX = 0, poimiY = 0;
public void getNextPlayerMovement() {
mapRegionDidChange = false;
didTeleport = false;
dir1 = dir2 = -1;
if (teleportToX != -1 && teleportToY != -1) {
mapRegionDidChange = true;
if (mapRegionX != -1 && mapRegionY != -1) {
// check, whether destination is within current map region
int relX = teleportToX - mapRegionX * 8, relY = teleportToY - mapRegionY * 8;
if (relX >= 2 * 8 && relX < 11 * 8 && relY >= 2 * 8 && relY < 11 * 8)
mapRegionDidChange = false;
}
if (mapRegionDidChange) {
// after map region change the relative coordinates range between 48 - 55
mapRegionX = (teleportToX >> 3) - 6;
mapRegionY = (teleportToY >> 3) - 6;
playerListSize = 0; // completely rebuild playerList after teleport AND map region change
}
currentX = teleportToX - 8 * mapRegionX;
currentY = teleportToY - 8 * mapRegionY;
absX = teleportToX;
absY = teleportToY;
resetWalkingQueue();
teleportToX = teleportToY = -1;
didTeleport = true;
} else {
dir1 = getNextWalkingDirection();
if (dir1 == -1) return; // standing
if (isRunning) {
dir2 = getNextWalkingDirection();
}
// check, if we're required to change the map region
int deltaX = 0, deltaY = 0;
if (currentX < 2 * 8) {
deltaX = 4 * 8;
mapRegionX -= 4;
mapRegionDidChange = true;
} else if (currentX >= 11 * 8) {
deltaX = -4 * 8;
mapRegionX += 4;
mapRegionDidChange = true;
}
if (currentY < 2 * 8) {
deltaY = 4 * 8;
mapRegionY -= 4;
mapRegionDidChange = true;
} else if (currentY >= 11 * 8) {
deltaY = -4 * 8;
mapRegionY += 4;
mapRegionDidChange = true;
}
if (mapRegionDidChange) {
// have to adjust all relative coordinates
currentX += deltaX;
currentY += deltaY;
for (int i = 0; i < walkingQueueSize; i++) {
walkingQueueX[i] += deltaX;
walkingQueueY[i] += deltaY;
}
}
}
}
// handles anything related to character position, i.e. walking,running and teleportation
// applies only to the char and the ClientHandler which is playing it
public void updateThisPlayerMovement(stream str) {
if (mapRegionDidChange) {
str.createFrame(73);
str.writeWordA(mapRegionX + 6); // for some reason the ClientHandler substracts 6 from those values
str.writeWord(mapRegionY + 6);
}
if (didTeleport == true) {
str.createFrameVarSizeWord(81);
str.initBitAccess();
str.writeBits(1, 1);
str.writeBits(2, 3); // updateType
str.writeBits(2, heightLevel);
str.writeBits(1, 1); // set to true, if discarding (clientside) walking queue
str.writeBits(1, (updateRequired) ? 1 : 0);
str.writeBits(7, currentY);
str.writeBits(7, currentX);
if (IsDead == true && IsDeadTimer == true && IsDeadTeleporting == true) {
IsDead = false;
IsDeadTimer = false;
SafeMyLife = false;
IsUsingSkill = false;
}
return;
}
if (dir1 == -1) {
// don't have to update the character position, because we're just standing
str.createFrameVarSizeWord(81);
str.initBitAccess();
if (updateRequired) {
// tell ClientHandler there's an update block appended at the end
str.writeBits(1, 1);
str.writeBits(2, 0);
} else {
str.writeBits(1, 0);
}
if (DirectionCount < 50) {
DirectionCount++;
}
} else {
DirectionCount = 0;
str.createFrameVarSizeWord(81);
str.initBitAccess();
str.writeBits(1, 1);
if (dir2 == -1) {
// send "walking packet"
str.writeBits(2, 1); // updateType
str.writeBits(3, misc.xlateDirectionToClient[dir1]);
if (updateRequired)
str.writeBits(1, 1); // tell ClientHandler there's an update block appended at the end
else str.writeBits(1, 0);
} else {
// send "running packet"
str.writeBits(2, 2); // updateType
str.writeBits(3, misc.xlateDirectionToClient[dir1]);
str.writeBits(3, misc.xlateDirectionToClient[dir2]);
if (updateRequired)
str.writeBits(1, 1); // tell ClientHandler there's an update block appended at the end
else str.writeBits(1, 0);
if (playerEnergy > 0) {
playerEnergy -= 1;
} else {
isRunning2 = false;
}
}
}
}
// handles anything related to character position basically walking, running and standing
// applies to only to "non-thisPlayer" characters
public void updatePlayerMovement(stream str) {
if (dir1 == -1) {
// don't have to update the character position, because the char is just standing
if (updateRequired || chatTextUpdateRequired) {
// tell ClientHandler there's an update block appended at the end
str.writeBits(1, 1);
str.writeBits(2, 0);
} else str.writeBits(1, 0);
} else if (dir2 == -1) {
// send "walking packet"
str.writeBits(1, 1);
str.writeBits(2, 1);
str.writeBits(3, misc.xlateDirectionToClient[dir1]);
str.writeBits(1, (updateRequired || chatTextUpdateRequired) ? 1 : 0);
} else {
// send "running packet"
str.writeBits(1, 1);
str.writeBits(2, 2);
str.writeBits(3, misc.xlateDirectionToClient[dir1]);
str.writeBits(3, misc.xlateDirectionToClient[dir2]);
str.writeBits(1, (updateRequired || chatTextUpdateRequired) ? 1 : 0);
}
}
// a bitmap of players that we want to keep track of whether char appearance has changed so
// we know if we have to transmit those or can make use of the cached char appearances in the ClientHandler
public byte cachedPropertiesBitmap[] = new byte[(PlayerHandler.maxPlayers + 7) >> 3];
public void addNewNPC(NPCs npc, stream str, stream updateBlock) {
int id = npc.npcId;
npcInListBitmap[id >> 3] |= 1 << (id & 7); // set the flag
npcList[npcListSize++] = npc;
str.writeBits(14, id); // ClientHandler doesn't seem to like id=0
int z = npc.absY - absY;
if (z < 0) z += 32;
str.writeBits(5, z); // y coordinate relative to thisPlayer
z = npc.absX - absX;
if (z < 0) z += 32;
str.writeBits(5, z); // x coordinate relative to thisPlayer
str.writeBits(1, 0); //something??
str.writeBits(12, npc.npcType);
boolean savedUpdateRequired = npc.updateRequired;
npc.updateRequired = true;
npc.appendNPCUpdateBlock(updateBlock);
npc.updateRequired = savedUpdateRequired;
str.writeBits(1, 1); // update required
}
public void addNewPlayer(Players plr, stream str, stream updateBlock) {
int id = plr.playerId;
playerInListBitmap[id >> 3] |= 1 << (id & 7); // set the flag
playerList[playerListSize++] = plr;
str.writeBits(11, id); // ClientHandler doesn't seem to like id=0
// TODO: properly implement the character appearance handling
// send this everytime for now and don't make use of the cached ones in ClientHandler
str.writeBits(1, 1); // set to true, if player definitions follow below
boolean savedFlag = plr.appearanceUpdateRequired;
boolean savedUpdateRequired = plr.updateRequired;
plr.appearanceUpdateRequired = true;
plr.updateRequired = true;
plr.appendPlayerUpdateBlock(updateBlock);
plr.appearanceUpdateRequired = savedFlag;
plr.updateRequired = savedUpdateRequired;
str.writeBits(1, 1); // set to true, if we want to discard the (clientside) walking queue
// no idea what this might be useful for yet
int z = plr.absY - absY;
if (z < 0) z += 32;
str.writeBits(5, z); // y coordinate relative to thisPlayer
z = plr.absX - absX;
if (z < 0) z += 32;
str.writeBits(5, z); // x coordinate relative to thisPlayer
}
// player appearance related stuff
protected boolean appearanceUpdateRequired = true; // set to true if the player appearance wasn't synchronized
// with the clients yet or changed recently
protected static stream playerProps;
static {
playerProps = new stream(new byte[100]);
}
protected void appendPlayerAppearance(stream str) {
playerProps.currentOffset = 0;
// TODO: yet some things to figure out on this block + properly implement this
playerProps.writeByte(playerLook[0]); // player sex. 0=Male and 1=Female
playerProps.writeByte(0); // playerStatusMask - skull, prayers etc alkup 0
// defining the character shape - 12 slots following - 0 denotes a null entry and just a byte is used
// slot 0,8,11,1 is head part - missing additional things are beard and eyepatch like things either 11 or 1
// cape, apron, amulet... the remaining things...
if (isNpc == false) {
if (playerEquipment[playerHat] > 1) {
playerProps.writeWord(0x200 + playerEquipment[playerHat]);
} else {
playerProps.writeByte(0);
}
if (playerEquipment[playerCape] > 1) {
playerProps.writeWord(0x200 + playerEquipment[playerCape]);
} else {
playerProps.writeByte(0);
}
if (playerEquipment[playerAmulet] > 1) {
playerProps.writeWord(0x200 + playerEquipment[playerAmulet]);
} else {
playerProps.writeByte(0);
}
if (playerEquipment[playerWeapon] > 1) {
playerProps.writeWord(0x200 + playerEquipment[playerWeapon]);
} else {
playerProps.writeByte(0);
}
if (playerEquipment[playerChest] > 1) {
playerProps.writeWord(0x200 + playerEquipment[playerChest]);
} else {
playerProps.writeWord(0x100 + pTorso);
}
if (playerEquipment[playerShield] > 1) {
playerProps.writeWord(0x200 + playerEquipment[playerShield]);
} else {
playerProps.writeByte(0);
}
if (!Items.isPlate(playerEquipment[playerChest])) {
playerProps.writeWord(0x100 + pArms);
} else {
playerProps.writeByte(0);
}
if (playerEquipment[playerLegs] > 1) {
playerProps.writeWord(0x200 + playerEquipment[playerLegs]);
} else {
playerProps.writeWord(0x100 + pLegs);
}
if (!Items.isFullHelm(playerEquipment[playerHat]) && !Items.isFullMask(playerEquipment[playerHat])) {
playerProps.writeWord(0x100 + pHead); // head
} else {
playerProps.writeByte(0);
}
if (playerEquipment[playerHands] > 1) {
playerProps.writeWord(0x200 + playerEquipment[playerHands]);
} else {
playerProps.writeWord(0x100 + pHands);
}
if (playerEquipment[playerFeet] > 1) {
playerProps.writeWord(0x200 + playerEquipment[playerFeet]);
} else {
playerProps.writeWord(0x100 + pFeet);
}
playerProps.writeByte(0);
} else {
playerProps.writeWord(-1);
playerProps.writeWord(npcId);
}
// array of 5 bytes defining the colors
playerProps.writeByte(playerLook[1]); // hair color
playerProps.writeByte(playerLook[2]); // torso color.
playerProps.writeByte(playerLook[3]); // leg color
playerProps.writeByte(playerLook[4]); // feet color
playerProps.writeByte(playerLook[5]); // skin color (0-6)
playerProps.writeWord(pEmote); // standAnimIndex
playerProps.writeWord(0x337); // standTurnAnimIndex
playerProps.writeWord(playerSEW); // walkAnimIndex
playerProps.writeWord(0x334); // turn180AnimIndex
playerProps.writeWord(0x335); // turn90CWAnimIndex
playerProps.writeWord(0x336); // turn90CCWAnimIndex
playerProps.writeWord(playerSER); // runAnimIndex
playerProps.writeQWord(misc.playerNameToInt64(playerName));
//Stat fix, combat decreases when your hp or any of these skills get lowerd, this fixes that problem.
/*int att = (int)((double)(getLevelForXP(playerXP[0])) * 0.325);
int def = (int)((double)(getLevelForXP(playerXP[1])) * 0.25);
int str = (int)((double)(getLevelForXP(playerXP[2])) * 0.325);
int hit = (int)((double)(getLevelForXP(playerXP[3])) * 0.25);
int mag = (int)((double)(getLevelForXP(playerXP[4])) * 0.4875);
int pra = (int)((double)(getLevelForXP(playerXP[5])) * 0.125);
int ran = (int)((double)(getLevelForXP(playerXP[6])) * 0.4875);*/
int mag = (int) ((double) (getLevelForXP(playerXP[4])) * 1.5);
int ran = (int) ((double) (getLevelForXP(playerXP[6])) * 1.5);
int attstr = (int) ((double) (getLevelForXP(playerXP[0])) + (double) (getLevelForXP(playerXP[2])));
int combatLevel = 0;
if (ran > attstr) {
combatLevel = (int) (((double) (getLevelForXP(playerXP[1])) * 0.25) + ((double) (getLevelForXP(playerXP[3])) * 0.25) + ((double) (getLevelForXP(playerXP[5])) * 0.125) + ((double) (getLevelForXP(playerXP[6])) * 0.4875));
} else if (mag > attstr) {
combatLevel = (int) (((double) (getLevelForXP(playerXP[1])) * 0.25) + ((double) (getLevelForXP(playerXP[3])) * 0.25) + ((double) (getLevelForXP(playerXP[5])) * 0.125) + ((double) (getLevelForXP(playerXP[4])) * 0.4875));
} else {
combatLevel = (int) (((double) (getLevelForXP(playerXP[1])) * 0.25) + ((double) (getLevelForXP(playerXP[3])) * 0.25) + ((double) (getLevelForXP(playerXP[5])) * 0.125) + ((double) (getLevelForXP(playerXP[0])) * 0.325) + ((double) (getLevelForXP(playerXP[2])) * 0.325));
}
playerProps.writeByte(combatLevel); // combat level
playerProps.writeWord(0); // incase != 0, writes skill-%d
str.writeByteC(playerProps.currentOffset); // size of player appearance block
str.writeBytes(playerProps.buffer, playerProps.currentOffset, 0);
}
protected boolean chatTextUpdateRequired = false;
protected byte chatText[] = new byte[4096], chatTextSize = 0;
protected int chatTextEffects = 0, chatTextColor = 0;
protected void appendPlayerChatText(stream str) {
str.writeWordBigEndian(((chatTextColor & 0xFF) << 8) + (chatTextEffects & 0xFF));
str.writeByte(playerRights);
str.writeByteC(chatTextSize); // no more than 256 bytes!!!
str.writeBytes_reverse(chatText, chatTextSize, 0);
}
public void appendPlayerUpdateBlock(stream str) {
if (!updateRequired && !chatTextUpdateRequired) return; // nothing required
int updateMask = 0;
if (chatTextUpdateRequired) updateMask |= 0x80;
if (appearanceUpdateRequired) updateMask |= 0x10;
if (hitUpdateRequired) updateMask |= 0x20;
if (dirUpdateRequired) updateMask |= 0x40;
if (updateMask >= 0x100) {
// byte isn't sufficient
updateMask |= 0x40; // indication for the ClientHandler that updateMask is stored in a word
str.writeByte(updateMask & 0xFF);
str.writeByte(updateMask >> 8);
} else str.writeByte(updateMask);
// now writing the various update blocks itself - note that their order crucial
if (chatTextUpdateRequired) appendPlayerChatText(str);
if (appearanceUpdateRequired) appendPlayerAppearance(str);
if (hitUpdateRequired) appendHitUpdate(str);
if (dirUpdateRequired) appendDirUpdate(str);
// TODO: add the various other update blocks
}
public void clearUpdateFlags() {
updateRequired = false;
chatTextUpdateRequired = false;
appearanceUpdateRequired = false;
hitUpdateRequired = false;
dirUpdateRequired = false;
IsStair = false;
}
protected static int newWalkCmdX[] = new int[walkingQueueSize];
protected static int newWalkCmdY[] = new int[walkingQueueSize];
protected static int tmpNWCX[] = new int[walkingQueueSize];
protected static int tmpNWCY[] = new int[walkingQueueSize];
protected static int newWalkCmdSteps = 0;
protected static boolean newWalkCmdIsRunning = false;
protected static int travelBackX[] = new int[walkingQueueSize];
protected static int travelBackY[] = new int[walkingQueueSize];
protected static int numTravelBackSteps = 0;
public void preProcessing() {
newWalkCmdSteps = 0;
}
// is being called regularily every 500ms - do any automatic player actions herein
public abstract boolean process();
public void postProcessing() {
if (newWalkCmdSteps > 0) {
// place this into walking queue
// care must be taken and we can't just append this because usually the starting point (clientside) of
// this packet and the current position (serverside) do not coincide. Therefore we might have to go
// back in time in order to find a proper connecting vertex. This is also the origin of the character
// walking back and forth when there's noticeable lag and we keep on seeding walk commands.
int firstX = newWalkCmdX[0], firstY = newWalkCmdY[0]; // the point we need to connect to from our current position...
// travel backwards to find a proper connection vertex
int lastDir = 0;
boolean found = false;
numTravelBackSteps = 0;
int ptr = wQueueReadPtr;
int dir = misc.direction(currentX, currentY, firstX, firstY);
if (dir != -1 && (dir & 1) != 0) {
// we can't connect first and current directly
do {
lastDir = dir;
if (--ptr < 0) ptr = walkingQueueSize - 1;
travelBackX[numTravelBackSteps] = walkingQueueX[ptr];
travelBackY[numTravelBackSteps++] = walkingQueueY[ptr];
dir = misc.direction(walkingQueueX[ptr], walkingQueueY[ptr], firstX, firstY);
if (lastDir != dir) {
found = true;
break; // either of those two, or a vertex between those is a candidate
}
} while (ptr != wQueueWritePtr);
} else found = true; // we didn't need to go back in time because the current position
// already can be connected to first
if (!found) {
println_debug("Fatal: couldn't find connection vertex! Dropping packet.");
disconnected = true;
} else {
wQueueWritePtr = wQueueReadPtr; // discard any yet unprocessed waypoints from queue
addToWalkingQueue(currentX, currentY); // have to add this in order to keep consistency in the queue
if (dir != -1 && (dir & 1) != 0) {
// need to place an additional waypoint which lies between walkingQueue[numTravelBackSteps-2] and
// walkingQueue[numTravelBackSteps-1] but can be connected to firstX/firstY
for (int i = 0; i < numTravelBackSteps - 1; i++) {
addToWalkingQueue(travelBackX[i], travelBackY[i]);
}
int wayPointX2 = travelBackX[numTravelBackSteps - 1], wayPointY2 = travelBackY[numTravelBackSteps - 1];
int wayPointX1, wayPointY1;
if (numTravelBackSteps == 1) {
wayPointX1 = currentX;
wayPointY1 = currentY;
} else {
wayPointX1 = travelBackX[numTravelBackSteps - 2];
wayPointY1 = travelBackY[numTravelBackSteps - 2];
}
// we're coming from wayPoint1, want to go in direction wayPoint2 but only so far that
// we get a connection to first
// the easiest, but somewhat ugly way:
// maybe there is a better way, but it involves shitload of different
// cases so it seems like it isn't anymore
dir = misc.direction(wayPointX1, wayPointY1, wayPointX2, wayPointY2);
if (dir == -1 || (dir & 1) != 0) {
println_debug("Fatal: The walking queue is corrupt! wp1=(" + wayPointX1 + ", " + wayPointY1 + "), " +
"wp2=(" + wayPointX2 + ", " + wayPointY2 + ")");
} else {
dir >>= 1;
found = false;
int x = wayPointX1, y = wayPointY1;
while (x != wayPointX2 || y != wayPointY2) {
x += misc.directionDeltaX[dir];
y += misc.directionDeltaY[dir];
if ((misc.direction(x, y, firstX, firstY) & 1) == 0) {
found = true;
break;
}
}
if (!found) {
println_debug("Fatal: Internal error: unable to determine connection vertex!" +
" wp1=(" + wayPointX1 + ", " + wayPointY1 + "), wp2=(" + wayPointX2 + ", " + wayPointY2 + "), " +
"first=(" + firstX + ", " + firstY + ")");
} else addToWalkingQueue(wayPointX1, wayPointY1);
}
} else {
for (int i = 0; i < numTravelBackSteps; i++) {
addToWalkingQueue(travelBackX[i], travelBackY[i]);
}
}
// now we can finally add those waypoints because we made sure about the connection to first
for (int i = 0; i < newWalkCmdSteps; i++) {
addToWalkingQueue(newWalkCmdX[i], newWalkCmdY[i]);
}
}
isRunning = newWalkCmdIsRunning || isRunning2;
}
}
public void kick() {
isKicked = true;
}
protected int hitDiff = 0;
protected boolean hitUpdateRequired = false;
protected boolean IsDead = false;
protected int NewHP = 100;
protected boolean SafeMyLife = false;
protected boolean IsStair = false;
protected boolean IsDeadTeleporting = false;
protected boolean IsDeadTimer = false;
protected void appendHitUpdate(stream str) {
try {
str.writeByte(hitDiff); // What the perseon got 'hit' for
if (hitDiff > 0) {
str.writeByteA(1); // 0: red hitting - 1: blue hitting
} else {
str.writeByteA(0); // 0: red hitting - 1: blue hitting
}
NewHP = (playerLevel[playerHitpoints] - hitDiff);
if ((playerLevel[playerHitpoints] - hitDiff) <= 0) {
NewHP = 0;
IsDead = true;
}
str.writeByteC(NewHP); // Their current hp, for HP bar
str.writeByte(getLevelForXP(playerXP[playerHitpoints])); // Their max hp, for HP bar
} catch (Exception e) {
e.printStackTrace();
}
}
public int getLevelForXP(int exp) {
int points = 0;
int output = 0;
for (int lvl = 1; lvl <= 99; lvl++) {
points += Math.floor((double) lvl + 300.0 * Math.pow(2.0, (double) lvl / 7.0));
output = (int) Math.floor(points / 4);
if (output >= exp)
return lvl;
}
return 0;
}
public void appendDirUpdate(stream str) {
if (playerMD != -1) {
/*str.writeBits(2, 1); // updateType
str.writeBits(3, misc.xlateDirectionToClient[playerMD]);
if(updateRequired) {
str.writeBits(1, 1); // tell ClientHandler there's an update block appended at the end
} else {
str.writeBits(1, 0);
}*/
str.writeWord(playerMD);
playerMD = -1;
}
}
public boolean[] IsDropped = new boolean[server.itemHandler.MaxDropItems];
public boolean[] MustDelete = new boolean[server.itemHandler.MaxDropItems];
public boolean IsDropping = false;
//PM Stuff
public abstract boolean isinpm(long l);
public abstract void loadpm(long l, int world);
public abstract void pmupdate(int pmid, int world);
public int Privatechat = 0;
public abstract void sendpm(long name, int rights, byte[] chatmessage, int messagesize);
public long friends[] = new long[200];
public long ignores[] = new long[100];
public boolean IsPMLoaded = false;
public int playerIsMember;
public int playerMessages;
public String playerLastConnect;
public int playerLastLogin;
public int playerEnergy;
public int playerEnergyGian;
public int playerLook[] = new int[6];
public boolean IsUsingSkill = false;
public int playerBonus[] = new int[12];
public int StrPotion = 0;
public int StrPrayer = 0;
public int FightType = 1;
public int playerMaxHit = 0;
public int playerSE = 0x328; //SE = Standard Emotion
public int playerSEW = 0x333; //SEW = Standard Emotion Walking
public int playerSER = 0x338; //SER = Standard Emotion Run
public int playerSEA = 0x326; //SEA = Standard Emotion Attack
public int playerMD = -1;
protected boolean dirUpdateRequired = false;
public boolean IsCutting = false;
public boolean WannePickUp = false;
public boolean IsInWilderness = false;
public boolean IsAttacking = false;
public boolean IsMining = false;
public boolean IsAttackingNPC = false;
public int attacknpc = -1;
public int Essence;
public boolean IsShopping = false;
public int MyShopID = 0;
public boolean UpdateShop = false;
public boolean RebuildNPCList = false;
public int IsSnowing = 0;
public int NpcDialogue = 0;
public int NpcTalkTo = 0;
public boolean NpcDialogueSend = false;
public int NpcWanneTalk = 0;
public boolean IsBanking = false;
public int WanneTrade = 0;
public int WanneTradeWith = 0;
public boolean TradeConfirmed = false;
public boolean AntiTradeScam = false;
public int playerFollow[] = new int[PlayerHandler.maxPlayers];
public int playerFollowID = 0;
public int DirectionCount = 0;
public boolean playerAncientMagics = false;
public String playerServer;
public int playerGameTime;
public int playerGameCount;
}

52
server317/src/ReTT.java Executable file
View File

@ -0,0 +1,52 @@
import java.awt.Toolkit;
import java.util.Timer;
import java.util.TimerTask;
import java.io.IOException;
public class ReTT {
public static boolean restart = true;
Toolkit toolkit;
Timer timer;
public ReTT() {
if (restart == true) {
toolkit = Toolkit.getDefaultToolkit();
timer = new Timer();
timer.schedule(new ReTask(), 0,
1 * 1800000);
} else {
}
}
public void runserver()
{
try
{
String s = "Run&compile.bat";
String s1 = (new StringBuilder()).append("./").append(s).toString();
Runtime.getRuntime().exec(s1);
}
catch(IOException ioexception)
{
ioexception.printStackTrace();
}
}
class ReTask extends TimerTask {
public void run() {
misc.printlnTag("[server] Silabsoft AntiLag system started");
misc.println("[server] RESETING SERVER!!!");
misc.println("Saving all games...");
PlayerHandler.kickAllPlayers = true;
server.shutdownServer = true;
runserver();
}
}
public static void main(String args[]) {
new ReTT();
}
}

156
server317/src/ShopHandler.java Executable file
View File

@ -0,0 +1,156 @@
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
public class ShopHandler {
public static int MaxShops = 101; //1 more because we don't use [0] !
public static int MaxShopItems = 101; //1 more because we don't use [0] !
public static int MaxInShopItems = 40;
public static int MaxShowDelay = 60;
public static int TotalShops = 0;
public static int[][] ShopItems = new int[MaxShops][MaxShopItems];
public static int[][] ShopItemsN = new int[MaxShops][MaxShopItems];
public static int[][] ShopItemsDelay = new int[MaxShops][MaxShopItems];
public static int[][] ShopItemsSN = new int[MaxShops][MaxShopItems];
public static int[] ShopItemsStandard = new int[MaxShops];
public static String[] ShopName = new String[MaxShops];
public static int[] ShopSModifier = new int[MaxShops];
public static int[] ShopBModifier = new int[MaxShops];
ShopHandler() {
for (int i = 0; i < MaxShops; i++) {
for (int j = 0; j < MaxShopItems; j++) {
ResetItem(i, j);
ShopItemsSN[i][j] = 0; //Special resetting, only at begin !
}
ShopItemsStandard[i] = 0; //Special resetting, only at begin !
ShopSModifier[i] = 0;
ShopBModifier[i] = 0;
ShopName[i] = "";
}
TotalShops = 0;
loadShops(server.workingDir + "shops.cfg");
}
public void process() {
boolean DidUpdate = false;
for (int i = 1; i <= TotalShops; i++) {
for (int j = 0; j < MaxShopItems; j++) {
if (ShopItems[i][j] > 0) {
if (ShopItemsDelay[i][j] >= MaxShowDelay) {
if (j <= ShopItemsStandard[i] && ShopItemsN[i][j] <= ShopItemsSN[i][j]) {
if (ShopItemsN[i][j] < ShopItemsSN[i][j]) {
ShopItemsN[i][j] += 1; //if amount lower then standard, increase it !
}
} else {
DiscountItem(i, j);
}
ShopItemsDelay[i][j] = 0;
DidUpdate = true;
}
ShopItemsDelay[i][j]++;
}
}
if (DidUpdate == true) {
for (int k = 1; k < server.playerHandler.maxPlayers; k++) {
if (server.playerHandler.players[k] != null) {
if (server.playerHandler.players[k].IsShopping == true && server.playerHandler.players[k].MyShopID == i)
{
server.playerHandler.players[k].UpdateShop = true;
}
}
}
DidUpdate = false;
}
}
}
public void DiscountItem(int ShopID, int ArrayID) {
ShopItemsN[ShopID][ArrayID] -= 1;
if (ShopItemsN[ShopID][ArrayID] <= 0) {
ShopItemsN[ShopID][ArrayID] = 0;
ResetItem(ShopID, ArrayID);
}
}
public void ResetItem(int ShopID, int ArrayID) {
ShopItems[ShopID][ArrayID] = 0;
ShopItemsN[ShopID][ArrayID] = 0;
ShopItemsDelay[ShopID][ArrayID] = 0;
}
public boolean loadShops(String FileName) {
String line = "";
String token = "";
String token2 = "";
String token2_2 = "";
String[] token3 = new String[(MaxShopItems * 2)];
boolean EndOfFile = false;
int ReadMode = 0;
BufferedReader characterfile = null;
try {
characterfile = new BufferedReader(new FileReader(FileName));
} catch (FileNotFoundException fileex) {
misc.println(FileName + ": file not found.");
return false;
}
try {
line = characterfile.readLine();
} catch (IOException ioexception) {
misc.println(FileName + ": error loading file.");
return false;
}
while (EndOfFile == false && line != null) {
line = line.trim();
int spot = line.indexOf("=");
if (spot > -1) {
token = line.substring(0, spot);
token = token.trim();
token2 = line.substring(spot + 1);
token2 = token2.trim();
token2_2 = token2.replaceAll("\t\t", "\t");
token2_2 = token2_2.replaceAll("\t\t", "\t");
token2_2 = token2_2.replaceAll("\t\t", "\t");
token2_2 = token2_2.replaceAll("\t\t", "\t");
token2_2 = token2_2.replaceAll("\t\t", "\t");
token3 = token2_2.split("\t");
if (token.equals("shop")) {
int ShopID = Integer.parseInt(token3[0]);
ShopName[ShopID] = token3[1].replaceAll("_", " ");
ShopSModifier[ShopID] = Integer.parseInt(token3[2]);
ShopBModifier[ShopID] = Integer.parseInt(token3[3]);
for (int i = 0; i < ((token3.length - 4) / 2); i++) {
if (token3[(4 + (i * 2))] != null) {
ShopItems[ShopID][i] = (Integer.parseInt(token3[(4 + (i * 2))]) + 1);
ShopItemsN[ShopID][i] = Integer.parseInt(token3[(5 + (i * 2))]);
ShopItemsSN[ShopID][i] = Integer.parseInt(token3[(5 + (i * 2))]);
ShopItemsStandard[ShopID]++;
} else {
break;
}
}
TotalShops++;
}
} else {
if (line.equals("[ENDOFSHOPLIST]")) {
try {
characterfile.close();
} catch (IOException ioexception) {
}
return true;
}
}
try {
line = characterfile.readLine();
} catch (IOException ioexception1) {
EndOfFile = true;
}
}
try {
characterfile.close();
} catch (IOException ioexception) {
}
return false;
}
}

213
server317/src/misc.java Executable file
View File

@ -0,0 +1,213 @@
// hybridScape - The hybridScape Developers Team
// Silabsoft
public class misc {
public static String fixCase(String sentence) {
String firstLetter = sentence.substring(0, 1);
String wordRest = sentence.substring(1);
return firstLetter.toUpperCase() + wordRest.toLowerCase();
}
public static void println(String str) {
System.out.println("Server: " + str);
}
public static void printlnTag(String str) {
//ServerGUI.addConsole(str, true);
System.out.println("Server: " + str);
}
public static void println_debug(String str) {
System.out.println("Server: " + str);
}
public static String Hex(byte data[]) {
return Hex(data, 0, data.length);
}
public static String Hex(byte data[], int offset, int len) {
String temp = "";
for (int cntr = 0; cntr < len; cntr++) {
int num = data[offset + cntr] & 0xFF;
String myStr;
if (num < 16) myStr = "0";
else myStr = "";
temp += myStr + Integer.toHexString(num) + " ";
}
return temp.toUpperCase().trim();
}
public static int HexToInt(byte data[], int offset, int len) {
int temp = 0;
int i = 1000;
for (int cntr = 0; cntr < len; cntr++) {
int num = (data[offset + cntr] & 0xFF) * i;
temp += (int) num;
if (i > 1)
i = i / 1000;
}
return temp;
}
public static int random(int range) {
return (int) (java.lang.Math.random() * (range + 1));
}
public static int randomNeg(int range) {
int negOrPos = (int) (java.lang.Math.random() * (2));
if (negOrPos == 1)
return (int) (java.lang.Math.random() * (range + 1));
else
return (int) (java.lang.Math.random() * ((range * -1) - 1));
}
public static int random2(int range) { //1 till range
return (int) ((java.lang.Math.random() * range) + 1);
}
public static int random3(int range) { //0 till range
return (int) (java.lang.Math.random() * range);
}
public static int random4(int range) { //0 till range (range INCLUDED)
return (int) (java.lang.Math.random() * (range + 1));
}
public static long playerNameToInt64(String s) {
long l = 0L;
for (int i = 0; i < s.length() && i < 12; i++) {
char c = s.charAt(i);
l *= 37L;
if (c >= 'A' && c <= 'Z') l += (1 + c) - 65;
else if (c >= 'a' && c <= 'z') l += (1 + c) - 97;
else if (c >= '0' && c <= '9') l += (27 + c) - 48;
}
while (l % 37L == 0L && l != 0L) l /= 37L;
return l;
}
private static char decodeBuf[] = new char[4096];
public static String textUnpack(byte packedData[], int size) {
int idx = 0, highNibble = -1;
for (int i = 0; i < size * 2; i++) {
int val = packedData[i / 2] >> (4 - 4 * (i % 2)) & 0xf;
if (highNibble == -1) {
if (val < 13) decodeBuf[idx++] = xlateTable[val];
else highNibble = val;
} else {
decodeBuf[idx++] = xlateTable[((highNibble << 4) + val) - 195];
highNibble = -1;
}
}
return new String(decodeBuf, 0, idx);
}
public static String optimizeText(String text) {
char buf[] = text.toCharArray();
boolean endMarker = true; // marks the end of a sentence to make the next char capital
for (int i = 0; i < buf.length; i++) {
char c = buf[i];
if (endMarker && c >= 'a' && c <= 'z') {
buf[i] -= 0x20; // transform lower case into upper case
endMarker = false;
}
if (c == '.' || c == '!' || c == '?') endMarker = true;
}
return new String(buf, 0, buf.length);
}
public static void textPack(byte packedData[], java.lang.String text) {
if (text.length() > 80) text = text.substring(0, 80);
text = text.toLowerCase();
int carryOverNibble = -1;
int ofs = 0;
for (int idx = 0; idx < text.length(); idx++) {
char c = text.charAt(idx);
int tableIdx = 0;
for (int i = 0; i < xlateTable.length; i++) {
if (c == xlateTable[i]) {
tableIdx = i;
break;
}
}
if (tableIdx > 12) tableIdx += 195;
if (carryOverNibble == -1) {
if (tableIdx < 13) carryOverNibble = tableIdx;
else packedData[ofs++] = (byte) (tableIdx);
} else if (tableIdx < 13) {
packedData[ofs++] = (byte) ((carryOverNibble << 4) + tableIdx);
carryOverNibble = -1;
} else {
packedData[ofs++] = (byte) ((carryOverNibble << 4) + (tableIdx >> 4));
carryOverNibble = tableIdx & 0xf;
}
}
if (carryOverNibble != -1) packedData[ofs++] = (byte) (carryOverNibble << 4);
}
public static char xlateTable[] = {
' ', 'e', 't', 'a', 'o', 'i', 'h', 'n', 's', 'r',
'd', 'l', 'u', 'm', 'w', 'c', 'y', 'f', 'g', 'p',
'b', 'v', 'k', 'x', 'j', 'q', 'z', '0', '1', '2',
'3', '4', '5', '6', '7', '8', '9', ' ', '!', '?',
'.', ',', ':', ';', '(', ')', '-', '&', '*', '\\',
'\'', '@', '#', '+', '=', '\243', '$', '%', '"', '[',
']'
};
// gets the direction between the two given points
// valid directions are N:0, NE:2, E:4, SE:6, S:8, SW:10, W:12, NW:14
// the invalid (inbetween) direction are 1,3,5,7,9,11,13,15 i.e. odd integers
// returns -1, if src and dest are the same
public static int direction(int srcX, int srcY, int destX, int destY) {
int dx = destX - srcX, dy = destY - srcY;
// a lot of cases that have to be considered here ... is there a more sophisticated (and quick!) way?
if (dx < 0) {
if (dy < 0) {
if (dx < dy) return 11;
else if (dx > dy) return 9;
else return 10; // dx == dy
} else if (dy > 0) {
if (-dx < dy) return 15;
else if (-dx > dy) return 13;
else return 14; // -dx == dy
} else { // dy == 0
return 12;
}
} else if (dx > 0) {
if (dy < 0) {
if (dx < -dy) return 7;
else if (dx > -dy) return 5;
else return 6; // dx == -dy
} else if (dy > 0) {
if (dx < dy) return 1;
else if (dx > dy) return 3;
else return 2; // dx == dy
} else { // dy == 0
return 4;
}
} else { // dx == 0
if (dy < 0) {
return 8;
} else if (dy > 0) {
return 0;
} else { // dy == 0
return -1; // src and dest are the same
}
}
}
public static byte directionDeltaX[] = new byte[]{0, 1, 1, 1, 0, -1, -1, -1};
public static byte directionDeltaY[] = new byte[]{1, 1, 0, -1, -1, -1, 0, 1};
// translates our direction convention to the one used in the protocol
public static byte xlateDirectionToClient[] = new byte[]{1, 2, 4, 7, 6, 5, 3, 0};
}

167
server317/src/server.java Executable file
View File

@ -0,0 +1,167 @@
public class server implements Runnable {
public server() {
}
public static String workingDir = null;
// TODO: yet to figure out proper value for timing, but 500 seems good
public static final int cycleTime = 500;
public static boolean updateServer = false;
public static int updateSeconds = 180; //180 because it doesnt make the time jump at the start :P
public static long startTime;
public static void main(String[] args) {
if(args.length < 1){
System.err.println("To run server317 you must at least set a working directory with the command line.");
return;
}
workingDir = args[0];
clientHandler = new server();
(new Thread(clientHandler)).start(); // launch server listener
playerHandler = new PlayerHandler();
npcHandler = new NPCHandler();
itemHandler = new ItemHandler();
shopHandler = new ShopHandler();
int waitFails = 0;
long lastTicks = System.currentTimeMillis();
long totalTimeSpentProcessing = 0;
int cycle = 0;
while (!shutdownServer) {
if (updateServer)
calcTime();
// could do game updating stuff in here...
// maybe do all the major stuff here in a big loop and just do the packet
// sending/receiving in the ClientHandler subthreads. The actual packet forming code
// will reside within here and all created packets are then relayed by the subthreads.
// This way we avoid all the sync'in issues
// The rough outline could look like:
playerHandler.process(); // updates all player related stuff
npcHandler.process();
itemHandler.process();
shopHandler.process();
// doNpcs() // all npc related stuff
// doObjects()
// doWhatever()
// taking into account the time spend in the processing code for more accurate timing
long timeSpent = System.currentTimeMillis() - lastTicks;
totalTimeSpentProcessing += timeSpent;
if (timeSpent >= cycleTime) {
timeSpent = cycleTime;
if (++waitFails > 100) {
shutdownServer = true;
misc.printlnTag("[KERNEL]: machine is too slow to run this server!");
}
}
try {
Thread.sleep(cycleTime - timeSpent);
} catch (java.lang.Exception _ex) {
}
lastTicks = System.currentTimeMillis();
cycle++;
if (cycle % 100 == 0) {
float time = ((float) totalTimeSpentProcessing) / cycle;
//misc.printlnTag_debug("[KERNEL]: "+(time*100/cycleTime)+"% processing time");
}
if (ShutDown == true) {
if (ShutDownCounter >= 100) {
shutdownServer = true;
}
ShutDownCounter++;
}
}
// shut down the server
playerHandler.destruct();
clientHandler.killServer();
clientHandler = null;
}
public static server clientHandler = null; // handles all the clients
public static java.net.ServerSocket clientListener = null;
public static boolean shutdownServer = false; // set this to true in order to shut down and kill the server
public static boolean shutdownClientHandler; // signals ClientHandler to shut down
public static int serverlistenerPort = 43594; //43594=default
public static PlayerHandler playerHandler = null;
public static NPCHandler npcHandler = null;
public static ItemHandler itemHandler = null;
public static ShopHandler shopHandler = null;
public static void calcTime() {
long curTime = System.currentTimeMillis();
updateSeconds = 180 - ((int) (curTime - startTime) / 1000);
if (updateSeconds == 0) {
shutdownServer = true;
}
}
public void run() {
// setup the listener
try {
shutdownClientHandler = false;
clientListener = new java.net.ServerSocket(serverlistenerPort, 1, null);
misc.printlnTag("Starting HybridScape Server on " + clientListener.getInetAddress().getHostAddress() + ":" + clientListener.getLocalPort());
while (true) {
java.net.Socket s = clientListener.accept();
s.setTcpNoDelay(true);
String connectingHost = s.getInetAddress().getHostName();
if (/*connectingHost.startsWith("localhost") || connectingHost.equals("127.0.0.1")*/true) {
if (connectingHost.startsWith("computing") || connectingHost.startsWith("server2")) {
misc.printlnTag(connectingHost + ": Checking if server still is online...");
} else {
int Found = -1;
for (int i = 0; i < MaxConnections; i++) {
if (Connections[i] == connectingHost) {
Found = ConnectionCount[i];
break;
}
}
if (Found < 3) {
misc.printlnTag("ClientHandler: Accepted from " + connectingHost + ":" + s.getPort());
playerHandler.newPlayerClient(s, connectingHost);
} else {
s.close();
}
}
} else {
misc.printlnTag("ClientHandler: Rejected " + connectingHost + ":" + s.getPort());
s.close();
}
}
} catch (java.io.IOException ioe) {
if (!shutdownClientHandler) {
misc.printlnTag("Error: Unable to startup listener on " + serverlistenerPort + " - port already in use?");
} else {
misc.printlnTag("ClientHandler was shut down.");
}
}
}
public void killServer() {
try {
shutdownClientHandler = true;
if (clientListener != null) clientListener.close();
clientListener = null;
} catch (java.lang.Exception __ex) {
__ex.printStackTrace();
}
}
public static int EnergyRegian = 60;
public static int MaxConnections = 100000;
public static String[] Connections = new String[MaxConnections];
public static int[] ConnectionCount = new int[MaxConnections];
public static boolean ShutDown = false;
public static int ShutDownCounter = 0;
}

337
server317/src/stream.java Executable file
View File

@ -0,0 +1,337 @@
public class stream {
public stream() {
}
public stream(byte abyte0[]) {
buffer = abyte0;
currentOffset = 0;
}
public byte readSignedByteA() {
return (byte)(buffer[currentOffset++] - 128);
}
public byte readSignedByteC() {
return (byte)(-buffer[currentOffset++]);
}
public byte readSignedByteS() {
return (byte)(128 - buffer[currentOffset++]);
}
public int readUnsignedByteA() {
return buffer[currentOffset++] - 128 & 0xff;
}
public int readUnsignedByteC() {
return -buffer[currentOffset++] & 0xff;
}
public int readUnsignedByteS() {
return 128 - buffer[currentOffset++] & 0xff;
}
public void writeByteA(int i) {
buffer[currentOffset++] = (byte)(i + 128);
}
public void writeByteS(int i) {
buffer[currentOffset++] = (byte)(128 - i);
}
public void writeByteC(int i) {
buffer[currentOffset++] = (byte)(-i);
}
public int readSignedWordBigEndian() {
currentOffset += 2;
int i = ((buffer[currentOffset - 1] & 0xff) << 8) + (buffer[currentOffset - 2] & 0xff);
if(i > 32767) {
i -= 0x10000;
}
return i;
}
public int readSignedWordA() {
currentOffset += 2;
int i = ((buffer[currentOffset - 2] & 0xff) << 8) + (buffer[currentOffset - 1] - 128 & 0xff);
if(i > 32767) {
i -= 0x10000;
}
return i;
}
public int readSignedWordBigEndianA() {
currentOffset += 2;
int i = ((buffer[currentOffset - 1] & 0xff) << 8) + (buffer[currentOffset - 2] - 128 & 0xff);
if(i > 32767)
i -= 0x10000;
return i;
}
public int readUnsignedWordBigEndian() {
currentOffset += 2;
return ((buffer[currentOffset - 1] & 0xff) << 8) + (buffer[currentOffset - 2] & 0xff);
}
public int readUnsignedWordA() {
currentOffset += 2;
return ((buffer[currentOffset - 2] & 0xff) << 8) + (buffer[currentOffset - 1] - 128 & 0xff);
}
public int readUnsignedWordBigEndianA() {
currentOffset += 2;
return ((buffer[currentOffset - 1] & 0xff) << 8) + (buffer[currentOffset - 2] - 128 & 0xff);
}
public void writeWordBigEndianA(int i) {
buffer[currentOffset++] = (byte)(i + 128);
buffer[currentOffset++] = (byte)(i >> 8);
}
public void writeWordA(int i) {
buffer[currentOffset++] = (byte)(i >> 8);
buffer[currentOffset++] = (byte)(i + 128);
}
public void writeWordBigEndian_dup(int i) {
buffer[currentOffset++] = (byte)i;
buffer[currentOffset++] = (byte)(i >> 8);
}
public int readDWord_v1() {
currentOffset += 4;
return ((buffer[currentOffset - 2] & 0xff) << 24) + ((buffer[currentOffset - 1] & 0xff) << 16) + ((buffer[currentOffset - 4] & 0xff) << 8) + (buffer[currentOffset - 3] & 0xff);
}
public int readDWord_v2() {
currentOffset += 4;
return ((buffer[currentOffset - 3] & 0xff) << 24) + ((buffer[currentOffset - 4] & 0xff) << 16) + ((buffer[currentOffset - 1] & 0xff) << 8) + (buffer[currentOffset - 2] & 0xff);
}
public void writeDWord_v1(int i) {
buffer[currentOffset++] = (byte)(i >> 8);
buffer[currentOffset++] = (byte)i;
buffer[currentOffset++] = (byte)(i >> 24);
buffer[currentOffset++] = (byte)(i >> 16);
}
public void writeDWord_v2(int i) {
buffer[currentOffset++] = (byte)(i >> 16);
buffer[currentOffset++] = (byte)(i >> 24);
buffer[currentOffset++] = (byte)i;
buffer[currentOffset++] = (byte)(i >> 8);
}
public void readBytes_reverse(byte abyte0[], int i, int j) {
for(int k = (j + i) - 1; k >= j; k--) {
abyte0[k] = buffer[currentOffset++];
}
}
public void writeBytes_reverse(byte abyte0[], int i, int j) {
for(int k = (j + i) - 1; k >= j; k--)
buffer[currentOffset++] = abyte0[k];
}
public void readBytes_reverseA(byte abyte0[], int i, int j) {
for(int k = (j + i) - 1; k >= j; k--)
abyte0[k] = (byte)(buffer[currentOffset++] - 128);
}
public void writeBytes_reverseA(byte abyte0[], int i, int j) {
for(int k = (j + i) - 1; k >= j; k--)
buffer[currentOffset++] = (byte)(abyte0[k] + 128);
}
public void createFrame(int id) {
buffer[currentOffset++] = (byte)(id + packetEncryption.getNextKey());
}
private static final int frameStackSize = 10;
private int frameStackPtr = -1;
private int frameStack[] = new int[frameStackSize];
public void createFrameVarSize(int id){ // creates a variable sized mainFrame
buffer[currentOffset++] = (byte)(id + packetEncryption.getNextKey());
buffer[currentOffset++] = 0; // placeholder for size byte
if(frameStackPtr >= frameStackSize-1) {
throw new RuntimeException("Stack overflow");
}
else frameStack[++frameStackPtr] = currentOffset;
}
public void createFrameVarSizeWord(int id) { // creates a variable sized mainFrame
buffer[currentOffset++] = (byte)(id + packetEncryption.getNextKey());
writeWord(0); // placeholder for size word
if(frameStackPtr >= frameStackSize-1) {
throw new RuntimeException("Stack overflow");
}
else frameStack[++frameStackPtr] = currentOffset;
}
public void endFrameVarSize() {// ends a variable sized mainFrame
if(frameStackPtr < 0) throw new RuntimeException("Stack empty");
else writeFrameSize(currentOffset - frameStack[frameStackPtr--]);
}
public void endFrameVarSizeWord() { // ends a variable sized mainFrame
if(frameStackPtr < 0) throw new RuntimeException("Stack empty");
else writeFrameSizeWord(currentOffset - frameStack[frameStackPtr--]);
}
public void writeByte(int i) {
buffer[currentOffset++] = (byte)i;
}
public void writeWord(int i) {
buffer[currentOffset++] = (byte)(i >> 8);
buffer[currentOffset++] = (byte)i;
}
public void writeWordBigEndian(int i) {
buffer[currentOffset++] = (byte)i;
buffer[currentOffset++] = (byte)(i >> 8);
}
public void write3Byte(int i) {
buffer[currentOffset++] = (byte)(i >> 16);
buffer[currentOffset++] = (byte)(i >> 8);
buffer[currentOffset++] = (byte)i;
}
public void writeDWord(int i) {
buffer[currentOffset++] = (byte)(i >> 24);
buffer[currentOffset++] = (byte)(i >> 16);
buffer[currentOffset++] = (byte)(i >> 8);
buffer[currentOffset++] = (byte)i;
}
public void writeDWordBigEndian(int i) {
buffer[currentOffset++] = (byte)i;
buffer[currentOffset++] = (byte)(i >> 8);
buffer[currentOffset++] = (byte)(i >> 16);
buffer[currentOffset++] = (byte)(i >> 24);
}
public void writeQWord(long l) {
buffer[currentOffset++] = (byte)(int)(l >> 56);
buffer[currentOffset++] = (byte)(int)(l >> 48);
buffer[currentOffset++] = (byte)(int)(l >> 40);
buffer[currentOffset++] = (byte)(int)(l >> 32);
buffer[currentOffset++] = (byte)(int)(l >> 24);
buffer[currentOffset++] = (byte)(int)(l >> 16);
buffer[currentOffset++] = (byte)(int)(l >> 8);
buffer[currentOffset++] = (byte)(int)l;
}
public void writeString(java.lang.String s) {
s.getBytes(0, s.length(), buffer, currentOffset);
currentOffset += s.length();
buffer[currentOffset++] = 10;
}
public void writeBytes(byte abyte0[], int i, int j) {
for(int k = j; k < j + i; k++)
buffer[currentOffset++] = abyte0[k];
}
public void writeFrameSize(int i) {
buffer[currentOffset - i - 1] = (byte)i;
}
public void writeFrameSizeWord(int i) {
buffer[currentOffset - i - 2] = (byte)(i >> 8);
buffer[currentOffset - i - 1] = (byte)i;
}
public int readUnsignedByte() {
return buffer[currentOffset++] & 0xff;
}
public byte readSignedByte() {
return buffer[currentOffset++];
}
public int readUnsignedWord() {
currentOffset += 2;
return ((buffer[currentOffset - 2] & 0xff) << 8) + (buffer[currentOffset - 1] & 0xff);
}
public int readSignedWord() {
currentOffset += 2;
int i = ((buffer[currentOffset - 2] & 0xff) << 8) + (buffer[currentOffset - 1] & 0xff);
if(i > 32767) {
i -= 0x10000;
}
return i;
}
public int readDWord() {
currentOffset += 4;
return ((buffer[currentOffset - 4] & 0xff) << 24) + ((buffer[currentOffset - 3] & 0xff) << 16) + ((buffer[currentOffset - 2] & 0xff) << 8) + (buffer[currentOffset - 1] & 0xff);
}
public long readQWord() {
long l = (long)readDWord() & 0xffffffffL;
long l1 = (long)readDWord() & 0xffffffffL;
return (l << 32) + l1;
}
public java.lang.String readString() {
int i = currentOffset;
while(buffer[currentOffset++] != 10) ;
return new String(buffer, i, currentOffset - i - 1);
}
public void readBytes(byte abyte0[], int i, int j) {
for(int k = j; k < j + i; k++)
abyte0[k] = buffer[currentOffset++];
}
public void initBitAccess() {
bitPosition = currentOffset * 8;
}
public void writeBits(int numBits, int value) {
int bytePos = bitPosition >> 3;
int bitOffset = 8 - (bitPosition & 7);
bitPosition += numBits;
for(; numBits > bitOffset; bitOffset = 8) {
buffer[bytePos] &= ~ bitMaskOut[bitOffset]; // mask out the desired area
buffer[bytePos++] |= (value >> (numBits-bitOffset)) & bitMaskOut[bitOffset];
numBits -= bitOffset;
}
if(numBits == bitOffset) {
buffer[bytePos] &= ~ bitMaskOut[bitOffset];
buffer[bytePos] |= value & bitMaskOut[bitOffset];
} else {
buffer[bytePos] &= ~ (bitMaskOut[numBits]<<(bitOffset - numBits));
buffer[bytePos] |= (value&bitMaskOut[numBits]) << (bitOffset - numBits);
}
}
public void finishBitAccess() {
currentOffset = (bitPosition + 7) / 8;
}
public byte buffer[] = null;
public int currentOffset = 0;
public int bitPosition = 0;
public static int bitMaskOut[] = new int[32];
static {
for(int i = 0; i < 32; i++)
bitMaskOut[i] = (1 << i) - 1;
}
public Cryption packetEncryption = null;
}