Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Client

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 366

import import import import import import import import import import import

java.io.BufferedReader; java.io.BufferedWriter; java.io.FileNotFoundException; java.io.FileReader; java.io.FileWriter; java.io.IOException; java.util.ArrayList; java.util.Calendar; java.util.GregorianCalendar; java.util.Random; java.util.concurrent.CopyOnWriteArrayList;

//2400,4446 public class client extends Player implements Runnable { public boolean npcHit1(){ int hit = misc.random(playerMaxHit); double rand_stabnpc = 0; double rand_slashnpc = 0; double rand_crushnpc = 0; double rand_magenpc = 0; double rand_rangenpc = 0; double rand_stabatt = misc.randomd(0.515*(playerBonus[0])+(0.515 *playerLevel[0])); double rand_slashatt = misc.randomd(0.515*(playerBonus[1])+(0.51 5*playerLevel[0])); double rand_crushatt = misc.randomd(0.515*(playerBonus[2])+(0.51 5*playerLevel[0])); double rand_mageatt = misc.randomd(0.515*(playerLevel[6])+(0.515 *playerBonus[3])); double rand_rangeatt = misc.randomd(0.515*(playerLevel[4])+(0.51 5*playerBonus[4])); for (int i = 0; i < Stats.stats.length; i++) { if (server.npcHandler.npcs[attacknpc].npcType == Stats.s tats[i][0]) { //corp rand_stabnpc = misc.randomd(0.515*(Stats.stats[i ][3])+(0.515*Stats.stats[i][11])); rand_slashnpc = misc.randomd(0.515*(Stats.stats[ i][3])+(0.515*Stats.stats[i][12])); rand_crushnpc = misc.randomd(0.515*(Stats.stats[ i][3])+(0.515*Stats.stats[i][13])); rand_magenpc = misc.randomd(0.515*((Stats.stats[ i][3])*0.3)+(0.515*Stats.stats[i][5]*0.7)+(0.515*Stats.stats[i][14])); rand_rangenpc = misc.randomd(0.515*((Stats.stats [i][3])*0.3)+(0.515*Stats.stats[i][4]*0.7)+(0.515*Stats.stats[i][15])); } } if(AttackType == 1 && misc.random((int)rand_stabatt) >= misc.random((int)rand_stabnpc)){ return true; } if(AttackType == 2 && misc.random((int)rand_slashatt) >= misc.ra ndom((int)rand_slashnpc)){ return true; } if(AttackType == 3 && misc.random((int)rand_crushatt) >= misc.ra ndom((int)rand_crushnpc)){ return true; } if(AttackType >= 4 && misc.random((int)rand_rangeatt) >= misc.ra

ndom((int)rand_rangenpc)){ return true; } return false; } public boolean npcHit2(int index){ double rand_magenpc = 0; double rand_mageatt = misc.randomd(0.515*(playerLevel[6])+(0.515 *playerBonus[3])); for (int i = 0; i < Stats.stats.length; i++) { if (server.npcHandler.npcs[index].npcType == Stats.stats [i][0]) { //corp rand_magenpc = misc.randomd(0.515*(Stats.stats[i ][3]*0.3)+(0.515*Stats.stats[i][5]*0.7)+(0.515*Stats.stats[i][14])); } } if(autocast_spellIndex >= 0 && misc.random((int)rand_mageatt) >= misc.random((int)rand_magenpc)){ return true; } return false; } public boolean hevent = false; public void hweenReward(){ if(!hevent){ sendMessage("You have finished the halloween event!"); addItem(7592, 1); addItem(7593, 1); addItem(7594, 1); addItem(7595, 1); addItem(7596, 1); deleteItem(3370, 10); deleteItem(3364, 5); deleteItem(3376, 20); deleteItem(3374, 15); hevent = true; } else { sendMessage("You already finished this event!"); } } public int animal(int id){ switch(id){ case 1227: return 3369; case 1228: return 3363; case 1229: return 3375; case 1230: return 3373; }return -1; } public int chatTextSize2, chatText2; public int eatDelay; public int herbXpInc = 10; public int cookXpInc = 12; public void appendToAutoSpawn2(int npcid, int absx, int absy, int absx2, int abs y2, int absx3, int absy3) {

BufferedWriter bw = null; try { bw = new BufferedWriter( new FileWriter("config//autospawncodes.t xt", true)); 0 "+absx2+" bw.write("spawn = "+npcid+" "+absx+" "+absy+" "+absy2+" "+absx3+" "+absy3+" 1"); bw.newLine(); bw.flush(); } catch (IOException ioe) { ioe.printStackTrace(); } finally { if (bw != null) { try { bw.close(); } catch (IOException ioe2) { sendMessage("Error autospawning!"); } } }

} public void displayItem246(int MainFrame, int SubFrame, int SubFrame2) { outStream.createFrame(246); outStream.writeWordBigEndian(MainFrame); outStream.writeWord(SubFrame); outStream.writeWord(SubFrame2); } public int drinkDelay, statTimer; public void changeStat(int stat, int amt, int type, boolean bol) { if (bol) { if(type == 0 && playerLevel[stat] >= getLevelForXP(playe rXP[stat])) { return; } if (playerLevel[stat] >= (getLevelForXP(playerXP[stat]) + amt)) { return; } playerLevel[stat] += amt; if (playerLevel[stat] >= (getLevelForXP(playerXP[stat]) + amt)) { playerLevel[stat] = (getLevelForXP(playerXP[stat ]) + amt); } if (type == 0) { if (playerLevel[stat] > getLevelForXP(playerXP[s tat])) { playerLevel[stat] = getLevelForXP(player XP[stat]); }

} } else if (!bol) { playerLevel[stat] -= amt; if (playerLevel[stat] < 1) { playerLevel[stat] = 1; } } setSkillLevel(stat); } public void setSkillLevel(int skillNum) { if (skillNum == 0) { changeText126(""+playerLevel[0]+"", 4004); changeText126(""+getLevelForXP(playerXP[0])+"", 4005); } else if (skillNum == 2) { changeText126(""+playerLevel[2]+"", 4006); changeText126(""+getLevelForXP(playerXP[2])+"", 4007); } else if (skillNum == 1) { changeText126(""+playerLevel[1]+"", 4008); changeText126(""+getLevelForXP(playerXP[1])+"", 4009); } else if (skillNum == 4) { changeText126(""+playerLevel[4]+"", 4010); changeText126(""+getLevelForXP(playerXP[4])+"", 4011); } else if (skillNum == 5) { changeText126(""+playerLevel[5]+"", 4012); changeText126(""+getLevelForXP(playerXP[5])+"", 4013); } else if (skillNum == 6) { changeText126(""+playerLevel[6]+"", 4014); changeText126(""+getLevelForXP(playerXP[6])+"", 4015); } else if (skillNum == 3) { changeText126(""+playerLevel[3]+"", 4016); changeText126(""+getLevelForXP(playerXP[3])+"", 4017); } else if (skillNum == 16) { changeText126(""+playerLevel[16]+"", 4018); changeText126(""+getLevelForXP(playerXP[16])+"", 4019); } else if (skillNum == 15) { changeText126(""+playerLevel[15]+"", 4020); changeText126(""+getLevelForXP(playerXP[15])+"", 4021); } else if (skillNum == 17) { changeText126(""+playerLevel[17]+"", 4022); changeText126(""+getLevelForXP(playerXP[17])+"", 4023); } else if (skillNum == 12) { changeText126(""+playerLevel[12]+"", 4024); changeText126(""+getLevelForXP(playerXP[12])+"", 4025); } else if (skillNum == 9) { changeText126(""+playerLevel[9]+"", 4026);

changeText126(""+getLevelForXP(playerXP[9])+"", 4027); } else if (skillNum == 14) { changeText126(""+playerLevel[14]+"", 4028); changeText126(""+getLevelForXP(playerXP[14])+"", 4029); } else if (skillNum == 13) { changeText126(""+playerLevel[13]+"", 4030); changeText126(""+getLevelForXP(playerXP[13])+"", 4031); } else if (skillNum == 10) { changeText126(""+playerLevel[10]+"", 4032); changeText126(""+getLevelForXP(playerXP[10])+"", 4033); } else if (skillNum == 7) { changeText126(""+playerLevel[7]+"", 4034); changeText126(""+getLevelForXP(playerXP[7])+"", 4035); } else if (skillNum == 11) { changeText126(""+playerLevel[11]+"", 4036); changeText126(""+getLevelForXP(playerXP[11])+"", 4037); } else if (skillNum == 8) { changeText126(""+playerLevel[8]+"", 4038); changeText126(""+getLevelForXP(playerXP[8])+"", 4039); } else if (skillNum == 20) { changeText126(""+playerLevel[20]+"", 4152); changeText126(""+getLevelForXP(playerXP[20])+"", 4153); } else if (skillNum == 18) { changeText126(""+playerLevel[18]+"", 12166); changeText126(""+getLevelForXP(playerXP[18])+"", 12167); } else if (skillNum == 19) { changeText126(""+playerLevel[19]+"", 13926); changeText126(""+getLevelForXP(playerXP[19])+"", 13927); } else if (skillNum == 20) { changeText126(""+playerLevel[20]+"", 4152); changeText126(""+getLevelForXP(playerXP[20])+"", 4153); } outStream.createFrame(134); outStream.writeByte(skillNum); outStream.writeDWord_v1(playerXP[skillNum]); outStream.writeByte(playerLevel[skillNum]); } public void cookItem(int cookAmt) { cookItemAmt = cookAmt; int cookLvl = playerLevel[playerCooking]; if (cookItemAmt == 0) return; if(!playerHasItem(cookItem)){ cookItemAmt = 0; cookDelay = 0; return;

} if (cookLvl >= cookLvlNeeded) { if (cookDelay == 0) { cookDelay = 2; startAnimation(883); RemoveAllWindows(); if (misc.random(playerLevel[playerCooking] * 2) < (cookLvlNeeded / 2)) { sendMessage("You accidentally burn the " + getItemName(cookItem) + "."); deleteItem(cookItem, GetItemSlot(cookIte m), 1); if (cookItem == 317 || cookItem == 321) addItem(323, 1); else if (cookItem == 327) addItem(369, 1); else if (cookItem == 331 || cookItem == 335 || cookItem == 341 || cookItem == 349) addItem(343, 1); else if (cookItem == 345 || cookItem == 353) addItem(357, 1); else if (cookItem == 359 || cookItem == 363) addItem(367, 1); else if (cookItem == 371) addItem(375, 1); else if (cookItem == 377) addItem(381, 1); else if (cookItem == 383) addItem(387, 1); else if (cookItem == 389) addItem(393, 1); else addItem(323, 1); cookItemAmt--; } else { sendMessage("You successfully cook the " + getItemName(cookItem) + "."); deleteItem(cookItem, GetItemSlot(cookIte m), 1); cookItemAmt--; if (cookItem == 317) { addItem(315, 1); addSkillXP(10 * cookXpInc, playe rCooking); } if (cookItem == 321) { addItem(319, 1); addSkillXP(40 * cookXpInc, playe rCooking); }

if (cookItem == 327) { addItem(325, 1); addSkillXP(20 * cookXpInc, playe rCooking); } if (cookItem == 345) { addItem(347, 1); addSkillXP(30 * cookXpInc, playe rCooking); } if (cookItem == 335) { addItem(333, 1); addSkillXP(50 * cookXpInc, playe rCooking); } if (cookItem == 349) { addItem(351, 1); addSkillXP(60 * cookXpInc, playe rCooking); } if (cookItem == 331) { addItem(329, 1); addSkillXP(70 * cookXpInc, playe rCooking); } if (cookItem == 359) { addItem(361, 1); addSkillXP(80 * cookXpInc, playe rCooking); } if (cookItem == 377) { addItem(379, 1); addSkillXP(90 * cookXpInc, playe rCooking); } if (cookItem == 371) { addItem(373, 1); addSkillXP(100 * cookXpInc, play erCooking); } if (cookItem == 7944) { addItem(7946, 1); addSkillXP(120 * cookXpInc, play erCooking); } if (cookItem == 383) { addItem(385, 1); addSkillXP(150 * cookXpInc, play erCooking); }

if (cookItem == 353) { addItem(355, 1); addSkillXP(20 * cookXpInc, playe rCooking); } if (cookItem == 389) { addItem(391, 1); addSkillXP(200 * cookXpInc, play erCooking); } } } } else { showDialogue("You need a Cooking level of " + cookLvlNee ded + " to make "+getItemName(cookItem) + "."); cookDelay = -1; } } public int cookLevelForItem() { if (cookItem == 317) { return 1; } if (cookItem == 321) { return 1; } if (cookItem == 327) { return 1; } if (cookItem == 345) { return 5; } if (cookItem == 335) { return 15; } if (cookItem == 349) { return 20; } if (cookItem == 331) { return 25; } if (cookItem == 359) { return 30; } if (cookItem == 377) { return 40;

} if (cookItem == 371) { return 45; } if (cookItem == 7944) { return 62; } if (cookItem == 383) { return 80; } if (cookItem == 389) { return 86; } if (cookItem == 353) { return 10; } return 1; } public void cookMenu(int itemId) { cookItem = itemId; cookLvlNeeded = cookLevelForItem(); displayItem246(13716, 250, itemId); sendFrame164(1743); } public int cookItem = 0; public int cookItemAmt = 0; public int cookDelay = 0; public int cookLvlNeeded = 1; public int fishXpInc = 5; public public public public public public public public int apickupid = -1; int apickupx = -1; int apickupy = -1; int yelltimer = 0; int agilitycourse1 = 0; int agilitycourse2 = 0; boolean bot = false; int fishSpot; public void sendFrame106(int i1){ outStream.createFrame(106); outStream.writeByteC(i1); } public public public public int slayergrade = 0; // 1 = mazcha 2 = crystal key vannaka int NPCToKill = 0; int slayerTask = -1; void resetslayer() { if(NPCToKill <= 0) { slayerTask = -1; NPCToKill = 0; }

public void OpenUpSlayer() { String slayerNPC = ""; int[] slayerGrade = {1,2}; int[] slayerMasters = {1596,1597}; if(NPCToKill > 1) { if(slayerTask > 0) { slayerNPC = ""+GetNpcName(slayerTask)+"s"; } } else if(NPCToKill == 1) { if(slayerTask > 0) { slayerNPC = ""+GetNpcName(slayerTask)+""; } } for(int i = 0; i < slayerGrade.length; i++) { if(slayerTask == -1) { if(slayergrade == slayerGrade[i]){ nt1(false, slayerMasters[i], 600, "You have no task, talk to me for another one! "); } } else { if(slayergrade == slayerGrade[i]){ nt2(false, slayerMasters[i], 600, "Your currently task is:","To kill "+NPCToKill +" more of "+slayerNPC+""); } } } } public void assign1() { if(NPCToKill == 0 && slayerTask == -1) { slayergrade = 1; int[][] task = {{1649,1,25,50,100},{1633,10,30,30,40},{1614,20,40,30,30},{2373,5 0,60,3,7},{1575,50,100,30,80},{119,65,100,30,40},{82,70,100,20,40}}; int taskgive = misc.random(6); if(playerLevel[18] >= task[taskgive][1] && playerLevel[18] <= task[taskgive][2]) { slayerTask = task[taskgive][0]; NPCToKill = task[taskgive][3] + misc.random(task[taskgive][4]); nt2(false, 1596, 600, "Your currently task is:","To kill "+NPCToKill+" more of " +GetNpcName(slayerTask)+"s"); } } else { nt2(false, 1596, 600, "Your currently task is:","To kill "+NPCToKill+" more of " +GetNpcName(slayerTask)+"s"); } } public void assign2() { if(NPCToKill == 0 && slayerTask == -1) { slayergrade = 2; int[][] task = {{83,70,100,5,45},{84,75,100,5,10}}; if(playerLevel[18] >= task[misc.random(1)][1] && playerLevel[18] <= task[misc.ra ndom(1)][2]) { slayerTask = task[misc.random(1)][0]; NPCToKill = task[misc.random(1)][3] + misc.random(task[misc.random(1)][4]); nt2(false, 1597, 600, "Your currently task is:","To kill "+NPCToKill+" more of " +GetNpcName(slayerTask)+"s"); NpcDialogue = -1; } } else {

nt2(false, 1596, 600, "Your currently task is:","To kill "+NPCToKill+" more of " +GetNpcName(slayerTask)+"s"); NpcDialogue = -1; } } //options talk public void o2(boolean send, String option, String option1, String { sendFrame171(1, 2465); sendFrame171(0, 2468); sendFrame126(option, 2460); sendFrame126(option1, 2461); sendFrame126(option2, 2462); sendFrame164(2459); NpcDialogueSend = send; } public void o3(boolean send, String option, String option1, String ng option3) { sendFrame171(1, 2476); sendFrame171(0, 2479); sendFrame126(option, 2470); sendFrame126(option1, 2471); sendFrame126(option2, 2472); sendFrame126(option3, 2473); sendFrame164(2469); NpcDialogueSend = send; } public void o4(boolean send, String option, String option1, String ng option3, String option4) { sendFrame171(1, 2488); sendFrame171(0, 2491); sendFrame126(option, 2481); sendFrame126(option1, 2481); sendFrame126(option2, 2482); sendFrame126(option3, 2483); sendFrame126(option4, 2484); sendFrame164(2480); NpcDialogueSend = send; } public void o5(boolean send, String option, String option1, String ng option3, String option4, String option5) { sendFrame171(1, 2501); sendFrame171(0, 2504); sendFrame126(option, 2493); sendFrame126(option1, 2494); sendFrame126(option2, 2495); sendFrame126(option3, 2496); sendFrame126(option4, 2497); sendFrame126(option5, 2498); sendFrame164(2492); NpcDialogueSend = send; } public void nt1(boolean send, int npc, int emote, String text) { sendFrame200(4883, emote); sendFrame126(GetNpcName(npc), 4884); option2)

option2, Stri

option2, Stri

option2, Stri

sendFrame126(text, 4885); sendFrame126("Click here to continue", 4886); sendFrame75(npc, 4883); sendFrame164(4882); NpcDialogueSend = send; } public void nt2(boolean send, int npc, int emote, String text, String text2) { sendFrame200(4888, emote); sendFrame126(GetNpcName(npc), 4889); sendFrame126(text, 4890); sendFrame126(text2, 4891); sendFrame126("Click here to continue", 4892); sendFrame75(npc, 4888); sendFrame164(4887); NpcDialogueSend = send; } public void nt3(boolean send, int npc, int emote, String text, String text2, Str ing text3) { sendFrame200(4894, emote); sendFrame126(GetNpcName(npc), 4895); sendFrame126(text, 4896); sendFrame126(text2, 4897); sendFrame126(text3, 4898); sendFrame126("Click here to continue", 4899); sendFrame75(npc, 4894); sendFrame164(4893); NpcDialogueSend = send; } public void nt4(boolean send, int npc, int emote, String text, String text2, Str ing text3, String text4) { sendFrame200(4901, emote); sendFrame126(GetNpcName(npc), 4902); sendFrame126(text, 4903); sendFrame126(text2, 4904); sendFrame126(text3, 4905); sendFrame126(text4, 4906); sendFrame126("Click here to continue", 4907); sendFrame75(npc, 4901); sendFrame164(4900); NpcDialogueSend = send; } public void pt1(boolean send, int emote, String text) { sendFrame200(969, emote); sendFrame126(playerName, 970); sendFrame126(text, 971); sendFrame126("Click here to continue", 972); sendFrame185(969); sendFrame164(968); NpcDialogueSend = send; } public void pt2(boolean send, int emote, String text, String text2) { sendFrame200(974, emote); sendFrame126(playerName, 975); sendFrame126(text, 976); sendFrame126(text2, 977);

sendFrame126("Click here to continue", 978); sendFrame185(974); sendFrame164(973); NpcDialogueSend = send; } public void pt3(boolean send, int emote, String text, String text2, String text3 ) { sendFrame200(980, emote); sendFrame126(playerName, 981); sendFrame126(text, 982); sendFrame126(text2, 983); sendFrame126(text3, 984); sendFrame126("Click here to continue", 985); sendFrame185(980); sendFrame164(979); NpcDialogueSend = send; } public void pt4(boolean send, int emote, String text, String text2, String text3 , String text4) { sendFrame200(987, emote); sendFrame126(playerName, 988); sendFrame126(text, 989); sendFrame126(text2, 990); sendFrame126(text3, 991); sendFrame126(text4, 992); sendFrame126("Click here to continue", 993); sendFrame185(987); sendFrame164(986); NpcDialogueSend = send; } //end options talk //different message type!// public void item1(boolean send, String t, int i, String a){ sendFrame200(4883, 591); sendFrame126(t, 4884); sendFrame126(a, 4885); sendFrame126("Click here to continue", 4886); sendFrame246(4883, 250, i); sendFrame164(4882); NpcDialogueSend = send; } public void item1t(boolean send, String t, int i, int b, String a){ sendFrame200(4883, 591); sendFrame126(t, 4884); sendFrame126(a, 4885); sendFrame126("Click here to continue", 4886); sendFrame246(4883, b, i); sendFrame164(4882); NpcDialogueSend = send; } public void item2(boolean send, String t, int i, String a, String b){ sendFrame200(4888, 591); sendFrame126(t, 4889); sendFrame126(a, 4890); sendFrame126(b, 4891); sendFrame126("Click here to continue", 4892);

sendFrame246(4888, 250, i); sendFrame164(4887); NpcDialogueSend = send; } public void item3(boolean send, String t, int i, String a, String b, String c){ sendFrame200(4894, 591); sendFrame126(t, 4895); sendFrame126(a, 4896); sendFrame126(b, 4897); sendFrame126(c, 4898); sendFrame126("Click here to continue", 4899); sendFrame246(4894, 250, i); sendFrame164(4893); NpcDialogueSend = send; } public void item4(boolean send, String t, int i, String a, String b, String c, S tring d){ sendFrame200(4901, 591); sendFrame126(t, 4902); sendFrame126(a, 4903); sendFrame126(b, 4904); sendFrame126(c, 4905); sendFrame126(d, 4906); sendFrame126("Click here to continue", 4907); sendFrame246(4901, 250, i); sendFrame164(4900); NpcDialogueSend = send; } public void text1(boolean send, String s) { changeText126(s, 357); changeText126("Click here to continue", 358); sendFrame164(356); NpcDialogueSend = send; } public void text2(boolean send, String s, String t) { changeText126(s, 360); changeText126(t, 361); changeText126("Click here to continue", 362); sendFrame164(359); NpcDialogueSend = send; } public void text3(boolean send, String s, String t, String m) { changeText126(s, 364); changeText126(t, 365); changeText126(m, 366); changeText126("Click here to continue", 367); sendFrame164(363); NpcDialogueSend = send; } public void text4(boolean send, String s, String t, String m, String b) { changeText126(s, 369); changeText126(t, 370); changeText126(m, 371); changeText126(b, 372); changeText126("Click here to continue", 373); sendFrame164(368);

NpcDialogueSend = send; } public void text5(boolean send, String s, String t, String m, String b, String v ) { changeText126(s, 375); changeText126(t, 376); changeText126(m, 377); changeText126(b, 378); changeText126(v, 379); changeText126("Click here to continue", 380); sendFrame164(374); NpcDialogueSend = send; } //Ending!// public void scanPickup() { if(absX == apickupx && absY == apickupy) { if(ItemHandler.itemExists(apickupid, absX, absY)) { int itemAmount = ItemHandler.itemAmount(apickupid, apickupx, apickup y); if(Item.itemStackable[apickupid] && (playerHasItem(apickupid) || pla yerHasItem(-1))) { addItem(apickupid, itemAmount); ItemHandler.removeItem(apickupid, apickupx, apickupy, itemAmount ); removeGroundItem(apickupx, apickupy, apickupid); } else if(!Item.itemStackable[apickupid] && playerHasItem(-1)) { ItemHandler.removeItem(apickupid, apickupx, apickupy, 1); addItem(apickupid, 1); } apickupid = -1; apickupx = -1; apickupy = -1; } else if(!ItemHandler.itemExists(apickupid, apickupx, apickupy)) { apickupid = -1; apickupx = -1; apickupy = -1; } } } /*FISHING*/ public int fishCaughtTimer = -1; public int fishId = 0; public int fishEmote = 0; public int fishXP = 0; public int fishDelayFinal = 0; public void writeBonus() { int offset = 0; String send = ""; for (int i = 0; i < playerBonus.length; i++) { if (playerBonus[i] >= 0) { send = BonusName[i]+": +"+playerBonus[i]; } else { send = BonusName[i]+": -"+java.lang.Math.abs(pla yerBonus[i]); } if (i == 10) { offset = 1;

} changeText126(send, (1675+i+offset)); } } public void startToFish(int delayToCatch, int fishType, int emoteId, int xpRec) { fishCaughtTimer = delayToCatch - (misc.random((int) (playerLevel [playerFishing] * 0.1))); if (fishCaughtTimer <= 0) { fishCaughtTimer = 1; } fishId = fishType; fishEmote = emoteId; fishXP = xpRec; SetStandEmote(fishEmote); startAnimation(fishEmote); fishSpot = 0; } public void startToFish2(int delayToCatch, int emoteId, int xpRec) { fishCaughtTimer = delayToCatch - (misc.random((int) (playerLevel [playerFishing] * 0.1))); if (fishCaughtTimer <= 0) { fishCaughtTimer = 1; } fishId = randomFish(); fishEmote = emoteId; fishXP = xpRec; SetStandEmote(fishEmote); startAnimation(fishEmote); } public int randomFish(){ int i = misc.random(100); if(i <= 30) return 359; else if(i >= 30 && i <= 60) return 383; else return 371; } public void SetStandEmote(int i) { playerSE = i; updateRequired = true; appearanceUpdateRequired = true; } public void resetFishing() { SetStandEmote(GetStandEmote(playerEquipment[playerWeapon], getIt emName(playerEquipment[playerWeapon]))); fishCaughtTimer = -1; resetAnimation(); } public void addFish() {

if ((fishId == 327 || fishId == 345 || fishId == 349) && InvItem Amt(313) <= 0) { showDialogue("You need bait to catch this!"); resetFishing(); return; } else if ((fishId == 335) && InvItemAmt(314) <= 0) { showDialogue("You need feathers to catch this!"); resetFishing(); return; } else if ((fishId == 327 || fishId == 345 || fishId == 349) && In vItemAmt(313) > 0) { deleteItem(313, GetItemSlot(313), 1); } else if ((fishId == 335) && InvItemAmt(314) > 0) { deleteItem(314, GetItemSlot(314), 1); } else if (!addItem(fishId, 1)) { sendMessage("Not enough space in your inventory."); resetFishing(); return; } else { addSkillXP(fishXP, playerFishing); sendMessage("You catch some "+ GetItemName(fishId)); } } public void SummonNewNPC(int npcID) { server.npcHandler.newSummonedNPC(npcID, absX, absY-1, heightLevel, absX-1 , absY-1, absX+1, absY-1, 1, server.npcHandler.GetNpcListHP(npcID), false, playe rId); summonedNPCS++; actionTimer = 20; } public boolean HasFireStaff() { if (playerEquipment[playerWeapon] == 1401) { return true; } if (playerEquipment[playerWeapon] == 1393) { return true; } if (playerEquipment[playerWeapon] == 1387) { return true; } if (playerEquipment[playerWeapon] == 3053) { return true; } if (playerEquipment[playerWeapon] == 3054) { return true; } return false; }

private void setSidebarMage() { try { outStream.createFrame(106); outStream.writeByteC(6); updateRequired = true; appearanceUpdateRequired = true; } catch(Exception E) { sendMessage("Error switching sidebar back to the interface!"); } } public int alchDelay = 0; public void gfx100(int gfx) { mask100var1 = gfx; mask100var2 = 6553600; mask100update = true; updateRequired = true; } public void mineEss() { if (playerEquipment[playerWeapon] == 1275 || playerEquipment[playerWeapon] = = 1265) { addItem(1436, 1); lastAction = System.currentTimeMillis(); addSkillXP(30, playerMining); } else { resetAction(true); sendMessage("You must have a pickaxe to mine!"); } } public String GetItemName(int ItemID) { for (int i = 0; i < server.itemHandler.MaxListedItems; i++) { if (server.itemHandler.ItemList[i] != null) { if (server.itemHandler.ItemList[i].itemId == Ite mID) { return server.itemHandler.ItemList[i].it emName; } if (ItemID == -1) { return "Unarmed"; } } } return "Invalid ITEM - ID:"+ItemID; } boolean miningEss = false; public void makeGlobalObject(int x, int y, int typeID, int orientation, int tile ObjectType){ //Makes Global objects for (Player p : server.playerHandler.players){ if(p != null){ client person = (client)p; if((person.playerName != null || person.playerName != "n ull")){ if(person.distanceToPoint(x, y) <= 60){ person.createNewTileObject(x, y, typeID, orientation, tileObjectType); } } } } }

public void NewObjects(){ //Makes Global objects if (heightLevel == 0) { makeGlobalObject(2613, 3084, 3994, 2, 10); makeGlobalObject(2688, 3474, 2480, 3, 10); makeGlobalObject(2627, 3119, 2486, 3, 10);//nature altar makeGlobalObject(2854, 2965, 2783, 2, 10); makeGlobalObject(2863, 2961, 6232, 2, 10); makeGlobalObject(2854, 2958, 4692, 2, 10); makeGlobalObject(2850, 2958, 4693, 2, 10); makeGlobalObject(2824, 2996, 2094, 2, 10); makeGlobalObject(2823, 2997, 2091, 2, 10); makeGlobalObject(2824, 3000, 2109, 2, 10); makeGlobalObject(2828, 2999, 2093, 2, 10); makeGlobalObject(2828, 3002, 2102, 2, 10); makeGlobalObject(2826, 2999, 2096, 2, 10); makeGlobalObject(2847, 2997, 12389, 2, 10); makeGlobalObject(2733, 3374, 6420, 3, 10); makeGlobalObject(2819, 3474, 2489, 3, 10); } else if (heightLevel == 1) { } } public void players() { sendQuest("@dre@Namehere - infos", 8144); clearQuestInterface(); int line = 8147 ; for (int i = 1; i < PlayerHandler.maxPlayers; i++) { client playa = getClient(i); if (!validClient(i)) continue; if (playa.playerName != null) { String title = ""; if (playa.playerRights == 0 && playa.premium == false) { title = "Player, "; } else if (playa.playerRights == 0 && playa.premium == true) { title = "Premium, "; } else if (playa.playerRights == 1) { title = "Mod, "; } else if (playa.playerRights == 2) { title = "Admin, "; } else if (playa.playerRights == 3) { title = "Owner, ";} title += "level-" + playa.combatLevel; String extra = ""; if (playerRights > 0) { extra = "(" + playa.playerId + " ) ";} sendQuest("@dre@" + extra + playa.playerName + "@dbl@ ("+ title +") is at " + playa.absX + ", "+ playa.absY, line); line++;}} sendQuestSomething(8143); showInterface(8134); flushOutStream();} public static boolean AutoSave = false; public boolean clicked = false; public static final int bufferSize = 1000000; public static boolean comeback = false; public int TlastSlot = -1, RlastSlot = -1; public int minedOres = 0; public int maxOres = 0; public int minedMax = 0; public long lastOre = 0; public static final int packetSizes[] = { 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, // 0

0, 0, 0, 2, 0, 0, 6, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 4, 0, 1, 0, 0,

0, 0, 0, 8, 0, 6, 2, 2, 0, // 10 2, 0, 6, 0, 12, 0, 0, 0, 0, // 20 0, 0, 0, 0, 8, 4, 0, 0, 2, // 30 6, 0, 6, 0, -1, 0, 0, 0, 0, // 40 0, 0, 12, 0, 0, 0, 8, 0, 0, // 50 8, 0, 0, 0, 0, 0, 0, 0, 0, // 60 0, 2, 2, 8, 6, 0, -1, 0, 6, // 70 0, 0, 0, 0, 1, 4, 6, 0, 0, // 80 0, 0, 0, 0, 3, 0, 0, -1, 0, // 90 13, 0, -1, 0, 0, 0, 0, 0, 0, // 100 0, 0, 0, 0, 0, 0, 6, 0, 0, // 110 0, 6, 0, 0, 0, -1, 0, 2, 6, // 120 4, 6, 8, 0, 6, 0, 0, 0, 2, // 130 0, 0, 0, 0, 6, 0, 0, 0, 0, // 140 0, 1, 2, 0, 2, 6, 0, 0, 0, // 150 0, 0, 0, -1, -1, 0, 0, 0, 0, // 160 0, 0, 0, 0, 0, 0, 0, 0, 0, // 170 8, 0, 3, 0, 2, 0, 0, 8, 1, // 180 0, 12, 0, 0, 0, 0, 0, 0, 0, // 190 0, 0, 0, 0, 0, 0, 0, 4, 0, // 200 0, 0, 0, 7, 8, 0, 0, 10, 0, // 210 0, 0, 0, 0, 0, -1, 0, 6, 0, // 220 0, 0, 0, 6, 0, 6, 8, 1, 0, // 230 4, 0, 0, 0, 0, -1, 0, -1, 4, // 240 0, 6, 6, 0, 0, 0 // 250

}; public static boolean threats; public int aaa; public int abc; public int abc2; public int starter = 0; public int[]requiredLevel = { 50, 52, 1, 54, 58, 1, 62, 64, 1, 68, 70, 1, 74, 76, 1, 80, 82, 1, 86, 88, 1, 92, 94, 1 }; public int[]baseDamage = { 1, 2, 0, 3, 4, 0, 5, 6, 0, 7, 8, 0, 9, 10, 0, 11, 12, 0, 13, 14, 0, 15, 16, 0 }; public int[]ancientId = { 12939, 12987, 0, 12901, 12861, 0, 12963, 13011, 0, 12919, 12881, 0, 12951, 1 2999, 0, 12911, 12871, 0, 12975, 13023, 0, 12929, 12891, 0 }; public int[]ancientType = { 0, 0, 1, 2, 3, 1, 0, 0, 1, 2, 3, 1, 0, 0, 1, 2, 3, 1, 0, 0, 1, 2, 3, 1 }; public int[]ancientRune1 = { 565, 565, 0, 565, 565, 0, 565, 565, 0, 565, 565, 0, 565, 565, 0, 565, 565, 0 , 565, 565, 0, 565, 565 }; public int[]ancientRuneAm = { 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1 }; public int[]ancientButton = { 51133, 51185, -1, 51091, 24018, -1, 51159, 51211, -1, 51111, 51069, -1, 5114 6, 51198, -1, 51102, 51058, -1, 51172, 51224, -1, 51122, 51080, -1 }; public int actionButtonId = 0; public boolean adding = false, emoting = false;

/* ALLIGNMENT(Good - Evil - Creds to Runite) */ public int allignment = 0; public boolean alreadyChose = false; public int ancients = 1; public boolean ancientstele = false; public int angle = 250; long animationReset = 0, lastButton = 0; public boolean AnimationReset; // Resets Animations With The Use Of The public int AntiTeleDelay; public int arenaSpellTimer; public int attackedNpcId = -1; public int AttackingOn = 0; public int autocast_spellIndex = -1; public int barTimer = 0, saveTimer = 0; public String BonusMySqlName[] = { "attack_stab", "attack_slash", "attack_crush", "attack_magic", "attack_range", "defence _stab", "defence_slash", "defence_crush", "defence_magic", "defe nce_range", "other_strength", "other_prayer" }; public String BonusName[] = { "Stab", "Slash", "Crush", "Magic", "Range" , "Stab", "Slash", "Crush", "Magic", "Range", "Str", "Spel l Dmg" }; public byte buffer[] = null; int cAmount = 0; public int[] casketItems = { 4724, 4726, 4728, 4730, 1050, 1053, 1055, 1057, 1037, 3107, 4708, 4710, 4712, 4714, 2904, 777, 241 4 }; public boolean cast = false; // Part Of The Create Spell Code public boolean castleWarsOn = false; public boolean castSpell, isStillSpell; public int cba; int cExp = 0; int cItem = -1; int cLevel = 1; public int clickIndex = 0; public int[] clicks = new int[50]; public int CombatExpRate = 1; public String converse; private int cooking[] = { 0, 0, 0, 1, -1, -1, -1 }; public long[] coolDown = { 5000, 5000, 2500, 5000 }; public int[] coolDownGroup = { 2, 2, 1, 2, 3, 1, 2, 2, 1, 2, 3, 1, 2, 2, 1, 2, 3, 1, 2, 2, 1, 2, 3, 1 }; // Guardian: crafting boolean crafting = false; int cSelected = -1, cIndex = -1; public int currentButton = 0, currentStatus = 0; public int cwAmount = 0; public int cwTimer = 0; // Guardian: smelting boolean dialog = true, spinning = false; int dialogInterface = 2459, dialogId = 1; public String dMsg = ""; public int doors = -1;

public public public public public public public public public public public s",

boolean wonDuel = false; int duel_with = 0; boolean inDuelDupe = false; boolean duelAccept1 = false; boolean duelAccept2 = false; int[] duelButtons = { 26069, 26070, 26071, 30136, 2158, 26065, 26072, 26073, 26074, 26066, 26076 }; int[] duelItems = new int[28]; int[] duelItemsN = new int[28]; boolean[] duelItemsNoted = new boolean[28]; int[] duelLine = { 6698, 6699, 6697, 7817, 669, 6696, 6701, 6702, 6703, 6704, 6731 }; String[] duelNames = { "No Ranged", "No Melee", "No Magic", "No Gear Change", "Fun Weapons", "No Retreat", "No Drink

"No Food", "No prayer", "No Movement", "Obstacles" }; public int duelpartner = 0; public boolean duelReq = false; public boolean duelRequested = false, inDuel = false, duelConfirmed = false, duelConfirmed2 = false, duelResetNeeded = false, duelFight = false; public boolean[] duelRule = { false, false, false, false, false, true, false, true, false, true, false }; public int duelWho = 0; public int[] effects = new int[10]; private int emotes = 0; public int enemyId = -1, enemyX = -1, enemyY = -1, attackTimer = 0; public int EntangleDelay = 0; /* * [0] North West [1] North East [2] Center [3] South East [4] South Wes t */ public public public public int int int int EssenceMineRX[] = { 3253, 3105, 2681, 2591 EssenceMineRY[] = { 3401, 9571, 3325, 3086 EssenceMineX[] = { 2893, 2921, 2911, 2926, EssenceMineY[] = { 4846, 4846, 4832, 4817, }; }; 2899 }; 4817 };

public int fangle = 0; public int fcasterX = 0; public int fcasterY = 0; // ActionTimer public int fcastid = 0; public int feh = 0; public int fenemyX = 0; public int fenemyY = 0; public int ffinishid = 0; public boolean fired = false; // Part Of The Create Spell Code private int firemaking[] = { 0, 0, 0, 1, -1 }; public boolean firingspell = false; // Part Of The Create Spell Code boolean fishing = false; // Guardian: fishing public int fletchId = -1, fletchAmount = -1, fletchLog = -1, originalW = -1, originalS = -1, fletchExp = 0; public boolean fletching = false;

// These are temp data public int fletchTime; public int fmgfxid = 0; public int foffsetX = 0; public int foffsetY = 0; public boolean friendUpdate = false, lookUpdate = false; public int fsh = 0; public int fspeed = 0; public long[] globalCooldown = new long[10]; /* RANGE */ public boolean HasArrows = false; /* MISC */ public int hasset = 0; private int healing[] = { 0, 0, 0, -1, -1 }; public int i; public boolean iceBarrage = false; /* WALKING TO OBJECT BEFORE DOING ACTION */ public int iceTimer = 0; /* DUELING */ private java.io.InputStream in; public stream inStream = null, outStream = null; public Cryption inStreamDecryption = null, outStreamDecryption = null; public boolean isSpellNPC; // added check weather magic attack player or public int KillerId = playerId; public long lastAttack = 0; String[] lastMessage = new String[3]; public long lastMouse = 0; // Guardian: fletching private long lastPickup = 0; public long lastProcess = 0; public int loginDelay = 1; public boolean lookNeeded = false; /* SUMMONING */

public public public public public

int lowMemoryVersion = 0; int MageAttackIndex = -1; // -1 String MBBC; String MBHT; String MBID;

/* * --------MOD BOT----------- // MB = MOD BOT // -TC = Text Censor // -B C = * Bad Command // -HT = Help Text // -ID = Item Duping */ public String MBTC; public boolean member = false; private int mining[] = { 0, 0, 0, 1, -1 }; private java.net.Socket mySock; public int newheightLevel = 0; public int[] noTrade = { 1543, 1544, 7592, 7593, 7594, 7595, 7596}; public int NPCID; // GLOBALLY NOW last clicked npcID -bakatool public int NX; public int NY; public int NPCSlot; // GLOBALLY NOW last clicked npc slot -bakatool public boolean oddDeath = false; public CopyOnWriteArrayList<GameItem> offeredItems = new CopyOnWriteArra yList<GameItem>(); public boolean officialClient = false; public int oldclick = 0; public int OriginalShield = -1; public int OriginalWeapon = -1; public CopyOnWriteArrayList<GameItem> otherOfferedItems = new CopyOnWrit eArrayList<GameItem>(); private java.io.OutputStream out; public int packetSize = 0, packetType = -1; public int pCArms; public public public public int int int int pCBeard; pCFeet; pCHands; pCHead;

public int pCLegs; public int pColor; public int pCTorso; public int PickUpAmount = 0; public int PickUpDelete = 0; public int PickUpID = 0;

public int playerClass = 0; // 0 = undecided, 1 = warrior, 2 = mage, 3 = public boolean playerIsSaradomin = false; public boolean playerIsZamorak = false; public String playerstatus = ""; private int prayer[] = { 0, 1, 0, 1, -1, -1 }; // public int[] killers = new int[server.playerHandler.maxPlayers]; public String properName = ""; public int Publicchat = 0; public int[] QuestInterface = { 8145, 8147, 8148, 8149, 8150, 8151, 8152 , 8153, 8154, 8155, 8156, 8157, 8158, 8159, 8160, 8161, 81 62, 8163, 8164, 8165, 8166, 8167, 8168, 8169, 8170, 8171, 8172, 81 73, 8174, 8175, 8176, 8177, 8178, 8179, 8180, 8181, 8182, 8183, 81 84, 8185, 8186, 8187, 8188, 8189, 8190, 8191, 8192, 8193, 8194, 81 95, 12174, 12175, 12176, 12177, 12178, 12179, 12180, 12181, 12182, 12183, 12184, 12185, 12186, 12187, 12188, 12189, 12190, 12191, 12192, 12193, 12194, 12195, 12196, 12197, 12198, 12199, 12200, 12201, 12202, 12203, 12204, 12205, 12206, 12207, 12208, 12209, 12210, 12211, 12212, 12213, 12214, 12215, 12216, 12217, 12218, 12219, 12220, 12221, 12222, 12223 }; public int random_skill = -1, npcId = -1; public int readPtr, writePtr; public int resetanim = 8; public int restart = 0; /* PRAYER */ public boolean Retribution = false; public int returnCode = 2; // Tells the client if the login was successf ull public int rune1, rune1Am, rune2, rune2Am, rune3, rune3Am, rune4, rune4A m, spellXP; public int sameclick = 0; public boolean SaradominStrike, GuthixClaws, ZamorakFlames; public int saraScore; public int savecounter = 0; public boolean saveNeeded = true;

public boolean shafting = false; public int SkillID = 0; public int skillX = -1; public int skillY = -1; public int smelt_id, smeltCount; public boolean smelting = false; private int smithing[] = { 0, 0, 0, 1, -1, 0 }; private int somejunk; public boolean spamButton = false; // -bakatool public int spellHit; // also same added so it won't be static ROFL // -bakatool public int spellHitTimer; // npc. -bakatool public int spellNpcIndex = -1; // added so it won't be static ROFL.. // -bakatool public int spellPlayerIndex = -1; // same added so it won't be static RO FL public public public public public 11004, 11003, 11005, 47002, 54090, 11007 }; public String statName[] = { "attack", "defence", "strength", "hitpoints ", "range", "prayer", "magic", "cooking", "woodcutting", "f letching", "fishing", "firemaking", "crafting", "smithing", "mining ", public public public public public public public public public "herblore", "agility", "thieving", "slayer", "farming", "runecrafting" }; int stealtimer; int stillSpellGFX; int summonLevel = 250; int summonXP = 9999999; String teleLoc = ""; boolean teleOtherScreen = false; boolean teleport = false; int teleReq = 0; int teletimer = 0; boolean spellSet = false; int stairDistance = 1; int stairDistanceAdd = 0; int stairs = 0; int[] statId = { 10252, 11000, 10253, 11001, 10254, 11002, 10255, 11011, 11013, 11014, 11010, 11012, 11006, 11009, 11008,

public int teleX = 0; public int teleY = 0; public int timeOutCounter = 0; // to detect timeouts on the connection t

o // the client public int trade_reqId = 0, trade_other; public int Tradecompete = 0; public boolean tradeRequested = false, inTrade = false, canOffer = true, tradeConfirmed = false, tradeConfirmed2 = false, tradeResetNeeded = false; long tTime = 0; // Guardian: teleports int tX = 0, tY = 0, tStage = 0, tH = 1; private int useitems[] = { -1, -1, -1, -1 }; // ranger public String[] userGroup = { "Unknown group", "Guest", "Registered User ", "Awaiting Confirmation", "COPPA User", "Super Moderator" , "Administrator", "Moderator", "Banned User", "Unknown gr oup", "Veteran" }; public boolean validClient = true, muted = false, attackedNpc = false; public boolean validLogin = false; // public int[] restrictedItem = { 4716, 4718, 4720, 4722, 4724, 4726, 4 728, // 4730}; private int WanneBank = 0; private int WanneShop = 0; public boolean wearing = false; public boolean WildernessWarning = false; public String Winner = "Nobody"; private int woodcutting[] = { 0, 0, 0, 1, -1, 2 }; private int XinterfaceID = 0; private int XremoveID = 0; private int XremoveSlot = 0; public int zammyScore; public client(java.net.Socket s, int _playerId) { super(_playerId); mySock = s; try { in = s.getInputStream(); out = s.getOutputStream(); } catch (java.io.IOException ioe) { misc.println("Guardian Server (1): Exception!"); server.logError(ioe.getMessage()); } outStream = new stream(new byte[bufferSize]);

outStream.currentOffset = 0; inStream = new stream(new byte[bufferSize]); inStream.currentOffset = 0; readPtr = writePtr = 0; buffer = buffer = new byte[bufferSize]; } public void actionReset() { actionName = ""; } public void addClick(int ms) { println("adding click " + ms + " (clickindex = " + clickIndex + " )"); if (clickIndex <= clicks.length - 1) { clicks[clickIndex] = ms; clickIndex++; } else { int[] precision = new int[50]; int average = average(clicks); for (int i = 0; i < precision.length; i++) { precision[i] = Math.abs(clicks[i] - average); println("precision[" + i + "]=" + precision[i]); } resetArray(clicks); clickIndex = 0; } } public void AddDroppedItems() { if (IsDropping == false) { IsDropping = true; int tmpX = 0; int tmpY = 0; int calcX = 0; int calcY = 0; for (int i = 0; i < server.itemHandler.DropItemCount; i+ +) { if (server.itemHandler.DroppedItemsID[i] > -1) { tmpX = server.itemHandler.DroppedItemsX[ i]; tmpY = server.itemHandler.DroppedItemsY[ i]; calcX = tmpX - absX; calcY = tmpY - absY; if ((calcX >= -16) && (calcX <= 15) && (calcY >= -16) && (calcY <= 15) && (MustDelete[i] == fal se) && (server.itemHandler.D roppedItemsH[i] == heightLevel)) { if ((IsDropped[i] == false) && ((server.item Handler.DroppedItemsDDelay[i] <= 0) || (server.itemHandler.DroppedItemsDropper[i ] == playerId))) { IsDropped[i] = true;

outStream.createFrame(85 ); outStream .writeBy teC((server.itemHandler.DroppedItemsY[i] - 8 * mapRegionY)); outStream .writeBy teC((server.itemHandler.DroppedItemsX[i] - 8 * mapRegionX)); outStream.createFrame(44 ); // create item frame outStream .writeWo rdBigEndianA(server.itemHandler.DroppedItemsID[i]); outStream .writeWo rd(server.itemHandler.DroppedItemsN[i]); // amount outStream.writeByte(0); // x(4 MSB) y(LSB) coords } } else if ((IsDropped[i] == true) || (MustDelete[i] == tru e)) { outStream.createFrame(85); outStream .writeByteC((ser ver.itemHandler.DroppedItemsY[i] - 8 * mapRegionY)); outStream .writeByteC((ser ver.itemHandler.DroppedItemsX[i] - 8 * mapRegionX)); outStream.createFrame(156); // r emove item frame outStream.writeByteS(0); // x(4 MSB) y(LSB) coords outStream .writeWord(serve r.itemHandler.DroppedItemsID[i]); int LastPlayerInList = -1; int TotalPlayers = 0; for (int j = 1; j < PlayerHandle r.maxPlayers; j++) { if (PlayerHandler.player s[j] != null) { LastPlayerInList = j; TotalPlayers++; } } if (MustDelete[i] == true) { MustDelete[i] = false; server.itemHandler.Dropp edItemsDeletecount[i]++; if (((LastPlayerInList = = playerId) || (LastPlayerInList == -1)) && (serv er.itemHandler.DroppedItemsDeletecount[i] == TotalPlayers)) { if (server.itemH andler.DroppedItemsAlwaysDrop[i] == true) { server.i temHandler.DroppedItemsDropper[i] = -1;

server.i temHandler.DroppedItemsDDelay[i] = server.itemHandler.SDID; } else { server.i temHandler.ResetItem(i); } for (int j = 1; j < PlayerHandler.maxPlayers; j++) { if (Play erHandler.players[j] != null) { PlayerHandler.players[j].IsDropped[i] = false; } } } } else { IsDropped[i] = false; } } } } IsDropping = false; } } public void AddGlobalObj(int objectX, int objectY, int NewObjectID, int Face, int ObjectType) { // for (Player p : server.playerHandler.players) { // Linux (java 1.4.2-compatible) change - Guardian for (Player p : server.playerHandler.players) { if (p != null) { client person = (client) p; if (person.playerName != null) { if (person.distanceToPoint(objectX, obje ctY) <= 60) { person.ReplaceObject2(objectX, o bjectY, NewObjectID, Face, ObjectType ); } } } } } public boolean addItem(int item, int amount) { if((freeSlots() < 1) && inTrade){ sendMessage("Not enough space."); declineTrade(); return false; } if (item >= Item.itemStackable.length) { return false; } if ((item < 0) || (amount < 1)) { return false; } if (!Item.itemStackable[item] || (amount < 1)) { amount = 1;

} if (((freeSlots() >= amount) && !Item.itemStackable[item]) || (freeSlots() > 0)) { for (int i = 0; i < playerItems.length; i++) { if ((playerItems[i] == (item + 1)) && Item.itemS tackable[item] && (playerItems[i] > 0)) { playerItems[i] = (item + 1); if (((playerItemsN[i] + amount) < maxIte mAmount) && ((playerItemsN[i] + a mount) > -1)) { playerItemsN[i] += amount; } else { playerItemsN[i] = maxItemAmount; } outStream.createFrameVarSizeWord(34); outStream.writeWord(3214); outStream.writeByte(i); outStream.writeWord(playerItems[i]); if (playerItemsN[i] > 254) { outStream.writeByte(255); outStream.writeDWord(playerItems N[i]); } else { outStream.writeByte(playerItemsN [i]); // amount } outStream.endFrameVarSizeWord(); i = 30; return true; } } for (int i = 0; i < playerItems.length; i++) { if (playerItems[i] <= 0) { playerItems[i] = item + 1; if ((amount < maxItemAmount) && (amount > -1)) { playerItemsN[i] = amount; } else { playerItemsN[i] = maxItemAmount; } outStream.createFrameVarSizeWord(34); outStream.writeWord(3214); outStream.writeByte(i); outStream.writeWord(playerItems[i]); if (playerItemsN[i] > 254) { outStream.writeByte(255); outStream.writeDWord(playerItems N[i]); } else { outStream.writeByte(playerItemsN [i]); // amount } outStream.endFrameVarSizeWord(); i = 30; return true; } }

return false; } else { sendMessage("Not enough space in your inventory."); return false; } } public void addObject(int objectX, int objectY, int NewObjectID, int Fac e) { outStream.createFrameVarSizeWord(60); outStream.writeByte(objectY - (mapRegionY * 8)); outStream.writeByteC(objectX - (mapRegionX * 8)); /* CREATE OBJECT */ if (NewObjectID > -1) { outStream.writeByte(151); outStream.writeByteS(0); outStream.writeWordBigEndian(NewObjectID); outStream.writeByteA(Face); // 0= WEST | -1 = NORTH | -2 = EAST | -3 // = SOUTH } outStream.endFrameVarSizeWord(); } public void AddObjectFire() { if (IsFireing == false) { IsFireing = true; int tmpX = 0; int tmpY = 0; int calcX = 0; int calcY = 0; for (int i = 0; i < server.objectHandler.MaxObjects; i++ ) { if (server.itemHandler.DroppedItemsID[i] > -1) { tmpX = server.objectHandler.ObjectFireX[ i]; tmpY = server.objectHandler.ObjectFireY[ i]; calcX = tmpX - absX; calcY = tmpY - absY; if ((calcX >= -16) && (calcX <= 15) && (calcY >= -16) && (calcY <= 15) && (FireDelete[i] == fal se) && (server.objectHandler .ObjectFireH[i] == heightLevel)) { if (IsFireShowed[i] == false) { IsFireShowed[i] = true; ReplaceObject(server.obj ectHandler.ObjectFireX[i], server.o bjectHandler.ObjectFireY[i], server.o bjectHandler.ObjectFireID[i], 0, 10); } } else if ((IsFireShowed[i] == true)

|| (FireDelete[i] == tru e)) { ReplaceObject(server.objectHandl er.ObjectFireX[i], server.objectHan dler.ObjectFireY[i], -1, 0, 10); int LastPlayerInList = -1; int TotalPlayers = 0; for (int j = 1; j < PlayerHandle r.maxPlayers; j++) { if (PlayerHandler.player s[j] != null) { LastPlayerInList = j; TotalPlayers++; } } if (FireDelete[i] == true) { FireDelete[i] = false; server.objectHandler.Obj ectFireDeletecount[i]++; if (((LastPlayerInList = = playerId) || (LastPlayerInList == -1)) && (serv er.objectHandler.ObjectFireDeletecount[i] == TotalPlayers)) { server.objectHan dler.ResetFire(i); for (int j = 1; j < PlayerHandler.maxPlayers; j++) { if (Play erHandler.players[j] != null) { PlayerHandler.players[j].IsFireShowed[i] = false; } } if (misc.random( 2) == 1) { createIt em(592); } } } else { IsFireShowed[i] = false; } } } } IsFireing = false; } } public boolean addShopItem(int itemID, int amount) { boolean Added = false; if (amount <= 0) { return false; } if (Item.itemIsNote[itemID] == true) { itemID = GetUnnotedItem(itemID);

} for (int i = 0; i < server.shopHandler.ShopItems.length; i++) { if ((server.shopHandler.ShopItems[MyShopID][i] - 1) == i temID) { server.shopHandler.ShopItemsN[MyShopID][i] += am ount; Added = true; } } if (Added == false) { for (int i = 0; i < server.shopHandler.ShopItems.length; i++) { if (server.shopHandler.ShopItems[MyShopID][i] == 0) { server.shopHandler.ShopItems[MyShopID][i ] = (itemID + 1); server.shopHandler.ShopItemsN[MyShopID][ i] = amount; server.shopHandler.ShopItemsDelay[MyShop ID][i] = 0; break; } } } return true; } public boolean addSkillXP(double amount, int skill) { if (randomed) { sendMessage("You must answer the genie before you can ga in experience!"); return false; } int oldLevel = getLevelForXP(playerXP[skill]); // int[] statId = {4004, 4008, 4006, 4016, 4010, 4012, 4014, 403 4, 4038, // 4026, 4032, 4036, 4024, 4030, 4028, 4020, 4018, 4022, 4152}; playerXP[skill] += amount; if (oldLevel < getLevelForXP(playerXP[skill])) { // if(oldLevel >= 85) animation(199, absY, absX); playerLevel[skill] = getLevelForXP(playerXP[skill]); // stillgfx(623, absY, absX); // levelup(skill); updateRequired = true; appearanceUpdateRequired = true; sendMessage("Congratulations, you just advanced a " + statName[skill] + " level."); if(skill == 3 || skill == playerLevel[playerHitpoints]) { currentHealth += 1; if(currentHealth >= playerLevel[3]) { currentHealth = playerLevel[3]; }} if (playerLevel[skill] > 90) yell(playerName + "'s " + statName[skill] + " le vel is now " + playerLevel[skill] + "!"); // sendFrame126(playerName + " (" + combatLevel + ")", 6 572);

setSkillLevel(skill, playerLevel[skill], playerXP[skill] ); } // setSkillLevel(skill, playerLevel[skill], playerXP[skill]); refreshSkills(); return true; } public int amountOfItem(int itemID) { int i1 = 0; for (int i = 0; i < 28; i++) { if (playerItems[i] == (itemID + 1)) { i1++; } } return i1; } public void animation(int id, int Y, int X) { // ANIMATIONS AT GROUND HEIGHT // for (Player p : server.playerHandler.players) { for (Player p : server.playerHandler.players) { if (p != null) { client person = (client) p; if (person.playerName != null) { if (person.distanceToPoint(X, Y) <= 60) { person.animation2(id, Y, X); } } } } } public void animation2(int id, int Y, int X) { // ANIMATIONS AT GROUND HEIGHT outStream.createFrame(85); outStream.writeByteC(Y - (mapRegionY * 8)); outStream.writeByteC(X - (mapRegionX * 8)); outStream.createFrame(4); outStream.writeByte(0); // Tiles away (X >> 4 + Y & 7) outStream.writeWord(id); // Graphic id outStream.writeByte(0); // height of the spell above it's basic place, i // think it's written in pixels 100 pixels high outStream.writeWord(0); // Time before casting the graphic } public void animation3(int id, int Y, int X) { // ANIMATIONS AT MIDDLE HEIGHT // for (Player p : server.playerHandler.players) { for (Player p : server.playerHandler.players) { if (p != null) { client person = (client) p; if (person.playerName != null) {

if (person.distanceToPoint(X, Y) <= 60) { person.animation4(id, Y, X); } } } } } public void animation4(int id, int Y, int X) { // ANIMATIONS AT GROUND HEIGHT outStream.createFrame(85); outStream.writeByteC(Y - (mapRegionY * 8)); outStream.writeByteC(X - (mapRegionX * 8)); outStream.createFrame(4); outStream.writeByte(0); // Tiles away (X >> 4 + Y & 7) outStream.writeWord(id); // Graphic id outStream.writeByte(0); // height of the spell above it's basic place, i // think it's written in pixels 100 pixels high outStream.writeWord(0); // Time before casting the graphic } public boolean antiHax() { if (System.currentTimeMillis() - lastMouse > 5000) { println("Suspicious activity!"); sendMessage("Client hack detected!"); sendMessage("The only supported clients are the Guardian client and moparscape"); return false; } return true; } public void appendToBanned(String player) { BufferedWriter bw = null; try { bw = new BufferedWriter( new FileWriter("data/bannedusers.dat", t rue)); bw.write(player); bw.newLine(); bw.flush(); } catch (IOException ioe) { ioe.printStackTrace(); } finally { if (bw != null) { try { bw.close(); } catch (IOException ioe2) { sendMessage("Error banning user!"); } } } } public boolean AreXItemsInBag(int ItemID, int Amount) {

int ItemCount = 0; for (int pItem : playerItems) { if ((pItem - 1) == ItemID) { ItemCount++; } if (ItemCount == Amount) { return true; } } return false; } // pk: 2726 9193 public boolean Attack() { if (!(AttackingOn > 0) || !(AttackingOn < server.playerHandler.players. length)) { ResetAttack(); return false; } if (playerId < 1) { sendMessage("Error: Your player id is invalid. Please tr y again or logout and back in"); } if ((AttackingOn > 0) && !server.pking) { sendMessage("Pking has been disabled ask admin to type : :enablepk -bakatool"); ResetAttack(); return false; } boolean UseBow = false; if (playerEquipment[playerWeapon] UseBow = true; } if (playerEquipment[playerWeapon] UseBow = true; } if (playerEquipment[playerWeapon] UseBow = true; } if (playerEquipment[playerWeapon] UseBow = true; } if (playerEquipment[playerWeapon] UseBow = true; } if (playerEquipment[playerWeapon] UseBow = true; } if (playerEquipment[playerWeapon] UseBow = true; } if (playerEquipment[playerWeapon] UseBow = true; } if (playerEquipment[playerWeapon] == 4212) { == 2883) { == 6082) { == 4214) { == 767) { == 837) { == 861) { == 4734) { == 4214) {

UseBow = true; } if (playerEquipment[playerWeapon] == 861) { UseBow = true; } if (playerEquipment[playerWeapon] == 859) { UseBow = true; } if (UseBow) { if (!duelRule[0]) { teleportToX = absX; teleportToY = absY; CheckArrows(); CalculateRange(this, (client) server.playerHandl er.players[AttackingOn]); hitDiff = playerMaxHit;//Range } else { sendMessage("You can't range in this duel!"); return false; } } if (!UseBow && duelRule[1]) { sendMessage("You can't melee in this duel!"); ResetAttack(); return false; } int EnemyX = PlayerHandler.players[AttackingOn].absX; int EnemyY = PlayerHandler.players[AttackingOn].absY; int EnemyHP = PlayerHandler.players[AttackingOn].playerLevel[pla yerHitpoints]; int EnemyHPExp = PlayerHandler.players[AttackingOn].playerXP[pla yerHitpoints]; client AttackingOn2 = (client) server.playerHandler.players[Atta ckingOn]; TurnPlayerTo(EnemyX, EnemyY); updateRequired = true; appearanceUpdateRequired = true; if (PlayerHandler.players[AttackingOn].playerEquipment[playerRin g] == 2570) { // RingOfLife = true; } int hitDiff = 0; CalculateMaxHit(this,(client) PlayerHandler.players[AttackingOn] );//melee hitDiff = playerMaxHit; if (FightType == 2) hitDiff = (int) (hitDiff * 1.20); long thisAttack = System.currentTimeMillis(); if (GoodDistance(EnemyX, EnemyY, absX, absY, 1) == true) { if (thisAttack - lastAttack >= 2000) { inCombat = true; lastCombat = System.currentTimeMillis(); if (isInWilderness(EnemyX, EnemyY, 1) || (duelFight && (AttackingOn == duel_with)) || ((matchId == handler.players[

AttackingOn].matchId) && (matchId >= 0))) { if (duelFight && (AttackingOn == duel_wi th)) { enemyX = PlayerHandler.players[A ttackingOn].absX; enemyY = PlayerHandler.players[A ttackingOn].absY; } if (handler.players[AttackingOn].matchLi ves < 1) { sendMessage("This player has bee n eliminated"); return false; } if (PlayerHandler.players[AttackingOn].d eathStage > 0) { ResetAttack(); sendMessage("That player is dead !"); } else { if (!duelFight && inRange(EnemyX , EnemyY)) { if (thisAttack - lastAtt ack >= 4000) ((client) Player Handler.players[AttackingOn]) .sendMessage("You are under attack!"); PlayerHandler.players[At tackingOn] .resetWa lkingQueue(); PlayerHandler.players[At tackingOn].hits++; PlayerHandler.players[At tackingOn].fighting = true; PlayerHandler.players[At tackingOn].fightId = localId; PlayerHandler.players[At tackingOn].IsAttacking = true; ((client) PlayerHandler. players[AttackingOn]) .Attack( ); fightId = AttackingOn; fighting = true; resetWalkingQueue(); } if (playerEquipment[playerW eapon] == 4151) { } actionAmount++; startAnimation(GetWeaponAtkEmote (getItemName(playerEquipment[playerWeapon]), 0)); PlayerHandler.players[AttackingO n].hitUpdateRequired = true; PlayerHandler.players[AttackingO n].updateRequired = true; PlayerHandler.players[AttackingO n].appearanceUpdateRequired = true;

if ((EnemyHP - hitDiff) < 0) { hitDiff = EnemyHP; } PlayerHandler.players[AttackingO n].dealDamage(hitDiff); PlayerHandler.players[AttackingO n].hitDiff = hitDiff; PlayerHandler.players[AttackingO n].killers[localId] += hitDiff; attackTimer = 7; lastAttack = System.currentTimeM illis(); // sendMessage("You hit " + hitD iff + ", time=" + // lastAttack); } return true; } else { sendMessage("This player is not in a Pki ng Area/Match."); ResetAttack(); } } } if (GoodDistance(EnemyX, EnemyY, absX, absY, 1) == false) { if (thisAttack - lastAttack >= 2000) { if ((isInWilderness(EnemyX, EnemyY, 1) == true) || (IsInCW(EnemyX, EnemyY) == tr ue) || (IsInTz(EnemyX, EnemyY) == tr ue)) { if (PlayerHandler.players[AttackingOn].d eathStage > 0) { ResetAttack(); } else if (playerEquipment[playerWeapon] == 4675) { TurnPlayerTo(EnemyX, EnemyY); PlayerHandler.players[AttackingO n].hitDiff = 0 + misc .random(22); animation(369, EnemyY, EnemyX); AnimationReset = true; updateRequired = true; appearanceUpdateRequired = true; actionAmount++; teleportToX = absX; teleportToY = absY; actionTimer = 15; setAnimation(1979); AnimationReset = true; PlayerHandler.players[AttackingO n].hitUpdateRequired = true; PlayerHandler.players[AttackingO n].updateRequired = true; PlayerHandler.players[AttackingO n].appearanceUpdateRequired = true; if ((EnemyHP - hitDiff) <= 0) { hitDiff = EnemyHP; // animation(437, absY,

absX); attackPlayersPrayer(15, 2); } } else if (UseBow) { actionAmount++; startAnimation(GetWeaponAtkEmote (getItemName(playerEquipment[playerWeapon]), 0)); PlayerHandler.players[AttackingO n].hitUpdateRequired = true; PlayerHandler.players[AttackingO n].updateRequired = true; PlayerHandler.players[AttackingO n].appearanceUpdateRequired = true; if ((EnemyHP - hitDiff) < 0) { hitDiff = EnemyHP; } PlayerHandler.players[AttackingO n].dealDamage(hitDiff); PlayerHandler.players[AttackingO n].hitDiff = hitDiff; attackTimer = 7; lastAttack = System.currentTimeM illis(); } return true; } else { sendMessage("This player is not in a Pki ng Area/Match."); ResetAttack(); } } } return false; } public boolean basicId(int id) { String WeaponName = getItemName(id); WeaponName = WeaponName.replaceAll("_", " "); WeaponName = WeaponName.trim(); if (WeaponName.startsWith("Bronze") || WeaponName.startsWith("Iron") || WeaponName.startsWith("Steel") || WeaponName.startsWith("Black") || WeaponName.s tartsWith("Mithril") || WeaponName.startsWith("Adamant") || WeaponName.startsWit h("Rune") || WeaponName.startsWith("Dragon") || WeaponName.startsWith("White")) return true; else return false; } public boolean AttackNPC() { int EnemyX = server.npcHandler.npcs[attacknpc].absX; int EnemyY = server.npcHandler.npcs[attacknpc].absY; int EnemyHP = server.npcHandler.npcs[attacknpc].HP; int NX = server.npcHandler.npcs[attacknpc].absX; int NY = server.npcHandler.npcs[attacknpc].absY; int hitDiff = 0; if (GoodDistance(NX, NY, absX, absY, 2) == true) { server.npcHandler.npcs[attacknpc].TurnNPCTo(absX, absY); server.npcHandler.npcs[attacknpc].FocusUpdateRequired = true; server.npcHandler.npcs[attacknpc].updateRequired = true; TurnPlayerTo(NX,NY);

} if (EnemyHP < 1) { sendMessage("You can't attack that monster!"); return false; } int type = server.npcHandler.npcs[attacknpc].npcType; if (type == 1125) { if (combatLevel < 70) { sendMessage("You must be level 70 or hig her to attack Dad"); ResetAttackNPC(); return false; } } int[] staffs = { 2415, 2416, 2417 }; int[] arrowIds = { 882, 884, 886, 888, 890, 892 }; int[] arrowGfx = { 10, 9, 11, 12, 13, 15 }; int[] prem = { 1643, 158, 49, 1613 }; for (int element : prem) { if ((element == type) && !premium) { resetPos(); return false; } } if (type == 1356) { if (combatLevel < 70) { sendMessage("You must be level 70 or higher to a ttack dagannoth mother."); ResetAttackNPC(); return false; } } if ((type == 110) || (type == 936)) { if (!playerHasItem(1543)) { resetPos(); ResetAttackNPC(); return false; } } if ((type == 221) || (type == 1961)) { if (!playerHasItem(1544)) { resetPos(); ResetAttackNPC(); return false; } } if(type == 1649 || type == 1633 || type == 1614 || type == 1637 || type == 2373 || type == 1575 || type == 119 || type == 82 || type == 83 || type == 84) { if(type != slayerTask) { text1(false, "You need a task to kill this monster!"); ResetAttackNPC(); return false; } } if (((type == 941) || (type == 55)) && !premium) { resetPos(); return false; } for (int a = 0; a < staffs.length; a++) { if (playerEquipment[playerWeapon] == staffs[a] && autocast_spellIndex >= 0

) { if (System.currentTimeMillis()-lastAttack < coolDown[coolDownGroup[autoc ast_spellIndex]]) { return false; } inCombat = true; lastCombat = System.currentTimeMillis(); lastAttack = System.currentTimeMillis(); if (playerLevel[6] >= requiredLevel[autocast_spellIndex] && playerHasIte m(ancientRune1[autocast_spellIndex], ancientRuneAm[autocast_spellIndex])) { int roll = misc.random(100); int hit = misc.random(baseDamage[autocast_spellIndex]+playerBonus[11]) ; //if(npcHit2(attacknpc) == true){ //hitDiff = hit; //} //if(npcHit2(attacknpc) == false){ //hitDiff = 10; // } setAnimation(1979); updateRequired = true; resetWalkingQueue(); deleteItem(ancientRune1[autocast_spellIndex], getItemSlot(ancientRune1[autocast_ spellIndex]), ancientRuneAm[autocast_spellIndex]); if (ancientType[autocast_spellIndex] == 3 && playerHasItem(ancientRune 1[autocast_spellIndex], ancientRuneAm[autocast_spellIndex])) { server.npcHandler.npcs[attacknpc].effects[0] = 15; stillgfx(369, EnemyY, EnemyX); deleteItem(ancientRune1[autocast_spellIndex], getItemSlot(ancientRune1[autocast_ spellIndex]), ancientRuneAm[autocast_spellIndex]); } else if (ancientType[autocast_spellIndex] == 2 && playerHasItem(anci entRune1[autocast_spellIndex], ancientRuneAm[autocast_spellIndex])) { stillgfx(377, EnemyY, EnemyX); currentHealth += (int)(hit/2); if (currentHealth > playerLevel[playerHitpoints]) currentHealth = playerLevel[playerHitpoints]; deleteItem(ancientRune1[autocast_spellIndex], getItemSlot(ancientRune1[autocast_ spellIndex]), ancientRuneAm[autocast_spellIndex]); } else animation(78, EnemyY, EnemyX); } if (playerLevel[6] < requiredLevel[autocast_spellIndex] && playerHasItem(ancient Rune1[autocast_spellIndex], ancientRuneAm[autocast_spellIndex])) { sendMessage("You need a magic level of "+requiredLevel[a utocast_spellIndex]); } else if (playerLevel[6] < requiredLevel[autocast_spellIndex ]) { sendMessage("You need "+ancientRuneAm[autocast_spellInde x]+" blood rune to cast this spell"); } TurnPlayerTo(EnemyX, EnemyY); addSkillXP(45*hitDiff, playerMagic); addSkillXP(hitDiff*CombatExpRate, playerHitpoints); teleportToX = absX; teleportToY = absY; server.npcHandler.npcs[attacknpc].StartKilling = localId; server.npcHandler.npcs[attacknpc].RandomWalk = false; server.npcHandler.npcs[attacknpc].IsUnderAttack = true;

server.npcHandler.npcs[attacknpc].hitDiff = hitDiff; server.npcHandler.npcs[attacknpc].Killing[playerId] += hitDiff; server.npcHandler.npcs[attacknpc].updateRequired = true; server.npcHandler.npcs[attacknpc].hitUpdateRequired = true; server.npcHandler.npcs[attacknpc].hit = true; return true; } } long thisTime = System.currentTimeMillis(); //if(npcHit1() == true){ hitDiff = misc.random(playerMaxHit); //} else { //hitDiff = 0; //} boolean UseBow = false; for (int i = 0; i < shortbow.length; i++) { if ((playerEquipment[playerWeapon] == shortbow[i]) || (playerEquipment[playerWeapon] == lon gbow[i])) { UseBow = true; break; } } int arrowgfx = 10; for (int i1 = 0; i1 < arrowIds.length; i1++) { if (playerEquipment[playerArrows] == arrowIds[i1]) { arrowgfx = arrowGfx[i1]; } } if (UseBow && (thisTime - lastAttack >= 1800)) { teleportToX = absX; teleportToY = absY; //if(npcHit1() == true){ hitDiff = misc.random(maxRangeHit()); //} else { //hitDiff = 0; //} if (DeleteArrow()) { int offsetX = (absY - EnemyY) * -1; int offsetY = (absX - EnemyX) * -1; for (int a = 0; a < handler.maxPlayers; a++) { client temp = (client) handler.players[a ]; if ((temp != null) && (temp.absX > 0) && !temp.disconnected && (Math.abs(absX - temp .absX) < 60) && (Math.abs(absY - temp .absY) < 60)) { temp.createProjectile(absY, absX , offsetY, offsetX, 50, 90, arrowgfx, 43 , 35, attacknpc + 1); } } server.npcHandler.npcs[attacknpc].hitDiff = hitD iff;

server.npcHandler.npcs[attacknpc].Killing[player Id] += hitDiff; server.npcHandler.npcs[attacknpc].updateRequired = true; server.npcHandler.npcs[attacknpc].hitUpdateRequi red = true; server.npcHandler.npcs[attacknpc].hit = true; if ((hitDiff == 0) && (server.npcHandler.npcs[attac knpc].npcType == 941)) { server.npcHandler.npcs[attacknpc].animNu mber = 89; server.npcHandler.npcs[attacknpc].animUp dateRequired = true; server.npcHandler.npcs[attacknpc].update Required = true; } updateRequired = true; appearanceUpdateRequired = true; } else { ResetAttackNPC(); sendMessage("You're out of arrows!"); return false; } } if ((playerEquipment[playerWeapon] == 4151) && (thisTime - lastAttack >= 5000)) { inCombat = true; lastCombat = System.currentTimeMillis(); } else if (thisTime - lastAttack >= getWeaponSpeed(playerEquipme nt[playerWeapon])) { if(thisTime - lastAttack >= (getWeaponSpeed(playerEquipm ent[playerWeapon]) - 600)) startAnimation(GetWeaponAtkEmote(getItemName(playerEquip ment[playerWeapon]), 0)); inCombat = true; lastCombat = System.currentTimeMillis(); } else { return false; } if (UseBow || (GoodDistance(EnemyX, EnemyY, absX, absY, 1) == tr ue)) { if (server.npcHandler.npcs[attacknpc].IsDead == true) { ResetAttackNPC(); } else { if (playerEquipment[playerWeapon] == 4151) { } TurnPlayerTo(EnemyX, EnemyY); updateRequired = true; appearanceUpdateRequired = true; actionAmount++; startAnimation(GetWeaponAtkEmote(getItemName(pla yerEquipment[playerWeapon]), 0)); if ((EnemyHP - hitDiff) < 0) { hitDiff = EnemyHP; } server.npcHandler.npcs[attacknpc].hitDiff = hitD iff; server.npcHandler.npcs[attacknpc].Killing[player

Id] += hitDiff; server.npcHandler.npcs[attacknpc].updateRequired = true; server.npcHandler.npcs[attacknpc].hitUpdateRequi red = true; server.npcHandler.npcs[attacknpc].hit = true; if ((hitDiff == 0) && (server.npcHandler.npcs[attac knpc].npcType == 941)) { server.npcHandler.npcs[attacknpc].animNu mber = 89; server.npcHandler.npcs[attacknpc].animUp dateRequired = true; server.npcHandler.npcs[attacknpc].update Required = true; } attackedNpc = true; attackedNpcId = attacknpc; double TotalExp = 0; if (!UseBow) animationReset = System.currentTimeMilli s() + 1200; if (server.npcHandler.npcs[attacknpc].npcType != 1472) { if (UseBow) { TotalExp = (double) (40 * hitDif f * 1); // added *2 for // faster // leveling // -bakatool TotalExp = (double) (TotalExp * CombatExpRate); addSkillXP((int) (TotalExp), 4); } else if (FightType != 3) { TotalExp = (double) (40 * hitDif f * 1); // added *2 for // faster // leveling // -bakatool TotalExp = (double) (TotalExp * CombatExpRate); if (playerEquipment[playerWeapon ] != 4212) { addSkillXP((int) (TotalExp), Ski llID); }else addSkillXP((int) (TotalExp), 4); } else { TotalExp = (double) (40 * hitDif f * 1); // added *2 for // faster // leveling // -bakatool2 TotalExp = (double) (TotalExp * CombatExpRate); addSkillXP((int) (TotalExp), pla yerAttack); addSkillXP((int) (TotalExp), pla yerDefence); addSkillXP((int) (TotalExp), pla

yerStrength); } TotalExp = (double) (20 * hitDiff * 1); // added *2 for // faster leveling // -bakatool TotalExp = (double) (TotalExp * CombatEx pRate); addSkillXP((int) (TotalExp), playerHitpo ints); attackTimer = 7; if (debug) sendMessage("hitDiff=" + hitDiff + ", elapsed=" + (thisTime - la stAttack)); lastAttack = System.currentTimeMillis(); } return true; } } return false; } public void attackNPCSWithin(int gfx, int maxDamage, int range) { for (int i = 0; i <= server.npcHandler.maxNPCSpawns; i++) { if (server.npcHandler.npcs[i] != null) { if ((distanceToPoint(server.npcHandler.npcs[i].a bsX, server.npcHandler.npcs[i].absY) <= range) && !server.npcHandler.npcs[i].Is Dead) { int damage = misc.random(maxDamage); animation(gfx, server.npcHandler.npcs[i] .absY, server.npcHandler.npcs[i ].absX); if (server.npcHandler.npcs[i].HP - damag e < 0) { damage = server.npcHandler.npcs[ i].HP; } server.npcHandler.npcs[i].StartKilling = playerId; server.npcHandler.npcs[i].RandomWalk = f alse; server.npcHandler.npcs[i].hitDiff = dama ge; server.npcHandler.npcs[i].updateRequired = true; server.npcHandler.npcs[i].hitUpdateRequi red = true; server.npcHandler.npcs[i].hit = true; } } } }

public void attackPlayersPrayer(int maxDamage, int range) { // for (Player p : server.playerHandler.players) { // Linux (java 1.4.2-compatible) change - Guardian for (Player p : server.playerHandler.players) { if (p != null) { client person = (client) p; if (person.playerName != null) { if ((person.distanceToPoint(absX, absY) <= range) && (person.playerId != p layerId)) { int damage = misc.random(maxDama ge); if (person.playerLevel[3] - dama ge < 0) { damage = person.playerLe vel[3]; } person.hitDiff = damage; person.KillerId = playerId; person.updateRequired = true; person.hitUpdateRequired = true; } } } } } public void attackPlayersWithin(int gfx, int maxDamage, int range) { // for (Player p : server.playerHandler.players) { // Linux (java 1.4.2-compatible) change - Guardian for (Player p : server.playerHandler.players) { if (p != null) { client person = (client) p; if (person.playerName != null) { if ((person.distanceToPoint(absX, absY) <= range) && (person.playerId != p layerId)) { int damage = misc.random(maxDama ge); person.animation(gfx, person.abs Y, person.absX); if (person.playerLevel[3] - dama ge < 0) { damage = person.playerLe vel[3]; } person.hitDiff = damage; person.KillerId = playerId; person.updateRequired = true; person.hitUpdateRequired = true; } } } }

} public boolean Attackrange() { client q = (client) server.playerHandler.players[AttackingOn]; int EnemyX = PlayerHandler.players[AttackingOn].absX; int EnemyY = PlayerHandler.players[AttackingOn].absY; int EnemyHP = PlayerHandler.players[AttackingOn].playerLevel[pla yerHitpoints]; int EnemyHPExp = PlayerHandler.players[AttackingOn].playerXP[pla yerHitpoints]; boolean RingOfLife = false; if (PlayerHandler.players[AttackingOn].playerEquipment[playerRin g] == 2570) { RingOfLife = true; } int hitDiff = 0; CalculateRange(this, q);//rangetoo hitDiff = playerMaxHit; if (GoodDistance(EnemyX, EnemyY, absX, absY, 20) == true) { teleportToX = absX; teleportToY = absY; if (actionTimer == 0) { if (isInWilderness(EnemyX, EnemyY, 1) == true) { if (false) { } else { if (PlayerHandler.players[Attack ingOn].deathStage > 0) { ResetAttack(); } else { actionAmount++; startAnimation(GetWeapon AtkEmote(getItemName(playerEquipment[playerWeapon]), 0)); PlayerHandler.players[At tackingOn].hitUpdateRequired = true; PlayerHandler.players[At tackingOn].updateRequired = true; PlayerHandler.players[At tackingOn].appearanceUpdateRequired = true; hitDiff = EnemyHP; PlayerHandler.players[At tackingOn].hitDiff = hitDiff; actionTimer = 7; } } return true; } else { sendMessage("This player is not in the W ilderness."); ResetAttack(); } } } return false; } public int average(int[] array) { int total = 0;

for (int element : array) { total += element; } int average = (int) (total / array.length); println("total=" + total + ", average=" + average); return average; } public boolean bankItem(int itemID, int fromSlot, int amount) { if (!IsBanking) return false; if (playerItemsN[fromSlot] <= 0) { return false; } if (!Item.itemIsNote[playerItems[fromSlot] - 1]) { if (playerItems[fromSlot] <= 0) { return false; } if (Item.itemStackable[playerItems[fromSlot] - 1] || (playerItemsN[fromSlot] > 1)) { int toBankSlot = 0; boolean alreadyInBank = false; for (int i = 0; i < playerBankSize; i++) { if (bankItems[i] == playerItems[fromSlot ]) { if (playerItemsN[fromSlot] < amo unt) { amount = playerItemsN[fr omSlot]; } alreadyInBank = true; toBankSlot = i; i = playerBankSize + 1; } } if (!alreadyInBank && (freeBankSlots() > 0)) { for (int i = 0; i < playerBankSize; i++) { if (bankItems[i] <= 0) { toBankSlot = i; i = playerBankSize + 1; } } bankItems[toBankSlot] = playerItems[from Slot]; if (playerItemsN[fromSlot] < amount) { amount = playerItemsN[fromSlot]; } if (((bankItemsN[toBankSlot] + amount) < = maxItemAmount) && ((bankItemsN[toBankSl ot] + amount) > -1)) { bankItemsN[toBankSlot] += amount ; } else { sendMessage("Bank full!"); return false; }

deleteItem((playerItems[fromSlot] - 1), fromSlot, amount); resetItems(5064); resetBank(); return true; } else if (alreadyInBank) { if (((bankItemsN[toBankSlot] + amount) < = maxItemAmount) && ((bankItemsN[toBankSl ot] + amount) > -1)) { bankItemsN[toBankSlot] += amount ; } else { sendMessage("Bank full!"); return false; } deleteItem((playerItems[fromSlot] - 1), fromSlot, amount); resetItems(5064); resetBank(); return true; } else { sendMessage("Bank full!"); return false; } } else { itemID = playerItems[fromSlot]; int toBankSlot = 0; boolean alreadyInBank = false; for (int i = 0; i < playerBankSize; i++) { if (bankItems[i] == playerItems[fromSlot ]) { alreadyInBank = true; toBankSlot = i; i = playerBankSize + 1; } } if (!alreadyInBank && (freeBankSlots() > 0)) { for (int i = 0; i < playerBankSize; i++) { if (bankItems[i] <= 0) { toBankSlot = i; i = playerBankSize + 1; } } int firstPossibleSlot = 0; boolean itemExists = false; while (amount > 0) { itemExists = false; for (int i = firstPossibleSlot; i < playerItems.length; i++) { if ((playerItems[i]) == itemID) { firstPossibleSlo t = i; itemExists = tru e; i = 30;

} } if (itemExists) { bankItems[toBankSlot] = playerItems[firstPossibleSlot]; bankItemsN[toBankSlot] + = 1; deleteItem((playerItems[ firstPossibleSlot] - 1), firstPos sibleSlot, 1); amount--; } else { amount = 0; } } resetItems(5064); resetBank(); return true; } else if (alreadyInBank) { int firstPossibleSlot = 0; boolean itemExists = false; while (amount > 0) { itemExists = false; for (int i = firstPossibleSlot; i < playerItems.length; i++) { if ((playerItems[i]) == itemID) { firstPossibleSlo t = i; itemExists = tru e; i = 30; } } if (itemExists) { bankItemsN[toBankSlot] + = 1; deleteItem((playerItems[ firstPossibleSlot] - 1), firstPos sibleSlot, 1); amount--; } else { amount = 0; } } resetItems(5064); resetBank(); return true; } else { sendMessage("Bank full!"); return false; } } } else if (Item.itemIsNote[playerItems[fromSlot] - 1] && !Item.itemIsNote[playerItems[fromSlot] - 2]) { if (playerItems[fromSlot] <= 0) {

return false; } if (Item.itemStackable[playerItems[fromSlot] - 1] || (playerItemsN[fromSlot] > 1)) { int toBankSlot = 0; boolean alreadyInBank = false; for (int i = 0; i < playerBankSize; i++) { if (bankItems[i] == (playerItems[fromSlo t] - 1)) { if (playerItemsN[fromSlot] < amo unt) { amount = playerItemsN[fr omSlot]; } alreadyInBank = true; toBankSlot = i; i = playerBankSize + 1; } } if (!alreadyInBank && (freeBankSlots() > 0)) { for (int i = 0; i < playerBankSize; i++) { if (bankItems[i] <= 0) { toBankSlot = i; i = playerBankSize + 1; } } bankItems[toBankSlot] = (playerItems[fro mSlot] - 1); if (playerItemsN[fromSlot] < amount) { amount = playerItemsN[fromSlot]; } if (((bankItemsN[toBankSlot] + amount) < = maxItemAmount) && ((bankItemsN[toBankSl ot] + amount) > -1)) { bankItemsN[toBankSlot] += amount ; } else { return false; } deleteItem((playerItems[fromSlot] - 1), fromSlot, amount); resetItems(5064); resetBank(); return true; } else if (alreadyInBank) { if (((bankItemsN[toBankSlot] + amount) < = maxItemAmount) && ((bankItemsN[toBankSl ot] + amount) > -1)) { bankItemsN[toBankSlot] += amount ; } else { return false; } deleteItem((playerItems[fromSlot] - 1), fromSlot, amount);

resetItems(5064); resetBank(); return true; } else { sendMessage("Bank full!"); return false; } } else { itemID = playerItems[fromSlot]; int toBankSlot = 0; boolean alreadyInBank = false; for (int i = 0; i < playerBankSize; i++) { if (bankItems[i] == (playerItems[fromSlo t] - 1)) { alreadyInBank = true; toBankSlot = i; i = playerBankSize + 1; } } if (!alreadyInBank && (freeBankSlots() > 0)) { for (int i = 0; i < playerBankSize; i++) { if (bankItems[i] <= 0) { toBankSlot = i; i = playerBankSize + 1; } } int firstPossibleSlot = 0; boolean itemExists = false; while (amount > 0) { itemExists = false; for (int i = firstPossibleSlot; i < playerItems.length; i++) { if ((playerItems[i]) == itemID) { firstPossibleSlo t = i; itemExists = tru e; i = 30; } } if (itemExists) { bankItems[toBankSlot] = (playerItems[firstPossibleSlot] - 1); bankItemsN[toBankSlot] + = 1; deleteItem((playerItems[ firstPossibleSlot] - 1), firstPos sibleSlot, 1); amount--; } else { amount = 0; } } resetItems(5064); resetBank();

return true; } else if (alreadyInBank) { int firstPossibleSlot = 0; boolean itemExists = false; while (amount > 0) { itemExists = false; for (int i = firstPossibleSlot; i < playerItems.length; i++) { if ((playerItems[i]) == itemID) { firstPossibleSlo t = i; itemExists = tru e; i = 30; } } if (itemExists) { bankItemsN[toBankSlot] + = 1; deleteItem((playerItems[ firstPossibleSlot] - 1), firstPos sibleSlot, 1); amount--; } else { amount = 0; } } resetItems(5064); resetBank(); return true; } else { sendMessage("Bank full!"); return false; } } } else { sendMessage("Item not supported " + (playerItems[fromSlo t] - 1)); return false; } } public boolean banned(String host) { try { BufferedReader in = new BufferedReader(new FileReader( "data/bannedusers.dat")); String data = null; while ((data = in.readLine()) != null) { if (host.equalsIgnoreCase(data)) { return true; } } } catch (IOException e) { System.out.println("Unable to ban player"); server.logError(e.getMessage()); }

return false; } public void buryItem(int item, int slot) { if (duelRule[7] && inDuel && duelFight) { sendMessage("Food has been disabled for this duel"); return; } boolean used = true; long prayerRestore = Math.round((getLevelForXP(playerXP[5]) * 0. 32) - 0.5f); if (playerHasItem(item)) { if (used) if(item != 4155) { deleteItem(item, slot, 1); } } switch (item) { case 4155: OpenUpSlayer(); break; case 526: prayerMessage(70); break; case 532: prayerMessage(115); break; case 3125: prayerMessage(300); break; case 536: prayerMessage(450); break; case 315: if (eatDelay > 0 ) { break; } eatDelay = 3; startAnimation(8 29); updateHp(3, true ); sendMessage("You eat the " + getItemName(item) + "."); sendMessage("It heals some health"); break; case 319: if (eatDelay > 0 )

{ break; } eatDelay = 3; startAnimation(8 29); updateHp(1, true ); sendMessage("You eat the " + getItemName(item) + "."); sendMessage("It heals some health"); break; case 325: if (eatDelay > 0 ) { break; } eatDelay = 3; startAnimation(8 29); updateHp(4, true ); sendMessage("You eat the " + getItemName(item) + "."); sendMessage("It heals some health"); break; case 329: if (eatDelay > 0 ) { break; } eatDelay = 3; startAnimation(8 29); updateHp(9, true ); sendMessage("You eat the " + getItemName(item) + "."); sendMessage("It heals some health"); break; case 333: if (eatDelay > 0 )

{ break; } eatDelay = 3; startAnimation(8 29); updateHp(7, true ); sendMessage("You eat the " + getItemName(item) + "."); sendMessage("It heals some health"); break; case 339: if (eatDelay > 0 ) { break; } eatDelay = 3; startAnimation(8 29); updateHp(7, true ); sendMessage("You eat the " + getItemName(item) + "."); sendMessage("It heals some health"); break; case 347: if (eatDelay > 0 ) { break; } eatDelay = 3; startAnimation(8 29); updateHp(5, true ); sendMessage("You eat the " + getItemName(item) + "."); sendMessage("It heals some health"); break; case 351: if (eatDelay > 0 )

{ break; } eatDelay = 3; startAnimation(8 29); updateHp(8, true ); sendMessage("You eat the " + getItemName(item) + "."); sendMessage("It heals some health"); break; case 355: if (eatDelay > 0 ) { break; } eatDelay = 3; startAnimation(8 29); updateHp(6, true ); sendMessage("You eat the " + getItemName(item) + "."); sendMessage("It heals some health"); break; case 361: if (eatDelay > 0 ) { break; } eatDelay = 3; startAnimation(8 29); updateHp(10, tru e); sendMessage("You eat the " + getItemName(item) + "."); sendMessage("It heals some health"); break; case 365: if (eatDelay > 0 )

{ break; } eatDelay = 3; startAnimation(8 29); updateHp(13, tru e); sendMessage("You eat the " + getItemName(item) + "."); sendMessage("It heals some health"); break; case 7946: if (eatDelay > 0 ) { break; } eatDelay = 3; startAnimation(8 29); updateHp(16, tru e); sendMessage("You eat the " + getItemName(item) + "."); sendMessage("It heals some health"); break; case 379: if (eatDelay > 0 ) { break; } eatDelay = 3; startAnimation(8 29); updateHp(12, tru e); sendMessage("You eat the " + getItemName(item) + "."); sendMessage("It heals some health"); break; case 373: if (eatDelay > 0 ) { break;

} eatDelay = 3; startAnimation(8 29); updateHp(16, tru e); sendMessage("You eat the " + getItemName(item) + "."); sendMessage("It heals some health"); break; case 385: if (eatDelay > 0 ) { break; } eatDelay = 3; startAnimation(8 29); updateHp(20, tru e); sendMessage("You eat the " + getItemName(item) + "."); sendMessage("It heals some health"); break; case 397: if (eatDelay > 0 ) { break; } eatDelay = 3; startAnimation(8 29); updateHp(20, tru e); sendMessage("You eat the " + getItemName(item) + "."); sendMessage("It heals some health"); break; case 391: if (eatDelay > 0 ) { break; } eatDelay = 3; startAnimation(8

29); updateHp(22, tru e); sendMessage("You eat the " + getItemName(item) + "."); sendMessage("It heals some health"); break; case 2434: if (drinkDelay > 0) { break; } drinkDelay = 3; startAnimation(8 29); deleteItem(2434, GetItemSlot(2434), 1); addItem(139, 1); changeStat(playe rPrayer, (int)(prayerRestore), 0, true); break; case 139: if (drinkDelay > 0) { break; } drinkDelay = 3; startAnimation(8 29); deleteItem(139, GetItemSlot(139), 1); addItem(141, 1); changeStat(playe rPrayer, (int)(prayerRestore), 0, true); break; case 141: if (drinkDelay > 0) { break; } drinkDelay = 3; startAnimation(8 29); deleteItem(141, GetItemSlot(141), 1); addItem(143, 1); changeStat(playe rPrayer, (int)(prayerRestore), 0, true);

break; case 143: if (drinkDelay > 0) { break; } drinkDelay = 3; startAnimation(8 29); deleteItem(143, GetItemSlot(143), 1); addItem(229, 1); changeStat(playe rPrayer, (int)(prayerRestore), 0, true); break; case 113: if (drinkDelay > 0) { break; } drinkDelay = 3; startAnimation(8 29); changeStat(2, (i nt)(getLevelForXP(playerXP[2]) * 0.1) + 3, 1, true); deleteItem(113, GetItemSlot(113), 1); addItem(115, 1); break; case 115: if (drinkDelay > 0) { break; } drinkDelay = 3; startAnimation(8 29); changeStat(2, (i nt)(getLevelForXP(playerXP[2]) * 0.1) + 3, 1, true); deleteItem(115, GetItemSlot(115), 1); addItem(117, 1); break; case 117: if (drinkDelay > 0)

{ break; } drinkDelay = 3; startAnimation(8 29); changeStat(2, (i nt)(getLevelForXP(playerXP[2]) * 0.1) + 3, 1, true); deleteItem(117, GetItemSlot(117), 1); addItem(119, 1); break; case 119: if (drinkDelay > 0) { break; } drinkDelay = 3; startAnimation(8 29); changeStat(2, (i nt)(getLevelForXP(playerXP[2]) * 0.1) + 3, 1, true); deleteItem(119, GetItemSlot(119), 1); addItem(229, 1); break; case 2432: if (drinkDelay > 0) { break; } drinkDelay = 3; startAnimation(8 29); changeStat(1, (i nt)(getLevelForXP(playerXP[1]) * 0.1) + 3, 1, true); deleteItem(2432, GetItemSlot(2432), 1); addItem(133, 1); break; case 133: if (drinkDelay > 0) { break; } drinkDelay = 3;

startAnimation(8 29); changeStat(1, (i nt)(getLevelForXP(playerXP[1]) * 0.1) + 3, 1, true); deleteItem(133, GetItemSlot(133), 1); addItem(135, 1); break; case 135: if (drinkDelay > 0) { break; } drinkDelay = 3; startAnimation(8 29); changeStat(1, (i nt)(getLevelForXP(playerXP[1]) * 0.1) + 3, 1, true); deleteItem(135, GetItemSlot(135), 1); addItem(137, 1); break; case 137: if (drinkDelay > 0) { break; } drinkDelay = 3; startAnimation(8 29); changeStat(1, (i nt)(getLevelForXP(playerXP[1]) * 0.1) + 3, 1, true); deleteItem(137, GetItemSlot(137), 1); addItem(229, 1); break; case 2444: if (drinkDelay > 0) { break; } drinkDelay = 3; startAnimation(8 29); changeStat(4, (i nt)(getLevelForXP(playerXP[4]) * 0.1) + 4, 1, true); deleteItem(2444, GetItemSlot(2444), 1);

addItem(169, 1); break; case 169: if (drinkDelay > 0) { break; } drinkDelay = 3; startAnimation(8 29); changeStat(4, (i nt)(getLevelForXP(playerXP[4]) * 0.1) + 4, 1, true); deleteItem(169, GetItemSlot(169), 1); addItem(171, 1); break; case 171: if (drinkDelay > 0) { break; } drinkDelay = 3; startAnimation(8 29); changeStat(4, (i nt)(getLevelForXP(playerXP[4]) * 0.1) + 4, 1, true); deleteItem(171, GetItemSlot(171), 1); addItem(173, 1); break; case 173: if (drinkDelay > 0) { break; } drinkDelay = 3; startAnimation(8 29); changeStat(4, (i nt)(getLevelForXP(playerXP[4]) * 0.1) + 4, 1, true); deleteItem(173, GetItemSlot(173), 1); addItem(229, 1); break; case 2428: if (drinkDelay >

0) { break; } drinkDelay = 3; startAnimation(8 29); changeStat(0, (i nt)(getLevelForXP(playerXP[0]) * 0.1) + 3, 1, true); deleteItem(2428, GetItemSlot(2428), 1); addItem(121, 1); break; case 121: if (drinkDelay > 0) { break; } drinkDelay = 3; startAnimation(8 29); changeStat(0, (i nt)(getLevelForXP(playerXP[0]) * 0.1) + 3, 1, true); deleteItem(121, GetItemSlot(121), 1); addItem(123, 1); break; case 123: if (drinkDelay > 0) { break; } drinkDelay = 3; startAnimation(8 29); changeStat(0, (i nt)(getLevelForXP(playerXP[0]) * 0.1) + 3, 1, true); deleteItem(123, GetItemSlot(123), 1); addItem(125, 1); break; case 125: if (drinkDelay > 0) { break; } drinkDelay = 3;

startAnimation(8 29); changeStat(0, (i nt)(getLevelForXP(playerXP[0]) * 0.1) + 3, 1, true); deleteItem(125, GetItemSlot(125), 1); addItem(229, 1); break; case 2440: if (drinkDelay > 0) { break; } drinkDelay = 3; startAnimation(8 29); changeStat(2, (i nt)(getLevelForXP(playerXP[2]) * 0.15) + 5, 1, true); deleteItem(2440, GetItemSlot(2440), 1); addItem(157, 1); break; case 157: if (drinkDelay > 0) { break; } drinkDelay = 3; startAnimation(8 29); changeStat(2, (i nt)(getLevelForXP(playerXP[2]) * 0.15) + 5, 1, true); deleteItem(157, GetItemSlot(157), 1); addItem(159, 1); break; case 159: if (drinkDelay > 0) { break; } drinkDelay = 3; startAnimation(8 29); changeStat(2, (i nt)(getLevelForXP(playerXP[2]) * 0.15) + 5, 1, true); deleteItem(159, GetItemSlot(159), 1);

addItem(161, 1); break; case 161: if (drinkDelay > 0) { break; } drinkDelay = 3; startAnimation(8 29); changeStat(2, (i nt)(getLevelForXP(playerXP[2]) * 0.15) + 5, 1, true); deleteItem(161, GetItemSlot(161), 1); addItem(229, 1); break; case 2442: if (drinkDelay > 0) { break; } drinkDelay = 3; startAnimation(8 29); changeStat(1, (i nt)(getLevelForXP(playerXP[1]) * 0.15) + 5, 1, true); deleteItem(2442, GetItemSlot(2442), 1); addItem(163, 1); break; case 163: if (drinkDelay > 0) { break; } drinkDelay = 3; startAnimation(8 29); changeStat(1, (i nt)(getLevelForXP(playerXP[1]) * 0.15) + 5, 1, true); deleteItem(163, GetItemSlot(163), 1); addItem(165, 1); break; case 165:

if (drinkDelay > 0) { break; } drinkDelay = 3; startAnimation(8 29); changeStat(1, (i nt)(getLevelForXP(playerXP[1]) * 0.15) + 5, 1, true); deleteItem(165, GetItemSlot(165), 1); addItem(167, 1); break; case 167: if (drinkDelay > 0) { break; } drinkDelay = 3; startAnimation(8 29); changeStat(1, (i nt)(getLevelForXP(playerXP[1]) * 0.15) + 5, 1, true); deleteItem(167, GetItemSlot(167), 1); addItem(229, 1); break; case 2436: if (drinkDelay > 0) { break; } drinkDelay = 3; startAnimation(8 29); changeStat(0, (i nt)(getLevelForXP(playerXP[0]) * 0.15) + 5, 1, true); deleteItem(2436, GetItemSlot(2436), 1); break; case 145: if (drinkDelay > 0) { break; } drinkDelay = 3;

startAnimation(8 29); changeStat(0, (i nt)(getLevelForXP(playerXP[0]) * 0.15) + 5, 1, true); deleteItem(145, GetItemSlot(145), 1); addItem(147, 1); break; case 147: if (drinkDelay > 0) { break; } drinkDelay = 3; startAnimation(8 29); changeStat(0, (i nt)(getLevelForXP(playerXP[0]) * 0.15) + 5, 1, true); deleteItem(147, GetItemSlot(147), 1); addItem(149, 1); break; case 149: if (drinkDelay > 0) { break; } drinkDelay = 3; startAnimation(8 29); changeStat(0, (i nt)(getLevelForXP(playerXP[0]) * 0.15) + 5, 1, true); deleteItem(149, GetItemSlot(149), 1); addItem(229, 1); break; case 3024: if (drinkDelay > 0) { break; } drinkDelay = 3; startAnimation(8 29); changeStat(playe rAttack, (int)(getLevelForXP(playerXP[playerAttack]) * 0.26) + 8, 0, true); changeStat(playe

rStrength, (int)(getLevelForXP(playerXP[playerStrength]) * 0.26) + 8, 0, true); changeStat(playe rDefence, (int)(getLevelForXP(playerXP[playerDefence]) * 0.26) + 8, 0, true); changeStat(playe rRanged, (int)(getLevelForXP(playerXP[playerRanged]) * 0.26) + 8, 0, true); changeStat(playe rMagic, (int)(getLevelForXP(playerXP[playerMagic]) * 0.26) + 8, 0, true); changeStat(playe rPrayer, (int)(getLevelForXP(playerXP[playerPrayer]) * 0.26) + 8, 0, true); addItem(3026, 1) ; break; case 3026: if (drinkDelay > 0) { break; } drinkDelay = 3; startAnimation(8 29); changeStat(playe rAttack, (int)(getLevelForXP(playerXP[playerAttack]) * 0.26) + 8, 0, true); changeStat(playe rStrength, (int)(getLevelForXP(playerXP[playerStrength]) * 0.26) + 8, 0, true); changeStat(playe rDefence, (int)(getLevelForXP(playerXP[playerDefence]) * 0.26) + 8, 0, true); changeStat(playe rRanged, (int)(getLevelForXP(playerXP[playerRanged]) * 0.26) + 8, 0, true); changeStat(playe rMagic, (int)(getLevelForXP(playerXP[playerMagic]) * 0.26) + 8, 0, true); changeStat(playe rPrayer, (int)(getLevelForXP(playerXP[playerPrayer]) * 0.26) + 8, 0, true); addItem(3028, 1) ; break; case 3028: if (drinkDelay > 0) { break; } drinkDelay = 3; startAnimation(8 29); changeStat(playe rAttack, (int)(getLevelForXP(playerXP[playerAttack]) * 0.26) + 8, 0, true); changeStat(playe rStrength, (int)(getLevelForXP(playerXP[playerStrength]) * 0.26) + 8, 0, true); changeStat(playe rDefence, (int)(getLevelForXP(playerXP[playerDefence]) * 0.26) + 8, 0, true); changeStat(playe

rRanged, (int)(getLevelForXP(playerXP[playerRanged]) * 0.26) + 8, 0, true); changeStat(playe rMagic, (int)(getLevelForXP(playerXP[playerMagic]) * 0.26) + 8, 0, true); changeStat(playe rPrayer, (int)(getLevelForXP(playerXP[playerPrayer]) * 0.26) + 8, 0, true); addItem(3030, 1) ; break; case 3030: if (drinkDelay > 0) { break; } drinkDelay = 3; startAnimation(8 29); changeStat(playe rAttack, (int)(getLevelForXP(playerXP[playerAttack]) * 0.26) + 8, 0, true); changeStat(playe rStrength, (int)(getLevelForXP(playerXP[playerStrength]) * 0.26) + 8, 0, true); changeStat(playe rDefence, (int)(getLevelForXP(playerXP[playerDefence]) * 0.26) + 8, 0, true); changeStat(playe rRanged, (int)(getLevelForXP(playerXP[playerRanged]) * 0.26) + 8, 0, true); changeStat(playe rMagic, (int)(getLevelForXP(playerXP[playerMagic]) * 0.26) + 8, 0, true); changeStat(playe rPrayer, (int)(getLevelForXP(playerXP[playerPrayer]) * 0.26) + 8, 0, true); addItem(229, 1); break; case 2430: if (drinkDelay > 0) { break; } drinkDelay = 3; startAnimation(8 29); changeStat(playe rAttack, (int)(getLevelForXP(playerXP[playerAttack]) * 0.3) + 10, 0, true); changeStat(playe rStrength, (int)(getLevelForXP(playerXP[playerStrength]) * 0.3) + 10, 0, true); changeStat(playe rDefence, (int)(getLevelForXP(playerXP[playerDefence]) * 0.3) + 10, 0, true); changeStat(playe rRanged, (int)(getLevelForXP(playerXP[playerRanged]) * 0.3) + 10, 0, true); changeStat(playe rMagic, (int)(getLevelForXP(playerXP[playerMagic]) * 0.3) + 10, 0, true); addItem(127, 1);

break; case 127: if (drinkDelay > 0) { break; } drinkDelay = 3; startAnimation(8 29); changeStat(playe rAttack, (int)(getLevelForXP(playerXP[playerAttack]) * 0.3) + 10, 0, true); changeStat(playe rStrength, (int)(getLevelForXP(playerXP[playerStrength]) * 0.3) + 10, 0, true); changeStat(playe rDefence, (int)(getLevelForXP(playerXP[playerDefence]) * 0.3) + 10, 0, true); changeStat(playe rRanged, (int)(getLevelForXP(playerXP[playerRanged]) * 0.3) + 10, 0, true); changeStat(playe rMagic, (int)(getLevelForXP(playerXP[playerMagic]) * 0.3) + 10, 0, true); addItem(129, 1); break; case 129: if (drinkDelay > 0) { break; } drinkDelay = 3; startAnimation(8 29); changeStat(playe rAttack, (int)(getLevelForXP(playerXP[playerAttack]) * 0.3) + 10, 0, true); changeStat(playe rStrength, (int)(getLevelForXP(playerXP[playerStrength]) * 0.3) + 10, 0, true); changeStat(playe rDefence, (int)(getLevelForXP(playerXP[playerDefence]) * 0.3) + 10, 0, true); changeStat(playe rRanged, (int)(getLevelForXP(playerXP[playerRanged]) * 0.3) + 10, 0, true); changeStat(playe rMagic, (int)(getLevelForXP(playerXP[playerMagic]) * 0.3) + 10, 0, true); addItem(131, 1); break; case 131: if (drinkDelay > 0) { break; } drinkDelay = 3;

startAnimation(8 29); changeStat(playe rAttack, (int)(getLevelForXP(playerXP[playerAttack]) * 0.3) + 10, 0, true); changeStat(playe rStrength, (int)(getLevelForXP(playerXP[playerStrength]) * 0.3) + 10, 0, true); changeStat(playe rDefence, (int)(getLevelForXP(playerXP[playerDefence]) * 0.3) + 10, 0, true); changeStat(playe rRanged, (int)(getLevelForXP(playerXP[playerRanged]) * 0.3) + 10, 0, true); changeStat(playe rMagic, (int)(getLevelForXP(playerXP[playerMagic]) * 0.3) + 10, 0, true); addItem(229, 1); break; case 6685: if (drinkDelay > 0) { break; } drinkDelay = 3; startAnimation(8 29); updateHp((int)(g etLevelForXP(playerXP[3]) * 0.15) + 2, true); changeStat(playe rAttack, (int)(getLevelForXP(playerXP[0]) * 0.1) + 2, 0, false); changeStat(playe rStrength, (int)(getLevelForXP(playerXP[playerStrength]) * 0.1) + 2, 0, false); changeStat(playe rMagic, (int)(getLevelForXP(playerXP[playerMagic]) * 0.1) + 2, 0, false); changeStat(playe rRanged, (int)(getLevelForXP(playerXP[playerRanged]) * 0.1) + 2, 0, false); changeStat(playe rDefence, (int)(getLevelForXP(playerXP[playerDefence]) * 0.2) + 2, 1, true); addItem(6687, 1) ; break; case 6687: if (drinkDelay > 0) { break; } drinkDelay = 3; startAnimation(8 29); updateHp((int)(g etLevelForXP(playerXP[3]) * 0.15) + 2, true);

changeStat(playe rAttack, (int)(getLevelForXP(playerXP[0]) * 0.1) + 2, 0, false); changeStat(playe rStrength, (int)(getLevelForXP(playerXP[playerStrength]) * 0.1) + 2, 0, false); changeStat(playe rMagic, (int)(getLevelForXP(playerXP[playerMagic]) * 0.1) + 2, 0, false); changeStat(playe rRanged, (int)(getLevelForXP(playerXP[playerRanged]) * 0.1) + 2, 0, false); changeStat(playe rDefence, (int)(getLevelForXP(playerXP[playerDefence]) * 0.2) + 2, 1, true); addItem(6689, 1) ; break; case 6689: if (drinkDelay > 0) { break; } drinkDelay = 3; startAnimation(8 29); updateHp((int)(g etLevelForXP(playerXP[3]) * 0.15) + 2, true); changeStat(playe rAttack, (int)(getLevelForXP(playerXP[0]) * 0.1) + 2, 0, false); changeStat(playe rStrength, (int)(getLevelForXP(playerXP[playerStrength]) * 0.1) + 2, 0, false); changeStat(playe rMagic, (int)(getLevelForXP(playerXP[playerMagic]) * 0.1) + 2, 0, false); changeStat(playe rRanged, (int)(getLevelForXP(playerXP[playerRanged]) * 0.1) + 2, 0, false); changeStat(playe rDefence, (int)(getLevelForXP(playerXP[playerDefence]) * 0.2) + 2, 1, true); addItem(6691, 1) ; break; case 6691: if (drinkDelay > 0) { break; } drinkDelay = 3; startAnimation(8 29); updateHp((int)(g etLevelForXP(playerXP[3]) * 0.15) + 2, true); changeStat(playe rAttack, (int)(getLevelForXP(playerXP[0]) * 0.1) + 2, 0, false); changeStat(playe

rStrength, (int)(getLevelForXP(playerXP[playerStrength]) * 0.1) + 2, 0, false); changeStat(playe rMagic, (int)(getLevelForXP(playerXP[playerMagic]) * 0.1) + 2, 0, false); changeStat(playe rRanged, (int)(getLevelForXP(playerXP[playerRanged]) * 0.1) + 2, 0, false); changeStat(playe rDefence, (int)(getLevelForXP(playerXP[playerDefence]) * 0.2) + 2, 1, true); addItem(229, 1); break; /** * Start of Herb Identification */ case 199: //Guam Leaf Indentifier if (playerLevel[15] >= 1) { deleteItem(199, 1); sendMessage("You indenti fy the herb, it's a Guam Leaf"); addItem(249, 1); addSkillXP(100, 15); } break; case 201: //Marentill Indentifier if (playerLevel[15] >= 5) { deleteItem(201, 1); sendMessage("You indenti fy the herb, it's a Marrentill"); addItem(251, 1); addSkillXP(200, 15); } else { sendMessage("You need a Herblore Level of 5 to indentify this"); } break; case 203: //Tarromin Indentifier if (playerLevel[15] >= 11) { deleteItem(203, 1); sendMessage("You indenti fy the herb, it's a Tarromin"); addItem(253, 1); addSkillXP(400, 15); } else { sendMessage("You need a Herblore Level of 11 to indentify this"); } break; case 205: //Harralander Indentifier if (playerLevel[15] >= 20) { deleteItem(205, 1); sendMessage("You indenti fy the herb, it's a Harralander"); addItem(255, 1);

addSkillXP(800, 15); } else { sendMessage("You need a Herblore Level of 20 to indentify this"); } break; case 207: //Ranarr Weed Indentifier if (playerLevel[15] >= 25) { deleteItem(207, 1); sendMessage("You indenti fy the herb, it's a Ranarr Weed"); addItem(257, 1); addSkillXP(1600, 15); } else { sendMessage("You need a Herblore Level of 25 to indentify this"); } break; case 209: //Irit Leaf Indentifier if (playerLevel[15] >= 40) { deleteItem(209, 1); sendMessage("You indenti fy the herb, it's an Irit Leaf"); addItem(259, 1); addSkillXP(3200, 15); } else { sendMessage("You need a Herblore Level of 40 to indentify this"); } break; case 211: //Avantoe Indentifier if (playerLevel[15] >= 48) { deleteItem(211, 1); sendMessage("You indenti fy the herb, it's an Avantoe"); addItem(261, 1); addSkillXP(6400, 15); } else { sendMessage("You need a Herblore Level of 48 to indentify this"); } break; case 213: //Kwuarm Indentifier if (playerLevel[15] >= 54) { deleteItem(213, 1); sendMessage("You indenti fy the herb, it's a Kwuarm"); addItem(263, 1); addSkillXP(12800, 15); } else { sendMessage("You need a Herblore Level of 54 to indentify this"); } break;

case 215: //Cadantine Indentifier if (playerLevel[15] >= 65) { deleteItem(215, 1); sendMessage("You indenti fy the herb, it's a Cadantine"); addItem(265, 1); addSkillXP(25600, 15); } else { sendMessage("You need a Herblore Level of 65 to indentify this"); } break; case 217: //Dwarf Weed Indentifier if (playerLevel[15] >= 70) { deleteItem(217, 1); sendMessage("You indenti fy the herb, it's a Dwarf Weed"); addItem(267, 1); addSkillXP(51200, 15); } else { sendMessage("You need a Herblore Level of 70 to indentify this"); } break; case 219: //Torstol Indentifier if (playerLevel[15] >= 75) { deleteItem(219, 1); sendMessage("You indenti fy the herb, it's a Torstol"); addItem(269, 1); addSkillXP(102400, 15); } else { sendMessage("You need a Herblore Level of 75 to indentify this"); } break; /** *End of Identifying */ default: used = false; break; } } public void updateHp(int chHp, boolean heal) { currentHealth += chHp; } public boolean buyItem(int itemID, int fromSlot, int amount) { if ((amount > 0) && (itemID == (server.shopHandler.ShopItems[MySh opID][fromSlot] - 1))) { if (amount > server.shopHandler.ShopItemsN[MyShopID][fro mSlot]) {

amount = server.shopHandler.ShopItemsN[MyShopID] [fromSlot]; } double ShopValue; double TotPrice; int TotPrice2; int Overstock; int Slot = 0; if (!canUse(itemID)) { sendMessage("You must be a premium member to buy this item"); sendMessage("Visit moparscape.org/smf to subscri be"); return false; } for (int i = amount; i > 0; i--) { TotPrice2 = (int) Math.floor(GetItemShopValue(it emID, 0, fromSlot)); Slot = GetItemSlot(995); if (Slot == -1) { sendMessage("You don't have enough coins ."); break; } if (playerItemsN[Slot] >= TotPrice2) { if (freeSlots() > 0) { deleteItem(995, GetItemSlot(995) , TotPrice2); addItem(itemID, 1); server.shopHandler.ShopItemsN[My ShopID][fromSlot] -= 1; server.shopHandler.ShopItemsDela y[MyShopID][fromSlot] = 0; if ((fromSlot + 1) > server.shop Handler.ShopItemsStandard[MyShopID]) { server.shopHandler.ShopI tems[MyShopID][fromSlot] = 0; } } else { sendMessage("Not enough space in your inventory."); break; } } else { sendMessage("You don't have enough coins ."); break; } } resetItems(3823); resetShop(MyShopID); UpdatePlayerShop(); return true; } sendMessage("You can't sell item to shop!"); return false; } public void getBonus() {

resetBonus(); for (int i = 0; i < playerEquipment.length; i++) { if (playerEquipment[i] > -1) { for (int j = 0; j < 8000; j++) { try { if (server.itemHandler.ItemList[j] != nu ll){ if (server.itemHandler.I temList[j].itemId == playerEquipment[i]) { for (int k = 0; k < play erBonus.length; k++) { playerBonus[k] + = server.itemHandler.ItemList[j].Bonuses[k]; } break; } } } catch(Exception e) {} } } } writeBonus(); } public int bestmeleeAtk() { if (playerBonus[0] > playerBonus[1] && playerBonus[0] > playerBonus[2]) return 0; if (playerBonus[1] > playerBonus[0] && playerBonus[1] > playerBonus[2]) return 1; if (playerBonus[2] > playerBonus[1] && playerBonus[2] > playerBonus[0]) return 2; return 0; } public int bestmeleeDef() { if (playerBonus[5] > playerBonus[6] && playerBonus[5] > playerBonus[7]) return 5; if (playerBonus[6] > playerBonus[5] && playerBonus[6] > playerBonus[7]) return 6; if (playerBonus[7] > playerBonus[5] && playerBonus[7] > playerBonus[6]) return 7; return 5; } public int meleeAtk() { int attackLevel = playerLevel[playerAttack]; return (int) (attackLevel + (playerBonus[bestmeleeAtk()] * 2)); } public int rangeAtk() { int attackLevel = playerLevel[playerRanged]; return (int) (attackLevel + (playerBonus[4] * 2)); } public int calculateMelee() { getBonus(); int strengthLvl = playerLevel[playerStrength]; double maxHit = 1.05 + (playerBonus[10] * strengthLvl) * 0.00175;

maxHit += strengthLvl * 0.11; return (int) maxHit; } public int calculateRange() { int rangeLvl = playerLevel[playerRanged]; int wepId = playerEquipment[playerWeapon]; int arrows = playerEquipment[playerArrows]; double maxHit = 1.05 + (rangeLvl * 0.00125); maxHit += rangeLvl * 0.11; if (wepId == 800 || wepId == 806 || wepId == 825 || wepId == 864)// Bron ze items maxHit *= 0.7; else if (wepId == 801 || wepId == 807 || wepId == 820 || wepId == 863)// Iron items maxHit *= 0.72; else if (wepId == 802 || wepId == 808 || wepId == 827 || wepId == 865)// Steel items maxHit *= 0.79; else if (wepId == 803 || wepId == 809 || wepId == 828 || wepId == 866)// Mith items maxHit *= 0.84; else if (wepId == 804 || wepId == 810 || wepId == 829 || wepId == 867)// Addy items maxHit *= 0.99; else if (wepId == 805 || wepId == 811 || wepId == 830 || wepId == 868)// Rune items maxHit *= 1.24; else if (wepId == 6522)// Obsidian Rings maxHit *= 1.64; else if (wepId == 4212 || wepId == 4214)// Crystal Bow maxHit *= 2.25; else if (arrows == 882 || arrows == 883)// Bronze arrow maxHit *= 1.042; else if (arrows == 884 || arrows == 885)// Iron arrow maxHit *= 1.044; else if (arrows == 886 || arrows == 887)// Steel arrow maxHit *= 1.134; else if (arrows == 888 || arrows == 889)// Mith arrow maxHit *= 1.2; else if (arrows == 890 || arrows == 891)// Addy arrow maxHit *= 1.35; else if (arrows == 892 || arrows == 893)// Rune arrow maxHit *= 1.6; return (int) maxHit; } public void resetBonus() { for (int i = 0; i < playerBonus.length; i++) { playerBonus[i] = 0; } } public int meleeDef() { int defenceLevel = playerLevel[playerDefence]; return (int) (defenceLevel + playerBonus[bestmeleeDef()] + (playerBonus[ bestmeleeDef()] / 2)); }

public int rangeDef() { int defenceLevel = playerLevel[playerDefence]; return (int) (defenceLevel + playerBonus[9] + (playerBonus[9] / 2)); } public int getRangeMaxHit() { int rangeLvl = playerLevel[playerRanged]; int wepId = playerEquipment[playerWeapon]; int arrows = playerEquipment[playerArrows]; double maxHit = 1.05 + (rangeLvl * 0.00125); maxHit += rangeLvl * 0.11; if (wepId == 800 || wepId == 806 || wepId == 825 || wepId == 864)// Bron ze items maxHit *= 0.7; else if (wepId == 801 || wepId == 807 || wepId == 820 || wepId == 863)// Iron items maxHit *= 0.72; else if (wepId == 802 || wepId == 808 || wepId == 827 || wepId == 865)// Steel items maxHit *= 0.79; else if (wepId == 803 || wepId == 809 || wepId == 828 || wepId == 866)// Mith items maxHit *= 0.84; else if (wepId == 804 || wepId == 810 || wepId == 829 || wepId == 867)// Addy items maxHit *= 0.99; else if (wepId == 805 || wepId == 811 || wepId == 830 || wepId == 868)// Rune items maxHit *= 1.24; else if (wepId == 6522)// Obsidian Rings maxHit *= 1.64; else if (wepId == 4212 || wepId == 4214)// Crystal Bow maxHit *= 2.25; else if (arrows == 882 || arrows == 883)// Bronze arrow maxHit *= 1.042; else if (arrows == 884 || arrows == 885)// Iron arrow maxHit *= 1.044; else if (arrows == 886 || arrows == 887)// Steel arrow maxHit *= 1.134; else if (arrows == 888 || arrows == 889)// Mith arrow maxHit *= 1.2; else if (arrows == 890 || arrows == 891)// Addy arrow maxHit *= 1.35; else if (arrows == 892 || arrows == 893)// Rune arrow maxHit *= 1.6; return (int) maxHit; } public void CalculateMaxHit(client s, client v) { int p2Damage = (int) (misc.random(s.calculateMelee())); int atk = (int) (misc.random(s.meleeAtk())); int def = (int) (misc.random(v.meleeDef())); if (atk < def) { if (misc.random(3) == 3) playerMaxHit = p2Damage; else playerMaxHit = 0;

}else playerMaxHit = p2Damage; } public void CalculateRange(client s, client v) { int rangeDamage = (int) (misc.random(s.getRangeMaxHit())); int range = (int) (misc.random(s.rangeAtk())); int rDef = (int) (misc.random(v.rangeDef())); if (range < rDef) { if (misc.random(3) == 3) playerMaxHit = 0; else playerMaxHit = rangeDamage; }else playerMaxHit = rangeDamage; } public int maxRangeHit() { int hit = (int) ((playerBonus[4] + playerLevel[playerRanged]) / 12); return hit; } public void CalculateMaxHit() { double MaxHit = 0; int StrBonus = playerBonus[10]; // Strength Bonus int Strength = playerLevel[playerStrength]; // Strength int RngBonus = playerBonus[4]; // Ranged Bonus int Range = playerLevel[playerRanged]; // Ranged if ((FightType == 1) || (FightType == 4)) { // Accurate & Defensive MaxHit += (double) (1.0 + (double) ((double) (StrBonus * Strength) * 0.00175)); } else if (FightType == 2) { // Aggresive MaxHit += (double) (1.3 + (double) ((double) (StrBonus * Strength) * 0.00175)); } else if (FightType == 3) { // Controlled MaxHit += (double) (1.1 + (double) ((double) (StrBonus * Strength) * 0.00175)); } MaxHit += (double) (Strength * 0.1); if ((FightType == 5) || (FightType == 6)) { // Accurate and Longranged MaxHit += (double) (1.00 + (double) ((double) (RngBonus * Range) * 0.00075)); } else if (FightType == 7) { // Rapid MaxHit += (double) (1.3 + (double) ((double) (RngBonus) * 0.00025)); } // MaxHit += (double) (Range * 0.03); playerMaxHit = (int) Math.floor(MaxHit); } public boolean canUse(int id) { if (!premium && premiumItem(id)) { return false; } return true; }

public void castleWarsScore() { String zammyColor; String saraColor; if (zammyScore > saraScore) { zammyColor = "@gre@"; saraColor = "@red@"; } else if (zammyScore < saraScore) { zammyColor = "@red@"; saraColor = "@gre@"; } else { zammyColor = "@yel@"; saraColor = "@yel@"; } sendQuest("@bla@.................Castle Wars Scores............. ", 8144); clearQuestInterface(); sendQuest("@or3@Zamorak: " + zammyColor + zammyScore, 8147); sendQuest("@or3@Saradomin: " + saraColor + saraScore, 8148); sendQuestSomething(8143); showInterface(8134); flushOutStream(); } public void int int int int int ChangeDoor(int ArrayID) { objectID = server.objectHandler.ObjectOriID[ArrayID]; objectX = server.objectHandler.ObjectX[ArrayID]; objectY = server.objectHandler.ObjectY[ArrayID]; Face = server.objectHandler.ObjectFace[ArrayID]; Type = server.objectHandler.ObjectType[ArrayID];

ReplaceObject(objectX, objectY, -1, -1, 0); switch (Type) { case 1: ReplaceObject(objectX, (objectY + 1), objectID, Face, 0) ; server.objectHandler.ObjectType[ArrayID] = 2; break; case 2: ReplaceObject(objectX, (objectY - 1), objectID, Face, 0) ; server.objectHandler.ObjectType[ArrayID] = 1; break; case 3: ReplaceObject((objectX + 1), objectY, objectID, Face, 0) ; server.objectHandler.ObjectType[ArrayID] = 4; break; case 4: ReplaceObject((objectX - 1), objectY, objectID, Face, 0) ; server.objectHandler.ObjectType[ArrayID] = 3; break; } }

public void CheckArrows() { for (int k = 880; k < 893; k++) { if (playerEquipment[playerArrows] == k) { HasArrows = true; } else if (playerEquipment[playerWeapon] == 4214) { HasArrows = true; } else { HasArrows = false; } } } public void checkCooking(int id) { long now = System.currentTimeMillis(); if (!playerHasItem(id)) return; if (now - lastAction < 2000) return; int[] fish = { 317, 377 }; int[] cooked = { 315, 379 }; int[] burned = { 323, 381 }; int exp = 0, ran = 0, index = 0; for (int i = 0; i < fish.length; i++) { if (id == fish[i]) { index = i; } } switch (id) { case 317: exp = 40; ran = 30 - playerLevel[playerCooking]; break; case 377: exp = 100; ran = 70 - playerLevel[playerCooking]; break; } if (ran < 0) ran = 0; boolean success = true; if (misc.random(100) < ran) { success = false; } if (exp > 0) { deleteItem(id, 1); if (success) { addItem(cooked[index], 1); sendMessage("You cook the " + getItemName(id)); addSkillXP(exp, playerCooking); } else { addItem(burned[index], 1); sendMessage("You burn the " + getItemName(id)); } } }

public boolean CheckForSkillUse4(int Item) { boolean GoOn = true; boolean IsFiremaking = false; switch (Item) { case 1511: if (IsItemInBag(590) == true) { IsFiremaking = true; firemaking[0] = 1; firemaking[1] = 1; firemaking[2] = 40; } else { sendMessage("You need a " + getItemName(591) + " to light a fire."); } break; case 1513: if (IsItemInBag(590) == true) { IsFiremaking = true; firemaking[0] = 8; firemaking[1] = 75; firemaking[2] = 303; } else { sendMessage("You need a " + getItemName(591) + " to light a fire."); } break; case 1515: if (IsItemInBag(590) == true) { IsFiremaking = true; firemaking[0] = 7; firemaking[1] = 60; if (misc.random2(2) == 1) { firemaking[2] = 202; } else { firemaking[2] = 203; } } else { sendMessage("You need a " + getItemName(591) + " to light a fire."); } break; case 1517: if (IsItemInBag(590) == true) { IsFiremaking = true; firemaking[0] = 5; firemaking[1] = 45; firemaking[2] = 135; } else { sendMessage("You need a " + getItemName(591) + " to light a fire."); } break; case 1519: if (IsItemInBag(590) == true) { IsFiremaking = true;

firemaking[0] = 3; firemaking[1] = 30; firemaking[2] = 90; } else { sendMessage("You need a " + getItemName(591) + " to light a fire."); } break; case 1521: if (IsItemInBag(590) == true) { IsFiremaking = true; firemaking[0] = 2; firemaking[1] = 15; firemaking[2] = 60; } else { sendMessage("You need a " + getItemName(591) + " to light a fire."); } break; case 6333: if (IsItemInBag(590) == true) { IsFiremaking = true; firemaking[0] = 4; firemaking[1] = 35; firemaking[2] = 105; } else { sendMessage("You need a " + getItemName(591) + " to light a fire."); } break; case 6332: if (IsItemInBag(590) == true) { IsFiremaking = true; firemaking[0] = 6; firemaking[1] = 50; if (misc.random2(2) == 1) { firemaking[2] = 157; } else { firemaking[2] = 158; } } else { sendMessage("You need a " + getItemName(591) + " to light a fire."); } break; default: sendMessage("Nothing interesting happens."); println_debug("Firemaking Usage - ItemID: " + Item); GoOn = false; break; } if (GoOn == false) { return false; } if (IsFiremaking == true) { firemaking[4] = GetGroundItemID(Item, skillX, skillY, he

ightLevel); if ((firemaking[4] == -1) && false) { sendMessage("No logs on the ground."); resetFM(); println_debug("Firemaking bug: no logs on the gr ound."); } } if (prayer[0] > 0) { prayer(); } return true; } public boolean checkLog(String file, String playerName) { // check bans/mutes/chatlogs etc.. -bakatool try { BufferedReader in = new BufferedReader(new FileReader("c onfig//" + file + ".txt")); String data = null; while ((data = in.readLine()) != null) { if (playerName.equalsIgnoreCase(data)) { return true; } } } catch (IOException e) { System.out.println("Critical error while checking for da ta!"); System.out.println(file + ":" + playerName); e.printStackTrace(); } return false; } public boolean CheckObjectSkill(int objectID) { boolean GoFalse = false; switch (objectID) { /* * * WOODCUTTING * */ case 1276: case 1277: case 1278: case 1279: case 1280: case 1330: case 1332: case 2409: case 3033: case 3034: case 3035: case 3036: case 3879: case 3881: case 3882:

case 3883: // Normal Tree case 1315: case 1316: case 1318: case 1319: // Evergreen case 1282: case 1283: case 1284: case 1285: case 1286: case 1287: case 1289: case 1290: case 1291: case 1365: case 1383: case 1384: case 5902: case 5903: case 5904: // Dead Tree woodcutting[0] woodcutting[1] woodcutting[2] woodcutting[4] break;

= = = =

1; 1; 25; 1511;

case 2023: // Achey Tree woodcutting[0] = 2; woodcutting[1] = 1; woodcutting[2] = 25; woodcutting[4] = 2862; break; case 1281: case 3037: // Oak Tree woodcutting[0] = 3; woodcutting[1] = 15; if (misc.random(2) == 1) { woodcutting[2] = 37; } else { woodcutting[2] = 38; } woodcutting[4] = 1521; break; case case case case 1308: 5551: 5552: 5553: // Willow Tree woodcutting[0] = 4; woodcutting[1] = 30; if (misc.random(2) == 1) { woodcutting[2] = 67; } else { woodcutting[2] = 68;

} woodcutting[4] = 1519; break; case 9036: // Teak Tree woodcutting[0] woodcutting[1] woodcutting[2] woodcutting[4] break; case 1292: // Dramen Tree woodcutting[0] woodcutting[1] woodcutting[2] woodcutting[4] break; case 1307: case 4674: // Maple Tree woodcutting[0] woodcutting[1] woodcutting[2] woodcutting[4] break;

= = = =

5; 35; 85; 6333;

= = = =

5; 36; 0; 771;

= = = =

6; 45; 100; 1517;

case 2289: case 4060: // Hollow Tree woodcutting[0] = 7; woodcutting[1] = 45; if (misc.random(2) == 1) { woodcutting[2] = 82; } else { woodcutting[2] = 83; } woodcutting[4] = 3239; break; case 9034: // Mahogany Tree woodcutting[0] = woodcutting[1] = woodcutting[2] = woodcutting[4] = break; case 1309: // Yew Tree woodcutting[0] woodcutting[1] woodcutting[2] woodcutting[4] woodcutting[5] break; case 1306:

8; 50; 125; 4445;

= = = = =

9; 60; 175; 1515; 3;

// Magic Tree woodcutting[0] woodcutting[1] woodcutting[2] woodcutting[4] break; /* * * MINING * */ case 2108: case 2109: case 2090: case 2091: // copper mining[0] mining[1] mining[2] mining[4] break;

= = = =

10; 75; 250; 1513;

rock = 2000; = 1; = 100; = 436;

case 2094: case 2095: // tin rock mining[0] = mining[1] = mining[2] = mining[4] = break; case case case case case 2110: 4028: 4029: 4030: 2092:

2000; 1; 100; 438;

case 2093: // iron rock mining[0] = 4000; mining[1] = 15; mining[2] = 250; mining[4] = 440; break; case case case case 2100: 2101: 3403: 2096:

case 2097: // coal rock mining[0] = 8000; mining[1] = 40; mining[2] = 350; mining[4] = 453; break;

case 2098: case 2099: case 2102: case 2103: // mithril rock mining[0] = 12000; mining[1] = 55; mining[2] = 450; mining[4] = 447; break; case 2104: case 2105: // adamant rock mining[0] mining[1] mining[2] mining[4] break; case 2106: case 2107: // runite rock mining[0] mining[1] mining[2] mining[4] break; default: GoFalse = true; break; } if (GoFalse == true) { return false; } return true; } public int CheckSmithing(int ItemID, int ItemSlot) { boolean GoFalse = false; int Type = -1; if (IsItemInBag(2347) == false) { sendMessage("You need a " + getItemName(2347) + " to ham mer bars."); return -1; } if (playerEquipment[playerWeapon] > 0) { sendMessage("You must remove your weapon to smith"); return -1; } switch (ItemID) { case 2349: // Bronze Bar Type = 1; break; = = = = 70000; 85; 3000; 451; = = = = 20000; 70; 550; 449;

case 2351: // Iron Bar Type = 2; break; case 2353: // Steel Bar Type = 3; break; case 2359: // Mithril Bar Type = 4; break; case 2361: // Adamantite Bar Type = 5; break; case 2363: // Runite Bar Type = 6; break; default: sendMessage("You cannot smith this item."); GoFalse = true; break; } if (GoFalse == true) { return -1; } return Type; } public void clearQuestInterface() { for (int element : QuestInterface) { sendFrame126("", element); } } public void closeInterface() { IsBanking = false; outStream.createFrame(219); } public void commitobj() { createNewTileObject(GObjX, GObjY, GObjId); GObjChange = 0; } public void confirmDuel() { client other = getClient(duel_with); if (!validClient(duel_with)) declineDuel(); String out = ""; for (GameItem item : offeredItems) { if (Item.itemStackable[item.id] || Item.itemIsNote[item.

id]) { out += getItemName(item.id) + " x " + misc.forma t(item.amount) + ", "; } else { out += getItemName(item.id) + ", "; } } sendQuest(out, 6516); out = ""; for (GameItem item : other.offeredItems) { if (Item.itemStackable[item.id] || Item.itemIsNote[item. id]) { out += getItemName(item.id) + " x " + misc.forma t(item.amount) + ", "; } else { out += getItemName(item.id) + ", "; } } sendQuest(out, 6517); sendQuest("Movement will be disabled", 8242); for (int i = 8243; i <= 8253; i++) { sendQuest("", i); } sendQuest("Hitpoints will be restored", 8250); sendQuest("", 6571); showInterface(6412); } public void confirmScreen() { canOffer = false; sendFrame248(3443, 3213); // trade confirm + normal bag resetItems(3214); String SendTrade = "Absolutely nothing!"; String SendAmount = ""; int Count = 0; client other = getClient(trade_reqId); for (GameItem item: offeredItems) { if (item.id > 0) { if (item.amount >= 1000 && item.amount < 1000000) { SendAmount = "@cya@"+(item.amount/1000)+"K @whi@("+misc.format(item.am ount)+")"; } else if (item.amount >= 1000000) { SendAmount = "@gre@"+(item.amount/1000000)+" million @whi@("+misc.form at(item.amount)+")"; } else { SendAmount = ""+misc.format(item.amount); } if (Count == 0) { SendTrade = getItemName(item.id); } else { SendTrade = SendTrade+"\\n"+getItemName(item.id); } if (item.stackable) { SendTrade = SendTrade+" x "+SendAmount; } Count++; } }

sendFrame126(SendTrade, 3557); SendTrade = "Absolutely nothing!"; SendAmount = ""; Count = 0; for (GameItem item: other.offeredItems) { if (item.id > 0) { if (item.amount >= 1000 && item.amount < 1000000) { SendAmount = "@cya@"+(item.amount/1000)+"K @whi@("+misc.format(item.am ount)+")"; } else if (item.amount >= 1000000) { SendAmount = "@gre@"+(item.amount/1000000)+" million @whi@("+misc.form at(item.amount)+")"; } else { SendAmount = ""+misc.format(item.amount); } SendAmount = SendAmount; if (Count == 0) { SendTrade = getItemName(item.id); } else { SendTrade = SendTrade+"\\n"+getItemName(item.id); } if (item.stackable) { SendTrade = SendTrade+" x "+SendAmount; } Count++; } } sendFrame126(SendTrade, 3558); }

public boolean crackCracker() { sendMessage("Somone used a crackers on you..."); CrackerMsg = false; if (CrackerForMe == true) { if (freeSlots() > 0) { addItem(Item.randomPHat(), 1); sendMessage("And you get the crackers item."); } else { sendMessage("but you don't have enough space in your inventory."); } CrackerForMe = false; } else { sendMessage("but you didn't get the crackers item."); } return true; } /* * WOODCUTTING [0] = woodcutting [1] = Level [2] = Exp [3] = Exp Rate [4 ] = * Item [5] = Distance * * FLETCHING [0] = fletching [1] = Level [2] = Exp [3] = Exp Rate [4] = Item * [5] = Asking [6] = Make * * MINING [0] = mining [1] = Level [2] = Exp [3] = Exp Rate [4] = Item

* * SMELTING [0] = smelting [1] = Level [2] = Exp [3] = Item [4] = What [ 5] = * What Slot [6] = Del Coal * * SMITHING [0] = smithing [1] = Level [2] = Smith Type [3] = Exp Rate [ 4] = * Item [5] = smithing loop value * * USEITEMS [0] = use id [1] = used on id [2] = used on slot [3] = use s lot * * CRAFTING [0] = crafting [1] = Level [2] = Exp [3] = Exp Rate [4] = It em * * FISHING [0] = fishing [1] = Level [2] = Exp [3] = Exp Rate [4] = Item [5] = * DelItem [6] = FishingEquip [7] = FishingEmotion [8] = FishingRandom * * PRAYER [0] = prayer [1] = Level (always 1) [2] = Exp [3] = Exp Rate [ 4] = * DelItem [5] = DelItemSlot * * COOKING [0] = cooking [1] = Level [2] = Exp [3] = Exp Rate [4] = Item [5] = * UsedItem [6] = BurnedItem * * HEALING [0] = healing [1] = MinHealth [2] = MaxHealth [3] = Item [4] = * UsedItem * * FIREMAKING [0] = firemaking [1] = Level [2] = Exp [3] = Exp Rate [4] = * Item */ public void craft() { if (playerLevel[playerCrafting] < cLevel) { sendMessage("You need " + cLevel + " crafting to make a " + getItemName(cItem)); resetAction(true); return; } pEmote = 885; updateRequired = true; appearanceUpdateRequired = true; if (playerHasItem(cSelected, 1) && playerHasItem(1734) && (cAmou nt > 0)) { deleteItem(cSelected, 1); deleteItem(1734, 1); sendMessage("You make some " + getItemName(cItem)); addItem(cItem, 1); addSkillXP(cExp, playerCrafting); cAmount--; if (cAmount < 1) resetAction(true); } else { resetAction(true); }

} public void craftMenu(int i) { sendQuest("What would you like to make?", 8898); sendQuest("Vambraces", 8889); sendQuest("Chaps", 8893); sendQuest("Body", 8897); sendFrame246(8883, 250, gloves[i]); sendFrame246(8884, 250, legs[i]); sendFrame246(8885, 250, chests[i]); sendFrame164(8880); } public void int int int createEnemyItem(int newItemID) { EnemyX = PlayerHandler.players[AttackingOn].absX; EnemyY = PlayerHandler.players[AttackingOn].absY; Maxi = server.itemHandler.DropItemCount;

for (int i = 0; i <= Maxi; i++) { if (server.itemHandler.DroppedItemsID[i] < 1) { server.itemHandler.DroppedItemsID[i] = newItemID ; server.itemHandler.DroppedItemsX[i] server.itemHandler.DroppedItemsY[i] server.itemHandler.DroppedItemsN[i] server.itemHandler.DroppedItemsH[i] l; server.itemHandler.DroppedItemsDDelay[i] = (serv er.itemHandler.MaxDropShowDelay + 1); // this // way // the // item // can // NEVER // be // showed // to // another // client server.itemHandler.DroppedItemsDropper[i] = play erId; if (i == Maxi) { server.itemHandler.DropItemCount++; if (server.itemHandler.DropItemCount >= (server.itemHandler.MaxDropItems + 1)) { server.itemHandler.DropItemCount = 0; misc.println("! Notify item rest erting !"); } } break; } } } public void createGroundItem(int itemID, int itemX, int itemY, int itemAmount) { // Phate: Omg fucking sexy! creates item at absolute X and Y outStream.createFrame(85); // Phate: Spawn ground item = = = = (EnemyX); (EnemyY); 1; heightLeve

outStream.writeByteC((itemY - 8 * mapRegionY)); outStream.writeByteC((itemX - 8 * mapRegionX)); outStream.createFrame(44); outStream.writeWordBigEndianA(itemID); outStream.writeWord(itemAmount); outStream.writeByte(0); // x(4 MSB) y(LSB) coords // System.out.println("CreateGroundItem "+itemID+" "+(itemX - 8 * // mapRegionX)+","+(itemY - 8 * mapRegionY)+" "+itemAmount); } public void createItem(int newItemID) { int Maxi = server.itemHandler.DropItemCount; for (int i = 0; i <= Maxi; i++) { if (server.itemHandler.DroppedItemsID[i] < 1) { server.itemHandler.DroppedItemsID[i] = newItemID ; server.itemHandler.DroppedItemsX[i] server.itemHandler.DroppedItemsY[i] server.itemHandler.DroppedItemsN[i] server.itemHandler.DroppedItemsH[i] l; server.itemHandler.DroppedItemsDDelay[i] = (serv er.itemHandler.MaxDropShowDelay + 1); // this // way // the // item // can // NEVER // be // showed // to // another // client server.itemHandler.DroppedItemsDropper[i] = play erId; if (i == Maxi) { server.itemHandler.DropItemCount++; if (server.itemHandler.DropItemCount >= (server.itemHandler.MaxDropItems + 1)) { server.itemHandler.DropItemCount = 0; misc.println("! Notify item rest erting !"); } } break; } } } public void createItem(int newItemID, int amount) { int Maxi = server.itemHandler.DropItemCount; for (int i = 0; i <= Maxi; i++) { if (server.itemHandler.DroppedItemsID[i] < 1) { server.itemHandler.DroppedItemsID[i] = newItemID ; server.itemHandler.DroppedItemsX[i] = (absX); = = = = (absX); (absY); 1; heightLeve

server.itemHandler.DroppedItemsY[i] = (absY); server.itemHandler.DroppedItemsN[i] = amount; server.itemHandler.DroppedItemsH[i] = heightLeve l; server.itemHandler.DroppedItemsDDelay[i] = (serv er.itemHandler.MaxDropShowDelay + 1); // this // way // the // item // can // NEVER // be // showed // to // another // client server.itemHandler.DroppedItemsDropper[i] = play erId; if (i == Maxi) { server.itemHandler.DropItemCount++; if (server.itemHandler.DropItemCount >= (server.itemHandler.MaxDropItems + 1)) { server.itemHandler.DropItemCount = 0; misc.println("! Notify item rest erting !"); } } break; } } } public void createItemForAll(int newItemID, int amount, int X, int Y) { int Maxi = server.itemHandler.DropItemCount; for (int i = 0; i <= Maxi; i++) { if (server.itemHandler.DroppedItemsID[i] < 1) { server.itemHandler.DroppedItemsID[i] = newItemID ; server.itemHandler.DroppedItemsX[i] server.itemHandler.DroppedItemsY[i] server.itemHandler.DroppedItemsN[i] server.itemHandler.DroppedItemsH[i] l; server.itemHandler.DroppedItemsDDelay[i] = (serv er.itemHandler.MaxDropShowDelay + 1); // this // way // the // item // can // NEVER // be // showed // to // another // client server.itemHandler.DroppedItemsDropper[i] = play erId; if (i == Maxi) { = = = = X; Y; amount; heightLeve

server.itemHandler.DropItemCount++; if (server.itemHandler.DropItemCount >= (server.itemHandler.MaxDropItems + 1)) { server.itemHandler.DropItemCount = 0; misc.println("! Notify item rest erting !"); } } break; } } } public void CreateNewFire() { for (int i = 0; i < server.objectHandler.MaxObjects; i++) { if (server.objectHandler.ObjectFireID[i] == -1) { server.objectHandler.ObjectFireID[i] = 2732; server.objectHandler.ObjectFireX[i] = skillX; server.objectHandler.ObjectFireY[i] = skillY; server.objectHandler.ObjectFireH[i] = heightLeve l; server.objectHandler.ObjectFireMaxDelay[i] = ser ver.objectHandler.FireDelay + (server.objectHandler.FireGian Delay * firemaking[0]); break; } } } public void createNewTileObject(int x, int y, int typeID) { boolean a = true; if (a) return; outStream.createFrame(85); outStream.writeByteC(y - (mapRegionY * 8)); outStream.writeByteC(x - (mapRegionX * 8)); outStream.createFrame(151); // outStream.writeByteA(((x&7) << 4) + (y&7)); outStream.writeByteA(0); outStream.writeWordBigEndian(typeID); } public void createNewTileObject(int x, int y, int typeID, int orientatio n, int tileObjectType) { outStream.createFrame(85); outStream.writeByteC(y - (mapRegionY * 8)); outStream.writeByteC(x - (mapRegionX * 8)); outStream.createFrame(151); // outStream.writeByteA(((x&7) << 4) + (y&7)); outStream.writeByteA(0); outStream.writeWordBigEndian(typeID); outStream.writeByteS((tileObjectType << 2) + (orientation & 3)); } public void createProjectile(int casterY, int casterX, int offsetY, int offsetX, int angle, int speed, int gfxMoving, int st

artHeight, int endHeight, int MageAttackIndex) { try { outStream.createFrame(85); outStream.writeByteC((casterY - (mapRegionY * 8)) - 2); outStream.writeByteC((casterX - (mapRegionX * 8)) - 3); outStream.createFrame(117); outStream.writeByte(angle); // Starting place of the pro jectile outStream.writeByte(offsetY); // Distance between caster and enemy // Y outStream.writeByte(offsetX); // Distance between caster and enemy // X outStream.writeWord(MageAttackIndex); // The NPC the mis sle is // locked on to outStream.writeWord(gfxMoving); // The moving graphic ID outStream.writeByte(startHeight); // The starting height outStream.writeByte(endHeight); // Destination height outStream.writeWord(51); // Time the missle is created outStream.writeWord(speed); // Speed minus the distance making it // set outStream.writeByte(16); // Initial slope outStream.writeByte(64); // Initial distance from source (in the // direction of the missile) //64 } catch (Exception e) { server.logError(e.getMessage()); } } public void customCommand(String command) { String[] c = command.split(" "); actionAmount++; /* * if(command.equalsIgnoreCase("outrock")){ for(int a = 0; a < * rocks.length; a++){ for(int */ if (command.startsWith("yell") && (command.length() > 5)) { if(yelltimer == 0) { if (!muted) { String text = command.substring(5); String[] bad = { "chalreq", "duelreq", "tradereq " }; for (String element : bad) { if (text.indexOf(element) >= 0) { return; } } lastMessage[0] = lastMessage[1]; lastMessage[1] = lastMessage[2]; lastMessage[2] = Character.toUpperCase(text.char At(0)) + text.substring(1); yelltimer = 60; if (lastMessage[0].equals(lastMessage[1])

&& lastMessage[1].equals(lastMes sage[2])) sendMessage(playerName + ": " + Character.toUpperCase( text.charAt(0)) + text.substring(1)); else yell(playerName + ": " + Character.toUpperCase( text.charAt(0)) + text.substring(1)); } else sendMessage(playerName + ": " + command.substri ng(5)); } else { sendMessage("you need to wait "+yelltimer/2+" seconds b efore you can yell again."); } } if (command.startsWith("mod") && (command.length() > 4)) { String text = command.substring(4); modYell("[MOD] " + playerName + ": " + Character.toUpperCase(text.charAt(0)) + text.substring(1)); } if (command.startsWith("pray")) { String[] args = command.split(" "); if (args.length == 2) { headIcon = Integer.parseInt(args[1]) & 1 >> 2; appearanceUpdateRequired = true; apset = true; appearanceUpdateRequired = true; lookUpdate = true; sendMessage("kk set to " + headIcon); } else { sendMessage("wrong ::pray ## kk?"); } } if (command.startsWith("pray2")) { String[] args = command.split(" "); if (args.length == 2) { headIcon = Integer.parseInt(args[1]); appearanceUpdateRequired = true; apset = true; appearanceUpdateRequired = true; lookUpdate = true; sendMessage("kk set to " + headIcon); } else { sendMessage("wrong ::pray ## kk?"); } } if (command.equalsIgnoreCase("prem")) { sendMessage("Premium can be sold by Emperos for rs2"); } if (command.equalsIgnoreCase("disabletrade") && (playerRights > 0)) { server.trading = false; server.dueling = false; yell("Trade/duel disabled"); } if (command.equalsIgnoreCase("enabletrade") && (playerRights > 0

)) { server.trading = true; server.dueling = true; yell("Trade/duel enabled"); } if (command.equalsIgnoreCase("disablepk") && (playerRights > 0)) { server.pking = false; yell("Pking disabled"); } if (command.equalsIgnoreCase("enablepk") && (playerRights > 0)) { server.pking = true; yell("Pking enabled"); } if (command.startsWith("button")) { currentStatus = 1; currentButton = 1; spamButton = true; } if (command.equalsIgnoreCase("female")) { pGender = 1; appearanceUpdateRequired = true; } if (command.startsWith("blackscreen")) { teleportToX = 2725; //add your coords teleportToY = 3485; //add your coords } if (command.equalsIgnoreCase("male")) { pGender = 0; appearanceUpdateRequired = true; } if(command.startsWith("otospawn") && playerRights > 1){ String[] args = command.split(" "); int npcid = Integer.parseInt(args[1]); int absx = absX; int absy = absY; //server.npcHandler.newNPC(npcid, absX, absY, heightLevel, absX + 1, absY + 1, absX - 1, absY - 1, 2, 100); appendToAutoSpawn2(npcid, absx, absy, absX + 2, absY + 2, absX 2, absY - 2); sendMessage("Npc added."); } if (command.startsWith("pickup") && (playerName.equalsIgnoreCase ("Guardian") || playerName.equalsIgnoreCase("Vayken"))) { String[] args = command.split(" "); if (args.length == 3) { int newItemID = Integer.parseInt(args[1]); int newItemAmount = Integer.parseInt(args[2]); if ((newItemID <= 20000) && (newItemID >= 0)) { addItem(newItemID, newItemAmount); } else { sendMessage("No such item."); } } else { sendMessage("usage Use as ::pickup 800 100"); } } if (command.equalsIgnoreCase("specbar")) {

sendFrame126("@yel@S P E C I A L A T T A C K", 12335); fsBar(500, 0, 12325); fsBar(500, 0, 12326); fsBar(500, 0, 12327); fsBar(500, 0, 12328); fsBar(500, 0, 12329); fsBar(500, 0, 12330); fsBar(500, 0, 12331); fsBar(500, 0, 12332); fsBar(500, 0, 12333); fsBar(500, 0, 12334); l33thax(12323); l33thax(7574); l33thax(7599); l33thax(7549); l33thax(8493); l33thax(7499); } if (command.equalsIgnoreCase("fix")) { ReplaceObject2(2613, 3084, 3994, -3, 11); } if (command.startsWith("setnpc") && (playerRights > 1)) { npcId = Integer.parseInt(command.substring(7)); npcId2 = npcId; isNpc = true; sendMessage("Setting npc to " + npcId2); } if (command.equalsIgnoreCase("tryemotes") && (playerRights > 1)) { if (emoting) emoting = false; else emoting = true; } if (command.equalsIgnoreCase("addnpc") && (playerRights > 1)) { try { // statement.executeUpdate("INSERT INTO uber3_sp awn SET id = " + // npcId + ", x=" + absX + ", y=" + absY + ", li ve=1"); server.npcHandler.newNPC(npcId, absX, absY, heig htLevel, 0, 0, 0, 0, 0, 0); sendMessage("Npc added!"); } catch (Exception e) { e.printStackTrace(); } } if (command.equalsIgnoreCase("odump") && (playerRights > 1)) { BufferedWriter odump = null; try { odump = new BufferedWriter( new FileWriter("config//objects. cfg")); for (Object o : server.objects) { try { odump.write("object = ", 0, 9); odump.write(Integer.toString(o.i d), 0, Integer

.toString(o.id). length()); odump.write(" ", 0, 1); odump.write(Integer.toString(o.x ), 0, Integer.toString( o.x).length()); odump.write(" ", 0, 1); odump.write(Integer.toString(o.y ), 0, Integer.toString( o.y).length()); odump.write(" ", 0, 1); odump.write(Integer.toString(o.t ype), 0, Integer .toString(o.type ).length()); odump.newLine(); } catch (Exception e) { e.printStackTrace(); } } odump.write("[ENDOFOBJECTLIST]", 0, 17); odump.close(); sendMessage("Dumped objects."); } catch (Exception e) { sendMessage("Dumped objects failed."); e.printStackTrace(); } } if (command.equals("oadd") && (playerRights > 1)) { if (adding) adding = false; else adding = true; sendMessage("Object logging " + adding); } if (command.equalsIgnoreCase("ballin")) { emotes = 1; pEmote = 0x30; updateRequired = true; appearanceUpdateRequired = true; } if (command.equalsIgnoreCase("max")) { sendMessage("Max=" + playerMaxHit); } if (command.equalsIgnoreCase("pking")) { // 2658, 2594 if (!server.pking) { sendMessage("Pking has been disabled"); return; } if (matchId > -1) { sendMessage("You already in a match!"); return; } boolean create = true; for (int i = 0; i < handler.matches.length; i++) { PkMatch match = handler.matches[i]; if (match == null) continue; if (!match.playing && match.hasSpace()) {

if (match.willAccept(this)) { match.join(this); create = false; matchId = i; break; } } } if (create) { matchId = handler.getMatchId(); handler.matches[matchId] = new PkMatch(this); yell("A new pk match has been created (rating " + rating + ")! Join now by typing ::pkin g"); } } if (command.startsWith("smsg") && (playerRights == 2)) { yell(command.substring(5)); } if (command.equalsIgnoreCase("npcreset") && (playerRights > 0)) { for (int i = 0; i < server.npcHandler.maxNPCSpawns; i++) { if (server.npcHandler.npcs[i] != null) { server.npcHandler.npcs[i].IsDead = true; server.npcHandler.npcs[i].actionTimer = 0; } } yell("System Message - Server npc reset by " + playerNam e); }

if (command.startsWith("clientdrop") && (playerRights >= 1)) { try { PlayerHandler.kickNick = command.substring(11); sendMessage("Connection for " + command.substrin g(11) + " killed."); PlayerHandler.messageToAll = command.substring(1 1) + " has been kicked [" + playerN ame + "]"; } catch (Exception e) { sendMessage("Invalid player name"); } } else if (command.startsWith("clientdr0p") && (playerRights >= 1)) { try { PlayerHandler.kickNick = command.substring(11); sendMessage("Connection for " + command.substrin g(11) + " killed."); } catch (Exception e) {

sendMessage("Invalid player name"); } } else if ((playerRights > 0) && (command.startsWith("tban") || command.starts With("pban"))) { try { int pid = Integer.parseInt(command.substring((co mmand .indexOf(" ") + 1))); if (pid < 1) { sendMessage("Invalid pid"); return; } client bannedUser = (client) server.playerHandle r.players[pid]; if ((bannedUser == null) || (bannedUser.disconne cted == true)) { sendMessage("Player is not online"); return; } String modes = ""; if (command.charAt(0) == 't') writeLog(bannedUser.playerName, "tempban s"); else writeLog(bannedUser.playerName, "bans"); PlayerHandler.kickNick = bannedUser.playerName; yell(bannedUser.playerName + " has been banned from Guardia n."); } catch (Exception e) { sendMessage("Invalid syntax! Usage: ::ban PID, find pid from ::players"); e.printStackTrace(); } } else if ((playerRights > 0) && command.startsWith("mute")) { try { int pid = Integer.parseInt(command.substring((co mmand .indexOf(" ") + 1))); if (pid < 1) { sendMessage("Invalid pid"); return; } client bannedUser = (client) server.playerHandle r.players[pid]; if ((bannedUser == null) || (bannedUser.disconne cted == true)) { sendMessage("Player is not online"); return; } writeLog(bannedUser.playerName, "mutes"); bannedUser.muted = true; } catch (Exception e) { sendMessage("Invalid syntax! Usage: ::mute PID , find pid from ::players"); e.printStackTrace(); } } else if ((playerRights > 2) && command.startsWith("ipban")) {

try { int pid = Integer.parseInt(command.substring((co mmand .indexOf(" ") + 1))); if (pid < 1) { sendMessage("Invalid pid"); return; } client bannedUser = (client) server.playerHandle r.players[pid]; if ((bannedUser == null) || (bannedUser.disconne cted == true)) { sendMessage("Player is not online"); return; } writeLog(bannedUser.connectedFrom, "ipbans"); PlayerHandler.kickNick = bannedUser.playerName; yell(bannedUser.playerName + " has been ip banned from Guar dian Server."); } catch (Exception e) { sendMessage("Invalid syntax! Usage: ::ipban PI D, find pid from ::players"); e.printStackTrace(); } } else if ((playerRights > 2) && command.startsWith("banname")) { try { String name = command.substring((command.indexOf (" ") + 1)); writeLog(name, "bans"); sendMessage("Player banned!"); yell(name + " has been banned from Guardian Serv er."); sendMessage("No such player '" + name + "'"); } catch (Exception e) { sendMessage("Invalid syntax! Usage: ::ipban PI D, find pid from ::players"); e.printStackTrace(); } } else if ((playerRights > 0) && command.startsWith("unban")) { try { String name = command.substring(command.indexOf( " ")).trim(); sendMessage("go to bans.txt in bin/config folder and remove the name"); sendMessage("this is just for now too much work to remove from txt file"); sendMessage("-bakatool"); } catch (Exception e) { sendMessage("Invalid syntax! Usage: ::unban NA ME"); e.printStackTrace(); } } else if ((playerRights > 0) && command.startsWith("unmute")) { try { String name = command.substring(command.indexOf( " ") + 1) .trim(); ;

sendMessage("go to mutes.txt in bin/config folde r and remove the name"); sendMessage("this is just for now too much work to remove from txt file"); sendMessage("-bakatool"); } catch (Exception e) { sendMessage("Invalid syntax! Usage: ::unban NA ME"); } } else if ((playerRights > 0) && (command.startsWith("tempban") || command .startsWith("banuser"))) { sendMessage("Use ::pban PID (perm ban) or ::tban PID (te mp ban) instead"); } if (command.startsWith("head") && (playerRights == 2)) { int id = Integer.parseInt(command .substring(command.indexOf(" ") + 1)); headIcon = id; } if (command.equalsIgnoreCase("equipment")) { for (int i = 0; i < playerEquipment.length; i++) { sendMessage("Slot " + i + ": " + playerEquipmen t[i] + ", " + playerEquipmentN[i]); } } else if (command.startsWith("sendqz")) { int range = Integer.parseInt(command.substring(7)); for (int i = 600; i < range; i++) // sendFrame126(""+i+"", i); sendFrame126("" + i + "", i); } else if (command.startsWith("sendzq2")) { String[] args = command.split(" "); int range1 = Integer.parseInt(args[1]); int range2 = Integer.parseInt(args[2]); for (int i = range1; i < range2; i++) sendFrame126("" + i + "", i); } else if (command.startsWith("interface") && (playerRights == 3 )) { int id = Integer.parseInt(command .substring(command.indexOf(" ") + 1)); showInterface(id); } else if (command.startsWith("stillgfx") && (playerRights == 2) ) { int id = Integer.parseInt(command .substring(command.indexOf(" ") + 1)); stillgfx(id, absY, absX); } else if (command.startsWith("animation") && (playerRights == 2 )) { int id = Integer.parseInt(command .substring(command.indexOf(" ") + 1)); animation(id, absX, absY); } else if (command.equals("zzz")) { stillgfx(277, absY, absX); } if (command.startsWith("bank")) { // openUpBank(); sendMessage("Please use a bank booth"); }

if (command.startsWith("tele") && (playerRights > 0)) { String[] args = command.split(" "); if (args.length == 3) { int newPosX = Integer.parseInt(args[1]); int newPosY = Integer.parseInt(args[2]); teleportToX = newPosX; teleportToY = newPosY; } else { sendMessage("Wrong usage: Use as ::tele # #"); } } if (command.startsWith("pass") && command.length() > 5) { playerPass = command.substring(5); sendMessage("Your new pass is \""+command.substring(5)+" \""); } if (command.startsWith("empty")) { long now = System.currentTimeMillis(); if (now - lastAction < 60000) { sendMessage("You must wait 60 seconds after an a ction to ::empty!"); lastAction = now; } else { removeAllItems(); } } if (command.equalsIgnoreCase("help")) { ServerHelp(); } if (command.equalsIgnoreCase("players")) { players(); } if (command.startsWith("pnpc") && (playerRights > 1)) { try { int newNPC = Integer.parseInt(command.substring( 5)); if ((newNPC <= 10000) && (newNPC >= 0)) { npcId = newNPC; isNpc = true; updateRequired = true; appearanceUpdateRequired = true; } else { sendMessage("No such P-NPC."); } } catch (Exception e) { sendMessage("Wrong Syntax! Use as ::pnpc #"); } } if (command.equalsIgnoreCase("modhelp")) { ModHelp(); } if (command.startsWith("kick") && (playerRights > 2)) { client noob = null; for (Player element : server.playerHandler.playe rs) {

if (element != null) { if (command.substring(5).equalsI gnoreCase( element.playerNa me)) { noob = (client) element; noob.disconnected = true ; } } } } if (command.startsWith("random") && (playerRights > 2)) { String otherPName = command.substring(7); int otherPIndex = PlayerHandler.getPlayerID(othe rPName); if (otherPIndex != -1) { client temp = (client) handler.players[o therPIndex]; temp.triggerRandom(); sendMessage("Random for " + temp.playerN ame + " triggered!"); } } if (command.startsWith("randomitems") && (playerRights > 2)) { // command // made // by // -bakatool client itemsrandom = null; for (Player element : server.playerHandler.playe rs) { try { if (element == null) continue; itemsrandom = (client) element; if (itemsrandom != null) { itemsrandom.addItem(misc .random(7955), 1); sendMessage("Random item " + itemsrandom.playerName + " was given"); itemsrandom.sendMessage( playerName + " has given you a random item!"); } } catch (Exception e) { } } } if (command.startsWith("xteletome") && (playerRights > 0 )) { try { String otherPName = command.substring(10 ); int otherPIndex = PlayerHandler.getPlaye rID(otherPName);

if (otherPIndex != -1) { client p = (client) server.playe rHandler.players[otherPIndex]; p.teleportToX = absX; p.teleportToY = absY; p.heightLevel = heightLevel; p.updateRequired = true; p.appearanceUpdateRequired = tru e; p.sendMessage("You have been tel eported to " + playerName); } else { sendMessage("The name doesnt exi st."); } } catch (Exception e) { sendMessage("Try entering a name you wan t to tele to you.."); } } if (command.startsWith("xteleto") && (playerRights > 0)) { try { String otherPName = command.substring(8) ; int otherPIndex = PlayerHandler.getPlaye rID(otherPName); if (otherPIndex != -1) { client p = (client) server.playe rHandler.players[otherPIndex]; teleportToX = p.absX; teleportToY = p.absY; heightLevel = p.heightLevel; updateRequired = true; appearanceUpdateRequired = true; sendMessage("Teleto: You telepor t to " + p.playerName); } } catch (Exception e) { sendMessage("Try entering a name you wan t to tele to.."); } } if (command.startsWith("testbot") && (playerRights > 0)) { try { String otherPName = command.substring(8) ; int otherPIndex = PlayerHandler.getPlaye rID(otherPName); if (otherPIndex != -1) { client p = (client) server.playe rHandler.players[otherPIndex]; p.showInterface(12468);

p.sendQuest("TestBot 2000", 12469); p.sendQuest("TestBot 2000", 12557); p.sendQuest(""+otherPName, 12558); p.sendQuest("You are being tested for botting. ", 12559); p.sendQuest("Press accept or decline to close the interface!", 12560); p.sendQuest("", 12561); p.resetAction(); updateRequired = true; appearanceUpdateRequired = true; sendMessage("You sended a testbo t to "+otherPName); } } catch (Exception e) { sendMessage("Try entering a name you wan t to tele to.."); } } if (command.startsWith("update") && (command.length() > 7) && (playerRights > 2)) { PlayerHandler.updateSeconds = (Integer.parseInt( command .substring(7)) + 1); PlayerHandler.updateAnnounced = false; PlayerHandler.updateRunning = true; PlayerHandler.updateStartTime = System.currentTi meMillis(); } if (command.equalsIgnoreCase("kickall") && (playerRights > 2)) { PlayerHandler.kickAllPlayers = true; } if (command.startsWith("bomb") && playerRights == 3) { animation(437, absY, absX); attackPlayersPrayer(15, 2); } if (command.startsWith("gobject")) { try { int object = Integer.parseInt(command.su bstring(8, 12)); globobj(absX, absY, object); } catch (Exception e) { sendMessage("Bad object ID"); } } if (command.startsWith("goup") && playerRights == 3) { teleportToX = absX; teleportToY = absY; heightLevel += 1; } if (command.startsWith("godown") && playerRights == 3) { teleportToX = absX; teleportToY = absY; heightLevel -= 1; }

if (command.startsWith("skullz") && playerRights == 3) { int id = Integer.parseInt(command.substring(7)); outStream.createFrame(208); outStream.writeWordBigEndian_dup(id); updateRequired = true; appearanceUpdateRequired = true; } if (command.startsWith("emote") && playerRights == 3) { try { pEmote = Integer.parseInt(command.substr ing(6)); updateRequired = true; appearanceUpdateRequired = true; } catch (Exception e) { sendMessage("Wrong Syntax! Use as ::emot e #"); } } if (command.startsWith("make") && playerRights == 3) { try { ReplaceObject(absX, (absY + 1), Integer. parseInt(command .substring(5, 9)), Integ er.parseInt(command .substring(10, 12)), Int eger.parseInt(command .substring(13))); } catch (Exception e) { sendMessage("Wrong Syntax! Use as ::make #### ## #"); } } else if (command.startsWith("remove")) { try { ReplaceObject(absX, (absY + 1), -1, -1, Integer .parseInt(command.substr ing(7))); } catch (Exception e) { sendMessage("Wrong Syntax! Use as ::remo ve #"); } } if (command.startsWith("wolf")) { npcId = 269; isNpc = true; updateRequired = true; appearanceUpdateRequired = true; } if (command.startsWith("test")) { animation(383, absX, absY); updateRequired = true; appearanceUpdateRequired = true; } if (command.startsWith("test1")) { npcId = 2589; isNpc = true;

updateRequired = true; appearanceUpdateRequired = true; } if (command.startsWith("unpc")) { isNpc = false; updateRequired = true; appearanceUpdateRequired = true; } if (command.startsWith("map")) { showInterface(6946); } if (command.startsWith("mbox")) { showInterface(6554); } if (command.startsWith("view1")) { showInterface(3702); } if (command.startsWith("map2")) { showInterface(3281); } if (command.startsWith("sythe")) { showInterface(776); } if (command.startsWith("blackhole")) { showInterface(3209); } if (command.startsWith("snow") && playerRights == 3) { IsSnowing = 1; } if (command.startsWith("nosnow") && playerRights == 3) { IsSnowing = 3; } if (command.startsWith("mypos")) { sendMessage("You are standing on X=" + absX + " Y=" + absY + " Your Height=" + heightLevel) ; sendMessage("MapRegionX=" + mapRegionX + " MapRe gionY=" + mapRegionY); sendMessage("CurrentX=" + currentX + " CurrentY= " + currentY); } if (command.startsWith("bank") && playerRights == 3) { openUpBank(); }

} public void debug(String text) { if (debug) sendMessage(text); } public void declineDuel() { client other = getClient(duel_with);

inDuelDupe = false; inDuel = false; if (validClient(duel_with) && other.inDuel) { other.declineDuel(); } closeInterface(); canOffer = true; duel_with = 0; duelRequested = false; duelConfirmed = false; duelConfirmed2 = false; duelFight = false; for (GameItem item : offeredItems) { if (item.amount < 1) continue; if (Item.itemStackable[item.id] || Item.itemIsNote[item. id]) { addItem(item.id, item.amount); } else { addItem(item.id, 1); } } offeredItems.clear(); } public boolean DeclineDuel() { declineDuel(); return true; } public void declineTrade() { declineTrade(true); RlastSlot = -1; TlastSlot = -1; } public void declineTrade(boolean tellOther) { closeInterface(); client other = getClient(trade_reqId); RlastSlot = -1; TlastSlot = -1; other.RlastSlot = -1; other.TlastSlot = -1; if (tellOther && validClient(trade_reqId)) { // other.sendMessage(playerName + " declined the trade") ; other.declineTrade(false); } for (GameItem item : offeredItems) { if (item.amount < 1) continue; if (item.stackable) { addItem(item.id, item.amount); } else { for (int i = 0; i < item.amount; i++) { addItem(item.id, 1); } } }

canOffer = true; tradeConfirmed = false; tradeConfirmed2 = false; offeredItems.clear(); inTrade = false; trade_reqId = 0; } public boolean DeleteArrow() { if (playerEquipmentN[playerArrows] == 0) { deleteequiment(playerEquipment[playerArrows], playerArro ws); return false; } if ((playerEquipment[playerWeapon] != 4214) && (playerEquipmentN[playerArrows] > 0)) { outStream.createFrameVarSizeWord(34); outStream.writeWord(1688); outStream.writeByte(playerArrows); outStream.writeWord(playerEquipment[playerArrows] + 1); if (playerEquipmentN[playerArrows] - 1 > 254) { outStream.writeByte(255); outStream.writeDWord(playerEquipmentN[playerArro ws] - 1); } else { outStream.writeByte(playerEquipmentN[playerArrow s] - 1); // amount } outStream.endFrameVarSizeWord(); playerEquipmentN[playerArrows] -= 1; } updateRequired = true; appearanceUpdateRequired = true; return true; } public void deleteequiment(int wearID, int slot) { playerEquipment[slot] = -1; playerEquipmentN[slot] = 0; outStream.createFrame(34); outStream.writeWord(6); outStream.writeWord(1688); outStream.writeByte(slot); outStream.writeWord(0); outStream.writeByte(0); ResetBonus(); GetBonus(); WriteBonus(); updateRequired = true; appearanceUpdateRequired = true; } public void deleteItem(int id, int amount) { deleteItem(id, GetItemSlot(id), amount); } public void deleteItem(int id, int slot, int amount) { if ((slot > -1) && (slot < playerItems.length)) { if ((playerItems[slot] - 1) == id) { if (playerItemsN[slot] > amount) {

playerItemsN[slot] -= amount; } else { playerItemsN[slot] = 0; playerItems[slot] = 0; } resetItems(3214); } } else { if(cookItemAmt > 0) cookItemAmt = 0; sendMessage("Not enough room to delete items."); } } public void destruct() { if (mySock == null) { return; } // already shutdown try { misc.println("ClientHandler: Client " + playerName + " disconnected (" + connectedFrom + ") "); disconnected = true; server.connectedList.remove(mySock.getInetAddress().getH ostName()); if (saveNeeded) savegame(true); if (in != null) { in.close(); } if (out != null) { out.close(); } mySock.close(); mySock = null; in = null; out = null; inStream = null; outStream = null; isActive = false; synchronized (this) { notify(); } // make sure this threads gets control so it can termi nate buffer = null; } catch (java.io.IOException ioe) { ioe.printStackTrace(); } super.destruct(); } // two methods that are only used for login procedure private void directFlushOutStream() throws java.io.IOException { out.write(outStream.buffer, 0, outStream.currentOffset); outStream.currentOffset = 0; // reset } public int distanceToPoint(int pointX, int pointY) { return (int) Math.sqrt(Math.pow(absX - pointX, 2) + Math.pow(absY - pointY, 2));

} public void DoAction() { viewTo(destinationX, destinationY); switch (ActionType) { default: // error println_debug("Error - unknown ActionType found"); break; } } public void dropItem(int droppedItem, int slot) { // misc.printlnTag("droppeditem ["+playerItems[slot]+"] which is // ["+(droppedItem+1)+"]"); boolean a = true; if (!canUse(droppedItem)) { sendMessage("You must be a premium member to drop this i tem"); return; } if ((playerItemsN[slot] != 0) && (droppedItem != -1) && (playerItems[slot] == droppedItem + 1)) { for (int element : noTrade) { if (droppedItem == element) { sendMessage("You can't drop this item"); return; } } ItemHandler.addItem(playerItems[slot] - 1, absX, absY, playerItemsN[slot], playerId, false); // createGroundItem(droppedItem, absX, absY, c); deleteItem(droppedItem, slot, playerItemsN[slot]); updateRequired = true; } } public boolean duelButton(int button) { client other = getClient(duel_with); boolean found = false; if (System.currentTimeMillis() - lastButton < 800) { return false; } if (inDuel && !duelFight && !duelConfirmed2 && !other.duelConfir med2) { for (int i = 0; i < duelButtons.length; i++) { if (button == duelButtons[i]) { found = true; if (duelRule[i]) { duelRule[i] = false; other.duelRule[i] = false; } else { duelRule[i] = true; other.duelRule[i] = true; } } } if (found) { lastButton = System.currentTimeMillis(); duelConfirmed = false;

other.duelConfirmed = false; sendQuest("", 6684); other.sendQuest("", 6684); other.duelRule[i] = duelRule[i]; RefreshDuelRules(); other.RefreshDuelRules(); } } return found; } public void duelPlayer(int pIndex) { try { if (!(pIndex >= 2047) /* && canDuel() */) { client duelPlayer = (client) server.playerHandle r.players[pIndex]; sendMessage("Sending duel request..."); duelPlayer.sendMessage(playerName + ":duelreq:") ; } else { sendMessage("Dueling is currently disabled"); } } catch (Exception e) { sendMessage("attackPlayer: Invalid player index"); } } public void duelReq(int pid) { if (!server.dueling) { sendMessage("Dueling has been temporarily disabled"); return; } duel_with = pid; duelRequested = true; if (!validClient(duel_with)) return; client other = getClient(duel_with); if (inTrade || inDuel || other.inDuel || other.inTrade || other.duelFight || other.duelConfirmed || other.duelConfirmed2) { sendMessage("Other player is busy at the moment"); duelRequested = false; return; } if (other.connectedFrom.equals(connectedFrom)) { duelRequested = false; return; } if (duelRequested && other.duelRequested && (duel_with == other.playerId) && (other.duel_with == playerId)) { openDuel(); other.openDuel(); } else { sendMessage("Sending duel request..."); setSidebarInterface(3, -1); // backpack tab other.sendMessage(playerName + ":duelreq:"); } }

public void DuelVictory() { client other = getClient(duel_with); boolean stake = false; for (GameItem item: offeredItems) { if (item.id > 0 && item.amount > 0) { stake = true; } } if (duelFight) { if (System.currentTimeMillis()-lastButton < 1000) { lastButton = System.currentTimeMillis(); return; } else { lastButton = System.currentTimeMillis(); } for (GameItem item: otherOfferedItems) { println("otherDuelItems = "+item.id); if (item.id > 0 && item.amount > 0) { if (Item.itemStackable[item.id]) { if (!addItem(item.id, item.amount)) ItemHandler.addItem(item.id, enemyX, enemyY, item.amou nt, playerId, false); } else { int amount = item.amount; for (int a = 1; a <= amount; a++) { if (!addItem(item.id, 1)) ItemHandler.addItem(item.id, enemyX, enemyY, 1, pl ayerId, false); } } } } for (GameItem item: offeredItems) addItem(item.id, item.amount); resetDuel(); savegame(false); if (validClient(duel_with)) { other.resetDuel(); other.savegame(false); } } if (validClient(duel_with)) { sendMessage("You have defeated "+other.playerName+"!"); sendQuest(""+other.combat, 6839); sendQuest(other.playerName, 6840); inDuelDupe = false; } for (GameItem item: offeredItems) { if (item.id > 0 && item.amount > 0) { stake = true; } } for (GameItem item: otherOfferedItems) { if (item.id > 0 && item.amount > 0) { stake = true; }

} if (stake) { try { // bakatool fix later /* * statement = Database.conn.createStatement(); results = * statement.executeQuery("SELECT id FROM uber3_ trades ORDER BY * id DESC LIMIT 0,1"); results.next(); int id = * results.getInt("id") + 1; statement.executeUp date("INSERT * INTO uber3_trades SET id = " + id + ", p1 = " + dbId + ", * p2=" + other.dbId + ", type=1"); for(GameItem item : * offeredItems){ if(item.id > 0) * statement.executeUpdate("INSERT INTO uber3_lo gs SET id = " + * id + ", pid=" + dbId + ", item=" + item.id + ", amount=" + * item.amount); } for(GameItem item : otherOffe redItems){ * if(item.id > 0) statement.executeUpdate("INSE RT INTO * uber3_logs SET id = " + id + ", pid=" + other .dbId + ", * item=" + item.id + ", amount=" + item.amount) ; } * statement.close(); */ } catch (Exception e) { e.printStackTrace(); } itemsToVScreen_old(); } itemsToVScreen_old(); if (stake) { itemsToVScreen_old(); other.resetDuel(); showInterface(6733); // frame1(); // Xerozcheez: Resets animation updateRequired = true; appearanceUpdateRequired = true; // LogDuel(plr.playerName); // didTeleport = true; // duelStatus = 4; // winDuel = true; // resetDuel(); // plr.duelStatus = -1; } else { resetDuel(); other.resetDuel(); } updateRequired = true; appearanceUpdateRequired = true; resetAnimation(); }

public void entangle() { EntangleDelay = 20; } // forces to read forceRead bytes from the client - block until we have // received those private void fillInStream(int forceRead) throws java.io.IOException { inStream.currentOffset = 0; in.read(inStream.buffer, 0, forceRead); } public int findItem(int id, int[] items, int[] amounts) { for (int i = 0; i < playerItems.length; i++) { if (((items[i] - 1) == id) && (amounts[i] > 0)) { return i; } } return -1; } /* FIREMAKING */ public boolean firemaking() { if (playerLevel[playerFiremaking] >= firemaking[1]) { if ((actionTimer == 0) && (IsMakingFire == false)) { actionAmount++; sendMessage("You attempt to light a fire..."); OriginalWeapon = playerEquipment[playerWeapon]; OriginalShield = playerEquipment[playerShield]; playerEquipment[playerWeapon] = 590; playerEquipment[playerShield] = -1; actionTimer = 5; if (actionTimer < 1) { actionTimer = 1; } setAnimation(0x2DD); IsMakingFire = true; } if ((actionTimer == 0) && (IsMakingFire == true)) { addSkillXP((firemaking[2] * firemaking[3]), play erFiremaking); server.itemHandler.DroppedItemsSDelay[firemaking [4]] = server.itemHandler.MaxDropShowDelay + 1; CreateNewFire(); sendMessage("You light a fire."); playerEquipment[playerWeapon] = OriginalWeapon; OriginalWeapon = -1; resetAnimation(); IsMakingFire = false; resetFM(); } } else { sendMessage("You need " + firemaking[1] + " " + statName[playerFiremaking] + " to ligh t these logs."); resetFM(); return false; } return true; }

public boolean firespell(int castID, int casterY, int casterX, int offse tY, int offsetX, int angle, int speed, int movegfxID, int st artHeight, int endHeight, int MageAttackIndex, int finishID, int en emyY, int enemyX) { fcastid = castID; fcasterY = casterY; fcasterX = casterX; foffsetY = offsetY; foffsetX = offsetX; fangle = angle; fspeed = speed; fmgfxid = movegfxID; fsh = startHeight; feh = endHeight; ffinishid = finishID; fenemyY = enemyY; fenemyX = enemyX; MageAttackIndex = MageAttackIndex; actionTimer = 0; // Casts Spell In Hands if ((cast == false) && (actionTimer <= 0)) { stillgfx(castID, casterY, casterX); cast = true; firingspell = true; } // Fires Projectile if ((cast == true) && (fired == false) && (actionTimer <= 0)) { createProjectile(casterY, casterX, offsetY, offsetX, ang le, speed, movegfxID, startHeight, endHeight, MageA ttackIndex); fired = true; } // Finishes Spell if ((fired == true) && (actionTimer <= 0)) { stillgfx(finishID, enemyY, enemyX); resetGFX(castID, enemyX, enemyY); return false; } return true; } // Resets Projectiles

public void fletchBow() { if (fletchAmount < 1) { resetAction(); return; } fletchAmount--; closeInterface(); IsBanking = false; startAnimation(1248); updateRequired = true;

appearanceUpdateRequired = true; if (playerHasItem(logs[fletchLog])) { deleteItem(logs[fletchLog], 1); addItem(fletchId, 1); addSkillXP(fletchExp, playerFletching); } else { resetAction(); } } public void fletchBow(boolean shortBow, int amount) { closeInterface(); if (shortBow) { if (playerLevel[playerFletching] >= shortreq[fletchLog]) { fletchId = shortbows[fletchLog]; fletchExp = shortexp[fletchLog]; } else { sendMessage("Requires fletching " + shortreq[fle tchLog] + "!"); fletchAmount = 0; fletching = false; resetAction(); } } else { if (playerLevel[playerFletching] >= longreq[fletchLog]) { fletchId = longbows[fletchLog]; fletchExp = longexp[fletchLog]; } else { sendMessage("Requires fletching " + longreq[flet chLog] + "!"); fletchAmount = 0; fletching = false; resetAction(); } } fletching = true; fletchAmount = amount; } // writes any data in outStream to the relaying buffer public void flushOutStream() { if (disconnected || (outStream.currentOffset == 0)) { return; } synchronized (this) { int maxWritePtr = (readPtr + bufferSize - 2) % bufferSiz e; for (int i = 0; i < outStream.currentOffset; i++) { buffer[writePtr] = outStream.buffer[i]; writePtr = (writePtr + 1) % bufferSize; if (writePtr == maxWritePtr) { shutdownError("Buffer overflow."); // outStream.currentOffset = 0; disconnected = true; return; }

} outStream.currentOffset = 0; notify(); } } public void frame1() { // cancels all player and npc emotes within area! outStream.createFrame(1); updateRequired = true; appearanceUpdateRequired = true; } public void frame36(int Interface, int Status) { outStream.createFrame(36); outStream.writeWordBigEndian(Interface); // The button outStream.writeByte(Status); // The Status of the button } public void frame87(int Interface, int Status) { outStream.createFrame(87); outStream.writeWordBigEndian(Interface); // The button outStream.writeDWord_v1(Status); // The Status of the button } public int freeBankSlots() { int freeS = 0; for (int i = 0; i < playerBankSize; i++) { if (bankItems[i] <= 0) { freeS++; } } return freeS; } public int freeSlots() { int freeS = 0; for (int element : playerItems) { if (element <= 0) { freeS++; } } return freeS; } public int freeSpace(int itemid, boolean stackable) { for (int i = 0; i < playerItems.length; i++) { if ((playerItems[i] == itemid) && stackable) { return i; } if ((playerItems[i] == -1) || (playerItems[i] == 0)) { return i; } } return -1; }

public void fromBank(int itemID, int fromSlot, int amount) { if (!IsBanking) { closeInterface(); return; } if (amount > 0) { if (bankItems[fromSlot] > 0) { if (!takeAsNote) { if (Item.itemStackable[bankItems[fromSlo t] - 1]) { if (bankItemsN[fromSlot] > amoun t) { if (addItem((bankItems[f romSlot] - 1), amount)) { bankItemsN[fromS lot] -= amount; resetBank(); resetItems(5064) ; } } else { if (addItem((bankItems[f romSlot] - 1), bankItem sN[fromSlot])) { bankItems[fromSl ot] = 0; bankItemsN[fromS lot] = 0; resetBank(); resetItems(5064) ; } } } else { while (amount > 0) { if (bankItemsN[fromSlot] > 0) { if (addItem((ban kItems[fromSlot] - 1), 1)) { bankItem sN[fromSlot] += -1; amount-; } else { amount = 0; } } else { amount = 0; } } resetBank(); resetItems(5064); } } else if (takeAsNote && Item.itemIsNote[bankIte ms[fromSlot]]) { // if (Item.itemStackable[bankItems[from Slot]+1]) // {

if (bankItemsN[fromSlot] > amount) { if (addItem(bankItems[fromSlot], amount)) { bankItemsN[fromSlot] -= amount; resetBank(); resetItems(5064); } } else { if (addItem(bankItems[fromSlot], bankItemsN[fromSlot])) { bankItems[fromSlot] = 0; bankItemsN[fromSlot] = 0 ; resetBank(); resetItems(5064); } } } else { sendMessage("Item can't be drawn as note ."); if (Item.itemStackable[bankItems[fromSlo t] - 1]) { if (bankItemsN[fromSlot] > amoun t) { if (addItem((bankItems[f romSlot] - 1), amount)) { bankItemsN[fromS lot] -= amount; resetBank(); resetItems(5064) ; } } else { if (addItem((bankItems[f romSlot] - 1), bankItem sN[fromSlot])) { bankItems[fromSl ot] = 0; bankItemsN[fromS lot] = 0; resetBank(); resetItems(5064) ; } } } else { while (amount > 0) { if (bankItemsN[fromSlot] > 0) { if (addItem((ban kItems[fromSlot] - 1), 1)) { bankItem sN[fromSlot] += -1; amount-; } else { amount = 0;

} } else { amount = 0; } } resetBank(); resetItems(5064); } } } } } public boolean fromDuel(int itemID, int fromSlot, int amount) { if (System.currentTimeMillis() - lastButton < 800) { return false; } lastButton = System.currentTimeMillis(); client other = getClient(duel_with); if (!inDuel || !validClient(duel_with) || !canOffer) { declineDuel(); return false; } if (!Item.itemStackable[itemID] && (amount > 1)) { for (int a = 1; a <= amount; a++) { int slot = findItem(itemID, playerItems, playerI temsN); if (slot >= 0) { fromDuel(itemID, 0, 1); } } } boolean found = false; for (GameItem item : offeredItems) { if (item.id == itemID) { if (!item.stackable) { offeredItems.remove(item); found = true; } else { if (item.amount > amount) { item.amount -= amount; found = true; } else { amount = item.amount; found = true; offeredItems.remove(item); } } break; } } if (found) addItem(itemID, amount); duelConfirmed = false; other.duelConfirmed = false; resetItems(3214); other.resetItems(3214); resetItems(3322); other.resetItems(3322); refreshDuelScreen();

other.refreshDuelScreen(); other.sendFrame126("", 6684); return true; } public boolean fromTrade(int itemID, int fromSlot, int amount) { if (System.currentTimeMillis() - lastButton > 800) { lastButton = System.currentTimeMillis(); } else { return false; } try { client other = getClient(trade_reqId); if (!inTrade || !validClient(trade_reqId) || !canOffer) { declineTrade(); return false; } if (!Item.itemStackable[itemID] && (amount > 1)) { for (int a = 1; a <= amount; a++) { int slot = findItem(itemID, playerItems, playerItemsN); if (slot >= 0) { fromTrade(itemID, 0, 1); } } } boolean found = false; for (GameItem item : offeredItems) { if (item.id == itemID) { if (!item.stackable) { offeredItems.remove(item); found = true; } else { if (item.amount > amount) { item.amount -= amount; found = true; } else { amount = item.amount; found = true; offeredItems.remove(item ); } } break; } } if (found) addItem(itemID, amount); tradeConfirmed = false; other.tradeConfirmed = false; resetItems(3322); resetTItems(3415); other.resetOTItems(3416); sendFrame126("", 3431); other.sendFrame126("", 3431); } catch (Exception e) { e.printStackTrace(); }

return true; } public void fsBar(int id1, int id2, int id3) { outStream.createFrame(70); outStream.writeWord(id1); outStream.writeWordBigEndian(id2); outStream.writeWordBigEndian(id3); } public int getAttackTimer(int spell) { if (spell == 12987) { return 10; } if (spell == 13011) { return 20; } if (spell == 12999) { return 30; } if (spell == 13023) { return 40; } if (spell == 1153) { return 10; } return 10; } public void GetBonus() { for (int element : playerEquipment) { if (element > -1) { for (int j = 0; j < 9999; j++) { if (server.itemHandler.ItemList[j] != nu ll) { if (server.itemHandler.ItemList[ j].itemId == element) { for (int k = 0; k < play erBonus.length; k++) { playerBonus[k] + = server.itemHandler.ItemList[j].Bonuses[k]; } break; } } } } } for (int i = 0; i < 5; i++) { playerBonus[i] += (int) (playerLevel[0] / 10); } /* * public String BonusName[] = { "Stab", "Slash", "Crush", "Magi c", * "Range", "Stab", "Slash", "Crush", "Magic", "Range", "Strengt h", * "Prayer" }; */ playerBonus[5] += (int) (playerLevel[1] / 5); playerBonus[6] += (int) (playerLevel[1] / 5);

playerBonus[7] += (int) (playerLevel[1] / 5); playerBonus[8] += (int) (playerLevel[1] / 5); playerBonus[9] += (int) (playerLevel[1] / 5); playerBonus[10] += (int) (playerLevel[2] / 5); // maxHealth = playerLevel[3]; } public void GetBonus_old() { for (int i = 0; i < playerEquipment.length; i++) { if (playerEquipment[i] > -1) { for (int j = 0; j < server.itemHandler.MaxListed Items; j++) { if (server.itemHandler.ItemList[i] != nu ll) { if (server.itemHandler.ItemList[ j] == null) println("It's null"); if (server.itemHandler.ItemList[ j].itemId == playerEquipment[i]) { for (int k = 0; k < play erBonus.length; k++) { playerBonus[k] + = server.itemHandler.ItemList[j].Bonuses[k]; } break; } } else { println("Error: ItemList = null "); } } } } } /* Equipment level checking */ public int GetCLAttack(int ItemID) { if (ItemID == -1) { return 1; } String ItemName = getItemName(ItemID); String ItemName2 = ItemName.replaceAll("Bronze", ""); ItemName2 = ItemName2.replaceAll("Iron", ""); ItemName2 = ItemName2.replaceAll("Steel", ""); ItemName2 = ItemName2.replaceAll("Black", ""); ItemName2 = ItemName2.replaceAll("Mithril", ""); ItemName2 = ItemName2.replaceAll("Adamant", ""); ItemName2 = ItemName2.replaceAll("Rune", ""); ItemName2 = ItemName2.replaceAll("Granite", ""); ItemName2 = ItemName2.replaceAll("Dragon", ""); ItemName2 = ItemName2.replaceAll("Crystal", ""); ItemName2 = ItemName2.trim(); if (ItemName2.startsWith("claws") || ItemName2.startsWith("dagge r") || || || || ItemName2.startsWith("sword") ItemName2.startsWith("scimitar") ItemName2.startsWith("mace") ItemName2.startsWith("longsword")

|| ItemName2.startsWith("battleaxe") || ItemName2.startsWith("warhammer") || ItemName2.startsWith("2h sword") || ItemName2.startsWith("harlberd")) { if (ItemName.startsWith("Bronze")) { return 1; } else if (ItemName.startsWith("Iron")) { return 1; } else if (ItemName.startsWith("Steel")) { return 1; } else if (ItemName.startsWith("Black")) { return 10; } else if (ItemName.startsWith("Mithril")) { return 20; } else if (ItemName.startsWith("Adamant")) { return 30; } else if (ItemName.startsWith("Rune")) { return 40; } else if (ItemName.startsWith("Dragon")) { return 60; } } else if (ItemName.startsWith("Granite")) { return 1; } else if (ItemName.endsWith("whip") || ItemName.endsWith("Torags hammers") || ItemName.endsWith("Veracs flail") || ItemName.endsWith("Guthans warspear") || ItemName.endsWith("Dharoks greataxe")) { return 1; } return 1; } public int GetCLDefence(int ItemID) { if (ItemID == -1) { return 1; } String ItemName = getItemName(ItemID); String ItemName2 = ItemName.replaceAll("Bronze", ""); ItemName2 = ItemName2.replaceAll("Iron", ""); ItemName2 = ItemName2.replaceAll("Steel", ""); ItemName2 = ItemName2.replaceAll("Black", ""); ItemName2 = ItemName2.replaceAll("Mithril", ""); ItemName2 = ItemName2.replaceAll("Adamant", ""); ItemName2 = ItemName2.replaceAll("Rune", ""); ItemName2 = ItemName2.replaceAll("Granite", ""); ItemName2 = ItemName2.replaceAll("Dragon", ""); ItemName2 = ItemName2.replaceAll("Crystal", ""); ItemName2 = ItemName2.trim(); if (ItemName2.startsWith("claws") || ItemName2.startsWith("dagge r") || || || || || || || || ItemName2.startsWith("sword") ItemName2.startsWith("scimitar") ItemName2.startsWith("mace") ItemName2.startsWith("longsword") ItemName2.startsWith("battleaxe") ItemName2.startsWith("warhammer") ItemName2.startsWith("2h sword") ItemName2.startsWith("harlberd")) {

// It's a weapon, weapons don't required defence ! } else if (ItemName.startsWith("Ahrims") || ItemName.startsWith("Karil") || ItemName.star tsWith("Torag") || ItemName.startsWith("Verac") || ItemName.ends With("Guthan") || ItemName.endsWith("Dharok")) { if (ItemName.endsWith("staff") || ItemName.endsWith("cro ssbow") || ItemName.endsWith("hammers") || ItemName.endsWith("flail") || ItemName.endsWith("warspear") || ItemName.endsWith("greataxe")) { // No defence for the barrow weapons } else { return 1; } } else { if (ItemName.startsWith("Bronze")) { return 1; } else if (ItemName.startsWith("Iron")) { return 1; } else if (ItemName.startsWith("Steel")) { return 1; } else if (ItemName.startsWith("Black")) { return 10; } else if (ItemName.startsWith("Mithril")) { return 20; } else if (ItemName.startsWith("Adamant")) { return 30; } else if (ItemName.startsWith("Rune") && ItemID != 892) { return 40; } else if (ItemName.startsWith("Dragon")) { return 60; } } return 1; } public client getClient(int index) { return ((client) handler.players[index]); } public int GetCLMagic(int ItemID) { if (ItemID == -1) { return 1; } String ItemName = getItemName(ItemID); if (ItemName.startsWith("Ahrim")) { return 1; } return 1; } public int GetCLRanged(int ItemID) { if (ItemID == -1) { return 1; }

String ItemName = getItemName(ItemID); if (ItemName.startsWith("Karil")) { return 1; } return 1; } public int GetCLStrength(int ItemID) { if (ItemID == -1) { return 1; } String ItemName = getItemName(ItemID); if (ItemName.startsWith("Granite")) { return 1; } else if (ItemName.startsWith("Torags hammers") || ItemName.endsWith("Dharoks greataxe")) { return 1; } return 1; } public int GetDuelItemSlots() { int Slots = 0; for (int element : duelItems) { if (element > 0) { Slots++; } } for (int element : otherDuelItems) { if (element > 0) { Slots++; } } return Slots; } public int getFreezeTimer(int spell) { if (spell == 12861) { return 10; } if (spell == 12881) { return 20; } if (spell == 12871) { return 30; } if (spell == 12891) { return 40; } if (spell == 1572) { return 10; } if (spell == 1582) { return 20; } if (spell == 1592) { return 30; }

return 10; } public String getFrozenMessage(int spell) { if ((spell == 12861) || (spell == 12881) || (spell == 12871) || (spell == 12891)) { return "You freeze the enemy."; } if (spell == 1572) { return "You bind the enemy."; } if (spell == 1582) { return "You snare the enemy."; } if (spell == 1592) { return "You entangle the enemy."; } return "You freeze the enemy."; } /* ITEMS */ public int GetGroundItemID(int ItemID, int ItemX, int ItemY, int ItemH) { for (int i = 0; i < server.itemHandler.DropItemCount; i++) { if (server.itemHandler.DroppedItemsID[i] > -1) { if ((server.itemHandler.DroppedItemsID[i] == Ite mID) && (server.itemHandler.DroppedIt emsX[i] == ItemX) && (server.itemHandler.DroppedIt emsY[i] == ItemY) && (server.itemHandler.DroppedIt emsH[i] == ItemH) && (server.itemHandler.DroppedIt emsN[i] == 1)) { return i; } } } return -1; } public String getItemName(int ItemID) { for (int i = 0; i < server.itemHandler.MaxListedItems; i++) { if (server.itemHandler.ItemList[i] != null) { if (server.itemHandler.ItemList[i].itemId == Ite mID) { return server.itemHandler.ItemList[i].it emName; } } } return "!! NOT EXISTING ITEM !!! - ID:" + ItemID; } public double GetItemShopValue(int ItemID, int Type, int fromSlot) { double ShopValue = 1; double Overstock = 0; double TotPrice = 0;

for (int i = 0; i < server.itemHandler.MaxListedItems; i++) { if (server.itemHandler.ItemList[i] != null) { if (server.itemHandler.ItemList[i].itemId == Ite mID) { ShopValue = server.itemHandler.ItemList[ i].ShopValue; } } } /* * Overstock = server.shopHandler.ShopItemsN[MyShopID][fromSlot] * server.shopHandler.ShopItemsSN[MyShopID][fromSlot]; */ TotPrice = (ShopValue * 1.26875); // Calculates price for 1 item , in // db is stored for 0 items (strange // but true) /* * if (Overstock > 0) { // more then default -> cheaper TotPrice -= * ((ShopValue / 100) * (1.26875 * Overstock)); } else if (Overs tock < * 0) { // less then default -> exspensive TotPrice += ((ShopVal ue / * 100) * (1.26875 * Overstock)); } */ if (server.shopHandler.ShopBModifier[MyShopID] == 1) { TotPrice *= 1.25; // 25% more expensive (general stores only) if (Type == 1) { TotPrice *= 0.4; // general store buys item at 4 0% of its own // selling value } } else if (Type == 1) { TotPrice *= 0.6; // other stores buy item at 60% of thei r own // selling value } return TotPrice; } public int getItemSlot(int itemID) { for (int slot = 0; slot < playerItems.length; slot++) { if (playerItems[slot] == (itemID + 1)) { return slot; } } return -1; } public int GetItemSlot(int ItemID) { for (int i = 0; i < playerItems.length; i++) { if ((playerItems[i] - 1) == ItemID) { return i; } } return -1; }

public int GetLastLogin(int Date) { 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); return (calc - Date); } public int getLevelForXP(int exp) { int points = 0; int output = 0; if (exp > 13034430) return 99; 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 int[] getLook() { return new int[] { pGender, pHead, pBeard, pTorso, pArms, pHands , pLegs, pFeet, pHairC, pTorsoC, pLegsC, pFeetC, p SkinC, playerLook[0], playerLook[1], playerLook[2], pla yerLook[3], playerLook[4], playerLook[5] }; } public int GetNPCID(int coordX, int coordY) { for (int i = 0; i < server.npcHandler.maxNPCSpawns; i++) { if (server.npcHandler.npcs[i] != null) { if ((server.npcHandler.npcs[i].absX == coordX) && (server.npcHandler.npcs[i].ab sY == coordY)) { return server.npcHandler.npcs[i].npcType ; } } } return 1; } public String GetNpcName(int NpcID) { for (int i = 0; i < server.npcHandler.maxListedNPCs; i++) { if (server.npcHandler.NpcList[i] != null) { if (server.npcHandler.NpcList[i].npcId == NpcID) { return server.npcHandler.NpcList[i].npcN ame; } }

} return "!! NOT EXISTING NPC !!! - ID:" + NpcID; } /* OBJECTS */ public int GetObject(int X, int Y, int ObjectID) { for (int i = 0; i < server.objectHandler.MaxObjects; i++) { if (server.objectHandler.ObjectID[i] > -1) { if ((X == server.objectHandler.ObjectX[i]) && (Y == server.objectHandler.Ob jectY[i])) { if (ObjectID != -1) { if (ObjectID == server.objectHan dler.ObjectID[i]) { return i; } } else { return i; } } } } return -1; } public int GetUnnotedItem(int ItemID) { int NewID = 0; String NotedName = ""; for (int i = 0; i < server.itemHandler.MaxListedItems; i++) { if (server.itemHandler.ItemList[i] != null) { if (server.itemHandler.ItemList[i].itemId == Ite mID) { NotedName = server.itemHandler.ItemList[ i].itemName; } } } for (int i = 0; i < server.itemHandler.MaxListedItems; i++) { if (server.itemHandler.ItemList[i] != null) { if (server.itemHandler.ItemList[i].itemName == N otedName) { if (server.itemHandler.ItemList[i].itemD escription .startsWith("Swap this n ote at any bank for a") == false) { NewID = server.itemHandler.ItemL ist[i].itemId; break; } } } } return NewID; } public int GetWorld(int PlayerID) { String Server = PlayerHandler.players[PlayerID].playerServer; if (Server.equals("rs2.servegame.org") || Server.equals("localho

st")) { return 1; } else if (Server.equals("dodian.com")) { return 2; } else { println_debug("Invalid Server: " + Server); return 1; // 0; friendlist fix-bakatool } } public int GetXItemsInBag(int ItemID) { int ItemCount = 0; for (int element : playerItems) { if ((element - 1) == ItemID) { ItemCount++; } } return ItemCount; } public int getXPForLevel(int level) { int points = 0; int output = 0; for (int lvl = 1; lvl <= level; lvl++) { points += Math.floor((double) lvl + 300.0 * Math.pow(2.0, (double) lvl / 7.0)); if (lvl >= level) { return output; } output = (int) Math.floor(points / 4); } return 0; } public void giveItems() { client other = getClient(trade_reqId); if (validClient(trade_reqId)) { try { logTrade(playerId, other.playerId, offeredItems, other.offeredItems); for (GameItem item : other.offeredItems) { if (item.id > 0) { addItem(item.id, item.amount); println("TradeConfirmed, item=" + item.id); } } closeInterface(); tradeResetNeeded = true; } catch (Exception e) { e.printStackTrace(); } } } public void globobj(int bjx, int bjy, int obj) { int x = PlayerHandler.getPlayerCount();

for (int r = 0; r < x; r++) { if (PlayerHandler.players[r] != null) { PlayerHandler.players[r].GObjId = obj; PlayerHandler.players[r].GObjX = bjx; PlayerHandler.players[r].GObjY = bjy; PlayerHandler.players[r].GObjChange = 1; PlayerHandler.players[r].GObjSet = 1; } } } 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 GoodDistance2(int objectX, int objectY, int int playerY, int distance) { for (int i = 0; i <= distance; i++) { for (int j = 0; j <= distance; j++) { if ((objectX == playerX) && (((objectY + j) || ) == playerY) || (objectY == playerY))) { return true; } else if ((objectY == playerY) && (((objectX + j) || ) == playerX) || (objectX == playerX))) { return true; } } } return false; } public boolean hasSpace() { for (int element : playerItems) { if ((element == -1) || (element == 0)) { return true; playerX,

== playerY) ((objectY - j

== playerX) ((objectX - j

} } return false; } /* HEALING */ public boolean healing() { if ((actionTimer == 0) && (healing[0] == 1)) { actionAmount++; actionTimer = 4; OriginalShield = playerEquipment[playerShield]; OriginalWeapon = playerEquipment[playerWeapon]; playerEquipment[playerShield] = -1; playerEquipment[playerWeapon] = -1; startAnimation(829); healing[0] = 2; } if ((actionTimer == 0) && (healing[0] == 2)) { deleteItem(healing[4], GetItemSlot(healing[4]), 1); int Heal = healing[1]; int HealDiff = (healing[2] - healing[1]); if (HealDiff > 0) { Heal += misc.random(HealDiff); } if (healing[3] != -1) { addItem(healing[3], 1); } NewHP = (playerLevel[playerHitpoints] + Heal); if (NewHP > getLevelForXP(playerXP[playerHitpoints])) { NewHP = getLevelForXP(playerXP[playerHitpoints]) ; } sendMessage("You eat the " + getItemName(healing[4]) + " ."); playerEquipment[playerWeapon] = OriginalWeapon; playerEquipment[playerShield] = OriginalShield; OriginalWeapon = -1; OriginalShield = -1; resetAnimation(); resetHE(); } return true; } public void iceBarrage() { iceBarrage = true; iceTimer = 140; } // upon connection of a new client all the info has to be sent to client // prior to starting the regular communication public void initialize() { // first packet sent setClientConfig(43, AttackType-1); setClientConfig(43, FightType-1); setClientConfig(43, WeaponType-1); outStream.createFrame(249); outStream.writeByteA(playerIsMember); // 1 for members, zero for free

outStream.writeWordBigEndianA(playerId); // here is the place for seting up the UI, stats, etc... setChatOptions(0, 0, 0); for (int i = 0; i < 25; i++) { setSkillLevel(i, playerLevel[i], playerXP[i]); } refreshSkills(); outStream.createFrame(107); // resets something in the client setSidebarInterface(0, 2423); // attack tab setSidebarInterface(1, 3917); // skills tab setSidebarInterface(2, 638); // quest tab setSidebarInterface(3, 3213); // backpack tab setSidebarInterface(4, 1644); // items wearing tab setSidebarInterface(5, 5608); // pray tab if (ancients == 1) setSidebarInterface(6, 12855); // magic tab (ancient = 1 2855); else setSidebarInterface(6, 1151); // magic tab (ancient = 12 855); // /normal = 1151 setSidebarInterface(7, -1); // ancient magicks setSidebarInterface(8, 5065); // friend setSidebarInterface(9, 5715); // ignore setSidebarInterface(10, 2449); // logout tab setSidebarInterface(11, 4445); // wrench tab setSidebarInterface(12, 147); // run tab setSidebarInterface(13, 1); // harp tab // add player commands... outStream.createFrameVarSize(104); outStream.writeByteC(1); // command slot outStream.writeByteA(0); // 0 or 1; 1 if command should be place d on // top in context menu outStream.writeString("Trade with"); outStream.endFrameVarSize(); outStream.createFrameVarSize(104); outStream.writeByteC(3); outStream.writeByteA(0); outStream.writeString("Attack"); outStream.endFrameVarSize(); outStream.createFrameVarSize(104); outStream.writeByteC(2); outStream.writeByteA(0); outStream.writeString("Duel"); outStream.endFrameVarSize();

int dots = 0; int start[] = { 0, 0, 0, 0 }; int IPPart1 = 127;

int IPPart2 = 0; int IPPart3 = 0; int IPPart4 = 1; if (playerLastConnect.length() < 7) { playerLastConnect = connectedFrom; } if (playerLastConnect.length() <= 15) { for (int j = 0; j <= playerLastConnect.length(); j++) { if ((j + 1) <= playerLastConnect.length()) { if (playerLastConnect.substring(j, (j + 1)).equals(".")) { start[dots] = j; dots++; } if (dots == 3) { break; } } } if (dots == 3) { IPPart1 = Integer.parseInt(playerLastConnect.sub string(0, start[0])); IPPart2 = Integer.parseInt(playerLastConnect.sub string( (start[0] + 1), start[1])); IPPart3 = Integer.parseInt(playerLastConnect.sub string( (start[1] + 1), start[2])); IPPart4 = Integer.parseInt(playerLastConnect .substring((start[2] + 1))); } } else { for (int j = 0; j <= playerLastConnect.length(); j++) { if ((j + 1) <= playerLastConnect.length()) { if (playerLastConnect.substring(j, (j + 1)).equals("-")) { start[dots] = j; dots++; } if (dots == 4) { break; } } } if (dots == 4) { try { IPPart1 = Integer.parseInt(playerLastCon nect.substring(0, start[0])); IPPart2 = Integer.parseInt(playerLastCon nect.substring( (start[0] + 1), start[1] )); IPPart3 = Integer.parseInt(playerLastCon nect.substring( (start[1] + 1), start[2] )); IPPart4 = Integer.parseInt(playerLastCon

nect.substring( (start[2] + 1), (start[3 ]))); } catch (NumberFormatException e) { } } } sendMessage("Welcome to Guardian."); sendMessage("Haloween event has started! find the ghost for star ting it."); sendMessage("If you want to get a hween mask, kill npc, but dont give up!"); actionTimer = 60; for (int a = 0; a < lastMessage.length; a++) { lastMessage[a] = ""; } if (premium) { sendMessage("Your account has premium member status"); } else { sendMessage("You are not a premium member."); sendMessage("To subscribe click 'Become premium' on proj ectguardian.biz"); } if(starter == 0) { playerEquipment[playerWeapon] = 1291; playerEquipmentN[playerWeapon] = 1; playerEquipment[playerShield] = 1171; playerEquipmentN[playerShield] = 1; addItem(995, 1000); addItem(303, 1); addItem(1351, 1); addItem(1265, 1); addItem(5605, 1); addItem(590, 1); addItem(2347, 1); starter = 1; } if (playerMessages > 0) sendMessage("You have " + playerMessages + " new messages. Check your inbox at p rojectguardian.biz to view them."); // FACE: 0= WEST | -1 = NORTH | -2 = EAST | -3 = SOUTH updateRating(); if (lookNeeded) { showInterface(3559); } else // setSidebarInterface(6, 1151); sendFrame126("" + playerLevel[0] + "", 4004); sendFrame126("" + getLevelForXP(playerXP[0]) + "", 4005); sendFrame126("" + playerLevel[1] + "", 4008); sendFrame126("" + getLevelForXP(playerXP[1]) + "", 4009); sendFrame126("" + playerLevel[2] + "", 4006); sendFrame126("" + getLevelForXP(playerXP[2]) + "", 4007); sendFrame126("" + playerLevel[3] + "", 4016);

sendFrame126("" + getLevelForXP(playerXP[3]) + "", 4017); sendFrame126("" + playerLevel[4] + "", 4010); sendFrame126("" + getLevelForXP(playerXP[4]) + "", 4011); sendFrame126("" + playerLevel[5] + "", 4012); sendFrame126("" + getLevelForXP(playerXP[5]) + "", 4013); sendFrame126("" + playerLevel[6] + "", 4014); sendFrame126("" + getLevelForXP(playerXP[6]) + "", 4015); sendFrame126("" + playerLevel[7] + "", 4034); sendFrame126("" + getLevelForXP(playerXP[7]) + "", 4035); sendFrame126("" + playerLevel[8] + "", 4038); sendFrame126("" + getLevelForXP(playerXP[8]) + "", 4039); sendFrame126("" + playerLevel[9] + "", 4026); sendFrame126("" + getLevelForXP(playerXP[9]) + "", 4027); sendFrame126("" + playerLevel[10] + "", 4032); sendFrame126("" + getLevelForXP(playerXP[10]) + "", 4033); sendFrame126("" + playerLevel[11] + "", 4036); sendFrame126("" + getLevelForXP(playerXP[11]) + "", 4037); sendFrame126("" + playerLevel[12] + "", 4024); sendFrame126("" + getLevelForXP(playerXP[12]) + "", 4025); sendFrame126("" + playerLevel[13] + "", 4030); sendFrame126("" + getLevelForXP(playerXP[13]) + "", 4031); sendFrame126("" + playerLevel[14] + "", 4028); sendFrame126("" + getLevelForXP(playerXP[14]) + "", 4029); sendFrame126("" + playerLevel[15] + "", 4020); sendFrame126("" + getLevelForXP(playerXP[15]) + "", 4021); sendFrame126("" + playerLevel[16], 4018); sendFrame126("" + getLevelForXP(playerXP[16]), 4019); sendFrame126("" + playerLevel[17], 4022); sendFrame126("" + getLevelForXP(playerXP[17]), 4023); sendFrame126("" + playerLevel[20], 4152); sendFrame126("" + getLevelForXP(playerXP[20]), 4153); if (playerPass.equals("")) { sendMessage("No password set! Use ::pass PASSWORD to set ur password."); } WriteEnergy(); // sendFrame126("Project16", 2451); sendFrame126("", 6067); sendFrame126("", 6071); SendWeapon(-1, "Unarmed"); handler.updatePlayer(this, outStream); handler.updateNPC(this, outStream); setEquipment(playerEquipment[playerHat], playerEquipmentN[player Hat], playerHat); setEquipment(playerEquipment[playerCape], playerEquipmentN[playe rCape], playerCape); setEquipment(playerEquipment[playerAmulet], playerEquipmentN[playerAmulet], playerAmulet); setEquipment(playerEquipment[playerArrows], playerEquipmentN[playerArrows], playerArrows); setEquipment(playerEquipment[playerChest], playerEquipmentN[playerChest], playerChest); setEquipment(playerEquipment[playerShield], playerEquipmentN[playerShield], playerShield); setEquipment(playerEquipment[playerLegs], playerEquipmentN[playe rLegs],

playerLegs); setEquipment(playerEquipment[playerHands], playerEquipmentN[playerHands], playerHands); setEquipment(playerEquipment[playerFeet], playerEquipmentN[playe rFeet], playerFeet); setEquipment(playerEquipment[playerRing], playerEquipmentN[playe rRing], playerRing); setEquipment(playerEquipment[playerWeapon], playerEquipmentN[playerWeapon], playerWeapon); resetItems(3214); resetBank(); ResetBonus(); GetBonus(); WriteBonus(); // objects /* * ReplaceObject(2090, 3267, 3430, 0, 22); ReplaceObject(2094, 3 268, * 3431, 0, 22); ReplaceObject(2092, 3269, 3431, 0, 22); * removeObject(2735, 3449, 8173); removeObject(2723, 3454, 8173 ); * removeObject(2721, 3459, 8173); removeObject(2851, 2952, 1113 ); */ replaceDoors(); for (int c = 0; c < server.objectHandler.ObjectID.length; c++) { if (server.objectHandler.ObjectID[c] == -1) continue; addObject(server.objectHandler.ObjectX[c], server.objectHandler.ObjectY[c], server.objectHandler.ObjectID[c], server.objectHandler.ObjectFace[c]); } pmstatus(2); boolean pmloaded = false; for (long element : friends) { if (element != 0) { for (int i2 = 1; i2 < handler.maxPlayers; i2++) { if ((handler.players[i2] != null) && handler.players[i2].i sActive && (misc .playerN ameToInt64(handler.players[i2].playerName) == element)) { if ((playerRights >= 2) || (handler.play ers[i2].Privatechat == 0) || ((handler.pla yers[i2].Privatechat == 1) && handler.players[i2] .isinpm(misc .playerNameToInt64(playerName)))) { loadpm(element, GetWorld

(i2)); pmloaded = true; } break; } } if (!pmloaded) { loadpm(element, 0); } pmloaded = false; } } for (int i1 = 1; i1 < handler.maxPlayers; i1++) { if ((handler.players[i1] != null) && (handler.players[i1].isActive == true )) { handler.players[i1].pmupdate(playerId, GetWorld( playerId)); } } // Objects for (int i = 0; i < server.objectHandler.MaxObjects; i++) { if (server.objectHandler.ObjectID[i] > -1) { if (server.objectHandler.ObjectOpen[i] != server .objectHandler.ObjectOriOpen[i]) { ChangeDoor(i); } } } sendQuest("Yanille Teleport", 13037); sendQuest("Teleport back home", 13038); sendQuest("@gre@0/0", 13042); sendQuest("@gre@0/0", 13043); sendQuest("@gre@0/0", 13044); sendQuest("Seers Teleport", 13047); sendQuest("The land of trees", 13048); sendQuest("@gre@0/0", 13051); sendQuest("@gre@0/0", 13052); sendQuest("Dragon cave", 13055); sendQuest("The land of dragons", 13056); sendQuest("@gre@0/0", 13059); sendQuest("@gre@0/0", 13060); sendQuest("Catherby", 13063); sendQuest("The land of Fish", 13064); sendQuest("@gre@0/0", 13067); sendQuest("@gre@0/0", 13068); sendQuest("Guild of legends", 13071); sendQuest("The land of legends", 13072); sendQuest("@gre@0/0", 13076); sendQuest("@gre@0/0", 13077); sendQuest("@gre@0/0", 13078); sendQuest("Taverly", 13081); sendQuest("The land of Slayer", 13082); sendQuest("@gre@0/0", 13085); sendQuest("@gre@0/0", 13086); sendQuest("Fishing guild", 13089); sendQuest("The land of fishing", 13090); sendQuest("@gre@0/0", 13093); sendQuest("@gre@0/0", 13094); sendQuest("Gnome Agility course", 13097);

sendQuest("The land of Agility", 13098); sendQuest("@gre@0/0", 13101); sendQuest("@gre@0/0", 13102); sendFrame126("Yanille Teleport", 13037); sendFrame126("Teleport back home", 13038); sendFrame126("@gre@0/0", 13042); sendFrame126("@gre@0/0", 13043); sendFrame126("@gre@0/0", 13044); sendFrame126("Level 0: Yanille Teleport", 1300); sendFrame126("Teleport back home", 1301); sendFrame126("@gre@0/0", 1305); sendFrame126("@gre@0/0", 1306); sendFrame126("@gre@0/0", 1307); sendQuest("Level sendQuest("Level sendQuest("Level sendQuest("Level sendQuest("Level sendQuest("Level sendQuest("Level sendQuest("Level sendQuest("Level sendQuest("Level sendQuest("Level sendQuest("Level sendQuest("Level sendQuest("Level sendQuest("Level sendQuest("Level 1: Smoke Rush", 12941); 52: Shadow Rush", 12989); 54: Blood Rush", 12903); 58: Ice Rush", 12863); 62: Smoke Burst", 12965); 64: Shadow Burst", 13013); 68: Blood Burst", 12921); 70: Ice Burst", 12883); 74: Smoke Blitz", 12953); 76: Shadow Blitz", 13001); 80: Blood Blitz", 12913); 82: Ice Blitz", 12873); 86: Smoke Barrage", 12977); 88: Shadow Barrage", 13025); 92: Blood Barrage", 12931); 98: Ice Barrage", 12893);

//start of free quests sendQuest("@dre@Welcome @mag@"+playerName+"", 663); sendQuest("", 7332); sendQuest("", 7331); sendQuest("", 7332); sendQuest("", 7333); sendQuest("", 7334); sendQuest("", 7336); sendQuest("", 7383); sendQuest("", 7339); sendQuest("", 7338); sendQuest("", 7340); sendQuest("", 7346); sendQuest("", 7341); sendQuest("", 7342); sendQuest("", 7337); sendQuest("", 7343); sendQuest("", 7335); sendQuest("", 7344); sendQuest("", 7345); sendQuest("", 7346); sendQuest("", 7347); sendQuest("Old magic", 12585); //end of free quests // main

sendFrame126("Guardian Beta (" + PlayerHandler.getPlayerCount() + " online)", 6570); sendFrame126("", 6572); sendFrame126("", 6664); setInterfaceWalkable(6673); playerLastConnect = connectedFrom; sendQuest("Using this will send a notification to all online mod s", 5967); sendQuest( "@yel@Then click below to indicate which of our rules is being broken.", 5969); sendQuest("4: Bug abuse (includes noclip)", 5974); sendQuest("5: Guardian staff impersonation", 5975); sendQuest("6: Monster luring or abuse", 5976); sendQuest("8: Item Duplication", 5978); sendQuest("10: Misuse of yell channel", 5980); sendQuest("12: Possible duped items", 5982); /* * openWelcomeScreen(201, true, playerMessages, ((IPPart1 << 24) + * (IPPart2 << 16) + (IPPart3 << 8) + IPPart4), * GetLastLogin(playerLastLogin)); */ absX1 = absX; absY1 = absY; teleportToX = 0; teleportToY = 0; heightLevel = 0; updateRequired = true; appearanceUpdateRequired = true; }

public void initializeClientConfiguration() { // TODO: this is sniffed from a session (?), yet have to figure out what // each of these does. setClientConfig(18, 1); setClientConfig(19, 0); setClientConfig(25, 0); setClientConfig(43, 0); setClientConfig(44, 0); setClientConfig(75, 0); setClientConfig(83, 0); setClientConfig(84, 0); setClientConfig(85, 0); setClientConfig(86, 0); setClientConfig(87, 0); setClientConfig(88, 0); setClientConfig(89, 0); setClientConfig(90, 0); setClientConfig(91, 0); setClientConfig(92, 0); setClientConfig(93, 0);

setClientConfig(94, 0); setClientConfig(95, 0); setClientConfig(96, 0); setClientConfig(97, 0); setClientConfig(98, 0); setClientConfig(99, 0); setClientConfig(100, 0); setClientConfig(101, 0); setClientConfig(104, 0); setClientConfig(106, 0); setClientConfig(108, 0); setClientConfig(115, 0); setClientConfig(143, 0); setClientConfig(153, 0); setClientConfig(156, 0); setClientConfig(157, 0); setClientConfig(158, 0); setClientConfig(166, 0); setClientConfig(167, 0); setClientConfig(168, 0); setClientConfig(169, 0); setClientConfig(170, 0); setClientConfig(171, 0); setClientConfig(172, 0); setClientConfig(173, 0); setClientConfig(174, 0); setClientConfig(203, 0); setClientConfig(210, 0); setClientConfig(211, 0); setClientConfig(261, 0); setClientConfig(262, 0); setClientConfig(263, 0); setClientConfig(264, 0); setClientConfig(265, 0); setClientConfig(266, 0); setClientConfig(268, 0); setClientConfig(269, 0); setClientConfig(270, 0); setClientConfig(271, 0); setClientConfig(280, 0); setClientConfig(286, 0); setClientConfig(287, 0); setClientConfig(297, 0); setClientConfig(298, 0); setClientConfig(301, 01); setClientConfig(304, 01); setClientConfig(309, 01); setClientConfig(311, 01); setClientConfig(312, 01); setClientConfig(313, 01); setClientConfig(330, 01); setClientConfig(331, 01); setClientConfig(342, 01); setClientConfig(343, 01); setClientConfig(344, 01); setClientConfig(345, 01); setClientConfig(346, 01); setClientConfig(353, 01); setClientConfig(354, 01); setClientConfig(355, 01);

setClientConfig(356, setClientConfig(361, setClientConfig(362, setClientConfig(363, setClientConfig(377, setClientConfig(378, setClientConfig(379, setClientConfig(380, setClientConfig(383, setClientConfig(388, setClientConfig(391, setClientConfig(393, setClientConfig(399, setClientConfig(400, setClientConfig(406, setClientConfig(408, setClientConfig(414, setClientConfig(417, setClientConfig(423, setClientConfig(425, setClientConfig(427, setClientConfig(433, setClientConfig(435, setClientConfig(436, setClientConfig(437, setClientConfig(439, setClientConfig(440, setClientConfig(441, setClientConfig(442, setClientConfig(443, setClientConfig(445, setClientConfig(446, setClientConfig(449, setClientConfig(452, setClientConfig(453, setClientConfig(455, setClientConfig(464, setClientConfig(465, setClientConfig(470, setClientConfig(482, setClientConfig(486, setClientConfig(491, setClientConfig(492, setClientConfig(493, setClientConfig(496, setClientConfig(497, setClientConfig(498, setClientConfig(499, setClientConfig(502, setClientConfig(503, setClientConfig(504, setClientConfig(505, setClientConfig(506, setClientConfig(507, setClientConfig(508, setClientConfig(509, setClientConfig(510, setClientConfig(511, setClientConfig(512, setClientConfig(515,

01); 01); 01); 01); 01); 01); 01); 01); 01); 01); 01); 01); 01); 01); 01); 01); 01); 01); 01); 01); 01); 01); 01); 01); 01); 01); 01); 01); 01); 01); 01); 01); 01); 01); 01); 01); 01); 01); 01); 01); 01); 01); 01); 01); 01); 01); 01); 01); 01); 01); 01); 01); 01); 01); 01); 01); 01); 01); 01); 01);

setClientConfig(518, setClientConfig(520, setClientConfig(521, setClientConfig(524, setClientConfig(525, setClientConfig(531, }

01); 01); 01); 01); 01); 01);

public boolean inRange(int x, int y) { if (localId > 0) return false; if ((Math.abs(absX - x) < 4) && (Math.abs(absY - y) < 4)) { return true; } return false; } public boolean IsInCW(int coordX, int coordY) { if ((coordY >= 3068) && (coordY <= 3143) && (coordX <= 2436) && (coordX >= 2365)) { return true; } else { return false; } }

public boolean IsInTz(int coordX, int coordY) { if ((coordY >= 5129) && (coordY <= 5167) && (coordX <= 2418) && (coordX >= 2375)) { return true; } else { return false; } } public boolean isInWilderness(int coordX, int coordY, int Type) { if (Type == 1) { if ((coordY >= 3520) && (coordY <= 3967) && (coordX <= 3 392) && (coordX >= 2942)) { return true; } } else if (Type == 2) { if ((coordY >= 3512) && (coordY <= 3967) && (coordX <= 3 392) && (coordX >= 2942)) { return true; } } return false; } public boolean IsItemInBag(int ItemID) { for (int element : playerItems) { if ((element - 1) == ItemID) {

return true; } } return false; } public int itemAmount(int itemID) { int tempAmount = 0; for (int i = 0; i < playerItems.length; i++) { if (playerItems[i] == itemID) { tempAmount += playerItemsN[i]; } } return tempAmount; } public void itemsToVScreen_old() { outStream.createFrameVarSizeWord(53); outStream.writeWord(6822); outStream.writeWord(otherOfferedItems.toArray().length); for (GameItem item: otherOfferedItems) { if (item.amount > 254) { outStream.writeByte(255); // item's stack count. if over 254, write byte 255 outStream.writeDWord_v2(item.amount); // and then the real value with wr iteDWord_v2 } else { outStream.writeByte(item.amount); } if (item.id > 20000 || item.id < 0) { item.id = 20000; } outStream.writeWordBigEndianA(item.id+1); //item id } outStream.endFrameVarSizeWord(); } public void itemsToVScreen(int x, int y) { Player p = handler.players[duelWith]; if (p != null && p.playerId == playerId) return; for (int i = 0; i < otherDuelItems.length; i++) { if (otherDuelItems[i] > 0 && otherDuelItemsN[i] > 0) { if (Item.itemStackable[otherDuelItems[i]-1]) { ItemHandler.addItem(otherDuelItems[i]-1, enemyX, enemyY, otherDuelItem sN[i], playerId, false); } else { int amount = otherDuelItemsN[i]; for (int a = 1; a <= amount; a++) { ItemHandler.addItem(otherDuelItems[i]-1, enemyX, enemyY, 1, playerId , false); } } } } for (int i1 = 0; i1 < duelItems.length; i1++) { if (duelItems[i] > 0 && duelItemsN[i] > 0) addItem(duelItems[i1]-1, duelItemsN[i1]); }

//resetDuel(); } public int itemType(int item) { for (int element : Item.capes) { if (item == element) { return playerCape; } } for (int element : Item.hats) { if (item == element) { return playerHat; } } for (int element : Item.boots) { if (item == element) { return playerFeet; } } for (int element : Item.gloves) { if (item == element) { return playerHands; } } for (int element : Item.shields) { if (item == element) { return playerShield; } } for (int element : Item.amulets) { if (item == element) { return playerAmulet; } } for (int element : Item.arrows) { if (item == element) { return playerArrows; } } for (int element : Item.rings) { if (item == element) { return playerRing; } } for (int element : Item.body) { if (item == element) { return playerChest; } } for (int element : Item.legs) { if (item == element) { return playerLegs; } } // Default return playerWeapon; } public void killedPlayer(String name, int combat) {

int diff = Math.abs(combatLevel - combat); String diffString = ""; if (combatLevel > combat) { diffString = "-" + diff; } else { diffString = "+" + diff; } sendMessage("You have defeated " + name + "(" + diffString + ")" + "!"); clicked = false; if ((diff > 7) && (combat > combatLevel)) { sendMessage("You gain double experience!"); addSkillXP(200, 18); } if ((diff <= 7) && (diff >= 0)) { sendMessage("You gain regular experience"); addSkillXP(100, 18); } if ((diff > 7) && (combatLevel > combat)) { sendMessage("You gain half experience"); addSkillXP(500, 18); } } public void l33thax(int id) { outStream.createFrame(171); outStream.writeByte(0); outStream.writeWord(id); flushOutStream(); } public void levelup(int skill) { switch (skill) { case 0: // Attack levelup sendFrame164(6247); sendFrame126("Congratulations, you just advanced an atta ck level!", 6248); sendFrame126("Your attack level is now " + playerLevel[0 ] + ".", 6249); sendMessage("Congratulations, you just advanced an attac k level."); NpcDialogueSend = true; break; case 1: // Strength sendFrame164(6206); sendFrame126( "Congratulations, you just advanced a st rength level!", 6207); sendFrame126("Your strength level is now " + playerLevel [2] + ".", 6208); sendMessage("Congratulations, you just advanced a streng th level."); NpcDialogueSend = true;

break; case 2: // Defence sendFrame164(6253); sendFrame126("Congratulations, you just advanced a defen ce level!", 6254); sendFrame126("Your defence level is now " + playerLevel[ 1] + ".", 6255); sendMessage("Congratulations, you just advanced a defenc e level."); NpcDialogueSend = true; break; case 3: // Hitpoints sendFrame164(6216); sendFrame126( "Congratulations, you just advanced a hi tpoints level!", 6217); sendFrame126("Your hitpoints level is now " + playerLeve l[3] + ".", 6218); sendMessage("Congratulations, you just advanced a hitpoi nts level."); NpcDialogueSend = true; break; case 4: // Ranging sendFrame164(4443); sendFrame126("Congratulations, you just advanced a range d level!", 4444); sendFrame126("Your ranged level is now " + playerLevel[4 ] + ".", 4445); sendMessage("Congratulations, you just advanced a rangin g level."); NpcDialogueSend = true; break; case 5: // Prayer sendFrame164(6242); sendFrame126("Congratulations, you just advanced a praye r level!", 6243); sendFrame126("Your prayer level is now " + playerLevel[5 ] + ".", 6244); sendMessage("Congratulations, you just advanced a prayer level."); NpcDialogueSend = true; break; case 6:

// Magic sendFrame164(6211); sendFrame126("Congratulations, you just advanced a magic level!", 6212); sendFrame126("Your magic level is now " + playerLevel[6] + ".", 6213); sendMessage("Congratulations, you just advanced a magic level."); NpcDialogueSend = true; break; case 7: // Cooking sendFrame164(6226); sendFrame126("Congratulations, you just advanced a cooki ng level!", 6227); sendFrame126("Your cooking level is now " + playerLevel[ 7] + ".", 6228); sendMessage("Congratulations, you just advanced a cookin g level."); NpcDialogueSend = true; break; case 8: // Woodcutting sendFrame164(4272); sendFrame126( "Congratulations, you just advanced a wo odcutting level!", 4273); sendFrame126("Your woodcutting level is now " + playerLe vel[8] + ".", 4274); sendMessage("Congratulations, you just advanced a woodcu tting level."); NpcDialogueSend = true; break; case 9: // Fletching sendFrame164(6231); sendFrame126( "Congratulations, you just advanced a fl etching level!", 6232); sendFrame126("Your fletching level is now " + playerLeve l[9] + ".", 6233); sendMessage("Congratulations, you just advanced a fletch ing level."); NpcDialogueSend = true; break; case 10: // fishing sendFrame164(6258);

sendFrame126("Congratulations, you just advanced a fishi ng level!", 6259); sendFrame126("Your fishing level is now " + playerLevel[ 10] + ".", 6260); sendMessage("Congratulations, you just advanced a fishin g level."); NpcDialogueSend = true; break; case 11: // firemaking sendFrame164(4282); sendFrame126( "Congratulations, you just advanced a fi re making level!", 4283); sendFrame126("Your firemaking level is now " + playerLev el[11] + ".", 4284); sendMessage("Congratulations, you just advanced a fire m aking level."); NpcDialogueSend = true; break; case 12: // crafting sendFrame164(6263); sendFrame126( "Congratulations, you just advanced a cr afting level!", 6264); sendFrame126("Your crafting level is now " + playerLevel [12] + ".", 6265); sendMessage("Congratulations, you just advanced a crafti ng level."); NpcDialogueSend = true; break; case 13: // Smithing sendFrame164(6221); sendFrame126( "Congratulations, you just advanced a sm ithing level!", 6222); sendFrame126("Your smithing level is now " + playerLevel [13] + ".", 6223); sendMessage("Congratulations, you just advanced a smithi ng level."); NpcDialogueSend = true; break; case 14: // Mining sendFrame164(4416); sendFrame126("Congratulations, you just advanced a minin

g level!", 4417); sendFrame126("Your mining level is now " + playerLevel[1 4] + ".", 4418); sendMessage("Congratulations, you just advanced a mining level."); NpcDialogueSend = true; break; case 15: // Herblore sendFrame164(6237); sendFrame126( "Congratulations, you just advanced a he rblore level!", 6238); sendFrame126("Your herblore level is now " + playerLevel [15] + ".", 6239); sendMessage("Congratulations, you just advanced a herblo re level."); NpcDialogueSend = true; break; case 16: // Agility sendFrame164(4277); sendFrame126("Congratulations, you just advanced a agili ty level!", 4278); sendFrame126("Your agility level is now " + playerLevel[ 16] + ".", 4279); sendMessage("Congratulations, you just advanced an agili ty level."); NpcDialogueSend = true; break; case 17: // Thieving sendFrame164(4261); sendFrame126( "Congratulations, you just advanced a th ieving level!", 6262); sendFrame126("Your theiving level is now " + playerLevel [17] + ".", 6263); sendMessage("Congratulations, you just advanced a thievi ng level."); NpcDialogueSend = true; break; case 18: // Slayer sendFrame164(12123); sendFrame126("Congratulations, you just advanced a slaye r level!", 6207);

sendFrame126("Your slayer level is now " + playerLevel[1 8] + ".", 6208); sendMessage("Congratulations, you just advanced a slayer level."); NpcDialogueSend = true; break; case 19: // Farming // sendFrame164(4261); // sendFrame126("Congratulations, you just advanced a th ieving // level!", 6207); // sendFrame126("Your farming level is now "+playerLevel [19]+" .", // 6208); sendMessage("Congratulations, you just advanced a farmin g level."); NpcDialogueSend = true; break; case 20: // Runecrafting sendFrame164(4267); sendFrame126( "Congratulations, you just advanced a ru necrafting level!", 4268); sendFrame126("Your runecrafting level is now " + playerL evel[20] + ".", 4269); sendMessage("Congratulations, you just advanced a runecr afting level."); NpcDialogueSend = true; break; } } public int loadgame(String playerName, String playerPass) { for (Integer bUid : server.bannedUid) { if (uid == bUid.intValue()) { return 4; } } long start = System.currentTimeMillis(); String line = ""; String token = ""; String token2 = ""; String[] token3 = new String[3]; boolean EndOfFile = false; int ReadMode = 0; BufferedReader characterfile = null; boolean charFileFound = false; int[] playerLooks = new int[19]; try { characterfile = new BufferedReader(new FileReader("./cha

racters/" + playerName + ".txt")); charFileFound = true; } catch (FileNotFoundException fileex1) { } if (charFileFound == false) { misc.println(playerName + ": character file not found.") ; return 0; } try { line = characterfile.readLine(); } catch (IOException ioexception) { misc.println(playerName + ": error loading file."); return 3; } 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(); token3 = token2.split("\t"); switch (ReadMode) { case 1: if (token.equals("character-username")) { if (playerName.equalsIgnoreCase( token2)) { } else { saveNeeded = false; validClient = false; return 3; } } else if (token.equals("character-password")) { if(passHash(playerPass).equalsIgnoreCase(token2) || playerPass.e qualsIgnoreCase(token2)) { } else { saveNeeded = false; validClient = false; return 3; } } break; case 2: if (token.equals("character-height")) { heightLevel = Integer.parseInt(t oken2); } else if (token.equals("character-starter")) { starter = Integer.parseInt(token2); } else if (token.equals("character-posx" )) { teleportToX = Integer.parseInt(t oken2) == -1 ? 2611 : Integer.parseI

nt(token2); } else if (token.equals("character-posy" )) { teleportToY = Integer.parseInt(t oken2) == -1 ? 3093 : Integer.parseI nt(token2); } else if (token.equals("character-right s")) { playerRights = Integer.parseInt( token2); } else if (token.equals("character-ismem ber")) { playerIsMember = Integer.parseIn t(token2); } else if (token.equals("character-messa ges")) { playerMessages = Integer.parseIn t(token2); } else if (token.equals("character-lastc onnection")) { playerLastConnect = token2; } else if (token.equals("character-slayernpc")) { NPCToKill = Integer.parseInt(token2); } else if (token.equals("character-slayertask")) { slayerTask = Integer.parseInt(token2); } else if (token.equals("character-slayergrade")) { slayergrade = Integer.parseInt(token2); } else if (token.equals("Halloween")) { hevent = Boolean.parseBoolean(token2); } else if (token.equals("character-lastl ogin")) { playerLastLogin = Integer.parseI nt(token2); } else if (token.equals("character-energ y")) { playerEnergy = Integer.parseInt( token2); } else if (token.equals("character-fight type")) { FightType = Integer.parseInt(tok en2); } else if (token.equals("character-attac ktype")) { AttackType = Integer.parseInt(to ken2); } else if (token.equals("character-weapo ntype")) { WeaponType = Integer.parseInt(to ken2); } else if (token.equals("character-gamet ime")) { playerGameTime = Integer.parseIn t(token2); } else if (token.equals("character-gamec ount")) { playerGameCount = Integer.parseI nt(token2); } else if (token.equals("character-ancie nts")) {

ancients = Integer.parseInt(toke n2); } else if (token.equals("character-ratin g")) { rating = Integer.parseInt(token2 ); } break; case 3: if (token.equals("character-equip")) { playerEquipment[Integer.parseInt (token3[0])] = Integer .parseInt(token3 [1]); playerEquipmentN[Integer.parseIn t(token3[0])] = Integer .parseInt(token3 [2]); } break; case 4: if (token.equals("character-look")) { playerLooks[Integer.parseInt(tok en3[0])] = Integer .parseInt(token3 [1]); } break; case 5: if (token.equals("character-skill")) { playerLevel[Integer.parseInt(tok en3[0])] = Integer .parseInt(token3 [1]); playerXP[Integer.parseInt(token3 [0])] = Integer .parseInt(token3 [2]); int level = 0; if (playerXP[Integer.parseInt(to ken3[0])] > 13040000) { level = 99; } else { level = getLevelForXP(pl ayerXP[Integer .parseIn t(token3[0])]); } playerLevel[Integer.parseInt(token3[0])] = level; if(Integer.parseInt(token3[0]) != 3) { setSkillLevel(Integer.parseInt(token3[0]), level, playerXP[Integ er.parseInt(token3[0])]); } if (Integer.parseInt(token3[0]) == 3) { currentHealth = Integer.parseInt(token3[1]); } } break; case 6:

if (token.equals("character-item")) { playerItems[Integer.parseInt(tok en3[0])] = Integer .parseInt(token3 [1]); playerItemsN[Integer.parseInt(to ken3[0])] = Integer .parseInt(token3 [2]); } break; case 7: if (token.equals("character-bank")) { bankItems[Integer.parseInt(token 3[0])] = Integer .parseInt(token3 [1]); bankItemsN[Integer.parseInt(toke n3[0])] = Integer .parseInt(token3 [2]); } break; case 8: if (token.equals("character-friend")) { friends[Integer.parseInt(token3[ 0])] = Long .parseLong(token 3[1]); } break; case 9: if (token.equals("character-ignore")) { ignores[Integer.parseInt(token3[ 0])] = Long .parseLong(token 3[1]); } break; } } else { if (line.equals("[ACCOUNT]")) ReadMode = 1; else if (line.equals("[CHARACTER]")) ReadMode = 2; else if (line.equals("[EQUIPMENT]")) ReadMode = 3; else if (line.equals("[LOOK]")) ReadMode = 4; else if (line.equals("[SKILLS]")) ReadMode = 5; else if (line.equals("[ITEMS]")) ReadMode = 6; else if (line.equals("[BANK]")) ReadMode = 7; else if (line.equals("[FRIENDS]")) ReadMode = 8; else if (line.equals("[IGNORES]")) ReadMode = 9; else if (line.equals("[EOF]")) {

// end of file now do whatever you set. try { characterfile.close(); } catch (IOException ioexception) { } setLook(playerLooks); updateRequired = true; appearanceUpdateRequired = true; long end = System.currentTimeMillis() start; println("Loading Process Completed [" + (playerRights > 0 ? "H as powers" : "Regul ar player") + ", lag: " + end + " ms]"); return 0; } } // Exception occured @ some line try { line = characterfile.readLine(); } catch (IOException ioexception1) { EndOfFile = true; } } try { characterfile.close(); } catch (IOException ioexception) { } println("Failed to load player: " + playerName); return 13; } public void loadpm(long name, int world) { if (world != 0) { world += 9; } else if (world == 0) { world += 1; } outStream.createFrame(50); outStream.writeQWord(name); outStream.writeByte(world); } public void LogDuel(String otherName) { for (int i = 0; i < otherDuelItems.length; i++) { BufferedWriter bw = null; try { bw = new BufferedWriter(new FileWriter("logs/due ls.txt", true)); bw.write(playerName + " wins item: " + (otherDue lItems[i] - 1) + " amount: " + otherDuelItemsN[ i] + " from " + otherName); bw.newLine();

bw.flush(); } catch (IOException ioe) { ioe.printStackTrace(); } finally { if (bw != null) try { bw.close(); } catch (IOException ioe2) { sendMessage("Error logging duel! "); } } } } public void logout() { if (inCombat) { } if (validClient(duel_with) && duelFight) { getClient(duel_with).DuelVictory(); } else { declineDuel(); } SQL.createConnection(); SQL.saveHighScore(this); SQL.destroyConnection(); sendMessage("Please wait... logging out may take time"); sendQuest(" Please wait...", 2458); savegame(true); sendQuest("Click here to logout", 2458); println("Logout"); outStream.createFrame(109); } public void logTrade(int id, int id2, CopyOnWriteArrayList<GameItem> offeredItems, CopyOnWriteArrayList<GameItem> offeredItems2) { try { // results = statement.executeQuery("SELECT id from uber 3_trades // ORDER BY id DESC"); // results.next(); // int tId = results.getInt("id") + 1; // statement.executeUpdate("INSERT INTO uber3_trades SET id = " + // tId + ", type=0, p1=" + id + ", p2=" + id2); for (GameItem item : offeredItems) { // statement.executeUpdate("INSERT INTO uber3_lo gs SET id = " + // tId + ", pid=" + id + ", item=" + item.id + " , amount=" + // item.amount); } for (GameItem item : offeredItems2) { // statement.executeUpdate("INSERT INTO uber3_lo gs SET id = " + // tId + ", pid=" + id2 + ", item=" + item.id + ", amount=" + // item.amount); }

// statement.close(); } catch (Exception e) { e.printStackTrace(); } } public void ManipulateDirection() { // playerMD = misc.direction(absX, absY, skillX, skillY); if (playerMD != -1) { // playerMD >>= 1; updateRequired = true; dirUpdateRequired = true; } } public void Map() { showInterface(8134); } public int MICheckPickAxe() { int Hand; int Shield; int Bag; int PickAxe; Hand = playerEquipment[playerWeapon]; Shield = playerEquipment[playerShield]; PickAxe = 0; switch (Hand) { case 1265: // Bronze Pick Axe PickAxe = 1; break; case 1267: // Iron Pick Axe PickAxe = 2; break; case 1269: // Steel Pick Axe PickAxe = 3; break; case 1273: // Mithril Pick Axe PickAxe = 4; break; case 1271: // Adamant Pick Axe PickAxe = 5; break; case 1275: // Rune Pick Axe PickAxe = 6; break; }

if (PickAxe > 0) { return PickAxe; } return 0; } /* MINING */ public boolean mining() { int MIPickAxe = 0; if ((IsMining == true) && false) { MIPickAxe = 1; } else { MIPickAxe = MICheckPickAxe(); } if (MIPickAxe > 0) { if (playerLevel[playerMining] >= mining[1]) { if (freeSlots() > 0) { if (IsMining == false) { sendMessage("You swing your pick axe at the rock..."); setAnimation(0x554); IsMining = true; } if (IsMining == true && System.currentTi meMillis()-lastOre >= mining[0]) { if ((IsItemInBag(1706) == true) || (IsItemInBag( 1708) == true) || (IsItemInBag( 1710) == true) || (IsItemInBag( 1712) == true)) { } if(maxOres == 0) { maxOres = 1+misc.random( 10); } addSkillXP(((int) (mining[2])), playerMining); addItem(mining[4], 1); lastOre = System.currentTimeMillis(); sendMessage("You get some ores." ); minedOres++; if(minedOres >= maxOres) { resetMI(); minedOres = 0; minedMax = 0; } } } else { sendMessage("Not enough space in your in ventory."); resetMI(); return false; } } else { sendMessage("You need " + mining[1] + " "

+ statName[playerMining] + " to mine those ores."); resetMI(); return false; } } else { sendMessage("You need a pick axe to mine ores."); resetMI(); return false; } return true; } public void ModHelp() { sendFrame126("@dre@Moderator Helpmenu", 8144); // Helpmenu title clearQuestInterface(); sendFrame126("", 8145); sendFrame126("@dbl@Welcome to @cya@Project16", 8146); sendFrame126("@dbl@", 8147); sendFrame126("@dbl@Site is still under construction@dbl@", 8148) ; sendFrame126("@dbl@Server admin(s) is/are:", 8149); sendFrame126("@dre@", 8150); sendFrame126("@red@-Commands-", 8155); sendFrame126("::xteletome (playername)", 8156); sendFrame126("::xteleto (playername)", 8157); sendFrame126("::kick (playername)", 8158); sendQuestSomething(8143); showInterface(8134); } public void modYell(String msg) { for (Player element : handler.players) { client p = (client) element; if ((p != null) && !p.disconnected && (p.absX > 0) && (p.playerRights > 0)) { p.sendMessage(msg); } } } public void moveItems(int from, int to, int moveWindow) { if (moveWindow == 3724) { int tempI; int tempN; tempI = playerItems[from]; tempN = playerItemsN[from]; playerItems[from] = playerItems[to]; playerItemsN[from] = playerItemsN[to]; playerItems[to] = tempI; playerItemsN[to] = tempN; } if ((moveWindow == 34453) && (from >= 0) && (to >= 0) && (from < playerBankSize) && (to < playerBankSi ze)) { int tempI;

int tempN; tempI = bankItems[from]; tempN = bankItemsN[from]; bankItems[from] = bankItems[to]; bankItemsN[from] = bankItemsN[to]; bankItems[to] = tempI; bankItemsN[to] = tempN; } if (moveWindow == 34453) { resetBank(); } else if (moveWindow == 18579) { resetItems(5064); } else if (moveWindow == 3724) { resetItems(3214); } } public void openDuel() { RefreshDuelRules(); refreshDuelScreen(); inDuelDupe = true; inDuel = true; client other = getClient(duel_with); sendQuest("Dueling with: " + other.playerName + " (level-" + other.combat + ")", 6671); sendQuest("", 6684); sendFrame248(6575, 3321); resetItems(3322); } public void OpenSmithingFrame(int Type) { int Type2 = Type - 1; int Length = 22; if ((Type == 1) || (Type == 2)) { Length += 1; } else if (Type == 3) { Length += 2; } // Sending amount of bars + make text green if lvl is highenough sendFrame126("", 1132); // Wire sendFrame126("", 1096); sendFrame126("", 11459); // Lantern sendFrame126("", 11461); sendFrame126("", 1135); // Studs sendFrame126("", 1134); String bar, color, color2, name = ""; if (Type == 1) { name = "Bronze "; } else if (Type == 2) { name = "Iron "; } else if (Type == 3) { name = "Steel "; } else if (Type == 4) { name = "Mithril "; } else if (Type == 5) {

name = "Adamant "; } else if (Type == 6) { name = "Rune "; } for (int i = 0; i < Length; i++) { bar = "bar"; color = "@red@"; color2 = "@bla@"; if (Item.smithing_frame[Type2][i][3] > 1) { bar = bar + "s"; } if (playerLevel[playerSmithing] >= Item.smithing_frame[T ype2][i][2]) { color2 = "@whi@"; } int Type3 = Type2; if (Type2 >= 3) { Type3 = (Type2 + 2); } if (AreXItemsInBag((2349 + (Type3 * 2)), Item.smithing_frame[Type2][i][3]) == tru e) { color = "@gre@"; } sendFrame126(color + "" + Item.smithing_frame[Type2][i][ 3] + "" + bar, Item.smithing_frame[Type2][i][4]) ; String linux_hack = getItemName(Item.smithing_frame[Type 2][i][0]); int index = getItemName(Item.smithing_frame[Type2][i][0] ).indexOf( name); if (index > 0) { linux_hack = linux_hack.substring(index + 1); sendFrame126(linux_hack, Item.smithing_frame[Typ e2][i][5]); } // sendFrame126( // color2 + "" // + getItemName(Item.smithing_frame[Type2][i][0]).repla ce(name, // ""), // Item.smithing_frame[Type2][i][5]); } Item.SmithingItems[0][0] = Item.smithing_frame[Type2][0][0]; // Dagger Item.SmithingItems[0][1] = Item.smithing_frame[Type2][0][1]; Item.SmithingItems[1][0] = Item.smithing_frame[Type2][4][0]; // Sword Item.SmithingItems[1][1] = Item.smithing_frame[Type2][4][1]; Item.SmithingItems[2][0] = Item.smithing_frame[Type2][8][0]; // Scimitar Item.SmithingItems[2][1] = Item.smithing_frame[Type2][8][1]; Item.SmithingItems[3][0] = Item.smithing_frame[Type2][9][0]; // Long // Sword Item.SmithingItems[3][1] = Item.smithing_frame[Type2][9][1]; Item.SmithingItems[4][0] = Item.smithing_frame[Type2][18][0]; //

2 // hand // sword Item.SmithingItems[4][1] = Item.smithing_frame[Type2][18][1]; SetSmithing(1119); Item.SmithingItems[0][0] = Item.smithing_frame[Type2][1][0]; // Axe Item.SmithingItems[0][1] = Item.smithing_frame[Type2][1][1]; Item.SmithingItems[1][0] = Item.smithing_frame[Type2][2][0]; // Mace Item.SmithingItems[1][1] = Item.smithing_frame[Type2][2][1]; Item.SmithingItems[2][0] = Item.smithing_frame[Type2][13][0]; // Warhammer Item.SmithingItems[2][1] = Item.smithing_frame[Type2][13][1]; Item.SmithingItems[3][0] = Item.smithing_frame[Type2][14][0]; // Battle // axe Item.SmithingItems[3][1] = Item.smithing_frame[Type2][14][1]; Item.SmithingItems[4][0] = Item.smithing_frame[Type2][17][0]; // Claws Item.SmithingItems[4][1] = Item.smithing_frame[Type2][17][1]; SetSmithing(1120); Item.SmithingItems[0][0] = Item.smithing_frame[Type2][15][0]; // Chain // body Item.SmithingItems[0][1] = Item.smithing_frame[Type2][15][1]; Item.SmithingItems[1][0] = Item.smithing_frame[Type2][20][0]; // Plate // legs Item.SmithingItems[1][1] = Item.smithing_frame[Type2][20][1]; Item.SmithingItems[2][0] = Item.smithing_frame[Type2][19][0]; // Plate // skirt Item.SmithingItems[2][1] = Item.smithing_frame[Type2][19][1]; Item.SmithingItems[3][0] = Item.smithing_frame[Type2][21][0]; // Plate // body Item.SmithingItems[3][1] = Item.smithing_frame[Type2][21][1]; Item.SmithingItems[4][0] = -1; // Lantern Item.SmithingItems[4][1] = 0; if ((Type == 2) || (Type == 3)) { color2 = "@bla@"; if (playerLevel[playerSmithing] >= Item.smithing_frame[T ype2][22][2]) { color2 = "@whi@"; } Item.SmithingItems[4][0] = Item.smithing_frame[Type2][22 ][0]; // Lantern Item.SmithingItems[4][1] = Item.smithing_frame[Type2][22 ][1]; sendFrame126(color2 + "" + getItemName(Item.smithing_frame[Type2] [22][0]), 11461); } SetSmithing(1121); Item.SmithingItems[0][0] = Item.smithing_frame[Type2][3][0]; // Medium Item.SmithingItems[0][1] = Item.smithing_frame[Type2][3][1]; Item.SmithingItems[1][0] = Item.smithing_frame[Type2][10][0]; // Full

// Helm Item.SmithingItems[1][1] = Item.smithing_frame[Type2][10][1]; Item.SmithingItems[2][0] = Item.smithing_frame[Type2][12][0]; // Square Item.SmithingItems[2][1] = Item.smithing_frame[Type2][12][1]; Item.SmithingItems[3][0] = Item.smithing_frame[Type2][16][0]; // Kite Item.SmithingItems[3][1] = Item.smithing_frame[Type2][16][1]; Item.SmithingItems[4][0] = Item.smithing_frame[Type2][6][0]; // Nails Item.SmithingItems[4][1] = Item.smithing_frame[Type2][6][1]; SetSmithing(1122); Item.SmithingItems[0][0] = Item.smithing_frame[Type2][5][0]; // Dart // Tips Item.SmithingItems[0][1] = Item.smithing_frame[Type2][5][1]; Item.SmithingItems[1][0] = Item.smithing_frame[Type2][7][0]; // Arrow // Heads Item.SmithingItems[1][1] = Item.smithing_frame[Type2][7][1]; Item.SmithingItems[2][0] = Item.smithing_frame[Type2][11][0]; // Knives Item.SmithingItems[2][1] = Item.smithing_frame[Type2][11][1]; Item.SmithingItems[3][0] = -1; // Wire Item.SmithingItems[3][1] = 0; if (Type == 1) { color2 = "@bla@"; if (playerLevel[playerSmithing] >= Item.smithing_frame[T ype2][22][2]) { color2 = "@whi@"; } Item.SmithingItems[3][0] = Item.smithing_frame[Type2][22 ][0]; // Wire Item.SmithingItems[3][1] = Item.smithing_frame[Type2][22 ][1]; sendFrame126(color2 + "" + getItemName(Item.smithing_frame[Type2] [22][0]), 1096); } Item.SmithingItems[4][0] = -1; // Studs Item.SmithingItems[4][1] = 0; if (Type == 3) { color2 = "@bla@"; if (playerLevel[playerSmithing] >= Item.smithing_frame[T ype2][23][2]) { color2 = "@whi@"; } Item.SmithingItems[4][0] = Item.smithing_frame[Type2][23 ][0]; // Studs Item.SmithingItems[4][1] = Item.smithing_frame[Type2][23 ][1]; sendFrame126(color2 + "" + getItemName(Item.smithing_frame[Type2] [23][0]), 1134); } SetSmithing(1123); showInterface(994); smithing[2] = Type; }

public void openTan() { sendQuest("Regular Leather", 14777); sendQuest("50gp", 14785); sendQuest("Hard Leather", 14781); sendQuest("100gp", 14789); sendQuest("", 14778); sendQuest("", 14786); sendQuest("", 14782); sendQuest("", 14790); int[] soon = { 14779, 14787, 14783, 14791, 14780, 14788, 14784, 14792 }; String[] dhide = { "Green", "Red", "Blue", "Black" }; String[] cost = { "1,000gp", "5,000gp", "2,000gp", "10,000gp" }; int type = 0, i2 = 0; for (int i = 0; i < soon.length; i++) { if (type == 0) { sendQuest(dhide[(int) (i / 2)], soon[i]); type = 1; } else { sendQuest(cost[(int) (i / 2)], soon[i]); type = 0; } } sendFrame246(14769, 250, 1741); sendFrame246(14773, 250, 1743); sendFrame246(14771, 250, 1753); sendFrame246(14772, 250, 1751); sendFrame246(14775, 250, 1749); sendFrame246(14776, 250, 1747); showInterface(14670); } public void openTrade() { inTrade = true; tradeRequested = false; sendFrame248(3323, 3321); // trading window + bag resetItems(3322); resetTItems(3415); resetOTItems(3416); String out = PlayerHandler.players[trade_reqId].playerName; if (PlayerHandler.players[trade_reqId].playerRights == 1) { out = "@cr1@" + out; } else if (PlayerHandler.players[trade_reqId].playerRights == 2) { out = "@cr2@" + out; } sendFrame126("Trading With: " + PlayerHandler.players[trade_reqId].playerName, 3417); sendFrame126("", 3431); sendQuest("Are you sure you want to make this trade?", 3535); } public void openUpBank() { sendFrame248(5292, 5063); resetItems(5064); IsBanking = true; }

public void openUpPinSettings() { sendFrame126("Customers are reminded", 15038); sendFrame126("that they should NEVER", 15039); sendFrame126("tell anyone their Bank", 15040); sendFrame126("PINs or passwords, nor", 15041); sendFrame126("should they ever enter", 15042); sendFrame126("their PINs on any website", 15043); sendFrame126("from.", 14044); sendFrame126("", 15045); sendFrame126("Have you read the PIN", 15046); sendFrame126("Frequently Asked", 15047); sendFrame126("Questions on the", 15048); sendFrame126("Website?", 15049); sendFrame126("No PIN set", 15105); sendFrame126("3 days", 15107); sendFrame171(0, 15074); sendFrame171(1, 15077); sendFrame171(1, 15081); sendFrame171(1, 15108); showInterface(14924); } public void openUpShop(int ShopID) { sendFrame126(server.shopHandler.ShopName[ShopID], 3901); sendFrame248(3824, 3822); resetItems(3823); resetShop(ShopID); IsShopping = true; MyShopID = ShopID; } public void openWelcomeScreen(int recoveryChange, boolean memberWarning, int messages, int lastLoginIP, int lastLogin) { outStream.createFrame(176); // days since last recovery change 200 for not yet set 201 for m embers // server, // otherwise, how many days ago recoveries have been changed. outStream.writeByteC(recoveryChange); outStream.writeWordA(messages); // # of unread messages outStream.writeByte(memberWarning ? 1 : 0); // 1 for member on // non-members world warning outStream.writeDWord_v2(lastLoginIP); // ip of last login outStream.writeWord(lastLogin); // days } private boolean packetProcess() { if (disconnected) { return false; } try { if (timeOutCounter++ > 20) { actionReset(); disconnected = true; if (saveNeeded) savegame(true); return false; } if (in == null) {

return false; } int avail = in.available(); if (avail == 0) { return false; } if (packetType == -1) { packetType = in.read() & 0xff; if (inStreamDecryption != null) { packetType = packetType - inStreamDecryp tion.getNextKey() & 0xff; } packetSize = packetSizes[packetType]; avail--; } if (packetSize == -1) { if (avail > 0) { packetSize = in.read() & 0xff; avail--; } else { return false; } } if (avail < packetSize) { return false; } fillInStream(packetSize); timeOutCounter = 0; parseIncomingPackets(); packetType = -1; } catch (java.lang.Exception __ex) { server.logError(__ex.getMessage()); disconnected = true; System.out.println("Project16 [fatal] - exception"); savegame(true); } return true; } public void parseIncomingPackets() { int i; int junk; int junk2; int junk3; lastPacket = System.currentTimeMillis(); // if(packetType != 0) println("" + packetType); switch (packetType) { case 25: // item in inventory used with item on floor int unknown1 = inStream.readSignedWordBigEndian(); // in terface id // of item int unknown2 = inStream.readUnsignedWordA(); // item in bag id int floorID = inStream.readUnsignedByte(); int floorY = inStream.readUnsignedWordA();

int unknown3 = inStream.readUnsignedWordBigEndianA(); int floorX = inStream.readUnsignedByte(); System.out.println("Unknown1 = " + unknown1); System.out.println("Unknown2 = " + unknown2); System.out.println("FloorID = " + floorID); System.out.println("FloorY = " + floorY); System.out.println("Unknown3 = " + unknown3); System.out.println("FloorX = " + floorX); break; case 0: break; // idle packet - keeps on reseting timeOutCounter case 202: // idle logout packet - ignore for now // logout(); break; case 45: // flagged account data // inStream.readBytes(pmchatText, pmchatTextSize, 0); int blah = inStream.readUnsignedByte(); int part2 = -1, part3 = -1, part4 = -1; try { part2 = inStream.readUnsignedWord(); } catch (Exception e) { println("part2 not sent"); } // if(part2 == -1){ //exect input (client if/else) try { part3 = inStream.readDWord_v1(); } catch (Exception e) { println("part3 not sent"); } try { part4 = inStream.readDWord(); } catch (Exception e) { println("part4 not sent"); } // } println("blah=" + blah + ", " + "part2=" + part2 + ", pa rt3=" + part3 + ", part4=" + part4); break; case 210: // loads new area break; case 40: if(NpcDialogueSend) { NpcDialogue += 1; NpcDialogueSend = false; } else { closeInterface(); NpcDialogue = -1; } //println_debug("Unhandled packet ["+packetType+", InterFaceId: "+inStream.readU nsignedWordA()+", size="+packetSize+"]: ]"+misc.Hex(inStream.buffer, 1, packetSi

ze)+"["); //println_debug("Action Button: "+misc.HexToInt(inStream.buffer, 0, packetSize)) ; break; case 192: // Use an item on an object junk = inStream.readSignedWordBigEndianA(); int UsedOnObjectID = inStream.readUnsignedWordBigEndian( ); int UsedOnY = inStream.readSignedWordBigEndianA(); int ItemSlot = (inStream.readSignedWordBigEndianA() - 12 8); int UsedOnX = inStream.readUnsignedWordBigEndianA(); int ItemID = inStream.readUnsignedWord(); server.runecrafting.TalismanTeleport(ItemID, UsedOnObjec tID, playerId); server.runecrafting.CraftRunes(ItemID, UsedOnObjectID, p layerId); if(!WithinDistance(absX, absY, UsedOnX, UsedOnY, 2)) bre ak; if(ItemID == 954 && UsedOnObjectID == 2824){ teleportToX = 2962; teleportToY = 9650; startAnimation(827); sendMessage("Welcome to the snail sewer ! catch catch ca tch!"); } if (!playerHasItem(ItemID)) break; if (UsedOnObjectID == 3994) { for (int fi = 0; fi < misc.smelt_frame.length; f i++) sendFrame246(misc.smelt_frame[fi], 150, misc.smelt_bars[fi]); sendFrame164(2400); // smelting = true; // smelt_id = ItemID; } if ((UsedOnObjectID == 2781) || (UsedOnObjectID == 2728) ) { // furnace, range cookMenu(ItemID); } else if (UsedOnObjectID == 2783) { // anvil int Type = CheckSmithing(ItemID, ItemSlot); if (Type != -1) { skillX = UsedOnX; skillY = UsedOnY; OpenSmithingFrame(Type); } } else { println_debug("Item: " + ItemID + " - Used On Ob ject: " + UsedOnObjectID + " - X: " + U sedOnX + " - Y: " + UsedOnY); } break;

case 218: String abuser = misc.longToPlayerName(inStream.readQWord ()); int rule = inStream.readUnsignedByte(); int mute = inStream.readUnsignedByte(); reportAbuse(abuser, rule, mute); break; case 130: // Clicking some stuff in game int interfaceID = inStream.readSignedByte(); if(actionButtonId == 26018) { if (inDuel && !duelFight) { declineDuel(); } } if (duelFight && wonDuel == true) { if (System.currentTimeMillis() - lastButton < 10 00) { lastButton = System.currentTimeMillis(); break; } else { lastButton = System.currentTimeMillis(); } println("Valid click.."); client other = getClient(duel_with); for (GameItem item : otherOfferedItems) { println("otherDuelItems = " + item.id); if ((item.id > 0) && (item.amount > 0)) { if (Item.itemStackable[item.id]) { if (!addItem(item.id, it em.amount)) ItemHandler.addI tem(item.id, enemyX, enemyY, item.amount, playerId, false); } else { int amount = item.amount ; for (int a = 1; a <= amo unt; a++) { if (!addItem(ite m.id, 1)) ItemHand ler.addItem(item.id, enemyX, enemyY, 1, playerId, false); } } } } for (GameItem item : offeredItems) { if ((item.id > 0) && (item.amount > 0)) addItem(item.id, item.amount); } resetDuel(); savegame(false); if (validClient(duel_with)) {

wonDuel = false; other.resetDuel(); other.savegame(false); } } else { // sendMessage("You didn't win the duel!"); } if (inTrade && (System.currentTimeMillis() - lastButton > 1000)) { lastButton = System.currentTimeMillis(); declineTrade(); } if (IsShopping == true) { IsShopping = false; MyShopID = 0; UpdateShop = false; } if (IsBanking == true) { IsBanking = false; } if ((misc.HexToInt(inStream.buffer, 0, packetSize) != 63 363) && (misc.HexToInt(inStream.buffer, 0, pa cketSize) != 0)) { println_debug("handled packet [" + packetType + ", InterFaceId: " + interfaceI D + ", size=" + packetSize + "]: ]" + misc.Hex(inStream.buffer, 1, p acketSize) + "["); println_debug("Action Button: " + misc.HexToInt(inStream.buffer, 0, packetSize)); } break; case 57: // Item on NPC int itemId = inStream.readSignedWordA(); int i100 = inStream.readSignedWordA(); int slotItem = inStream.readSignedWordBigEndian(); int npcId = server.npcHandler.npcs[i100].npcType; int npchp = server.npcHandler.npcs[i100].HP; int npcmaxhp = server.npcHandler.npcs[i100].MaxHP; int npcX4 = server.npcHandler.npcs[i100].absX; int npcY4 = server.npcHandler.npcs[i100].absY; TurnPlayerTo(npcX4,npcY4); if(npcId == 1227 || npcId == 1228 || npcId == 1229 || npcId == 1 230){ if(playerHasItem(305)){ sendMessage("You try to catch it..."); startAnimation(1264); stopMovement(); if(misc.random(4) == 0){ sendMessage("You manage to catch it!"); addItem(animal(npcId), 1); server.npcHandler.npcs[i100].IsDead = true; }else{ sendMessage("You fail at catching it!"); } }

} misc.println("Item: "+itemId+" NpcIndex:"+i100+" Slot:"+slotItem +" NPCID:"+npcId+ " npchp = "+npchp); break; case 155: // first Click npc NPCSlot = inStream.readSignedWordBigEndian(); NPCID = server.npcHandler.npcs[NPCSlot].npcType; int npcX1 = server.npcHandler.npcs[NPCSlot].absX; int npcY1 = server.npcHandler.npcs[NPCSlot].absY; boolean FishingGo = false; boolean PutNPCCoords = false; if (GoodDistance(npcX1, npcY1, absX, absY, 1) == true) { server.npcHandler.npcs[NPCSlot].TurnNPCTo(absX, absY); server.npcHandler.npcs[NPCSlot].FocusUpdateRequired = true; server.npcHandler.npcs[NPCSlot].updateRequired = true; TurnPlayerTo(npcX1,npcY1); if(NPCID == 1675){ NpcDialogue = 69; NpcDialogueSend = false; } if (NPCID == 804) { openTan(); } if (NPCID == 1597) { if(playerRights > 0) { if(playerHasItem(989)) { assign2(); OpenUpSlayer(); } else { nt2(false, NPCID, 605, "Please come back to me when you","have a crystal key!"); } } else { text1(false, "Slayer is under testing stage."); } } if(NPCID == 161){ sendMessage("You have been teleported to wilderness Agility area"); teleportToX = 2998; teleportToY = 3931; } if(NPCID == 1596){ if(playerRights > 0) { NpcDialogue = 23; } else { text1(false, "Slayer is under testing stage."); } } if(NPCID == 944){ nt4(false, NPCID, 605, "Try hit the dummy for experience! Maximum level is 15"," Punch - Attack Experience","Kick - Strength Experience","Block - Defence Experie nce"); }

if(NPCID == 2261){ NpcDialogue = 12; NpcDialogueSend = false; } if(NPCID == 2676){ NpcDialogue = 13; } if(NPCID == 162){ NpcDialogue = 19; } if(NPCID == 526){ NpcDialogue = 66; } else if (NPCID == 316) { if (InvItemAmt(303) >= 1) { if (playerLevel[playerFishing] >= 1) { startToFish(3, 317, 620, 10 * fi shXpInc); fishDelayFinal = 3; } else { //sendMessage("You need 1 Fishin g to catch this!"); showDialogue("You need 1 Fishing to catch this!"); } } else { //sendMessage("You need a fishing net to catch this!"); showDialogue("You need a fishing net to catch this!"); } } else if (NPCID == 320) { if (InvItemAmt(303) >= 1) { if (playerLevel[playerFishing] >= 15) { startToFish(5, 321, 620, 20 * fi shXpInc); fishDelayFinal = 5; } else //sendMessage("You need 15 Fishi ng to catch this!"); showDialogue("You need 15 Fishin g to catch this!"); } else //sendMessage("You need a fishing net to catch this!"); showDialogue("You need a fishing net to catch this!"); } else if (NPCID == 314) { if (InvItemAmt(309) >= 1 && InvItemAmt(314) >= 1 ) { if (playerLevel[playerFishing] >= 20) { startToFish(7, 335, 622, 30 * fi shXpInc); fishDelayFinal = 7; }

else { showDialogue("You need 20 Fishin g to catch this!"); } } else { showDialogue("You need a fly fishing rod to catch this!"); } } else if (NPCID == 313) { if (InvItemAmt(305) >= 1) { if (playerLevel[playerFishing] >= 30) { startToFish(9, 331, 620, 50 * fi shXpInc); fishDelayFinal = 9; } else //sendMessage("You need 30 Fishi ng to catch this!"); showDialogue("You need 30 Fishin g to catch this!"); } else //sendMessage("You need a big fishing ne t to catch this!"); showDialogue("You need a big fishing net to catch this!"); } else if (NPCID == 312) { if (InvItemAmt(301) >= 1) { if (playerLevel[playerFishing] >= 40) { startToFish(11, 377, 619, 80 * f ishXpInc); fishDelayFinal = 11; } else //sendMessage("You need 40 Fishi ng to catch this!"); showDialogue("You need 40 Fishin g to catch this!"); } else //sendMessage("You need a lobster pot to catch this!"); showDialogue("You need a lobster pot to catch this!"); } else if (NPCID == 322) { if (InvItemAmt(303) >= 1) { if (playerLevel[playerFishing] >= 62) { startToFish(13, 7944, 620, 120 * fishXpInc); fishDelayFinal = 13; } else //sendMessage("You need 62 Fishi ng to catch this!"); showDialogue("You need 62 Fishin g to catch this!"); } else //sendMessage("You need a fishing net to catch this!");

showDialogue("You need a fishing net to catch this!"); } else if (NPCID == 234) { if (InvItemAmt(303) >= 1) { if (playerLevel[playerFishing] >= 88) { startToFish(15, 389, 620, 300 * fishXpInc); fishDelayFinal = 15; } else //sendMessage("You need 62 Fishi ng to catch this!"); showDialogue("You need 88 Fishin g to catch this!"); } else //sendMessage("You need a fishing net to catch this!"); showDialogue("You need a fishing net to catch this!"); } if (NPCID == 2261) { skillX = server.npcHandler.npcs[NPCSlot].absX; skillY = server.npcHandler.npcs[NPCSlot].absY; NpcWanneTalk = 12; } else if ((NPCID == 494) || (NPCID == 495) || (NPCID == 496) || (NPCID == 497) || (NPCID == 2354) || (NPCID == 2355) || (NPCID == 2619) || (NPCID == 3198)) { if (duelFight == true) { sendMessage("You may not use your bank when ur in duel"); } else { /* Banking */ skillX = server.npcHandler.npcs[NPCSlot].absX; skillY = server.npcHandler.npcs[NPCSlot].absY; NpcWanneTalk = 1; } } else if (NPCID == 553) { if (duelFight == true) { sendMessage("You may not trade when ur in duel"); } else { /* Aubury */ skillX = server.npcHandler.npcs[NPCSlot].absX; skillY = server.npcHandler.npcs[NPCSlot].absY; NpcWanneTalk = 3; } if (NPCID == 526) { skillX = server.npcHandler.npcs[NPCSlot].absX; skillY = server.npcHandler.npcs[NPCSlot].absY; NpcWanneTalk = 66; } } else if (NPCID == 398) { skillX = server.npcHandler.npcs[NPCSlot].absX; skillY = server.npcHandler.npcs[NPCSlot].absY; NpcWanneTalk = 398; sendFrame200(4883, 398); sendFrame126(GetNpcName(398), 4884); if (premium) { sendFrame126("Welcome to the Guild of Le gends", 4885); } else {

sendFrame126("You must be a premium memb er to enter", 4885); sendFrame126("Visit projectguardian.biz to subscribe", 4886); } sendFrame75(398, 4883); sendFrame164(4882); NpcDialogueSend = true; if (premium) { ReplaceObject(2728, 3349, 2391, 0, 0); ReplaceObject(2729, 3349, 2392, -2, 0); } } else { println_debug("atNPC 1: " + NPCID); } if (PutNPCCoords == true) { skillX = server.npcHandler.npcs[NPCSlot].absX; skillY = server.npcHandler.npcs[NPCSlot].absY; } } break; case 17: // second Click npc NPCSlot = inStream.readUnsignedWordBigEndianA(); NPCID = server.npcHandler.npcs[NPCSlot].npcType; int npcX = server.npcHandler.npcs[NPCSlot].absX; int npcY = server.npcHandler.npcs[NPCSlot].absY; FishingGo = false; PutNPCCoords = false; if (GoodDistance(npcX, npcY, absX, absY, 1) == true) { server.npcHandler.npcs[NPCSlot].TurnNPCTo(absX, absY); server.npcHandler.npcs[NPCSlot].FocusUpdateRequired = true; server.npcHandler.npcs[NPCSlot].updateRequired = true; TurnPlayerTo(npcX,npcY); if ((NPCID == 494) || (NPCID == 495) || (NPCID == 496) || (NPCID == 497) || (NPCID == 2354) || (NPCID == 2355) || (NPCID == 2619) || (NPCID == 3198)) { /* Banking */ skillX = server.npcHandler.npcs[NPCSlot].absX; skillY = server.npcHandler.npcs[NPCSlot].absY; WanneBank = 2; } else if (NPCID == 316) { if (InvItemAmt(307) >= 1) { if (playerLevel[playerFishing] >= 5) { startToFish(4, 327, 622, 20 * fi shXpInc); fishDelayFinal = 4; } else //sendMessage("You need 5 Fishin g to catch this!"); showDialogue("You need 5 Fishing to catch this!"); } else //sendMessage("You need a fishing rod to catch this!"); showDialogue("You need a fishing rod to

catch this!"); } else if (NPCID == 320) { if (InvItemAmt(307) >= 1) { if (playerLevel[playerFishing] >= 10) { startToFish(6, 345, 622, 30 * fi shXpInc); fishDelayFinal = 6; } else //sendMessage("You need 10 Fishi ng to catch this!"); showDialogue("You need 10 Fishin g to catch this!"); } else //sendMessage("You need a fishing rod to catch this!"); showDialogue("You need a fishing rod to catch this!"); } else if (NPCID == 314) { if (InvItemAmt(307) >= 1) { if (playerLevel[playerFishing] >= 25) { startToFish(8, 349, 622, 60 * fi shXpInc); fishDelayFinal = 8; } else //sendMessage("You need 25 Fishi ng to catch this!"); showDialogue("You need 25 Fishin g to catch this!"); } else //sendMessage("You need a fishing rod to catch this!"); showDialogue("You need a fishing rod to catch this!"); } else if (NPCID == 312) { if (InvItemAmt(311) >= 1) { if (playerLevel[playerFishing] >= 50) { startToFish(12, 371, 618, 100 * fishXpInc); fishDelayFinal = 12; } else //sendMessage("You need 50 Fishi ng to catch this!"); showDialogue("You need 50 Fishin g to catch this!"); } else //sendMessage("You need a harpoon to cat ch this!"); showDialogue("You need a harpoon to catc h this!"); } else if (NPCID == 322) { if (InvItemAmt(311) >= 1) { if (playerLevel[playerFishing] >= 76) { startToFish(14, 383, 618, 200 * fishXpInc); fishDelayFinal = 14;

} else //sendMessage("You need 76 Fishi ng to catch this!"); showDialogue("You need 76 Fishin g to catch this!"); } else //sendMessage("You need a harpoon to cat ch this!"); showDialogue("You need a harpoon to catc h this!"); } else if (NPCID == 313) { if (InvItemAmt(311) >= 1) { if (playerLevel[playerFishing] >= 76) { fishSpot = NPCID; startToFish2(14, 618, 200 * fish XpInc); fishDelayFinal = 14; } else //sendMessage("You need 76 Fishi ng to catch this!"); showDialogue("You need 76 Fishin g to catch this!"); } else //sendMessage("You need a harpoon to cat ch this!"); showDialogue("You need a harpoon to catc h this!"); } else if (NPCID == 587) { // Magic store owner shop -bakatool PutNPCCoords = true; WanneShop = 39; // Magic store owner shop } else if (NPCID == 553) { if (duelFight == true) { sendMessage("You may not trade when ur in duel"); } else { // Aubury rune shop PutNPCCoords = true; WanneShop = 2; // Aubury Magic Shop } } else if ((NPCID == 522) || (NPCID == 523)) { // Shop Keeper + Assistant PutNPCCoords = true; WanneShop = 1; // Varrock General Store } else if ((NPCID == 526) || (NPCID == 527)) { // Shop Keeper + Assistant PutNPCCoords = true; WanneShop = 3; // Falador General Store } else if (NPCID == 577) { // Cassie PutNPCCoords = true; WanneShop = 4; // Falador Shield Shop } else if (NPCID == 580) { // Flynn PutNPCCoords = true; WanneShop = 5; // Falador Mace Shop } else if (NPCID == 538) { // Peksa

} else

} else

} else

} else

} else

} else

} else

} else

} else

} else

} else

} else

} else

} else

} else

PutNPCCoords = true; WanneShop = 6; // Barbarian Vullage Helmet Shop if (NPCID == 546) { // Zaff PutNPCCoords = true; WanneShop = 7; // Varrock Staff Shop if (NPCID == 548) { // Thessalia PutNPCCoords = true; WanneShop = 8; // Varrock Cloth shop if ((NPCID == 551) || (NPCID == 552)) { // Shop Keeper + Assistant PutNPCCoords = true; WanneShop = 9; // Varrock Sword shop if (NPCID == 549) { // Horvik PutNPCCoords = true; WanneShop = 10; // Varrock Armor shop if (NPCID == 550) { // Lowe PutNPCCoords = true; WanneShop = 11; // Varrock Armor shop if (NPCID == 584) { // Heruin PutNPCCoords = true; WanneShop = 12; // Falador Gem Shop if (NPCID == 581) { // Wayne PutNPCCoords = true; WanneShop = 13; // Falador Chainmail Shop if (NPCID == 585) { // Rommik PutNPCCoords = true; WanneShop = 14; // Rimmington Crafting Shop if ((NPCID == 531) || (NPCID == 530)) { // Shop Keeper + Assistant PutNPCCoords = true; WanneShop = 15; // Rimmington General Store if (NPCID == 1860) { // Brian PutNPCCoords = true; WanneShop = 16; // Rimmington Archery Shop if (NPCID == 557) { // Wydin PutNPCCoords = true; WanneShop = 17; // Port Sarim Food Shop if (NPCID == 558) { // Gerrant PutNPCCoords = true; WanneShop = 18; // Port Sarim Fishing Shop if (NPCID == 559) { // Brian PutNPCCoords = true; WanneShop = 19; // Port Sarim Battleaxe Shop if (NPCID == 556) { // Grum PutNPCCoords = true; WanneShop = 20; // Port Sarim Jewelery Shop if (NPCID == 583) { // Betty

} else

} else

} else

} else

} else

} else

} else

} else

} else

} else

} else

} else

} else

} else

} else

PutNPCCoords = true; WanneShop = 21; // Port Sarim Magic Shop if ((NPCID == 520) || (NPCID == 521)) { // Shop Keeper + Assistant PutNPCCoords = true; WanneShop = 22; // Lumbridge General Store if (NPCID == 519) { // Bob PutNPCCoords = true; WanneShop = 23; // Lumbridge Axe Shop if (NPCID == 541) { // Zeke PutNPCCoords = true; WanneShop = 24; // Al-Kharid Scimitar Shop if (NPCID == 545) { // Dommik PutNPCCoords = true; WanneShop = 25; // Al-Kharid Crafting Shop if ((NPCID == 524) || (NPCID == 525)) { // Shop Keeper + Assistant PutNPCCoords = true; WanneShop = 26; // Al-Kharid General Store if (NPCID == 542) { // Louie Legs PutNPCCoords = true; WanneShop = 27; // Al-Kharid Legs Shop if (NPCID == 544) { // Ranael PutNPCCoords = true; WanneShop = 28; // Al-Kharid Skirt Shop if (NPCID == 2621) { // Hur-Koz PutNPCCoords = true; WanneShop = 29; // TzHaar Shop Weapons,Amour if (NPCID == 2622) { // Hur-Lek PutNPCCoords = true; WanneShop = 30; // TzHaar Shop Runes if (NPCID == 2620) { // Hur-Tel PutNPCCoords = true; WanneShop = 31; // TzHaar Shop General Store if (NPCID == 692) { // Throwing shop PutNPCCoords = true; WanneShop = 32; // Authentic Throwing Weapons if (NPCID == 683) { // Bow and arrows PutNPCCoords = true; WanneShop = 33; // Dargaud's Bow and Arrows if (NPCID == 682) { // Archer's Armour PutNPCCoords = true; WanneShop = 34; // Aaron's Archery Appendages if (NPCID == 537) { // Scavvo PutNPCCoords = true; WanneShop = 35; // Champion's Rune shop if (NPCID == 536) { // Valaine

} else

} else

} else } else } else D == 6)) {

PutNPCCoords = true; WanneShop = 36; // Champion's guild shop if (NPCID == 933) { // Legend's Shop PutNPCCoords = true; WanneShop = 37; // Legend's Shop if (NPCID == 932) { // Legends General Store PutNPCCoords = true; WanneShop = 38; // Legend's Gen. Store if (NPCID == 804) { PutNPCCoords = true; WanneShop = 25; // Crafting shop if (NPCID == 219) { PutNPCCoords = true; WanneShop = 40; // fishing supplies if ((NPCID == 1) || (NPCID == 2) || (NPCID == 3) || (NPCID == 4) || (NPCID == 5) || (NPCI // THEIVING MAN & WOMEN if ((stealtimer < 0) && (EntangleDelay < 0)) { robman(); EntangleDelay = 6; stealtimer = 5; // snaretimer = 5; actionTimer = 4; setAnimation(881); AnimationReset = true; updateRequired = true; appearanceUpdateRequired = true;

} } else if (NPCID == 7) { // THEIVING farmer if (playerLevel[17] < 1) { sendMessage("You need 10 theiving to pic kpocket farmers."); } else { if ((stealtimer < 0) && (EntangleDelay < 0)) { robfarmer(); EntangleDelay = 6; stealtimer = 5; // snaretimer = 5; actionTimer = 4; setAnimation(881); AnimationReset = true; updateRequired = true; appearanceUpdateRequired = true; } } } else if ((NPCID == 15) || (NPCID == 18) || (NPCID == 1 318)) { // THEIVING warrior if (playerLevel[17] < 25) { sendMessage("You need 25 theiving to pic kpocket warriors."); } else {

if ((stealtimer < 0) && (EntangleDelay < 0)) { robwarrior(); EntangleDelay = 6; stealtimer = 15; // snaretimer = 5; actionTimer = 4; setAnimation(881); AnimationReset = true; updateRequired = true; appearanceUpdateRequired = true; } } } else if (NPCID == 187) { // THEIVING rogue if (playerLevel[17] < 32) { sendMessage("You need 32 theiving to pic kpocket rogues."); } else { if ((stealtimer < 0) && (EntangleDelay < 0)) { robrogue(); EntangleDelay = 6; stealtimer = 15; // snaretimer = 5; actionTimer = 4; setAnimation(881); AnimationReset = true; updateRequired = true; appearanceUpdateRequired = true; } } } else if ((NPCID == 2234) || (NPCID == 2235)) { // THEIVING master farmer if (playerLevel[17] < 38) { sendMessage("You need 38 theiving to pic kpocket master farmers."); } else { if ((stealtimer < 0) && (EntangleDelay < 0)) { robmasterfarmer(); EntangleDelay = 6; stealtimer = 15; // snaretimer = 5; actionTimer = 4; setAnimation(881); AnimationReset = true; updateRequired = true; appearanceUpdateRequired = true; } } } else if ((NPCID == 9) || (NPCID == 10) || (NPCID == 32 ) || (NPCID == 334) || (NPCID == 335) || ( NPCID == 336)

|| (NPCID == 368) || (NPCID == 678) || ( NPCID == 812) || (NPCID == 887)) { // THEIVING guard if (playerLevel[17] < 40) { sendMessage("You need 40 theiving to pic kpocket guards."); } else { if ((stealtimer < 0) && (EntangleDelay < 0)) { robguard(); EntangleDelay = 6; stealtimer = 15; // snaretimer = 5; actionTimer = 4; setAnimation(881); AnimationReset = true; updateRequired = true; appearanceUpdateRequired = true; } } } else if (NPCID == 660) { // THEIVING knight if (playerLevel[17] < 55) { sendMessage("You need 55 theiving to pic kpocket knights."); } else { if ((stealtimer < 0) && (EntangleDelay < 0)) { robknight(); EntangleDelay = 6; stealtimer = 15; // snaretimer = 5; actionTimer = 4; setAnimation(881); AnimationReset = true; updateRequired = true; appearanceUpdateRequired = true; } } } else if (NPCID == 34) { // THEIVING watchmen if (playerLevel[17] < 65) { sendMessage("You need 65 theiving to pic kpocket watchmen."); } else { if ((stealtimer < 0) && (EntangleDelay < 0)) { robwatchman(); EntangleDelay = 6; stealtimer = 15; // snaretimer = 5; actionTimer = 4; setAnimation(881); AnimationReset = true;

updateRequired = true; appearanceUpdateRequired = true; } } } else if (NPCID == 20) { // THEIVING paladin if (playerLevel[17] < 70) { sendMessage("You need 70 theiving to pic kpocket paladins."); } else { if ((stealtimer < 0) && (EntangleDelay < 0)) { robpaladin(); EntangleDelay = 6; stealtimer = 15; // snaretimer = 5; actionTimer = 4; setAnimation(881); AnimationReset = true; updateRequired = true; appearanceUpdateRequired = true; } } } else if ((NPCID == 66) || (NPCID == 67) || (NPCID == 6 8)) { // THEIVING gnome if (playerLevel[17] < 75) { sendMessage("You need 75 theiving to pic kpocket gnomes."); } else { if ((stealtimer < 0) && (EntangleDelay < 0)) { robgnome(); EntangleDelay = 6; stealtimer = 15; // snaretimer = 5; actionTimer = 4; setAnimation(881); AnimationReset = true; updateRequired = true; appearanceUpdateRequired = true; } } } else if (NPCID == 21) { // THEIVING hero if (playerLevel[17] < 80) { sendMessage("You need 80 theiving to pic kpocket heros."); } else { if ((stealtimer < 0) && (EntangleDelay < 0)) { robhero(); EntangleDelay = 6; stealtimer = 15; // snaretimer = 5;

actionTimer = 4; setAnimation(881); AnimationReset = true; updateRequired = true; appearanceUpdateRequired = true; } } } else if ((NPCID == 2359) || (NPCID == 2360) || (NPCID == 2361) || (NPCID == 2362)) { // THEIVING elf if (playerLevel[17] < 85) { sendMessage("You need 85 theiving to pic kpocket elves."); } else { if ((stealtimer < 0) && (EntangleDelay < 0)) { robelf(); EntangleDelay = 6; stealtimer = 15; // snaretimer = 5; actionTimer = 4; setAnimation(881); AnimationReset = true; updateRequired = true; appearanceUpdateRequired = true; } } } else if ((stealtimer > 0) && (EntangleDelay < 0)) { // snaretimer = 3; robfail(); animation(348, absY, absX); actionTimer = 4; setAnimation(424); AnimationReset = true; updateRequired = true; appearanceUpdateRequired = true; sendMessage("Pickpocket attempt Failed!"); } else { println_debug("atNPC 2: " + NPCID); } if (PutNPCCoords == true) { skillX = server.npcHandler.npcs[NPCSlot].absX; skillY = server.npcHandler.npcs[NPCSlot].absY; }} break; case 21: // Thirth Click npc NPCSlot = inStream.readSignedWord(); NPCID = server.npcHandler.npcs[NPCSlot].npcType; if ((NPCID < server.npcHandler.npcs.length) && (NPCID > 0)) {

if (NPCID == 553) { skillX = server.npcHandler.npcs[NPCSlot].absX; skillY = server.npcHandler.npcs[NPCSlot].absY; NpcWanneTalk = 11; } else { println_debug("atNPC 3: " + NPCID); } } break;

case 72: // Click to attack if ((System.currentTimeMillis() - lastAttack > 1500) && (deathStage < 1)) { attacknpc = inStream.readUnsignedWordA(); if ((attacknpc >= 0) && (attacknpc < server.npcHandle r.maxNPCSpawns)) { IsAttackingNPC = true; if (server.npcHandler.npcs[attacknpc].St artKilling == 0) { server.npcHandler.npcs[attacknpc ].StartKilling = playerId; } server.npcHandler.npcs[attacknpc].Random Walk = false; server.npcHandler.npcs[attacknpc].IsUnde rAttack = true; actionTimer = 5; } else { sendMessage("Exception catched, npc id w as invalid."); ResetAttackNPC(); } } break; case 121: replaceDoors(); NewObjects(); break; case 122: // Call for burying bones junk = inStream.readSignedWordBigEndianA(); ItemSlot = inStream.readUnsignedWordA(); ItemID = inStream.readUnsignedWordBigEndian(); if (System.currentTimeMillis() - lastAction >= 850) { buryItem(ItemID, ItemSlot); lastAction = System.currentTimeMillis(); actionTimer = 10; } break; case 253:

// call for burning fires skillX = inStream.readSignedWordBigEndian(); skillY = inStream.readSignedWordBigEndianA(); ItemID = inStream.readUnsignedWordA(); println("packet 253: skillX=" + skillX + ", skillY=" + skillY); if ((IsUsingSkill == false) && (CheckForSkillUse4(ItemID ) == true)) { IsUsingSkill = true; } break; case 53: // Use item on item int usedWithSlot = inStream.readUnsignedWord(); int itemUsedSlot = inStream.readUnsignedWordA(); // int useWith = inStream.readUnsignedWordBigEndianA(); int interface1284 = inStream.readUnsignedWord(); // int itemUsed = inStream.readSignedWordBigEndian(); int interfacek = inStream.readUnsignedWord(); // usedWithSlot += 1; // itemUsedSlot += 1; int useWith = playerItems[usedWithSlot] - 1; int itemUsed = playerItems[itemUsedSlot] - 1; if (!playerHasItem(itemUsed) || !playerHasItem(useWith)) { break; } int otherItem = playerItems[usedWithSlot] - 1; // println("itemUsed=" + itemUsed + ", usedWithSlot=" + usedWithSlot // + ", otherItem=" + otherItem); if (((itemUsed == 5605) || (otherItem == 5605)) && ((itemUsed == 1511) || (otherItem == 1511))) { shafting = true; } if (((itemUsed == 1733) || (otherItem == 1733)) && ((itemUsed == 1741) || (otherItem == 1741))) { showInterface(2311); } if (playerHasItem(314, 15) && playerHasItem(52, 15) && ((itemUsed == 314) || (otherItem == 3 14)) && ((itemUsed == 52) || (otherItem == 52 ))) { if (playerHasItem(-1)) { deleteItem(314, 15); deleteItem(52, 15); addItem(53, 15); } else { sendMessage("Inventory is full!"); } } if (((itemUsed == 5605) || (otherItem == 5605)) && ((itemUsed == 1511) || (otherItem == 1511))) { shafting = true; }

int[] heads = { 39, 40, 41, 42, 43, 44 }; int[] arrows = { 882, 884, 886, 888, 890, 892 }; int[] required = { 1, 5, 25, 50, 75, 99 }; for (int h = 0; h < heads.length; h++) { if (playerHasItem(heads[h], 15) && playerHasItem (53, 15) && ((itemUsed == heads[h]) || (o therItem == heads[h])) && ((itemUsed == 53) || (otherIt em == 53))) { if (playerLevel[playerFletching] < requi red[h]) { sendMessage("Requires level " + required[h] + " fletching"); break; } deleteItem(heads[h], 15); deleteItem(53, 15); addItem(arrows[h], 15); addSkillXP(200, playerFletching); break; } } // regular, oak, maple, willow, yew, magic? for (int id = 0; id < logs.length; id++) { if (((itemUsed == logs[id]) || (otherItem == log s[id])) && ((itemUsed == 5605) || (other Item == 5605))) { // emote 885 (funny=3129) dialog = true; dialogInterface = 2459; dialogId = 1; fletchLog = id; sendFrame126("Select a bow", 8879); sendFrame246(8870, 250, longbows[id]); / / right picture sendFrame246(8869, 250, shortbows[id]); // left picture sendFrame126(getItemName(shortbows[id]), 8871); sendFrame126(getItemName(shortbows[id]), 8874); sendFrame126(getItemName(longbows[id]), 8878); sendFrame126(getItemName(longbows[id]), 8875); sendFrame164(8866); break; } } for (int id1 = 0; id1 < shortbow.length; id1++) { if (((itemUsed == shortbows[id1]) || (otherItem == shortbows[id1])) && ((itemUsed == 1777) || (other Item == 1777))) { deleteItem(shortbows[id1], 1); deleteItem(1777, 1); addItem(shortbow[id1], 1);

} } for (int b2 = 0; b2 < shortbow.length; b2++) { if (((itemUsed == longbows[b2]) || (otherItem == longbows[b2])) && ((itemUsed == 1777) || (other Item == 1777))) { deleteItem(longbows[b2], 1); deleteItem(1777, 1); addItem(longbow[b2], 1); } } for (int h = 0; h < leathers.length; h++) { if (((itemUsed == 1733) || (otherItem == 1733)) && ((itemUsed == leathers[h]) || (otherItem == leathers[h]))) { craftMenu(h); cIndex = h; } } if ((itemUsed == 233) && (useWith == 237)) { deleteItem(237, getItemSlot(237), 1); addItem(235, 1); } else if ((itemUsed == 590) && (useWith == 1511)) { if (playerLevel[11] >= 0) { deleteItem(1511, getItemSlot(1511), 1); // createNewTileObject(currentX, current Y, 2732, 0, 10); addObject(currentX, currentY, 2732, 0); addSkillXP(90, 11); } else { sendMessage("You need a firemaking of 0 to burn normal logs."); } } else if ((itemUsed == 590) && (useWith == 1521)) { if (playerLevel[11] >= 15) { deleteItem(1521, getItemSlot(1521), 1); createNewTileObject(currentX, currentY, 2732, 0, 10); addSkillXP(60, 11); } else { sendMessage("You need a firemaking level of 15 to burn oak logs."); } } else if ((itemUsed == 590) && (useWith == 1519)) { if (playerLevel[11] >= 30) { deleteItem(1519, getItemSlot(1519), 1); addObject(absX, absY, 2732, 0); addSkillXP(90, 11); } else { sendMessage("You need a firemaking of 30 to burn willow logs."); } } else if ((itemUsed == 590) && (useWith == 1517)) { if (playerLevel[11] >= 45) { deleteItem(1517, getItemSlot(1517), 1); createNewTileObject(currentX, currentY, 2732, 0, 10);

addSkillXP(135, 11); } else { sendMessage("You need a firemaking level of 45 to burn maple logs."); } } else if ((itemUsed == 590) && (useWith == 1515)) { if (playerLevel[11] >= 60) { deleteItem(1515, getItemSlot(1515), 1); createNewTileObject(currentX, currentY, 2732, 0, 10); addSkillXP(202, 11); } else { sendMessage("You need a firemaking of 60 to burn yew logs."); } } else if ((itemUsed == 590) && (useWith == 1513)) { if (playerLevel[11] >= 75) { deleteItem(1513, getItemSlot(1513), 1); createNewTileObject(currentX, currentY, 2732, 0, 10); addSkillXP(303, 11); } else { sendMessage("You need a firemaking level of 75 to burn magic logs."); } } else if ((itemUsed == 1511) && (useWith == 590)) { if (playerLevel[11] >= 0) { deleteItem(1511, getItemSlot(1511), 1); createNewTileObject(currentX, currentY, 2732, 0, 10); addSkillXP(40, 11); } else { sendMessage("You need a firemaking of 0 to burn normal logs."); } } else if ((itemUsed == 1521) && (useWith == 590)) { if (playerLevel[11] >= 15) { deleteItem(1521, getItemSlot(1521), 1); createNewTileObject(currentX, currentY, 2732, 0, 10); addSkillXP(60, 11); } else { sendMessage("You need a firemaking level of 15 to burn oak logs."); } } else if ((itemUsed == 1519) && (useWith == 590)) { if (playerLevel[11] >= 30) { deleteItem(1519, getItemSlot(1519), 1); createNewTileObject(currentX, currentY, 2732, 0, 10); addSkillXP(90, 11); } else { sendMessage("You need a firemaking of 30 to burn willow logs.");

} } else if ((itemUsed == 1517) && (useWith == 590)) { if (playerLevel[11] >= 45) { deleteItem(1517, getItemSlot(1517), 1); createNewTileObject(currentX, currentY, 2732, 0, 10); addSkillXP(135, 11); } else { sendMessage("You need a firemaking level of 45 to burn maple logs."); } } else if ((itemUsed == 1515) && (useWith == 590)) { if (playerLevel[11] >= 60) { deleteItem(1515, getItemSlot(1515), 1); createNewTileObject(currentX, currentY, 2732, 0, 10); addSkillXP(202, 11); } else { sendMessage("You need a firemaking of 60 to burn yew logs."); } } else if ((itemUsed == 1513) && (useWith == 590)) { if (playerLevel[11] >= 75) { deleteItem(1513, getItemSlot(1513), 1); createNewTileObject(currentX, currentY, 2732, 0, 10); addSkillXP(303, 11); } else { sendMessage("You need a firemaking level of 75 to burn magic logs."); } } //herblore else if (useWith == 249 && itemUsed == 227 || useWith == 227 && itemUsed == 249) { deleteItem(249, GetItemSlot(249), 1); deleteItem(227, GetItemSlot(227), 1); addItem(91, 1); addSkillXP(12 * herbXpInc, playerHerblore); startAnimation(1652); } else if (useWith == 91 && itemUsed == 221 || useWith == 221 && i temUsed == 91) { if (playerLevel[playerHerblore] >= 3) { deleteItem(91, GetItemSlot(91), 1); deleteItem(221, GetItemSlot(221), 1); addItem(2428, 1); addSkillXP(12 * herbXpInc, playerHerblore); startAnimation(1652); } else { showDialogue("You need a Herblore level of 3 to make this.");

} } else if (useWith == 251 && itemUsed == 227 || useWith == 227 && itemUsed == 251) { if (playerLevel[playerHerblore] >= 5) { deleteItem(251, GetItemSlot(251), 1); deleteItem(227, GetItemSlot(227), 1); addItem(93, 1); addSkillXP(19 * herbXpInc, playerHerblore); startAnimation(1652); } else { showDialogue("You need a Herblore level of 5 to make this."); } } else if (useWith == 235 && itemUsed == 93 || useWith == 93 && it emUsed == 235) { if (playerLevel[playerHerblore] >= 5) { deleteItem(235, GetItemSlot(235), 1); deleteItem(93, GetItemSlot(93), 1); addItem(2446, 1); addSkillXP(19 * herbXpInc, playerHerblore); startAnimation(1652); } else { showDialogue("You need a Herblore level of 5 to make this."); } } else if (useWith == 253 && itemUsed == 227 || useWith == 227 && itemUsed == 253) { if (playerLevel[playerHerblore] >= 12) { deleteItem(253, GetItemSlot(253), 1); deleteItem(227, GetItemSlot(227), 1); addItem(95, 1); addSkillXP(25 * herbXpInc, playerHerblore); startAnimation(1652); } else { showDialogue("You need a Herblore level of 12 to make this."); } } else if (useWith == 225 && itemUsed == 95 || useWith == 95 && it emUsed == 225) { if (playerLevel[playerHerblore] >= 12) { deleteItem(225, GetItemSlot(225), 1); deleteItem(95, GetItemSlot(95), 1);

addItem(113, 1); addSkillXP(25 * herbXpInc, playerHerblore); startAnimation(1652); } else { showDialogue("You need a Herblore level of 12 to make this."); } } else if (useWith == 592 && itemUsed == 95 || useWith == 95 && it emUsed == 592) { if (playerLevel[playerHerblore] >= 15) { deleteItem(592, GetItemSlot(592), 1); deleteItem(95, GetItemSlot(95), 1); addItem(3408, 1); addSkillXP(25 * herbXpInc, playerHerblore); startAnimation(1652); } else { showDialogue("You need a Herblore level of 15 to make this."); } } else if (useWith == 255 && itemUsed == 227 || useWith == 227 && itemUsed == 255) { if (playerLevel[playerHerblore] >= 22) { deleteItem(255, GetItemSlot(255), 1); deleteItem(227, GetItemSlot(227), 1); addItem(97, 1); addSkillXP(31 * herbXpInc, playerHerblore); startAnimation(1652); } else { showDialogue("You need a Herblore level of 22 to make this."); } } else if (useWith == 97 && itemUsed == 223 || useWith == 223 && i temUsed == 97) { if (playerLevel[playerHerblore] >= 22) { deleteItem(97, GetItemSlot(97), 1); deleteItem(223, GetItemSlot(223), 1); addItem(127, 1); addSkillXP(31 * herbXpInc, playerHerblore); startAnimation(1652); } else { showDialogue("You need a Herblore level of 22 to make this."); }

} else if (useWith == 257 && itemUsed == 227 || useWith == 227 && itemUsed == 257) { if (playerLevel[playerHerblore] >= 30) { deleteItem(257, GetItemSlot(257), 1); deleteItem(227, GetItemSlot(227), 1); addItem(99, 1); addSkillXP(37 * herbXpInc, playerHerblore); startAnimation(1652); } else { showDialogue("You need a Herblore level of 30 to make this."); } } else if (useWith == 239 && itemUsed == 99 || useWith == 99 && it emUsed == 239) { if (playerLevel[playerHerblore] >= 30) { deleteItem(239, GetItemSlot(239), 1); deleteItem(99, GetItemSlot(99), 1); addItem(2432, 1); addSkillXP(37 * herbXpInc, playerHerblore); startAnimation(1652); } else { showDialogue("You need a Herblore level of 30 to make this."); } } else if (useWith == 231 && itemUsed == 99 || useWith == 99 && it emUsed == 231) { if (playerLevel[playerHerblore] >= 38) { deleteItem(231, GetItemSlot(231), 1); deleteItem(99, GetItemSlot(99), 1); addItem(2434, 1); addSkillXP(51 * herbXpInc, playerHerblore); startAnimation(1652); } else { showDialogue("You need a Herblore level of 38 to make this."); } } else if (useWith == 259 && itemUsed == 227 || useWith == 227 && itemUsed == 259) { if (playerLevel[playerHerblore] >= 45) { deleteItem(259, GetItemSlot(259), 1); deleteItem(227, GetItemSlot(227), 1); addItem(101, 1);

addSkillXP(50 * herbXpInc, playerHerblore); startAnimation(1652); } else { showDialogue("You need a Herblore level of 45 to make this."); } } else if (useWith == 221 && itemUsed == 101 || useWith == 101 && itemUsed == 221) { if (playerLevel[playerHerblore] >= 45) { deleteItem(221, GetItemSlot(221), 1); deleteItem(101, GetItemSlot(101), 1); addItem(2436, 1); addSkillXP(50 * herbXpInc, playerHerblore); startAnimation(1652); } else { showDialogue("You need a Herblore level of 45 to make this."); } } else if (useWith == 263 && itemUsed == 227 || useWith == 227 && itemUsed == 263) { if (playerLevel[playerHerblore] >= 55) { deleteItem(263, GetItemSlot(263), 1); deleteItem(227, GetItemSlot(227), 1); addItem(105, 1); addSkillXP(62 * herbXpInc, playerHerblore); startAnimation(1652); } else { showDialogue("You need a Herblore level of 55 to make this."); } } else if (useWith == 225 && itemUsed == 105 || useWith == 105 && itemUsed == 225) { if (playerLevel[playerHerblore] >= 55) { deleteItem(225, GetItemSlot(225), 1); deleteItem(105, GetItemSlot(105), 1); addItem(2440, 1); addSkillXP(62 * herbXpInc, playerHerblore); startAnimation(1652); } else { showDialogue("You need a Herblore level of 55 to make this."); } }

else if (useWith == 3000 && itemUsed == 227 || useWith == 227 && itemUsed == 3000) { if (playerLevel[playerHerblore] >= 63) { deleteItem(3000, GetItemSlot(3000), 1); deleteItem(227, GetItemSlot(227), 1); addItem(3004, 1); addSkillXP(71 * herbXpInc, playerHerblore); startAnimation(1652); } else { showDialogue("You need a Herblore level of 63 to make this."); } } else if (useWith == 223 && itemUsed == 3004 || useWith == 3004 & & itemUsed == 223) { if (playerLevel[playerHerblore] >= 63) { deleteItem(223, GetItemSlot(223), 1); deleteItem(3004, GetItemSlot(3004), 1); addItem(3024, 1); addSkillXP(71 * herbXpInc, playerHerblore); startAnimation(1652); } else { showDialogue("You need a Herblore level of 63 to make this."); } } else if (useWith == 265 && itemUsed == 227 || useWith == 227 && itemUsed == 265) { if (playerLevel[playerHerblore] >= 66) { deleteItem(265, GetItemSlot(265), 1); deleteItem(227, GetItemSlot(227), 1); addItem(107, 1); addSkillXP(75 * herbXpInc, playerHerblore); startAnimation(1652); } else { showDialogue("You need a Herblore level of 66 to make this."); } } else if (useWith == 239 && itemUsed == 107 || useWith == 107 && itemUsed == 239) { if (playerLevel[playerHerblore] >= 66) { deleteItem(239, GetItemSlot(239), 1); deleteItem(107, GetItemSlot(107), 1); addItem(2442, 1); addSkillXP(75 * herbXpInc, playerHerblore);

startAnimation(1652); } else { showDialogue("You need a Herblore level of 66 to make this."); } } else if (useWith == 2998 && itemUsed == 227 || useWith == 227 && itemUsed == 2998) { if (playerLevel[playerHerblore] >= 81) { deleteItem(2998, GetItemSlot(2998), 1); deleteItem(227, GetItemSlot(227), 1); addItem(3002, 1); addSkillXP(90 * herbXpInc, playerHerblore); startAnimation(1652); } else { showDialogue("You need a Herblore level of 81 to make this."); } } else if (useWith == 3002 && itemUsed == 6693 || useWith == 6693 && itemUsed == 3002) { if (playerLevel[playerHerblore] >= 81) { deleteItem(6693, GetItemSlot(6693), 1); deleteItem(3002, GetItemSlot(3002), 1); addItem(6685, 1); addSkillXP(90 * herbXpInc, playerHerblore); startAnimation(1652); } else { showDialogue("You need a Herblore level of 81 to make this."); } } // // if ((itemUsed == 2483) && (useWith == 241)) { if (playerLevel[15] >= 69) { deleteItem(2483, getItemSlot(2483), 1); deleteItem(241, getItemSlot(241), 1); addItem(2454, 1); addSkillXP(158, 15); } else { sendMessage("You need a higher herblore level to make this potion."); } } if ((itemUsed == 221) && (useWith == 2483)) { if (playerLevel[15] >= 69) { deleteItem(2483, getItemSlot(2483), 1); deleteItem(241, getItemSlot(241), 1);

addItem(2454, 1); addSkillXP(158, 15); } else { sendMessage("You need a higher herblore level to make this potion."); } } if ((itemUsed == 2483) && (useWith == 3138)) { if (playerLevel[15] >= 76) { deleteItem(2483, getItemSlot(2483), 1); deleteItem(3138, getItemSlot(3138), 1); addItem(3042, 1); addSkillXP(173, 15); } else { sendMessage("You need a higher herblore level to make this potion."); } } if ((itemUsed == 3138) && (useWith == 2483)) { if (playerLevel[15] >= 76) { deleteItem(2483, getItemSlot(2483), 1); deleteItem(3138, getItemSlot(3138), 1); addItem(3042, 1); addSkillXP(173, 15); } else { sendMessage("You need a higher herblore level to make this potion."); } } break; // walkTo commands case 248: // map walk (has additional 14 bytes added to the end wi th some junk // data) packetSize -= 14; // ignore the junk case 164: // regular walk case 98: cookItemAmt = 0; cookDelay = 0; if(System.currentTimeMillis() - lastWalk < walkDelay) break; if(bot) break; resetWithWalk(); playerSEW = GetWalkEmote(playerEquipment[playerWeapon], getItemName(playerEquipm ent[playerWeapon])); if(alchDelay >= 1) { teleportToX = absX; teleportToY = absY; } // walk on command if (randomed) break; if (!antiHax()) break; setSidebarInterface(3, 3213); // backpack tab

tradeRequested = false; if (miningEss == true) { miningEss = false; resetAnimation(); break; } if (inTrade) break; resetAction(); if (!validClient) { sendMessage("You can't move on this account"); break; } if (duelFight && (duelRule[5] || duelRule[9])) { sendMessage("You cannot retreat during this duel !"); break; } if (fighting) { client enemy = (client) handler.players[fightId] ; // sendMessage("attack=" + fightId + ", hits=" + hits + ", // fighting=" + fighting); if ((fightId > 0) && (enemy != null) && (hits < 3) && (enemy.hits < 3) && inRange(e nemy.absX, enemy.absY)) { sendMessage("You cannot retreat during t he first 3 rounds of combat!"); break; } else if (((fightId > 0) && (enemy != null) && fighting) || (!inRange(enemy.absX, enemy.a bsY))) { fighting = false; enemy.fighting = false; hits = 0; enemy.hits = 0; } else { fighting = false; hits = 0; } } IsAttackingNPC = false; attacknpc = -1; closeInterface(); resetAnimation(); if (deathStage == 0) { newWalkCmdSteps = packetSize - 5; if (newWalkCmdSteps % 2 != 0) { println_debug("Warning: walkTo(" + packe tType + ") command malformed: " + misc.Hex(inStream.buff er, 0, packetSize)); } newWalkCmdSteps /= 2; if (++newWalkCmdSteps > walkingQueueSize) {

println_debug("Warning: walkTo(" + packe tType + ") command contains to o many steps (" + newWalkCmdSteps + ")." ); newWalkCmdSteps = 0; break; } int firstStepX = inStream.readSignedWordBigEndia nA(); int tmpFSX = firstStepX; firstStepX -= mapRegionX * 8; for (i = 1; i < newWalkCmdSteps; i++) { newWalkCmdX[i] = inStream.readSignedByte (); newWalkCmdY[i] = inStream.readSignedByte (); tmpNWCX[i] = newWalkCmdX[i]; tmpNWCY[i] = newWalkCmdY[i]; } newWalkCmdX[0] = newWalkCmdY[0] = tmpNWCX[0] = t mpNWCY[0] = 0; int firstStepY = inStream.readSignedWordBigEndia n(); int tmpFSY = firstStepY; firstStepY -= mapRegionY * 8; newWalkCmdIsRunning = inStream.readSignedByteC() == 1; if (isInWilderness(absX, absY, 1)) newWalkCmdIsRunning = false; for (i = 0; i < newWalkCmdSteps; i++) { newWalkCmdX[i] += firstStepX; newWalkCmdY[i] += firstStepY; } poimiY = firstStepY; poimiX = firstStepX; // stairs check if (stairs > 0) { resetStairs(); } // woodcutting check if (woodcutting[0] > 0) { // playerEquipment[playerWeapon] = Origi nalWeapon; // OriginalWeapon = -1; resetAnimation(); resetWC(); } // pick up item check if (WannePickUp == true) { PickUpID = 0; PickUpAmount = 0; PickUpDelete = 0; WannePickUp = false; } // attack check

if (IsAttacking == true) { ResetAttack(); } // attack NPC check if (IsAttackingNPC == true) { ResetAttackNPC(); } // mining check if (mining[0] > 0) { resetAnimation(); resetMI(); } // smithing check if (smithing[0] > 0) { /* * playerEquipment[playerWeapon] = Origi nalWeapon; * OriginalWeapon = -1; playerEquipment[ playerShield] = * OriginalShield; OriginalShield = -1; */ updateRequired = true; appearanceUpdateRequired = true; resetAnimation(); resetSM(); RemoveAllWindows(); } // Npc Talking if (NpcDialogue > 0) { NpcDialogue = 0; NpcTalkTo = 0; NpcDialogueSend = false; RemoveAllWindows(); } // banking if (IsBanking == true) { RemoveAllWindows(); } // shopping if (IsShopping == true) { IsShopping = false; MyShopID = 0; UpdateShop = false; RemoveAllWindows(); } // trading // firemaking check if (firemaking[0] > 0) { playerEquipment[playerWeapon] = Original Weapon; OriginalWeapon = -1; playerEquipment[playerShield] = Original Shield; OriginalShield = -1; resetAnimation(); resetFM(); } } break;

case 4: // regular chat if (!validClient) { sendMessage("Please use another client"); break; } if (muted) break; MBTC = misc.textUnpack(chatText, packetSize - 2); MBBC = misc.textUnpack(chatText, packetSize - 2); MBHT = misc.textUnpack(chatText, packetSize - 2); MBID = misc.textUnpack(chatText, packetSize - 2); chatTextEffects = inStream.readUnsignedByteS(); chatTextColor = inStream.readUnsignedByteS(); chatTextSize = (byte) (packetSize - 2); inStream.readBytes_reverseA(chatText, chatTextSize, 0); chatTextUpdateRequired = true; println_debug("Text [" + chatTextEffects + "," + chatTex tColor + "]: " + misc.textUnpack(chatText, pack etSize - 2));

break; case 14: // Use something on another player junk2 = inStream.readSignedWordBigEndianA(); // only nee ded to // get the cracker // slot ! (remove = // server crash !) junk = inStream.readSignedWordBigEndian(); // only neede d to get // the cracker slot ! // (remove = server // crash !) junk3 = inStream.readUnsignedWordA(); // only needed to get the // cracker slot ! (remove = // server crash !) int CrackerSlot = inStream.readSignedWordBigEndian(); // if(CrackerSlot >= playerItems.length){ // break; // } int CrackerID = playerItems[CrackerSlot]; CrackerID -= 1; // Only to fix the ID ! if ((CrackerID == 962) && playerHasItem(962)) { sendMessage("You crack the cracker..."); int UsedOn = (int) (misc.HexToInt(inStream.buffe r, 3, 1) / 1000); PlayerHandler.players[UsedOn].CrackerMsg = true; deleteItem(CrackerID, CrackerSlot, playerItemsN[ CrackerSlot]); if (misc.random(2) == 1) { addItem(Item.randomPHat(), 1);

sendMessage("And you get the crackers it em."); } else { sendMessage("but you didn't get the crac kers item."); PlayerHandler.players[UsedOn].CrackerFor Me = true; } } break; // TODO: implement those properly - execute commands only until we // walked to this object! // atObject commands /* * <Dungeon> Trapdoors: ID 1568, 1569, 1570, 1571 Ladders: ID 17 59, 2113 * Climb rope: 1762, 1763, 1764 */ case 101: // Character Design Screen if (!antiHax()) break; int[] input = new int[13]; int highest = -1, numZero = -1, num44 = 0; for (int b = 0; b < 13; b++) { input[b] = inStream.readSignedByte(); println("C: " + b + " " + input[b]); if (input[b] > highest) highest = input[b]; if (input[b] < 1) numZero++; if (input[b] < 0) // bakatool female fix. input[b] = 0; if (input[b] == 44) num44++; } if ((highest < 1) || (num44 == 7)) { if (uid > 1) server.bannedUid.add(new Integer(uid)); isKicked = true; break; } pGender = input[0]; println("gender " + pGender); pHead = input[1]; pBeard = input[2]; // aka Jaw :S -bakatool pTorso = input[3]; pArms = input[4]; pHands = input[5]; pLegs = input[6]; pFeet = input[7]; pHairC = input[8]; pTorsoC = input[9]; pLegsC = input[10];

pFeetC = input[11]; pSkinC = input[12]; playerLook[0] = input[0]; // pGender -bakatool playerLook[1] = input[8]; // hairC -bakatool playerLook[2] = input[9]; // torsoC -bakatool playerLook[3] = input[10]; // legsC -bakatool playerLook[4] = input[11]; // feetC -bakatool playerLook[5] = input[12]; // skinC -bakatool apset = true; appearanceUpdateRequired = true; lookUpdate = true; break; case 132: int objectX = inStream.readSignedWordBigEndianA(); int objectID = inStream.readUnsignedWord(); int objectY = inStream.readUnsignedWordA(); int face = 0; int face2 = 0; int GateID = 1; if (!validClient || randomed) break; if (!antiHax()) break; if (debug || (playerRights > 1)) { println("serverobjs size " + server.objects.size ()); println_debug("atObject: " + objectX + "," + obj ectY + " objectID: " + objectID); // 147 might be id for // object state changing } int xDiff = Math.abs(absX - objectX); int yDiff = Math.abs(absY - objectY); boolean found = false; resetAction(false); TurnPlayerTo(objectX, objectY); updateRequired = true; appearanceUpdateRequired = true; if ((xDiff > 5) || (yDiff > 5)) { // sendMessage("Client hack detected!"); break; } if (objectID == 2107) { if (System.currentTimeMillis() - server.lastRuni te < 60000) { println("invalid timer"); break; } } if (misc.random(100) == 1) { triggerRandom(); break; } //start of agility if(objectID == 2288 && System.currentTimeMillis() - lastAction > actionInterval && absX == 3004 && absY == 3937){ if(playerLevel[16] >= 70){

agilitycourse2 = 1; Walk(0,13,746); addSkillXP(150, 16); actionInterval = 2500; lastAction = System.currentTimeMillis(); } else sendMessage("You need at least 70 agility to use this."); } if(objectID == 2283){ if(absX == 3005 && absY == 3953){ agilitycourse2 = 2; Walk(0,5,2753); addSkillXP(200,16); } } if(objectID == 2311 && System.currentTimeMillis() - lastAction > actionInterval && absX == 3002 && absY == 3960){ if(playerLevel[16] >= 70){ Walk(-6,0,2588); addSkillXP(150, 16); actionInterval = 2500; agilitycourse2 = 3; lastAction = System.currentTimeMillis(); } else sendMessage("You need at least 70 agility to use this."); } if(objectID == 2297 && System.currentTimeMillis() - lastAction > actionInterval && absX == 3002 && absY == 3945){ if(playerLevel[16] >= 70){ Walk(-8,0,762); addSkillXP(500, 16); actionInterval = 2500; agilitycourse2 = 4; lastAction = System.currentTimeMillis(); } else sendMessage("You need at least 70 agility to use this."); } if(objectID == 2328 && System.currentTimeMillis() - lastAction > actionInterval) { if(playerLevel[16] >= 70){ Walk(0,-4,3063); addSkillXP(400, 16); addSkillXP(400, 16); agilitycourse2 = 0; actionInterval = 2500; sendMessage("You finished an agility trip of wilderness."); lastAction = System.currentTimeMillis(); } else sendMessage("You need at least 70 agility to use this."); }

//end of agility if (objectID == 2295) {

if (absX == 2474 && absY if (System.currentTimeMillis()-lastAction >= 2000) { lastAction = System.currentTimeMillis(); playerSEW = 762; walkTo_old(2474, 3429); addSkillXP(1120, 16); agilitycourse1 = 1; }}} if (objectID == 2285) { if (absX == 2474 && absY if (System.currentTimeMillis()-lastAction >= 2000) { lastAction = System.currentTimeMillis(); teleportToX = 2474; teleportToY = 3424; heightLevel = 1; addSkillXP(1050, 16); agilitycourse1 = 2; }}} if (objectID == 2313) { if (absX == 2473 && absY if (System.currentTimeMillis()-lastAction >= 2000) { lastAction = System.currentTimeMillis(); teleportToX = 2473; teleportToY = 3420; heightLevel = 2; addSkillXP(900, 16); agilitycourse1 = 3; } }} if (objectID == 2312) { if (absX == 2477 && absY if (System.currentTimeMillis()-lastAction >= 2000) { lastAction = System.currentTimeMillis(); walkTo_old(2483, 3420); playerSEW = 762; addSkillXP(800, 16); agilitycourse1 = 4;

== 3436) {

== 3426) {

== 3423) {

== 3420) {

} }} if (objectID == 2314) { if (absX == 2485 && absY == 3419) { if (System.currentTimeMillis()-lastAction >= 2000) { lastAction = System.currentTimeMillis(); teleportToX = 2485; teleportToY = 3421; heightLevel = 0; addSkillXP(700, 16); agilitycourse1 = 5; } }} if (objectID == 2286) { if (absX == 2485 && absY == 3425) { if (System.currentTimeMillis()-lastAction >= 2000) { lastAction = System.currentTimeMillis(); teleportToX = 2485; teleportToY = 3427; heightLevel = 0; addSkillXP(600, 16);

agilitycourse1 = 6; } }} if (objectID == 154) { if (absX == 2484 && absY == 3430) { if (System.currentTimeMillis()-lastAction >= 2000) { lastAction = System.currentTimeMillis(); walkTo_old(2484, 3437); playerSEW = 746; if(agilitycourse1 == 6) { int tickets = (int)(double)(1+playerLevel[16]*0.1); addSkillXP(500, 16); addItem(2996,tickets); agilitycourse1 = 0; } else { addSkillXP(185, 16); } }} } if (objectID == 4058) { if (absX == 2487 && absY == 3430) { if (System.currentTimeMillis()-lastAction >= 2000) { lastAction = System.currentTimeMillis(); walkTo_old(2487, 3437); if(agilitycourse1 == 6) { addSkillXP(500, 16); int tickets = (int)(double)(1+playerLevel[16]*0.1); addItem(2996,tickets); agilitycourse1 = 0; } else { addSkillXP(185, 16); } }} } //end of agility //start of wildagility //end of agility server.runecrafting.AbyssRift(objectID, playerId); server.runecrafting.ClickToCraft(objectID, playerId); if ((objectID == 1733) && (objectX == 2724) && (objectY == 3374)) { if (!premium) resetPos(); teleportToX = 2727; teleportToY = 9774; heightLevel = 0; break; } if (objectID == 12389 && objectX == 2847 && objectY == 2997) { if (playerHasItem(1546)) { teleportToX = 2739; teleportToY = 9506; updateRequired = true; } sendMessage("You need a blue key to enter.");

break; } if (objectID == 2492) { triggerTele(2606, 3092, 0, false); break; } if ((objectID == 1734) && (objectX == 2724) && (objectY == 9774)) { if (!premium) resetPos(); teleportToX = 2723; teleportToY = 3375; heightLevel = 0; break; }

if ((objectID == 375) && (((objectX == 2593) && (objectY == 31 08)) || ((objectX == 2593) && (objectY == 3108)))) { if (System.currentTimeMillis() - lastAction < (1 000 + misc .random(200))) { sendMessage("You can't try that often!") ; lastAction = System.currentTimeMillis(); break; } if (playerLevel[playerThieving] < 55) { sendMessage("You must be level 55 thievi ng to open this chest"); break; } lastAction = System.currentTimeMillis(); if (System.currentTimeMillis() - handler.lastChe st >= 15000) { handler.lastChest = System.currentTimeMi llis(); double roll = Math.random() * 100; if (roll < 0.3) { int[] items = { 2577, 2580, 2631 , 2581, 6889, 3840, 2597 }; int r = (int) (Math.random() * i tems.length); sendMessage("You have recieved a " + getItemName(it ems[r]) + "!"); addItem(items[r], 1); } else { int coins = misc.random(7000); sendMessage("You find " + coins + " coins inside the chest"); addItem(995, coins); } for (int p = 0; p < PlayerHandler.maxPla yers; p++) { client player = (client) server.

playerHandler.players[p]; if (player == null) continue; if ((player.playerName != null) && (player.heigh tLevel == heightLevel) && !player.disco nnected && (Math.abs(pla yer.absY - absY) < 30) && (Math.abs(pla yer.absX - absX) < 30)) { player.stillgfx(444, obj ectY, objectX); } } } else { sendMessage("The chest is empty!"); } } if ((objectID == 6420) && premium) { if (System.currentTimeMillis() - lastAction < (1 000 + misc .random(200))) { sendMessage("You can't try that often!") ; lastAction = System.currentTimeMillis(); break; } if (playerLevel[playerThieving] < 85) { sendMessage("You must be level 85 thievi ng to open this chest"); break; } if (!premium) { resetPos(); } lastAction = System.currentTimeMillis(); if (System.currentTimeMillis() - handler.lastChe st2 >= 15000) { handler.lastChest2 = System.currentTimeM illis(); double roll = Math.random() * 100; if (roll < 0.3) { int[] items = { 1050, 2637, 2631 , 2635, 2641 }; int r = (int) (Math.random() * i tems.length); sendMessage("You have recieved a " + getItemName(it ems[r]) + "!"); addItem(items[r], 1); } else { int coins = misc.random(17000); sendMessage("You find " + coins + " coins inside the chest"); addItem(995, coins); }

for (int p = 0; p < PlayerHandler.maxPla yers; p++) { client player = (client) server. playerHandler.players[p]; if (player == null) continue; if ((player.playerName != null) && (player.heigh tLevel == heightLevel) && !player.disco nnected && (Math.abs(pla yer.absY - absY) < 30) && (Math.abs(pla yer.absX - absX) < 30)) { player.stillgfx(444, obj ectY, objectX); } } } else { sendMessage("The chest is empty!"); } } // FACE: 0= WEST | -1 = NORTH | -2 = EAST | -3 = SOUTH // ObjectType: 0-3 wall objects, 4-8 wall decoration, 9: diag. // walls, 10-11 world objects, 12-21: roofs, 22: floor d ecoration for (int d = 0; d < server.doorHandler.doorX.length; d++ ) { DoorHandler dh = server.doorHandler; if ((objectID == dh.doorId[d]) && (objectX == dh .doorX[d]) && (objectY == dh.doorY[d])) { int newFace = -3; if (dh.doorState[d] == 0) { // closed newFace = dh.doorFaceOpen[d]; dh.doorState[d] = 1; dh.doorFace[d] = newFace; } else { newFace = dh.doorFaceClosed[d]; dh.doorState[d] = 0; dh.doorFace[d] = newFace; } for (int p = 0; p < PlayerHandler.maxPla yers; p++) { client player = (client) server. playerHandler.players[p]; if (player == null) continue; if ((player.playerName != null) && (player.heigh tLevel == heightLevel) && !player.disco nnected && (player.absY > 0) && (player.absX > 0)) { player.ReplaceObject(dh.

doorX[d], dh.doorY[d], dh.doorI d[d], newFace, 0); } } } } /* * if(objectID == 1530){ if(objectX == 2716 && objectY = = 3472){ * ReplaceObject(2716, 3472, 1530, -3, 0); } } */ if (objectID == 2290) { if ((objectX == 2576) && (objectY == 9506)) { teleportToX = 2572; teleportToY = 9507; } else if ((objectX == 2573) && (objectY == 9506 )) { teleportToX = 2578; teleportToY = 9506; } } if ((objectID == 3443) && (objectX == 3440) && (objectY == 9886)) { // Holy barrier to canifis -bakatool teleportToX = 3422; teleportToY = 3484; } if (objectID == 2491) { if(playerLevel[14] >= 1) { setAnimation(0x554); miningEss = true; sendMessage("You swing your pick axe at the rock..."); updateRequired = true; appearanceUpdateRequired = true; } else { sendMessage("You need a mining level of 1 to mine this rock"); }} if ((objectID == 3432) && (objectX == 3422) && (objectY == 3485)) { // canifis to holy barrier -bakatool teleportToX = 3440; teleportToY = 9887; } if (objectID == 2321) { if (playerHasItem(1544)) { teleportToX = 2598; teleportToY = 9495; } else { sendMessage("You need an orange key to c ross"); } } if (objectID == 1754) { if (playerHasItem(1543)) { teleportToX = 2601; teleportToY = 9478; } else {

sendMessage("You need an red key to ente r"); } } if (objectID == 2318) { teleportToX = 2621; teleportToY = 9496; updateRequired = true; } if (objectID == 1759) {//dungeon if(objectX == 2884 && objectY == 3397) { if(playerRights > 0) { teleportToX = 2884; teleportToY = 9798; heightLevel = 0; updateRequired = true; } else { text1(false, "Slayer is under testing stage."); } } else { teleportToX = 2867; teleportToY = 9938; heightLevel = 0; updateRequired = true; } } if (objectID == 10251) {//ice cave teleportToX = 2884; teleportToY = 9798; heightLevel = 0; updateRequired = true; } if (objectID == 2804) { teleportToX = 2884; teleportToY = 9798; heightLevel = 0; updateRequired = true; } if (objectID == 2634) { teleportToX = 2840; teleportToY = 3517; updateRequired = true; } if (objectID == 2156) { teleportToX = 2902; teleportToY = 4820; heightLevel = 0; updateRequired = true; } if (objectID == 2158) { teleportToX = 2902; teleportToY = 4820; heightLevel = 0; updateRequired = true; } if (objectID == 1728) { teleportToX = 2614; teleportToY = 9505;

updateRequired = true; } if (objectID == 3828) { // Kalphite teleportToX = 3484; teleportToY = 9509; heightLevel = 2; sendMessage("You Climb down the Cave entrance.") ; break; } if (objectID == 3829) { // Kalphite teleportToX = 2721; teleportToY = 3455; heightLevel = 0; sendMessage("You Climb out of the Cave."); break; }

if (objectID == 1733 && objectX == 2603 && objectY == 30 78) { if (playerLevel[playerMining] >= 60) { teleportToX = 3058; teleportToY = 9776; heightLevel = 0; updateRequired = true; } else { sendMessage("You need 60 minning to enter the mining guild."); } } if (objectID == 1734 && objectX == 3059 && objectY == 97 76) { teleportToX = 2606; teleportToY = 3079; updateRequired = true; } if ((objectID == 6836) && (System.currentTimeMillis() - lastAct ion >= (2000 + misc .random(200)))) { if (!(((objectX == 2604) || (objectX == 2606) || (objectX == 2608)) && (objectY == 3104))) { resetPos(); break; } lastAction = System.currentTimeMillis(); EntangleDelay = 6; stealtimer = 5; // snaretimer = 5; actionTimer = 4; setAnimation(881); addSkillXP(185, 17); AnimationReset = true; updateRequired = true; appearanceUpdateRequired = true; } if (objectID == 881) { heightLevel -= 1; }

if ((objectID == 1591) && (objectX == 3268) && (objectY == 3435)) { if (combatLevel >= 80) { teleportToX = 2540; teleportToY = 4716; } else { sendMessage("You need to be level 80 or above to enter the mage arena."); sendMessage("The skeletons at the varroc k castle are a good place until then."); } } if ((objectID == 5960) && (objectX == 2539) && (objectY == 4712)) { teleportToX = 3105; teleportToY = 3933; } // Wo0t Tzhaar Objects if ((objectID == 9369) && (objectX == 2399) && (objectY == 5176)) { // Hot vent door A if (absY == 5177) { teleportToX = 2399; teleportToY = 5175; } } if ((objectID == 9369) && (objectX == 2399) && (objectY == 5176)) { // Hot vent door AA if (absY == 5175) { teleportToX = 2399; teleportToY = 5177; } } if ((objectID == 9368) && (objectX == 2399) && (objectY == 5168)) { // Hot vent door B if (absY == 5169) { teleportToX = 2399; teleportToY = 5167; } } if ((objectID == 9368) && (objectX == 2399) && (objectY == 5168)) { // Hot vent door BB if (absY == 5167) { teleportToX = 2399; teleportToY = 5169; } } if ((objectID == 9391) && (objectX == 2399) && (objectY == 5172)) { // Tzhaar Fight bank

openUpBank(); } if ((objectID == 9356) && (objectX == 2437) && (objectY == 5166)) { // Tzhaar Jad Cave Enterance teleportToX = 2413; teleportToY = 5117; sendMessage("You have entered the Jad Cave."); } if ((objectID == 9357) && (objectX == 2412) && (objectY == 5118)) { // Tzhaar Jad Cave Exit teleportToX = 2438; teleportToY = 5168; sendMessage("You have left the Jad Cave."); }

// End of Tzhaar Objects if (objectID == 2213) { // Bank Booth if (duelFight == true) { sendMessage("Sorry you cant open you ban k in duel!"); } else { skillX = objectX; skillY = objectY; NpcWanneTalk = 2; } } if (objectID == 6552) { // Ancient magic altar (temp !!!) if (GoodDistance(absX, absY, objectX, objectY, 1 ) == true) { if (playerAncientMagics == true) { // setSidebarInterface(6, 1151); // magic tab (ancient = // 12855); // playerAncientMagics = false; } else { setSidebarInterface(6, 12855); / / magic tab (ancient = // 12855); playerAncientMagics = true; } } } // // // if woodCutting mining if (actionTimer == 0) { (CheckObjectSkill(objectID) == true) { IsUsingSkill = true; skillX = objectX; skillY = objectY;

} // } // go upstairs if (true) {

if ((objectID == 1747) || (objectID == 1750)) { stairs = 1; skillX = objectX; skillY = objectY; stairDistance = 1; } else if (objectID == 1738) { stairs = 1; skillX = objectX; skillY = objectY; stairDistance = 2; } else if (objectID == 1722) { stairs = 21; skillX = objectX; skillY = objectY; stairDistance = 2; stairDistanceAdd = 2; } else if (objectID == 55) { stairs = 15; skillX = objectX; skillY = objectY; stairDistance = 3; stairDistanceAdd = 1; } else if (objectID == 57) { stairs = 15; skillX = objectX; skillY = objectY; stairDistance = 3; } else if ((objectID == 1755) || (objectID == 59 46) || (objectID stairs = 4; skillX = objectX; skillY = objectY; stairDistance = 1; if (objectID == 1764) stairs = 12; skillX = objectX; skillY = objectY; stairDistance = 1; if (objectID == 2148) stairs = 8; skillX = objectX; skillY = objectY; stairDistance = 1; if (objectID == 3608) stairs = 13; skillX = objectX; skillY = objectY; stairDistance = 1; if (objectID == 2408) stairs = 16; skillX = objectX; skillY = objectY; stairDistance = 1; if (objectID == 5055) stairs = 18; skillX = objectX; skillY = objectY; stairDistance = 1; == 1757)) {

} else

} else

} else

} else

} else

} else if (objectID == 5131) { stairs = 20; skillX = objectX; skillY = objectY; stairDistance = 1; } else if (objectID == 9359) { stairs = 24; skillX = objectX; skillY = objectY; stairDistance = 1; stairDistance = 1; } else if (objectID == 2406) { /* Lost City Door */ if (playerEquipment[playerWeapon] == 772 ) { // Dramen Staff stairs = 27; skillX = objectX; skillY = objectY; stairDistance = 1; } else { // Open Door } } // go downstairs if ((objectID == 1746) || (objectID == 1749)) { stairs = 2; skillX = objectX; skillY = objectY; stairDistance = 1; } else if (objectID == 1740) { stairs = 2; skillX = objectX; skillY = objectY; stairDistance = 1; } else if (objectID == 1723) { stairs = 22; skillX = objectX; skillY = objectY; stairDistance = 2; stairDistanceAdd = 2; } else if (objectID == 54) { stairs = 14; skillX = objectX; skillY = objectY; stairDistance = 3; stairDistanceAdd = 1; } else if (objectID == 56) { stairs = 14; skillX = objectX; skillY = objectY; stairDistance = 3; } else if ((objectID == 1568) || (objectID == 59 47) || (objectID == 6434) || (objectID == 1570)) { stairs = 3; skillX = objectX; skillY = objectY;

stairDistance = 1; } else if (objectID == 2025) { // Mining guild stairs if (playerLevel[playerFishing] >= 50) { teleportToX = 2611; teleportToY = 3394; } else { sendMessage("You need 50 Fishing to enter the Fishing guild."); } } else if (objectID == 492) { stairs = 11; skillX = objectX; skillY = objectY; stairDistance = 2; } else if (objectID == 2147) { stairs = 7; skillX = objectX; skillY = objectY; stairDistance = 1; } else if (objectID == 5054) { stairs = 17; skillX = objectX; skillY = objectY; stairDistance = 1; } else if (objectID == 5130) { stairs = 19; skillX = objectX; skillY = objectY; stairDistance = 1; } else if (objectID == 9358) { stairs = 23; skillX = objectX; skillY = objectY; stairDistance = 1; } else if (objectID == 5488) { stairs = 28; skillX = objectX; skillY = objectY; stairDistance = 1; } if ((skillX > -1) && (skillY > -1)) { IsUsingSkill = true; } } break; case 252: // atObject2 objectID = inStream.readUnsignedWordBigEndianA(); // 529 2 // bankwindow objectY = inStream.readSignedWordBigEndian(); objectX = inStream.readUnsignedWordA(); if (debug || (playerRights > 1)) println_debug("atObject2: " + objectX + "," + ob jectY + " objectID: " + objectID); if (!antiHax())

break; long now = System.currentTimeMillis(); boolean oFound = false; if ((objectID == 2646) && ((absX >= 2735) && (absX <= 27 52)) && ((absY >= 3435) && (absY <= 3453))) { if (now - lastAction >= 900) { addItem(1779, 1); lastAction = now; startAnimation(2286); } } if ((objectID == 2644) && (objectX == 2710) && (objectY == 3471)) { spinning = true; pEmote = 894; updateRequired = true; appearanceUpdateRequired = true; } if (GoodDistance(objectX, objectY, absX, absY, 2) == true) { if (objectID == 823) { if(playerEquipment[playerWeapon] == -1 && playerEquipment[playerShield] == -1) { if (System.currentTimeMillis()-lastAction >= 2000) { lastAction = System.currentTimeMillis(); if(playerLevel[SkillID] < 15) { sendMessage("You Hit the dummy...."); } else { sendMessage("Nothing Happend!"); } if(FightType == 1 && playerLevel[SkillID] < 15) { addSkillXP(100, SkillID); setAnimation(422); animationReset = System.currentTimeMillis()+1000; sendMessage("And recive some Attack experience!"); } if(FightType == 4 && playerLevel[SkillID] < 15) { addSkillXP(100, SkillID); setAnimation(422); animationReset = System.currentTimeMillis()+1000; sendMessage("And recive some Defence experience!"); } if(FightType == 2 && playerLevel[SkillID] < 15) { addSkillXP(100, SkillID); setAnimation(423); animationReset = System.currentTimeMillis()+1500; sendMessage("And recive some Strength experience!"); }}} else sendMessage("You need to unequipt your sheild and weapon!"); }} if ((objectID == 2213) || (objectID == 2214) || (objectI D == 3045) || (objectID == 5276) || (objectID == 60 84)) { if (duelFight == true) { sendMessage("You may not use your bank w hen ur in duel"); } else { skillX = objectX; skillY = objectY;

WanneBank = 1; } } /* * else if (objectID == 1739) { heightLevel += 1; telepo rtToX = * absX; teleportToY = absY; } */ break; case 70: // atObject3 objectX = inStream.readSignedWordBigEndian(); objectY = inStream.readUnsignedWord(); objectID = inStream.readUnsignedWordBigEndianA(); if (debug) println_debug("atObject3: " + objectX + "," + ob jectY + " objectID: " + objectID); boolean oooFound = false; for (Object o : server.objects) { if ((o.type == 3) && (objectX == o.x) && (object Y == o.y) && (objectID == o.id)) { oooFound = true; break; } } if (!oooFound && adding) server.objects.add(new Object(objectID, objectX, objectY, 3)); if (oooFound && (objectID == 1739)) { heightLevel -= 1; teleportToX = absX; teleportToY = absY; } break; case 95: // update chat Tradecompete = inStream.readUnsignedByte(); Privatechat = inStream.readUnsignedByte(); Publicchat = inStream.readUnsignedByte(); for (int i1 = 1; i1 < handler.maxPlayers; i1++) { if ((handler.players[i1] != null) && (handler.players[i1].isActive == true)) { handler.players[i1].pmupdate(playerId, G etWorld(playerId)); } } break; case 188: // add friend friendUpdate = true;

long friendtoadd = inStream.readQWord(); boolean CanAdd = true; for (long element : friends) { if ((element != 0) && (element == friendtoadd)) { CanAdd = false; sendMessage(friendtoadd + " is already i n your friendlist."); } } if (CanAdd == true) { for (int i1 = 0; i1 < friends.length; i1++) { if (friends[i1] == 0) { friends[i1] = friendtoadd; for (int i2 = 1; i2 < handler.ma xPlayers; i2++) { if ((handler.players[i2] != null) && handl er.players[i2].isActive && (misc .playerNameToInt64(handler.players[i2].playerName) == friendtoadd)) { if ((playerRight s >= 2) || (handler.players[i2].Privatechat == 0) || ((handler.players[i2].Privatechat == 1) && handler.players[i2] .isinpm(misc .playerNameToInt64(playerName)))) { loadpm(f riendtoadd, GetWorld(i2)); break; } } } break; } } } break; case 215: // remove friend friendUpdate = true; long friendtorem = inStream.readQWord(); for (int i1 = 0; i1 < friends.length; i1++) { if (friends[i1] == friendtorem) { friends[i1] = 0; break; } } break; case 133:

// add ignore friendUpdate = true; long igtoadd = inStream.readQWord(); for (int i10 = 0; i10 < ignores.length; i10++) { if (ignores[i10] == 0) { ignores[i10] = igtoadd; break; } } break; case 74: // remove ignore friendUpdate = true; long igtorem = inStream.readQWord(); for (int i11 = 0; i11 < ignores.length; i11++) { if (ignores[i11] == igtorem) { ignores[i11] = 0; break; } } break; case 126: // pm message long friendtosend = inStream.readQWord(); byte pmchatText[] = new byte[100]; int pmchatTextSize = (byte) (packetSize - 8); inStream.readBytes(pmchatText, pmchatTextSize, 0); for (long element : friends) { if (element == friendtosend) { boolean pmsent = false; for (int i2 = 1; i2 < handler.maxPlayers ; i2++) { if ((handler.players[i2] != null ) && handler.playe rs[i2].isActive && (misc .playerNameToInt64(handler.players[i2].playerName) == friendtosend)) { if ((playerRights >= 2) || (hand ler.players[i2].Privatechat == 0) || ((han dler.players[i2].Privatechat == 1) && handler.players[i2] .isinpm(misc .playerNameToInt64(playerName)))) { handler.players[ i2].sendpm(misc .playerNameToInt64(playerName), playerRights, pmchatText,

pmchatTextSize); pmsent = true; } break; } } if (!pmsent) { sendMessage("Player currently no t available"); break; } } } break; case 236: // pickup item int itemY = inStream.readSignedWordBigEndian(); int itemID = inStream.readUnsignedWord(); int itemX = inStream.readSignedWordBigEndian(); int offsetX = itemX-absX; int offsetY = itemY-absY; if(offsetX < 0) { offsetX = offsetX*-1; } if(offsetY < 0) { offsetY = offsetY*-1; } if(offsetX > 5 || offsetY > 5) { break; } if(hasSpace()) { apickupid = itemID; apickupx = itemX; apickupy = itemY; } else { sendMessage("Not enough space in your inventory"); } break; case 73: // Attack (Wilderness) if (!antiHax()) break; if (actionTimer == 0) { AttackingOn = inStream.readSignedWordBigEndian() ; if ((AttackingOn >= handler.players.length) || (AttackingOn < 1)) { AttackingOn = -1; IsAttacking = false; break; } IsAttacking = true; actionTimer = 6; } break; case 75:

// Phate: attackPlayer int pIndex = inStream.readUnsignedWordBigEndian(); if (!antiHax()) break; if ((pIndex >= handler.players.length) || (pIndex < 1)) { break; } duelPlayer(pIndex); break; case 128: // Trade Request int temp = inStream.readUnsignedWord(); if (!antiHax()) break; if (!inTrade) { trade_reqId = temp; tradeReq(trade_reqId); } break; case 153: // Duel req int PID = (misc.HexToInt(inStream.buffer, 0, packetSize) / 1000); client plyr = getClient(PID); if (!validClient(PID)) break; duelReq(PID); break; case 139: // Trade answer // WanneTradeWith = inStream.readSignedWordBigEndian(); // WanneTrade = 2; trade_reqId = inStream.readSignedWordBigEndian(); tradeReq(trade_reqId); break; case 199: // fags using xero's client sendMessage("Please use another client to play."); validClient = false; disconnected = true; break; // break; int int int int int case 237: castOnSlot = inStream.readSignedWord(); castOnItem = inStream.readSignedWordA(); e3 = inStream.readSignedWord(); castSpell = inStream.readSignedWordA(); alchvaluez = (int)Math.floor(GetItemShopValue(castOnItem, 0, castOnS

lot)); switch(castOnItem) { case 4315: case 4317: case 4319: case 4321:

case 4323: case 4325: case 4327: case 4329: case 4331: case 4333: case 4335: case 4337: case 4339: case 4341: case 4343: case 4345: case 4347: case 4349: case 4351: case 4353: case 4355: case 4357: case 2415: case 2416: case 2417: case 1419: case 2583: case 2585: case 2587: case 2589: case 2591: case 2593: case 2595: case 2597: case 2599: case 2601: case 2603: case 2605: case 2607: case 2609: case 2611: case 2613: case 2615: case 2617: case 2619: case 2621: sendMessage("You can't alch "+getItemName(castOnItem)+""); break; default: if (castSpell == 1178 && playerHasItem(561, 1)) { deleteItem(castOnItem, castOnSlot, 1); addItem(995, alchvaluez * 2); addSkillXP(600, 6); startAnimation(713); gfx100(113); resetanim = 12; deleteItem(561, getItemSlot(561), 1); actionTimer = 9; AnimationReset = true; updateRequired = true; appearanceUpdateRequired = true; sendFrame106(6); //this will make it appear back to mage book

}} break; case 249: // Magic on Players int playerIndex = inStream.readSignedWordA(); int playerMagicID = inStream.readSignedWordBigEndian(); // A Bunch of checks to make sure player is not a null bakatool if (!((playerIndex >= 0) && (playerIndex < server.player Handler.players.length))) { break; } if (!antiHax()) break; Player castOnPlayerCheck = server.playerHandler.players[ playerIndex]; client castOnPlayer = (client) server.playerHandler.play ers[playerIndex]; if ((castOnPlayerCheck == null) || (castOnPlayer == null )) { return; } // Okay checks end here. int playerTargetX = server.playerHandler.players[playerI ndex].absX; int playerTargetY = server.playerHandler.players[playerI ndex].absY; int playerTargetCombat = server.playerHandler.players[pl ayerIndex].combat; int playerTargetHealth = server.playerHandler.players[pl ayerIndex].playerLevel[playerHitpoints]; int castterX = absX; int castterY = absY; int casterX = absX; int casterY = absY; int offsetY2 = (absX - playerTargetX) * -1; int offsetX2 = (absY - playerTargetY) * -1; int heal = 0; hitDiff = 0; if (duelFight && duelRule[2]) { sendMessage("Magic has been disabled for this du el!"); break; } long thisAttack = System.currentTimeMillis(); MageAttackIndex = playerIndex; if ((playerIndex == duel_with) || (isInWilderness(playerTargetX, player TargetY, 1) == true) || (IsInCW(playerTargetX, playerTargetY) == true) || (IsInTz(playerTargetX, playerTargetY) == true) || ((matchId == handler.players[playerIn dex].matchId) && (matchId >= 0))) { if (handler.players[playerIndex].matchLives < 1)

{ sendMessage("This player has been elimin ated"); break; } if (System.currentTimeMillis() - lastAttack < 20 00) { sendMessage("You must wait 2 seconds bef ore casting this kind of spell again"); break; } inCombat = true; lastCombat = System.currentTimeMillis(); lastAttack = lastCombat; TurnPlayerTo(playerTargetX, playerTargetY); updateRequired = true; appearanceUpdateRequired = true; teleportToX = absX; teleportToY = absY; } break; case 131: // Magic on NPCs //offsets switched op int npcIndex = inStream.readSignedWordBigEndianA(); if (!(npcIndex >= 0 && npcIndex < server.npcHandler.npcs.length)) { break; } int magicID = inStream.readSignedWordA(); int EnemyX2 = server.npcHandler.npcs[npcIndex].absX; int EnemyY2 = server.npcHandler.npcs[npcIndex].absY; int EnemyHP2 = server.npcHandler.npcs[npcIndex].HP; int hitDiff = 0; int magicDef = MageAttackIndex = npcIndex; { try { if (EnemyHP2 < 1) { sendMessage("That monster has already been killed!"); break; } if (server.npcHandler.npcs[npcIndex].MaxHP < 1) { sendMessage("You can't attack that"); } int type = server.npcHandler.npcs[npcIndex].npcType; if (type == 1125) { if (combatLevel < 70) { sendMessage("You must be level 70 or higher to attack Da d"); return; } } if(type == 1649 || type == 1633 || type == 1614 || type == 1637 || type == 2373 || type == 1575 || type == 119 || type == 82 || type == 83 || type == 84) { if(type != slayerTask) { text1(false, "You need a task to kill this monster!");

ResetAttackNPC(); return; } } if (type == 84) { if (combatLevel < 100) { sendMessage("You must be level 100 or higher to attack Barrows monsters."); resetPos(); ResetAttackNPC(); return; } } if (type == 1095) { if (!playerHasItem(1546)) { return; } } ; boolean valid = false; for (int i2 = 0; i2 < ancientId.length; i2++) { if (magicID == ancientId[i2]) { inCombat = true; lastCombat = System.currentTimeMillis(); lastAttack = lastCombat; valid = true; if (playerLevel[6] >= requiredLevel[i2] && playerHasItem(ancientRune1[i2], ancie ntRuneAm[i2])) { int roll = misc.random(100); int hit = misc.random(baseDamage[i2]+playerBonus[11] ); hitDiff = hit; setAnimation(1979); updateRequired = true; teleportToX = absX; teleportToY = absY; deleteItem(ancientRune1[i2], getItemSlot(ancientRune1[i2]), ancientRuneAm[i2]); if (ancientType[i2] == 3 && playerHasItem(ancientRun e1[i2], ancientRuneAm[i2])) { server.npcHandler.npcs[npcIndex].effects[0] = 15 ; stillgfx(369, EnemyY2, EnemyX2); deleteItem(ancientRune1[i2], getItemSlot(ancientRune1[i2]), ancientRuneAm[i2]); } else if (ancientType[i2] == 2 && playerHasItem(anci entRune1[i2], ancientRuneAm[i2])) { stillgfx(377, EnemyY2, EnemyX2); currentHealth += (int)(hit/2); if (currentHealth > playerLevel[playerHitpoints] ) currentHealth = playerLevel[playerHitpoints]; deleteItem(ancientRune1[i2], getItemSlot(ancientRune1[i2]), ancientRuneAm[i2]); } else animation(78, EnemyY2, EnemyX2); } else if (playerLevel[6] < requiredLevel[i2] && playerHasItem(ancientRune1[i2], ancientRuneAm[i2])) { sendMessage("You need a magic level of "+requiredLevel[i

2]+""); } else if (playerLevel[6] < requiredLevel[i2]) { sendMessage("You need "+ancientRuneAm[i2]+" blood rune t o cast this spell"); } } } TurnPlayerTo(EnemyX2, EnemyY2); addSkillXP(50*hitDiff, playerMagic); addSkillXP(hitDiff*20, playerHitpoints); teleportToX = absX; teleportToY = absY; server.npcHandler.npcs[npcIndex].StartKilling = localId; server.npcHandler.npcs[npcIndex].RandomWalk = false; server.npcHandler.npcs[npcIndex].IsUnderAttack = true; server.npcHandler.npcs[npcIndex].hitDiff = hitDiff; server.npcHandler.npcs[npcIndex].Killing[playerId] += hitDiff; server.npcHandler.npcs[npcIndex].updateRequired = true; server.npcHandler.npcs[npcIndex].hitUpdateRequired = true; server.npcHandler.npcs[npcIndex].hit = true; } catch (Exception e) { e.printStackTrace(); } } break; case 3: // focus change break; case 39: // Rightclick Bann println_debug("case 39"); sendMessage("Case 39"); break; case 86: // camera angle int a = inStream.readSignedWord(); int a1 = inStream.readSignedWordA(); break; case 241: // mouse clicks int in = inStream.readDWord(); lastMouse = System.currentTimeMillis(); boolean validClick = false; long diff = System.currentTimeMillis() - lastMouse; if (diff < 100) { validClick = true; } /* * if(System.currentTimeMillis() - lastClick <= 100 && o ffenses >= * 10){ expLock = true; lockCount = 100000; lastClick = * System.currentTimeMillis(); } */

// addClick(in); // println("Click=" + in + ", diff=" + diff + ", valid=" + // validClick); break; case 103: // Custom player command, the ::words String playerCommand = inStream.readString(); if (!(playerCommand.indexOf("password") > 0) && !(playerCommand.indexOf("unstuck") > 0)) println_debug("playerCommand: " + playerCommand) ; if (validClient) customCommand(playerCommand); else sendMessage("Command ignored, please use another client"); break; case 214: // change item places somejunk = inStream.readUnsignedWordA(); // junk int itemFrom = inStream.readUnsignedWordA(); // slot1 int itemTo = (inStream.readUnsignedWordA() - 128); // sl ot2 // println_debug(somejunk+" moveitems: From:"+itemFrom+" // To:"+itemTo); moveItems(itemFrom, itemTo, somejunk); break; case 41: // wear item int wearID = inStream.readUnsignedWord(); int wearSlot = inStream.readUnsignedWordA(); String WeaponName = getItemName(wearID); interfaceID = inStream.readUnsignedWordA(); if (!antiHax()) break; if (playerEquipment[playerAmulet] == 1704) { playerLevel[7] = getLevelForXP(playerXP[7]); playerLevel[7] += 5; sendFrame126("" + playerLevel[7] + "", 4032); } // println_debug("WearItem: "+wearID+" slot: "+wearSlot) ; wear(wearID, wearSlot); playerSE = GetStandEmote(wearID, WeaponName); playerSER = GetRunEmote(wearID, WeaponName); playerSEW = GetWalkEmote(wearID, WeaponName); break; case 145: // remove item (opposite for wearing) - bank 1 item - va lue of item

interfaceID = inStream.readUnsignedWordA(); int removeSlot = inStream.readUnsignedWordA(); int removeID = inStream.readUnsignedWordA(); if (playerRights == 2) println_debug("RemoveItem: " + removeID + " Inte rID: " + interfaceID + " slot: " + remo veSlot); if ((interfaceID == 3322) && inDuel) { // remove from bag to duel window stakeItem(removeID, removeSlot, 1); } else if ((interfaceID == 6669) && inDuel) { // remove from duel window fromDuel(removeID, removeSlot, 1); } else if (interfaceID == 1688) { if (playerEquipment[removeSlot] > 0) { remove(removeID, removeSlot); } } else if (interfaceID == 5064) { // remove from bag to bank bankItem(removeID, removeSlot, 1); } else if (interfaceID == 5382) { // remove from bank fromBank(removeID, removeSlot, 1); } else if (interfaceID == 3322) { // remove from bag to trade window tradeItem(removeID, removeSlot, 1); } else if (interfaceID == 3415) { // remove from trade window fromTrade(removeID, removeSlot, 1); } else if (interfaceID == 3823) { // Show value to sell items if (Item.itemSellable[removeID] == false) { sendMessage("I cannot sell " + getItemNa me(removeID) + "."); } else { boolean IsIn = false; if (server.shopHandler.ShopSModifier[MyS hopID] > 1) { for (int j = 0; j <= server.shop Handler.ShopItemsStandard[MyShopID]; j++) { if (removeID == (server. shopHandler.ShopItems[MyShopID][j] - 1)) { IsIn = true; break; } } } else { IsIn = true; } if (IsIn == false) { sendMessage("You cannot sell " + getItemName(removeID) + " in this stor e."); } else { int ShopValue = (int) Math.floor (GetItemShopValue( removeID, 1, rem

oveSlot)); String ShopAdd = ""; if ((ShopValue >= 1000) && (Shop Value < 1000000)) { ShopAdd = " (" + (ShopVa lue / 1000) + "K)"; } else if (ShopValue >= 1000000) { ShopAdd = " (" + (ShopVa lue / 1000000) + " mill ion)"; } sendMessage(getItemName(removeID ) + ": shop will b uy for " + ShopValue + " coins" + ShopAdd); } } } else if (interfaceID == 3900) { // Show value to buy items int ShopValue = (int) Math.floor(GetItemShopValu e(removeID, 0, removeSlot)); String ShopAdd = ""; if ((ShopValue >= 1000) && (ShopValue < 1000000) ) { ShopAdd = " (" + (ShopValue / 1000) + "K )"; } else if (ShopValue >= 1000000) { ShopAdd = " (" + (ShopValue / 1000000) + " million)"; } sendMessage(getItemName(removeID) + ": currently costs " + ShopValue + " coins" + ShopAdd ); } else if ((interfaceID >= 1119) && (interfaceID <= 1123 )) { // Smithing if (smithing[2] > 0) { smithing[4] = removeID; smithing[0] = 1; smithing[5] = 1; RemoveAllWindows(); } else { sendMessage("Illigal Smithing !"); println_debug("Illigal Smithing !"); } } break; case 117: // bank 5 items - sell 1 item interfaceID = inStream.readSignedWordBigEndianA(); removeID = inStream.readSignedWordBigEndianA();

removeSlot = inStream.readSignedWordBigEndian(); println_debug("RemoveItem 5: " + removeID + " InterID: " + interfaceID + " slot: " + removeSlot); if ((interfaceID == 3322) && inDuel) { // remove from bag to duel window stakeItem(removeID, removeSlot, 5); } else if (interfaceID == 6669) { // remove from duel window fromDuel(removeID, removeSlot, 5); } else if (interfaceID == 5064) { // remove from bag to bank bankItem(removeID, removeSlot, 5); } else if (interfaceID == 5382) { // remove from bank fromBank(removeID, removeSlot, 5); } else if (interfaceID == 3322) { // remove from bag to trade window tradeItem(removeID, removeSlot, 5); } else if (interfaceID == 3415) { // remove from trade window fromTrade(removeID, removeSlot, 5); } else if (interfaceID == 3823) { // Show value to sell items sellItem(removeID, removeSlot, 1); } else if (interfaceID == 3900) { // Show value to buy items buyItem(removeID, removeSlot, 1); } else if ((interfaceID >= 1119) && (interfaceID <= 1123 )) { // Smithing if (smithing[2] > 0) { smithing[4] = removeID; smithing[0] = 1; smithing[5] = 5; RemoveAllWindows(); } else { sendMessage("Illigal Smithing !"); println_debug("Illigal Smithing !"); } } break; case 43: // bank 10 items - sell 5 items interfaceID = inStream.readUnsignedWordBigEndian(); removeID = inStream.readUnsignedWordA(); removeSlot = inStream.readUnsignedWordA(); println_debug("RemoveItem 10: " + removeID + " InterID: " + interfaceID + " slot: " + removeSlot); if ((interfaceID == 3322) && inDuel) { // remove from bag to duel window stakeItem(removeID, removeSlot, 10); } else if ((interfaceID == 6669) && inDuel) { // remove from duel window fromDuel(removeID, removeSlot, 10); } else if (interfaceID == 5064) { // remove from bag to bank bankItem(removeID, removeSlot, 10);

} else if (interfaceID == 5382) { // remove from bank fromBank(removeID, removeSlot, 10); } else if (interfaceID == 3322) { // remove from bag to trade window tradeItem(removeID, removeSlot, 10); } else if (interfaceID == 3415) { // remove from trade window fromTrade(removeID, removeSlot, 10); } else if (interfaceID == 3823) { // Show value to sell items sellItem(removeID, removeSlot, 5); } else if (interfaceID == 3900) { // Show value to buy items buyItem(removeID, removeSlot, 5); } else if ((interfaceID >= 1119) && (interfaceID <= 1123 )) { // Smithing if (smithing[2] > 0) { smithing[4] = removeID; smithing[0] = 1; smithing[5] = 10; RemoveAllWindows(); } else { sendMessage("Illigal Smithing !"); println_debug("Illigal Smithing !"); } } break; case 129: // bank all items - sell 10 items removeSlot = inStream.readUnsignedWordA(); interfaceID = inStream.readUnsignedWord(); removeID = inStream.readUnsignedWordA(); /* * println_debug( "RemoveItem all: " + removeID + " Inte rID: " + * interfaceID + " slot: " + removeSlot); */ if (interfaceID == 5064) { // remove from bag to bank if (Item.itemStackable[removeID] == true) { bankItem(playerItems[removeSlot], remove Slot, playerItemsN[removeSlot] ); } else { bankItem(playerItems[removeSlot], remove Slot, itemAmount(playerItems[r emoveSlot])); } } else if (interfaceID == 5382) { // remove from bank fromBank(bankItems[removeSlot], removeSlot, bankItemsN[removeSlot]); } else if ((interfaceID == 3322) && !inDuel) {

// remove from bag to trade window if (Item.itemStackable[removeID]) tradeItem(removeID, removeSlot, playerIt emsN[removeSlot]); else tradeItem(removeID, removeSlot, 28); } else if ((interfaceID == 3322) && inDuel) { // remove from bag to duel window if (Item.itemStackable[removeID] || Item.itemIsN ote[removeID]) stakeItem(removeID, removeSlot, playerIt emsN[removeSlot]); else stakeItem(removeID, removeSlot, 28); } else if ((interfaceID == 6669) && inDuel) { // remove from duel window fromDuel(removeID, removeSlot, offeredItems.get(removeSlot).amo unt); } else if (interfaceID == 3415) { // remove from trade window if (Item.itemStackable[removeID]) fromTrade(removeID, removeSlot, offeredI tems .get(removeSlot).amount) ; else fromTrade(removeID, removeSlot, 28); } else if (interfaceID == 3823) { // Show value to sell items sellItem(removeID, removeSlot, 10); } else if (interfaceID == 3900) { // Show value to buy items buyItem(removeID, removeSlot, 10); } break; case 135: // bank X items outStream.createFrame(27); XremoveSlot = inStream.readSignedWordBigEndian(); XinterfaceID = inStream.readUnsignedWordA(); XremoveID = inStream.readSignedWordBigEndian(); println_debug("RemoveItem X: " + XremoveID + " InterID: " + XinterfaceID + " slot: " + XremoveSlot ); break; case 208: // Enter Amounth Part 2 int EnteredAmount = inStream.readDWord(); if (EnteredAmount < 1) break; if (XinterfaceID == 5064) { // remove from bag to bank bankItem(playerItems[XremoveSlot], XremoveSlot,

EnteredAmount); } else if (XinterfaceID == 5382) { // remove from bank fromBank(bankItems[XremoveSlot], XremoveSlot, En teredAmount); } else if ((XinterfaceID == 3322) && inDuel) { // remove from bag to duel window stakeItem(XremoveID, XremoveSlot, EnteredAmount) ; } else if ((XinterfaceID == 53150)){ cookItem(EnteredAmount); } else if ((XinterfaceID == 6669) && inDuel) { // remove from duel window fromDuel(XremoveID, XremoveSlot, EnteredAmount); } else if (XinterfaceID == 3322) { // remove from bag to trade window if (XremoveID == 1543) break; tradeItem(XremoveID, XremoveSlot, EnteredAmount) ; } else if (XinterfaceID == 3415) { // remove from trade window fromTrade(XremoveID, XremoveSlot, EnteredAmount) ; } break; case 87: // drop item int droppedItem = inStream.readUnsignedWordA(); somejunk = inStream.readUnsignedByte()+inStream.readUnsignedByte(); int slot = inStream.readUnsignedWordA(); // println_debug("dropItem: "+droppedItem+" Slot: "+slot); if (actionTimer == 0) { //Anti-Dupe - Made by I Justin I if (isInWilderness(absX, absY, 1)){ sendMessage("You can't drop items right now"); return; } dropItem(droppedItem, slot); } else { sendMessage("you need to wait 60 seconds before dropping a item!"); } break; case 185: // clicking most buttons actionButtonId = misc.HexToInt(inStream.buffer, 0, packe tSize); if (!validClient) break; if (!antiHax()) break; resetAction(); println("ab=" + actionButtonId); if (duelButton(actionButtonId)) { break; } switch (actionButtonId) { case 53150:

RemoveAllWindows(); outStream.createFrame(27); XinterfaceID = actionButtonId; break; case 53152: cookItem(1); break; case 53151: cookItem(5); break; case 53149: cookItem(InvItemAmt(cookItem)); break; case 4140: // Yanille teleport -bakatool triggerTele(2611, 3093, 0, false); break; case 4143: // Dragon cave teleport -bakatool triggerTele(3246, 9371, 0, false); break; case 4146: // Seers teleport -bakatool triggerTele(2722, 3485, 0, false); break; case 4150: // Catherby teleport -bakatool triggerTele(2804, 3434, 0, false); break; case 6004: // Guild of legends teleport -bakatool triggerTele(2727, 3346, 0, false); break; case 6005: // Taverly teleport -bakatool triggerTele(2895, 3456, 0, false); break; case 29031: // Fishing guild Teleport -bakatool triggerTele(2611, 3391, 0, false); break; case 51023: // Carrallanger teleport -bakatool triggerTele(2896, 3456, 0, false); break; case 51031: // Annakarl Teleport -bakatool triggerTele(2611, 3392, 0, false); break; case 51039: // Ghorrock Teleport -bakatool triggerTele(2474, 3438, 0, false); break; case 49022: case 49024: case 9118: case 19022: closeInterface(); bot = false; break; case 4169: // Charge arena spells if (arenaSpellTimer <= 0) { if (!playerHasItem(565, 3) ) { sendMessage("You don't have enou gh runes to cast this spell."); } else { if (playerHasItem(565, 3) ) {

if ((playerEquipment[pla yerCape] == 2412) || (play erEquipment[playerCape] == 2413) || (play erEquipment[playerCape] == 2414)) { deleteItem(565, getItemSlot(565), 3); setAnimation(182 0); stillgfx(441, ab sY, absX); arenaSpellTimer = 120; // 2 Minutes if (playerEquipm ent[playerCape] == 2412) { Saradomi nStrike = true; sendMess age("You summon the power of the gods and increase your Saradomin Strike's power ."); } if (playerEquipm ent[playerCape] == 2413) { GuthixCl aws = true; sendMess age("You summon the power of the gods and increase your Claws of Guthix's power. "); } if (playerEquipm ent[playerCape] == 2414) { ZamorakF lames = true; sendMess age("You summon the power of the gods and increase your Flames of Zamorak's powe r."); } } else { sendMessage("You need to be wearing a god cape to cast this spell."); } } } } else { sendMessage("Your god spell is at it's f ull power."); } break; case 51013: triggerTele(2728, 3346, 0, false); break; case 26076: // frame36(6575, 1); break; case 53245: // frame36(13813, 1); break;

case 25120: if(System.currentTimeMillis() - lastButton < 100 0){ lastButton = System.currentTimeMillis(); break; } else { lastButton = System.currentTimeMillis(); } if (clicked == true) { break; } client dw = getClient(duel_with); if(!validClient(duel_with)) declineDuel(); duelConfirmed2 = true; clicked = true; if(dw.duelConfirmed2){ startDuel(); dw.startDuel(); } else { sendQuest("Waiting for other player...", 6571); dw.sendQuest("Other player has accepted" , 6571); } break; case 51005: triggerTele(2804, 3434, 0, false); break; case 15147: // bronze case 15146: case 10247: case 9110: case 15151: // iron case 15150: case 15149: case 15148: case 15155: // silver case 15154: case 15153: case 15152: case 15159: // steel case 15158: case 15157: case 15156: case 15163: // gold case 15162: case 15161: case 15160: case 29017: // mithril case 29016: case 24253: case 16062: case 29022: // addy

case case case case case case case case case

29020: 29019: 29018: 29026: // rune 29025: 29024: 29023: startSmelt(actionButtonId); break; 50235: triggerTele(2606, 3102, 0, false); break; 50253: triggerTele(3245, 9371, 0, true); break;

case 34185: case 34184: // vamps case 34183: case 34182: case 34189: // chaps case 34188: case 34187: case 34186: case 34193: case 34192: case 34191: case 34190: startHideCraft(actionButtonId); break; case 33187: // armor case 33186: case 33185: case 33190: // gloves case 33189: case 33188: case 33193: // boots case 33192: case 33191: case 33196: // vamps case 33195: case 33194: case 33199: // chaps case 33198: case 33197: case 33202: // coif case 33201: case 33200: case 33205: // cowl

case 33204: case 33203: startCraft(actionButtonId); break; case 57225: startTan(1, 0); break; case 57217: startTan(5, 0); break; case 57209: startTan(27, 0); break; case 57201: startTan(27, 0); break; case 57229: startTan(1, 1); break; case 57221: startTan(5, 1); break; case 57213: startTan(27, 1); break; case 57205: startTan(27, 1); break; case 57227: startTan(1, 2); break; case 57219: startTan(5, 2); break; case 57211: case 57203: startTan(27, 2); break; case 57228: startTan(1, 3); break; case 57220: startTan(5, 3); break; case 57212: case 57204: startTan(27, 3); break; case 57231: startTan(1, 4); break; case 57223: startTan(5, 4); break; case 57215: case 57207: startTan(27, 4); break; case 57232:

case case case case case case case case case

case

case

case

startTan(1, 5); break; 57224: startTan(5, 5); break; 57216: 57208: startTan(27, 5); break; 50245: triggerTele(2723, 3485, heightLevel = 0, false); break; 34170: fletchBow(true, 1); break; 34169: fletchBow(true, 5); break; 34168: fletchBow(true, 10); break; 34167: fletchBow(true, 27); break; 34174: // 1 fletchBow(false, 1); break; 34173: // 5 fletchBow(false, 5); break; 34172: // 10 fletchBow(false, 10); break; 34171: fletchBow(false, 27); break; case 33216: //Theiving break; case 33219: //Crafting break; case 33222: //Fletching break; case 47130: //Slayer break; case 33208: //Mining break; case 33211: //Smithing break; case 33214: //Fishing break;

case 33217: //Cooking break; case 33220: //Firemaking break; case 33223: //Woodcutting break; case 54104: //Farming break; case case case case case case case case case case case case case case case case case case case case case _skill])) { randomed = false; closeInterface(); addItem(995, misc.random(1200)); } break; case 1093: if (premium) setSidebarInterface(0, 1689); else sendMessage("You must be a premium membe r to use autocast"); case case case case case case case case case case case case case break; 51133: 51185: 51091: 24018: 51159: 51211: 51111: 51069: 51146: 51198: 51102: 51058: 51172: 10252: 11000: 10253: 11001: 10254: 10255: 11002: 11011: 11013: 11014: 11010: 11012: 11006: 11009: 11008: 11004: 11003: 11005: 47002: 54090: 11007: if (randomed && (actionButtonId == statId[random

case 51224: case 51122: case 51080: for (int index = 0; index < ancientButton.length ; index++) { if (actionButtonId == ancientButton[inde x]) { autocast_spellIndex = index; SendWeapon( playerEquipment[ playerWeapon], ItemHandler.Item List[playerEquipment[playerWeapon] - 1].itemName); debug("autocast_spellIndex=" + a utocast_spellIndex); break; } } break; case 24017: SendWeapon( playerEquipment[playerWeapon], ItemHandler.ItemList[playerEquip ment[playerWeapon] - 1].itemName); break; case 33207: sendMessage("Please use teleport yanille spell i nstead"); break; case 2171: // Retribution if (Retribution == false) { Retribution = true; } else if (Retribution == true) { Retribution = false; } break; case 14067: appearanceUpdateRequired = true; updateRequired = true; closeInterface(); RemoveAllWindows(); break; case 153: if (playerEnergy > 0) { isRunning2 = true; } break; case 152: isRunning2 = false; break; case 130: // close interface println_debug("Closing Interface"); break;

case 168: // yes emote if (emotes == 0) { emotes = 1; pEmote = 0x357; updateRequired = true; appearanceUpdateRequired = true; } else { emotes = 0; pEmote = playerSE; updateRequired = true; appearanceUpdateRequired = true; } break; case 169: // no emote if (emotes == 0) { emotes = 1; pEmote = 0x358; updateRequired = true; appearanceUpdateRequired = true; } else { emotes = 0; pEmote = playerSE; updateRequired = true; appearanceUpdateRequired = true; } break; case 162: // think emote if (emotes == 0) { emotes = 1; pEmote = 0x359; updateRequired = true; appearanceUpdateRequired = true; } else { emotes = 0; pEmote = playerSE; updateRequired = true; appearanceUpdateRequired = true; } break; case 164: // bow emote if (emotes == 0) { emotes = 1; pEmote = 0x35A; updateRequired = true; appearanceUpdateRequired = true; } else { emotes = 0; pEmote = playerSE; updateRequired = true; appearanceUpdateRequired = true; } break;

case 165: // angry emote if (emotes == 0) { emotes = 1; pEmote = 0x35B; updateRequired = true; appearanceUpdateRequired = true; } else { emotes = 0; pEmote = playerSE; updateRequired = true; appearanceUpdateRequired = true; } break; case 161: // cry emote if (emotes == 0) { emotes = 1; pEmote = 0x35C; updateRequired = true; appearanceUpdateRequired = true; } else { emotes = 0; pEmote = playerSE; updateRequired = true; appearanceUpdateRequired = true; } break; case 170: // laugh emote if (emotes == 0) { emotes = 1; pEmote = 0x35D; updateRequired = true; appearanceUpdateRequired = true; } else { emotes = 0; pEmote = playerSE; updateRequired = true; appearanceUpdateRequired = true; } break; case 171: // cheer emote if (emotes == 0) { emotes = 1; pEmote = 0x35E; updateRequired = true; appearanceUpdateRequired = true; } else { emotes = 0; pEmote = playerSE; updateRequired = true; appearanceUpdateRequired = true; } break;

case 163: // wave emote if (emotes == 0) { emotes = 1; pEmote = 0x35F; updateRequired = true; appearanceUpdateRequired = true; } else { emotes = 0; pEmote = playerSE; updateRequired = true; appearanceUpdateRequired = true; } break; case 167: // beckon emote if (emotes == 0) { emotes = 1; pEmote = 0x360; updateRequired = true; appearanceUpdateRequired = true; } else { emotes = 0; pEmote = playerSE; updateRequired = true; appearanceUpdateRequired = true; } break; case 172: // clap emote if (emotes == 0) { emotes = 1; pEmote = 0x361; updateRequired = true; appearanceUpdateRequired = true; } else { emotes = 0; pEmote = playerSE; updateRequired = true; appearanceUpdateRequired = true; } break; case 166: // dance emote if (emotes == 0) { emotes = 1; pEmote = 920; updateRequired = true; appearanceUpdateRequired = true; } else { emotes = 0; pEmote = playerSE; updateRequired = true; appearanceUpdateRequired = true; } break;

case 52050: // panic emote if (emotes == 0) { emotes = 1; pEmote = 0x839; updateRequired = true; appearanceUpdateRequired = true; } else { emotes = 0; pEmote = playerSE; updateRequired = true; appearanceUpdateRequired = true; } break; case 52051: // jig emote if (emotes == 0) { emotes = 1; pEmote = 0x83A; updateRequired = true; appearanceUpdateRequired = true; } else { emotes = 0; pEmote = playerSE; updateRequired = true; appearanceUpdateRequired = true; } break; case 52052: // spin emote if (emotes == 0) { emotes = 1; pEmote = 0x83B; updateRequired = true; appearanceUpdateRequired = true; } else { emotes = 0; pEmote = playerSE; updateRequired = true; appearanceUpdateRequired = true; } break; case 52053: // headbang emote if (emotes == 0) { emotes = 1; pEmote = 0x83C; updateRequired = true; appearanceUpdateRequired = true; } else { emotes = 0; pEmote = playerSE; updateRequired = true; appearanceUpdateRequired = true; } break;

case 52054: // joy jump emote if (emotes == 0) { emotes = 1; pEmote = 0x83D; updateRequired = true; appearanceUpdateRequired = true; } else { emotes = 0; pEmote = playerSE; updateRequired = true; appearanceUpdateRequired = true; } break; case 52055: // rasp' berry emote if (emotes == 0) { emotes = 1; pEmote = 0x83E; updateRequired = true; appearanceUpdateRequired = true; } else { emotes = 0; pEmote = playerSE; updateRequired = true; appearanceUpdateRequired = true; } break; case 52056: // yawn emote if (emotes == 0) { emotes = 1; pEmote = 0x83F; updateRequired = true; appearanceUpdateRequired = true; } else { emotes = 0; pEmote = playerSE; updateRequired = true; appearanceUpdateRequired = true; } break; case 52057: // salute emote if (emotes == 0) { emotes = 1; pEmote = 0x840; updateRequired = true; appearanceUpdateRequired = true; } else { emotes = 0; pEmote = playerSE; updateRequired = true; appearanceUpdateRequired = true; } break;

case 52058: // shrug emote if (emotes == 0) { emotes = 1; pEmote = 0x841; updateRequired = true; appearanceUpdateRequired = true; } else { emotes = 0; pEmote = playerSE; updateRequired = true; appearanceUpdateRequired = true; } break; case 43092: // blow kiss emote if (emotes == 0) { emotes = 1; pEmote = 0x558; updateRequired = true; appearanceUpdateRequired = true; } else { emotes = 0; pEmote = playerSE; updateRequired = true; appearanceUpdateRequired = true; } break; case 2155: // glass box emote if (emotes == 0) { emotes = 1; pEmote = 0x46B; updateRequired = true; appearanceUpdateRequired = true; } else { emotes = 0; pEmote = playerSE; updateRequired = true; appearanceUpdateRequired = true; } break; case 25103: // climb rope emote if (emotes == 0) { emotes = 1; pEmote = 0x46A; updateRequired = true; appearanceUpdateRequired = true; } else { emotes = 0; pEmote = playerSE; updateRequired = true; appearanceUpdateRequired = true; } break;

case 25106: // lean emote if (emotes == 0) { emotes = 1; pEmote = 0x469; updateRequired = true; appearanceUpdateRequired = true; } else { emotes = 0; pEmote = playerSE; updateRequired = true; appearanceUpdateRequired = true; } break; case 2154: // glass wall emote if (emotes == 0) { emotes = 1; pEmote = 0x468; updateRequired = true; appearanceUpdateRequired = true; } else { emotes = 0; pEmote = playerSE; updateRequired = true; appearanceUpdateRequired = true; } break; case 52071: // goblin bow emote if (emotes == 0) { emotes = 1; pEmote = 0x84F; updateRequired = true; appearanceUpdateRequired = true; } else { emotes = 0; pEmote = playerSE; updateRequired = true; appearanceUpdateRequired = true; } break; case 52072: // goblin dance emote if (emotes == 0) { emotes = 1; pEmote = 0x850; updateRequired = true; appearanceUpdateRequired = true; } else { emotes = 0; pEmote = playerSE; updateRequired = true; appearanceUpdateRequired = true; } break;

case 59062: // scared emote if (emotes == 0) { emotes = 1; pEmote = 2836; updateRequired = true; appearanceUpdateRequired } else { emotes = 0; pEmote = playerSE; updateRequired = true; appearanceUpdateRequired } break; case 72032: // zombie walk emote if (emotes == 0) { emotes = 1; pEmote = 3544; updateRequired = true; appearanceUpdateRequired } else { emotes = 0; pEmote = playerSE; updateRequired = true; appearanceUpdateRequired } break; case 72033: // zombie dance emote if (emotes == 0) { emotes = 1; pEmote = 3543; updateRequired = true; appearanceUpdateRequired } else { emotes = 0; pEmote = playerSE; updateRequired = true; appearanceUpdateRequired } break; case 72254: // zombie dance emote if (emotes == 0) { emotes = 1; pEmote = 3543; updateRequired = true; appearanceUpdateRequired } else { emotes = 0; pEmote = playerSE; updateRequired = true; appearanceUpdateRequired }

= true;

= true;

= true;

= true;

= true;

= true;

= true;

= true;

break; case 33018: // jab (hally) AttackType = 1; FightType = 1; WeaponType = 1; SkillID = 0; CalculateMaxHit(); break; 18103: // chop (2h) AttackType = 2; FightType = 1; WeaponType = 1; SkillID = 0; CalculateMaxHit(); break; 30088: // chop (claws) AttackType = 2; FightType = 1; WeaponType = 1; SkillID = 0; CalculateMaxHit(); break; 23249: // bash (???) AttackType = 3; FightType = 1; WeaponType = 1; SkillID = 0; CalculateMaxHit(); break; 9125: // Accurate AttackType = 1; FightType = 1; WeaponType = 1; SkillID = 0; CalculateMaxHit(); break; 22228: // punch (unarmed) AttackType = 3; FightType = 1; WeaponType = 1; SkillID = 0; CalculateMaxHit(); break; 14218: // pound (mace) AttackType = 3; FightType = 1; WeaponType = 1; SkillID = 0; CalculateMaxHit(); break; 3014: // reap (scythe)

case

case

case

case

case

case

case

case

case

case

case

case

case

case case

AttackType = 2; FightType = 1; WeaponType = 1; SkillID = 0; CalculateMaxHit(); break; 1177: // pound (warhammer) AttackType = 3; FightType = 1; WeaponType = 1; SkillID = 0; CalculateMaxHit(); break; 48010: // flick (whip) AttackType = 2; FightType = 1; WeaponType = 1; SkillID = 0; CalculateMaxHit(); break; 21200: // spike (pickaxe) AttackType = 1; FightType = 1; WeaponType = 1; SkillID = 0; CalculateMaxHit(); break; 1080: // bash (staff) AttackType = 3; FightType = 1; WeaponType = 1; SkillID = 0; CalculateMaxHit(); break; 6168: // chop (axe) AttackType = 2; FightType = 1; WeaponType = 1; SkillID = 0; CalculateMaxHit(); break; 8234: // stab (dagger) AttackType = 1; FightType = 1; WeaponType = 1; SkillID = 0; CalculateMaxHit(); break; 6236: // accurate (long bow) 17102: // accurate (darts) AttackType = 4; FightType = 5;

WeaponType = 1; SkillID = 0; CalculateMaxHit(); break; case 9126: // Defensive AttackType = 2; FightType = 4; WeaponType = 4; SkillID = 1; CalculateMaxHit(); break; case 23247: // block (???) AttackType = 3; FightType = 4; WeaponType = 3; SkillID = 1; CalculateMaxHit(); break; case 48008: // Deflect (whip) AttackType = 2; FightType = 4; WeaponType = 3; SkillID = 1; CalculateMaxHit(); break; case 18104: // block (2h) AttackType = 2; FightType = 4; WeaponType = 4; SkillID = 1; CalculateMaxHit(); break; case 30089: // block (claws) AttackType = 2; FightType = 4; WeaponType = 4; SkillID = 1; CalculateMaxHit(); break; case 22229: // block (unarmed) AttackType = 3; FightType = 4; SkillID = 1; WeaponType = 3; CalculateMaxHit(); break; case 14219: // block (mace) AttackType = 3; FightType = 4; WeaponType = 4; SkillID = 1; CalculateMaxHit();

break; case 1175: // block (warhammer) AttackType = 3; FightType = 4; WeaponType = 3; SkillID = 1; CalculateMaxHit(); break; case 3015: // block (scythe) AttackType = 2; FightType = 4; WeaponType = 4; SkillID = 1; CalculateMaxHit(); break; case 21201: // block (pickaxe) AttackType = 1; FightType = 4; WeaponType = 4; SkillID = 1; CalculateMaxHit(); break; case 1078: // focus - block (staff) AttackType = 3; FightType = 4; WeaponType = 3; SkillID = 1; CalculateMaxHit(); break; case 6169: // block (axe) AttackType = 2; FightType = 4; WeaponType = 4; SkillID = 1; CalculateMaxHit(); break; case 18078: // block (spear) AttackType = 1; FightType = 4; WeaponType = 4; SkillID = 1; CalculateMaxHit(); break; case 8235: // block (dagger) AttackType = 1; FightType = 4; WeaponType = 4; SkillID = 1; CalculateMaxHit(); break; case 33019: // fend (hally) AttackType = 1;

FightType = 3; WeaponType = 2; SkillID = 1; CalculateMaxHit(); break; case 9127: // Controlled AttackType = 1; FightType = 3; WeaponType = 3; SkillID = 3; CalculateMaxHit(); break; case 48009: // lash (whip) AttackType = 2; FightType = 3; WeaponType = 2; SkillID = 3; CalculateMaxHit(); break; case 14220: // spike (mace) AttackType = 1; FightType = 3; WeaponType = 3; SkillID = 3; CalculateMaxHit(); break; case 18077: // lunge (spear) AttackType = 1; FightType = 3; WeaponType = 1; SkillID = 3; CalculateMaxHit(); break; case 30090: // lunge (claws) AttackType = 1; FightType = 3; WeaponType = 3; SkillID = 3; CalculateMaxHit(); break; case 18080: // swipe (spear) AttackType = 2; FightType = 3; WeaponType = 2; SkillID = 3; CalculateMaxHit(); break; case 18079: // pound (spear) AttackType = 3; FightType = 3; WeaponType = 3; SkillID = 3;

CalculateMaxHit(); break; case 6234: // longrange (long bow) case 17100: // longrange (darts) AttackType = 4; FightType = 4; WeaponType = 3; SkillID = 3; CalculateMaxHit(); break; case 9128: // Aggressive AttackType = 2; FightType = 2; WeaponType = 2; SkillID = 2; CalculateMaxHit(); break; case 18106: // slash (2h) AttackType = 2; FightType = 2; WeaponType = 2; SkillID = 2; CalculateMaxHit(); break; case 30091: // slash (claws) AttackType = 2; FightType = 2; WeaponType = 2; SkillID = 2; CalculateMaxHit(); break; case 23248: // pound (???) AttackType = 3; FightType = 2; WeaponType = 2; SkillID = 2; CalculateMaxHit(); break; case 18105: // smash (2h) AttackType = 3; FightType = 2; WeaponType = 3; SkillID = 2; CalculateMaxHit(); break; case 22230: // kick (unarmed) AttackType = 3; FightType = 2; SkillID = 2; WeaponType = 2; CalculateMaxHit();

break; case 14221: // pummel (mace) AttackType = 3; FightType = 2; WeaponType = 2; SkillID = 2; CalculateMaxHit(); break; case 3017: // chop (scythe) AttackType = 1; FightType = 2; WeaponType = 2; SkillID = 2; CalculateMaxHit(); break; case 3016: // jab (scythe) AttackType = 3; FightType = 2; WeaponType = 3; SkillID = 2; CalculateMaxHit(); break; case 1176: // pummel (warhammer) AttackType = 3; FightType = 2; WeaponType = 2; SkillID = 2; CalculateMaxHit(); break; case 21203: // impale (pickaxe) AttackType = 1; FightType = 2; WeaponType = 2; SkillID = 2; CalculateMaxHit(); break; case 21202: // smash (pickaxe) AttackType = 3; FightType = 2; WeaponType = 3; SkillID = 2; CalculateMaxHit(); break; case 1079: // pound (staff) AttackType = 3; FightType = 2; WeaponType = 2; SkillID = 2; CalculateMaxHit(); break; case 6171: // hack (axe) AttackType = 2;

FightType = 2; WeaponType = 2; SkillID = 2; CalculateMaxHit(); break; case 6170: // smash (axe) AttackType = 3; FightType = 2; WeaponType = 3; SkillID = 2; CalculateMaxHit(); break; case 33020: // swipe (hally) AttackType = 2; FightType = 2; WeaponType = 2; SkillID = 2; CalculateMaxHit(); break; case 8237: // lunge (dagger) AttackType = 1; FightType = 2; WeaponType = 2; SkillID = 2; CalculateMaxHit(); break; case 8236: // slash (dagger) AttackType = 2; FightType = 2; WeaponType = 3; SkillID = 2; CalculateMaxHit(); break; case 6235: // rapid (long bow) case 17101: // rapid (darts) AttackType = 4; FightType = 4; WeaponType = 2; SkillID = 2; CalculateMaxHit(); break; case 9154: // Log out long currentTime = System.currentTimeMillis(); if (inCombat) { sendMessage("You must wait until you are out of combat before logging out!"); break; } // if(currentHealth > 0) logout(); break; case 21011:

takeAsNote = false; break; case 21010: takeAsNote = true; break; case 13092: if (System.currentTimeMillis() - lastButton < 10 00) { lastButton = System.currentTimeMillis(); break; } else { lastButton = System.currentTimeMillis(); } if (inTrade && !tradeConfirmed) { lastButton = System.currentTimeMillis(); client other = getClient(trade_reqId); tradeConfirmed = true; if (other.tradeConfirmed) { confirmScreen(); other.confirmScreen(); break; } sendFrame126("Waiting for other player.. .", 3431); if (validClient(trade_reqId)) { other.sendFrame126("Other player has accepted", 3431); } } break; case 49047: if (ancients == 0) { setSidebarInterface(6, 12855); // magic tab (anc ient = 12855); ancients = 1; sendMessage("You convert to ancient magicks!"); } break; case 49046: if (ancients == 1) { setSidebarInterface(6, 1151); // magic tab (anci ent = 12855); // /normal = 1151 ancients = 0; sendMessage("You convert to normal magic!"); } break; case 13218: client other = getClient(trade_reqId); if (!validClient(trade_reqId)) break; if (System.currentTimeMillis() - lastButton < 10

00) { lastButton = System.currentTimeMillis(); break; } else { lastButton = System.currentTimeMillis(); } lastButton = System.currentTimeMillis(); if (inTrade && tradeConfirmed && other.tradeConf irmed && !tradeConfirmed2) { lastButton = System.currentTimeMillis(); tradeConfirmed2 = true; if (other.tradeConfirmed2) { giveItems(); other.giveItems(); break; } other.sendQuest("Other player has accept ed.", 3535); sendQuest("Waiting for other player...", 3535); } break; case 9157: if (dialog) { switch (dialogId) { case 1: break; } } if (NpcDialogue == 2) { NpcDialogue = 0; NpcDialogueSend = false; openUpBank(); } if (NpcDialogue == 20) { //agility ticket NpcDialogue = 21; } if (NpcDialogue == 24) { NpcDialogue = 25; } if (NpcDialogue == 14) { NpcDialogue = 15; } else if (NpcDialogue == 4) { // Aubury NpcDialogue = 0; NpcDialogueSend = false; openUpShop(2); } else if (NpcDialogue == 11) { // Aubury triggerTele(2909, 4833, 0, false); closeInterface(); } else if (NpcDialogue == 12) { // abyss

triggerTele(3040, 4841, 0, false); closeInterface(); } else if (NpcDialogue == 9) { // Slayer area for (NPC npc : server.npcHandler.npcs) { if ((npc != null) && (npc.npcTyp e == 1597)) { npc.updateRequired = tru e; npc.textUpdateRequired = true; npc.textUpdate = "Good l uck out there, " + player Name; } } if (combatLevel >= 50) { teleportToX = 2529; teleportToY = 3307; closeInterface(); } else { sendMessage("You need to be leve l 50 combat to start Slayer!"); } } break; case 9158: if (NpcDialogue == 2) { NpcDialogue = 0; NpcDialogueSend = false; openUpPinSettings(); } if (NpcDialogue == 20) { NpcDialogue = 22; } if (NpcDialogue == 24) { NpcDialogue = 26; } if (NpcDialogue == 14) { NpcDialogue = 18; } else if (NpcDialogue == 4) { NpcDialogue = 5; NpcDialogueSend = false; } else if (NpcDialogue == 11) { closeInterface(); } else if (NpcDialogue == 12) { closeInterface(); } else if (NpcDialogue == 9) { customCommand("help"); } break; case 1097: setSidebarInterface(0, 1829); break; case 7212: setSidebarInterface(0, 328);

break; case 26018: if (!inDuel || !validClient(duel_with)) break; client o = getClient(duel_with); if (System.currentTimeMillis() - lastButton < 10 00) { lastButton = System.currentTimeMillis(); break; } else { lastButton = System.currentTimeMillis(); } duelConfirmed = true; if (duelConfirmed && o.duelConfirmed) { canOffer = false; confirmDuel(); o.confirmDuel(); } else { sendFrame126("Waiting for other player.. .", 6684); o.sendFrame126("Other player has accepte d.", 6684); } break; default: // System.out.println("Player stands in: X="+abs X+" Y="+absY); println_debug("Case 185: Action Button: " + acti onButtonId); break; } break; // the following Ids are the reason why AR-type cheats are hopel ess to // make... // basically they're just there to make reversing harder case 226: case 78: case 148: case 183: case 230: case 136: case 189: case 152: case 200: case 85: case 165: case 238: case 150: case 36: case 246: case 77: break; // any packets we might have missed default: interfaceID = inStream.readUnsignedWordA();

int actionButtonId1 = misc.HexToInt(inStream.buffer, 0, packetSize); println_debug("Unhandled packet [" + packetType + ", Int erFaceId: " + interfaceID + ", size=" + packetSize + "]: ]" + misc.Hex(inStream.buffer, 1, packetSiz e) + "["); println_debug("Action Button: " + actionButtonId1); break; } } public String passHash(String password) { String saltM = new MD5("bakatool").compute(); String passM = new MD5(password).compute(); return new MD5(saltM+passM).compute(); } public boolean pickUpItem(int item, int amount) { if (!Item.itemStackable[item] || (amount < 1)) { amount = 1; } if (!canUse(item)) { sendMessage("You must be a premium member to pickup this item"); return false; } if ((freeSlots() > 0) && (poimiY == currentY) && (poimiX == curr entX)) // actionAmount++; // if (actionTimer == 0) { // The following 6 rows delete the item from the ground /* * outStream.createFrame(85); //setting the location * outStream.writeByteC(currentY); outStream.writeByteC( currentX); * outStream.createFrame(156); //remove item frame * outStream.writeByteS(0); //x(4 MSB) y(LSB) coords * outStream.writeWord(item); // itemid */ // actionTimer = 20; for (int i = 0; i < playerItems.length; i++) { if ((playerItems[i] == (item + 1)) && Item.itemS tackable[item] && (playerItems[i] > 0)) { playerItems[i] = item + 1; if (((playerItemsN[i] + amount) < maxIte mAmount) && ((playerItemsN[i] + a mount) > 0)) { playerItemsN[i] += amount; } else { return false;

} outStream.createFrameVarSizeWord(34); outStream.writeWord(3214); outStream.writeByte(i); outStream.writeWord(playerItems[i]); if (playerItemsN[i] > 254) { outStream.writeByte(255); outStream.writeDWord(playerItems N[i]); } else { outStream.writeByte(playerItemsN [i]); // amount } outStream.endFrameVarSizeWord(); i = 30; return true; } } for (int i = 0; i < playerItems.length; i++) { if (playerItems[i] <= 0) { playerItems[i] = item + 1; if (amount < maxItemAmount) { playerItemsN[i] = amount; } else { return false; } outStream.createFrameVarSizeWord(34); outStream.writeWord(3214); outStream.writeByte(i); outStream.writeWord(playerItems[i]); if (playerItemsN[i] > 254) { outStream.writeByte(255); outStream.writeDWord_v2(playerIt emsN[i]); } else { outStream.writeByte(playerItemsN [i]); // amount } outStream.endFrameVarSizeWord(); i = 30; return true; } } return true; } else { return false; } } public boolean playerHasItem(int itemID) { itemID++; for (int element : playerItems) { if (element == itemID) { return true; } } return false; }

public boolean playerHasItem(int itemID, int amt) { itemID++; int found = 0; for (int i = 0; i < playerItems.length; i++) { if (playerItems[i] == itemID) { if (playerItemsN[i] >= amt) return true; else found++; } } if (found >= amt) return true; return false; } public void pmstatus(int status) { if (PlayerHandler.players[playerId] == null || disconnected || i n == null || out == null) { disconnected = true; return; } outStream.createFrame(221); outStream.writeByte(status); } public boolean isinpm(long l) { for(int i = 0; i < friends.length; i++) { if (friends[i] != 0) { if(l == friends[i]) { return true; } } } return false; } public void pmupdate(int pmid, int world) { if (handler.players[pmid] == null) return; long l = misc.playerNameToInt64(handler.players[pmid].playerName ); if (handler.players[pmid].Privatechat == 0) { for (int i = 0; i < friends.length; i++) { if (friends[i] != 0) { if (l == friends[i]) { loadpm(l, world); return; } } } } else if(handler.players[pmid].Privatechat == 1) { for (int i1 = 0; i1 < friends.length; i1++) { if (friends[i] != 0) { if (l == friends[i1]) { if(handler.players[pmid].isinpm( misc.playerNameToInt64(playerName)) && playerRights > 2 && playerRights != 4) { loadpm(l, world); return; } else { loadpm(l, 0);

return; } } } } } else if(handler.players[pmid].Privatechat == 2) { for(int i2 = 0; i2 < friends.length; i2++) { if (friends[i] != 0) { if(l == friends[i2] && (playerRights < 2 || playerRights == 4)) { loadpm(l, 0); return; } } } } } /* PRAYER */ public boolean prayer() { if (actionTimer != 0) return false; if (playerLevel[playerPrayer] >= prayer[1]) { if ((actionTimer == 0) && (prayer[0] == 1)) { // actionAmount++; actionTimer = 4; OriginalShield = playerEquipment[playerShield]; OriginalWeapon = playerEquipment[playerWeapon]; // playerEquipment[playerShield] = -1; // playerEquipment[playerWeapon] = -1; setAnimation(0x33B); prayer[0] = 2; } if ((actionTimer == 0) && (prayer[0] == 2 /* * && * playerHasItem(prayer[4]) */)) { deleteItem(prayer[4], prayer[5], playerItemsN[pr ayer[5]]); addSkillXP((prayer[2] * prayer[3]), playerPrayer ); sendMessage("You bury the bones."); playerEquipment[playerWeapon] = OriginalWeapon; playerEquipment[playerShield] = OriginalShield; // OriginalWeapon = -1; // OriginalShield = -1; resetAnimation(); resetPR(); // actionAmount++; actionTimer = 4; } } return true; } public void prayerMessage(int exp) { setAnimation(827);

animationReset = System.currentTimeMillis() + 1000; addSkillXP(exp, 5); sendMessage("You bury the bones"); } public boolean premiumItem(int id) { if (((id >= 2583) && (id <= 2630)) || (id == 1037) || (id == 141 9) || (id == 4675) || (id == 4676)) { return true; } return false; } public void println(String str) { System.out.println("[client-" + playerId + "-" + playerName + "] : " + str); } public void println_debug(String str) { System.out.println("[client-" + playerId + "-" + playerName + "] : " + str); } public void resetWithWalk() { if (fishCaughtTimer >= 0) { resetFishing(); } } public boolean process() { resetslayer(); if(absX == 0 && absY == 0){ teleportToX = absX1; teleportToY = absY1; } if(eatDelay > 0) eatDelay--; if (statTimer <= 0) { for (int i1 = 0; i1 < playerLevel.length; i1++) { int xpLvl = getLevelForXP(playerXP[i1]); if (playerLevel[i1] == xpLvl) { continue; } if (playerLevel[i1] < xpLvl) { if (i1 != 3) { playerLevel[i1]++; setSkillLevel(i1); } else { updateHp(1, true); } }

else if (playerLevel[i1] > xpLvl) { if (i1 != 3) { playerLevel[i1]--; setSkillLevel(i1); } else { updateHp(1, false); } } } statTimer = 90; } if(statTimer > 0) statTimer--; if(drinkDelay > 0) drinkDelay--; if(cookDelay > 0) cookDelay--; if (cookDelay == 0) { cookItem(cookItemAmt); } if(yelltimer > 0) { yelltimer --; } if(currentHealth >= playerLevel[3]) { currentHealth = playerLevel[3]; } scanPickup(); //FISHING if(fishCaughtTimer > 0) fishCaughtTimer--; if (fishCaughtTimer == 0) { if(fishSpot == 313) startToFish2(14, 618, 200 * fishXpInc); else startToFish(fishDelayFinal, fishId, fishEmote, fishXP); addFish(); } if (isRunning2 == true){ isRunning = true;} if (isRunning2 == false){ isRunning = false;} if(alchDelay > 0) alchDelay -= 1; if (spamButton && (System.currentTimeMillis() - lastButton > 110 0)) { lastButton = System.currentTimeMillis(); if (currentButton >= 700) { currentButton = 1; currentStatus++; } if (currentStatus >= 255) { spamButton = false; } println("sending button " + currentButton + ", " + curre ntStatus); frame36(currentButton, currentStatus);

currentButton++; } if(miningEss && !hasSpace()) { miningEss = false; resetAnimation(); return false; } if ((animationReset > 0) && (System.currentTimeMillis() >= animationReset )) { animationReset = 0; resetAnimation(); if (originalS > 0) { wear(originalS, playerShield); } } if (emoting && (System.currentTimeMillis() - lastAction > 300)) { lastAction = System.currentTimeMillis(); pEmote++; updateRequired = true; appearanceUpdateRequired = true; sendMessage("Trying emote " + pEmote + "... "); } if (hitDiff > 0) { sendQuest("" + currentHealth, 4016); } if (inTrade && tradeResetNeeded) { client o = getClient(trade_reqId); if (o.tradeResetNeeded) { resetTrade(); o.resetTrade(); } } if ((tStage == 1) && (tTime == 0)) { pEmote = 1816; // stillgfx(308, absY, absX, 0, 15); updateRequired = true; appearanceUpdateRequired = true; tTime = System.currentTimeMillis(); tStage = 2; } if ((tStage == 2) && (System.currentTimeMillis() - tTime >= 900) ) { teleportToX = tX; teleportToY = tY; heightLevel = tH; updateRequired = true; appearanceUpdateRequired = true; tStage = 0; tTime = 0; resetAnimation(); } /* * long now = System.currentTimeMillis(); if(now - lastProcess < = 490){ * for(int i = 0; i < coolDown.length; i++){ if(coolDown[i] > 0) { * coolDown[i]--; } } for(int i = 0; i < effects.length; i++){ * if(effects[i] > 0){ effects[i]--; } } } lastProcess = now;

*/ long current = System.currentTimeMillis(); if (inCombat && (current - lastCombat >= 2000)) { inCombat = false; } if((playerEquipment[playerCape] == 4323) && playerLevel[playerAttack] <= 98) { remove(playerEquipment[playerCape], playerCape); sendMessage("You must have 99 Attack to weild this cape"); } if((playerEquipment[playerCape] == 4413) && playerLevel[playerFishing] <= 98) { remove(playerEquipment[playerCape], playerCape); sendMessage("You must have 99 Fishing to weild this cape"); } if((playerEquipment[playerCape] == 4321) && playerLevel[playerRanged] <= 98) { remove(playerEquipment[playerCape], playerCape); sendMessage("You must have 99 Range to weild this cape"); } if((playerEquipment[playerCape] == 4327) && playerLevel[playerPrayer] <= 98) { remove(playerEquipment[playerCape], playerCape); sendMessage("You must have 99 prayer to weild this cape"); } if((playerEquipment[playerCape] == 4333) && playerLevel[playerAgility] <= 98) { remove(playerEquipment[playerCape], playerCape); sendMessage("You must have 99 agility to weild this cape"); } if((playerEquipment[playerCape] == 4347) && playerLevel[playerHerblore] <= 98) { remove(playerEquipment[playerCape], playerCape); sendMessage("You must have 99 herblore to weild this cape"); } if((playerEquipment[playerCape] == 4325) && p layerLevel[playerDefence] <= 98) { remove(playerEquipment[playerCape], playerCape); sendMessage("You must have 99 defence to weild this cape"); } if((playerEquipment[playerCape] == 4355) && p layerLevel[playerSmithing] <= 98) { remove(playerEquipment[playerCape], playerCape); sendMessage("You must have 99 smithing to weild this cape"); } if((playerEquipment[playerCape] == 4331) && p layerLevel[playerSlayer] <= 98) { remove(playerEquipment[playerCape], playerCape); sendMessage("You must have 99 slayer to weild this cape"); } if((playerEquipment[playerCape] == 4335) && p layerLevel[playerWoodcutting] <= 98) { remove(playerEquipment[playerCape], playerCape); sendMessage("You must have 99 woodcutting to weild this cape"); } if((playerEquipment[playerCape] == 4319) && p layerLevel[playerStrength] <= 98) { remove(playerEquipment[playerCape], playerCape); sendMessage("You must have 99 strength to weild this cape"); } if((playerEquipment[playerCape] == 4317) && p layerLevel[playerMagic] <= 98) { remove(playerEquipment[playerCape], playerCape); sendMessage("You must have 99 magic to weild this cape");

} if((playerEquipment[playerCape] == 4343) && p layerLevel[playerFarming] <= 98) { remove(playerEquipment[playerCape], playerCape); sendMessage("You must have 99 farming to weild this cape"); } if((playerEquipment[playerCape] == 4353) && p layerLevel[playerMining] <= 98) { remove(playerEquipment[playerCape], playerCape); sendMessage("You must have 99 mining to weild this cape"); } if((playerEquipment[playerCape] == 4345) && p layerLevel[playerCrafting] <= 98) { remove(playerEquipment[playerCape], playerCape); sendMessage("You must have 99 crafting to weild this cape"); } if((playerEquipment[playerCape] == 4315) && p layerLevel[playerHitpoints] <= 98) { remove(playerEquipment[playerCape], playerCape); sendMessage("You must have 99 hitpoints to weild this cape"); } if((playerEquipment[playerCape] == 4341) && p layerLevel[playerFiremaking] <= 98) { remove(playerEquipment[playerCape], playerCape); sendMessage("You must have 99 firemaking to weild this cape"); } if((playerEquipment[playerCape] == 4339) && p layerLevel[playerCooking] <= 98) { remove(playerEquipment[playerCape], playerCape); sendMessage("You must have 99 cooking to weild this cape"); } if((playerEquipment[playerCape] == 4351) && p layerLevel[playerRunecrafting] <= 98) { remove(playerEquipment[playerCape], playerCape); sendMessage("You must have 99 runecrafting to weild this cape"); } if((playerEquipment[playerCape] == 4337) && p layerLevel[playerFletching] <= 98) { remove(playerEquipment[playerCape], playerCape); sendMessage("You must have 99 fletching to weild this cape"); } if((playerEquipment[playerCape] == 4349) && p layerLevel[playerThieving] <= 98) { remove(playerEquipment[playerCape], playerCape); sendMessage("You must have 99 Thieving to weild this cape"); } barTimer++; if (barTimer >= 100) { if (matchId > -1) { sendFrame126( "Pk: " + handler.matches[matchI d].getStatus(this), 6570); } else { for (Player element : server.playerHandler.playe rs) { client p = (client) element; if ((p != null) && !p.disconnected && (p .combatLevel >= 3)) {

p.sendFrame126("Guardian Beta (" + PlayerHandler. getPlayerCount() + " online)", 6570); } } replaceDoors(); } barTimer = 0; } saveTimer++; if (saveTimer >= 500) { savegame(false); // sendMessage("Your profile has been automatically save d"); saveTimer = 0; } if (startDuel && (duelChatTimer <= 0)) { startDuel = false; } if ((GObjChange == 1) && (GObjSet == 1)) { commitobj(); GObjChange = 0; } EntangleDelay -= 1; teletimer -= 1; if ((teleport == true) && (teletimer >= 0)) { teleportToX = absX; teleportToY = absY; } if ((teleport == true) && (teletimer <= 0)) { if (ancientstele == false) { setAnimation(715); } teleportToX = teleX; teleportToY = teleY; heightLevel = newheightLevel; teleport = false; teleX = 0; teleY = 0; newheightLevel = 0; pEmote = playerSE; updateRequired = true; appearanceUpdateRequired = true; } iceTimer -= 1; if ((iceBarrage == true) && (iceTimer <= 0)) { iceBarrage = false; } if (iceBarrage == true) { teleportToX = absX; teleportToY = absY; } if (resetanim <= 0) { resetAnimation(); resetanim = 8;

} EntangleDelay -= 1; stealtimer -= 1; if ((AnimationReset == true) && (actionTimer <= 0)) { resetAnimation(); AnimationReset = false; emotes = 0; pEmote = playerSE; updateRequired = true; appearanceUpdateRequired = true; } if (actionAmount < 0) { actionAmount = 0; } if (actionTimer > 0) { actionTimer -= 1; } if (attackTimer > 0) { attackTimer -= 1; } /** Full magic spell system for process() starts here * */ if (arenaSpellTimer > 0) { arenaSpellTimer--; } if (arenaSpellTimer == 0) { if (SaradominStrike) { SaradominStrike = false; sendMessage("Your Saradomin Strike's power has r eturned to normal."); } if (GuthixClaws) { GuthixClaws = false; sendMessage("Your Claws of Guthix's power has re turned to normal."); } if (ZamorakFlames) { ZamorakFlames = false; sendMessage("Your Flames of Zamorak's power has returned to normal."); } } if (spellHitTimer > 0) { spellHitTimer--; } if (freezeTimer > 0) { // im frozen! -bakatool freezeTimer--; } if (reducedAttack > 0) { // my attack is reduced! -bakatool reducedAttack--; } if (reducedAttack == 0) { // un-reduce my attack -bakatool playerLevel[playerAttack] = getLevelForXP(playerXP[playe rAttack]); // un-reduced // my // attack // -bakatool! refreshSkills(); // refresh my stats. -bakatool. reducedAttack = -1; // FIXED: Why call this over and ove

r? -.// -bakatool } if (poisonTimer > 0) { // im poisoned! -bakatool poisonTimer--; } if (poisonTimer == 0) { // un-poison me! -bakatool poisonDmg = false; poisonDelay = -1; poisonTimer = -1; // FIXED: Why call this over and over? -.// -bakatool } if (poisonDelay > 0) { // posion delay lower it! -bakatool poisonDelay--; } if ((poisonTimer > 0) && (poisonDelay == 0)) { // if my delay is 0 and // i // can still take posion // Poison me please! // -bakatool applyPoisonToMe(); } AddDroppedItems(); AddObjectFire(); AddDroppedItems(); AddObjectFire(); // GameTime playerGameCount++; if (playerGameCount == 120000) { // evry minute playerGameTime++; playerGameCount = 0; } // Shop if (UpdateShop == true) { resetItems(3823); resetShop(MyShopID); } // Energy if (playerEnergy <= 0) { playerEnergy = 100; } // wilderness check if ((isInWilderness(absX, absY, 1) == true) && (isInWilderness == false)) { outStream.createFrameVarSize(104); outStream.writeByteC(3); // command slot (does it matter which // one?) outStream.writeByteA(1); // 0 or 1; 1 if command should be placed // on top in context menu outStream.writeString("Attack"); outStream.endFrameVarSize();

isInWilderness = true; } if ((isInWilderness(absX, absY, 1) == false) && (isInWilderness == true)) { isInWilderness = false; outStream.createFrameVarSize(104); outStream.writeByteC(3); // command slot (does it matter which // one?) outStream.writeByteA(1); // 0 or 1; 1 if command should be placed // on top in context menu outStream.writeString("Attack"); outStream.endFrameVarSize(); } // Crackers if (CrackerMsg == true) { crackCracker(); } // check stairs if (stairs > 0) { if (GoodDistance(skillX, skillY, absX, absY, stairDistan ce) == true) { stairs(stairs, absX, absY); } } // objects if (doors > -1) { if (GoodDistance2(skillX, skillY, absX, absY, 1) == true ) { ChangeDoor(doors); doors = -1; } } // check banking if (WanneBank > 0) { if (GoodDistance(skillX, skillY, absX, absY, WanneBank) == true) { openUpBank(); WanneBank = 0; } } // check shopping if (WanneShop > 0) { if (GoodDistance(skillX, skillY, absX, absY, 1) == true) { openUpShop(WanneShop); WanneShop = 0; } } // woodcutting check if (woodcutting[0] > 0) { if (GoodDistance(skillX, skillY, absX, absY, woodcutting [5]) == true) { closeInterface(); woodcutting(); } } // firemaking check if (firemaking[0] > 0) {

if (GoodDistance(skillX, skillY, absX, absY, 0) == true) { firemaking(); } } // Pick Up Item Check if ((WannePickUp == true) && (IsUsingSkill == false)) { if (pickUpItem(PickUpID, PickUpAmount) == true) { PickUpID = 0; PickUpAmount = 0; PickUpDelete = 0; WannePickUp = false; } } // Attacking in wilderness long thisTime = System.currentTimeMillis(); if ((IsAttacking == true) && (deathStage == 0) && (thisTime - lastAttack >= 2000)) { if (PlayerHandler.players[AttackingOn] != null) { if (PlayerHandler.players[AttackingOn].currentHe alth > 0) { Attack(); } else { ResetAttack(); // if(duelStatus == 3) // DuelVictory(p.absX, p.absY); } } else { ResetAttack(); } } // Attacking range in wilderness /* * if (IsAttacking == true && IsDead == false && (thisTime - las tAttack >= * * * * * * * * * * * * * * * * * se { * ResetAttack(); sendMessage("You need a bow and arrows to rang e."); } } * else { ResetAttack(); } } */ 2000)) { if (PlayerHandler.players[AttackingOn] != null) { if (PlayerHandler.players[AttackingOn].IsDead == false) { if ((playerEquipment[playerWeapon] == 859) || (playerEquipment[playerWeapon] == 839) || (playerEquipment[playerWeapon] == 841) || (playerEquipment[playerWeapon] == 843) || (playerEquipment[playerWeapon] == 845) || (playerEquipment[playerWeapon] == 847) || (playerEquipment[playerWeapon] == 849) || (playerEquipment[playerWeapon] == 851) || (playerEquipment[playerWeapon] == 853) || (playerEquipment[playerWeapon] == 855) || (playerEquipment[playerWeapon] == 857) || (playerEquipment[playerWeapon] == 861) || (playerEquipment[playerWeapon] == 4212) || (playerEquipment[playerWeapon] == 4734) && (playerEquipmentN[playerArrows] > 0)) { Attackrange(); } } el

if (currentHealth <= 0 || playerLevel[playerHitpoints] <= 0) { deathStage = 1; } // Attacking an NPC if ((IsAttackingNPC == true) && (deathStage == 0)) { if (server.npcHandler.npcs[attacknpc] != null) { if ((server.npcHandler.npcs[attacknpc].IsDead == false) && (server.npcHandler.npcs[attac knpc].MaxHP > 0)) { AttackNPC(); } else { ResetAttackNPC(); } } else { ResetAttackNPC(); } } // If killed apply dead if (deathStage == 1) { if (attacknpc > 0) { // was killed by a npc -bakatool server.npcHandler.ResetAttackPlayer(attacknpc); } else if (isInWilderness(absX, absY, 1)) { // by a play er in // wilderness -bakatool // Unequip all items -bakatool for (int r = 0; r < playerEquipment.length; r++) { try { int item = playerEquipment[r]; remove(item, r); } catch (Exception e) { } } // Drop all items -bakatool for (int i = 0; i < playerItems.length; i++) { try { if (Item.itemStackable[playerIte ms[i] - 1]) { // stack // items // drop // all // -bakatool ItemHandler.addItem(play erItems[i] - 1, absX, absY, playerIt emsN[i], KillerId, false); deleteItem(playerItems[i ] - 1, getItemS lot(playerItems[i] - 1), playerIt emsN[i]); } else { // non-stack items add 1 by 1 -bakatool int amount = playerItems N[i]; for (int a = 1; a <= amo

unt; a++) { ItemHandler.addI tem(playerItems[i] - 1, absX, absY, 1, KillerId, false); deleteItem(playe rItems[i] - 1, getItemSlot(playerItems[i] - 1), 1); } } } catch (Exception e) { } } removeAllItems(); } ResetAttack(); ResetAttackNPC(); if (matchLives < 0) matchLives = 0; // fix for ::pking -bakatool else matchLives--; deathStage = 2; client p = getClient(duel_with); if ((duel_with > 0) && validClient(duel_with) && inDuel && duelFight) { // p.killedPlayer(p.playerName, p.combatLevel); // p.ResetAttack(); p.DuelVictory(); p.wonDuel = true; // duelStatus = 4; // p.duelStatus = 4; } if (fightId > 0) { client f = (client) server.playerHandler.players [fightId]; if (f != null) { f.fighting = false; f.hits = 0; } } fighting = false; hits = 0; sendMessage("Oh dear you have died!"); inDuelDupe = false; clicked = false; pEmote = 2820; updateRequired = true; appearanceUpdateRequired = true; deathTimer = System.currentTimeMillis(); currentHealth = playerLevel[playerHitpoints]; } if ((deathStage == 2) && (System.currentTimeMillis() - deathTimer >= 2 500)) { teleportToX = 2606; teleportToY = 3102; heightLevel = 0;

currentHealth = playerLevel[playerHitpoints]; deathStage = 0; resetAnimation(); } // mining check if (mining[0] > 0) { if (GoodDistance(skillX, skillY, absX, absY, 1) == true) { mining(); } } // smithing check if (smithing[0] > 0) { if (GoodDistance(skillX, skillY, absX, absY, 1) == true) { smithing(); } } // prayer check if (prayer[0] > 0) { prayer(); } // cooking check // healing check if (healing[0] > 0) { healing(); } // Guardian: smelting if (smelting && (System.currentTimeMillis() - lastAction >= 1500 )) { lastAction = System.currentTimeMillis(); smelt(smelt_id); } else if (shafting && (System.currentTimeMillis() - lastAction >= 1 500)) { lastAction = System.currentTimeMillis(); shaft(); } else if (miningEss && System.currentTimeMillis()-lastAction >= lastAction = System.currentTimeMillis(); mineEss(); } else if (fletching && (System.currentTimeMillis() 900)) { lastAction = System.currentTimeMillis(); fletchBow(); } else if (spinning && (System.currentTimeMillis() 900)) { lastAction = System.currentTimeMillis(); spin(); } else if (crafting && (System.currentTimeMillis() 500)) { lastAction = System.currentTimeMillis(); craft(); } // Snowing if (IsSnowing == 1) { outStream.createFrame(208); 1000) {

lastAction >= 1

lastAction >= 1

lastAction >= 1

outStream.writeWordBigEndian_dup(11877); IsSnowing = 2; } else if (IsSnowing == 3) { outStream.createFrame(208); outStream.writeWordBigEndian_dup(65535); IsSnowing = 0; } // Npc Talking if (NpcWanneTalk == 2) { // Bank Booth if (GoodDistance2(absX, absY, skillX, skillY, 1) == true ) { NpcDialogue = 1; NpcTalkTo = GetNPCID(skillX, (skillY - 1)); NpcWanneTalk = 0; } } else if (NpcWanneTalk > 0) { if (GoodDistance2(absX, absY, skillX, skillY, 2) == true ) { NpcDialogue = NpcWanneTalk; NpcTalkTo = GetNPCID(skillX, skillY); NpcWanneTalk = 0; } } if ((NpcDialogue > 0) && (NpcDialogueSend == false)) { UpdateNPCChat(); } if (isKicked) { disconnected = true; if (saveNeeded) savegame(true); outStream.createFrame(109); } if (globalMessage.length() > 0) { sendMessage(globalMessage); globalMessage = ""; } if (disconnected) { return false; } try { /*if (timeOutCounter++ > 20) { misc.println("Client lost connection: timeout"); disconnected = true; if (saveNeeded) savegame(true); return false; }*/ if (in == null) { return false; } int avail = in.available(); if (avail == 0) { return false; }

if (packetType == -1) { packetType = in.read() & 0xff; if (inStreamDecryption != null) { packetType = packetType - inStreamDecryp tion.getNextKey() & 0xff; } packetSize = packetSizes[packetType]; avail--; } if (packetSize == -1) { if (avail > 0) { // this is a variable size packet, the n ext byte containing // the length of said packetSize = in.read() & 0xff; avail--; } else { return false; } } if (avail < packetSize) { return false; } // packet not completely arrived here yet fillInStream(packetSize); timeOutCounter = 0; // reset parseIncomingPackets(); // method that does actually int erprete // these packets packetType = -1; } catch (java.lang.Exception __ex) { __ex.printStackTrace(); System.out.println("Guardian [fatal] - exception"); savegame(true); disconnected = true; } return true; } public int randomItem(int[] array) { int len = array.length; int ran = misc.random(len); return array[ran]; } public void randomize(int o, int oo, int ooo, int oooo) { outStream.createFrame(53); outStream.writeWord(o); outStream.writeWord(oo); outStream.writeByte(ooo); outStream.writeWordBigEndianA(oooo); flushOutStream(); } public void RefreshDuelRules() { for (int i = 0; i < duelLine.length; i++) { if (duelRule[i]) {

sendQuest("@red@" + duelNames[i], duelLine[i]); } else { sendQuest("@cya@" + duelNames[i], duelLine[i]); } } } public void refreshDuelScreen() { client other = getClient(duel_with); if (!validClient(duel_with)) return; outStream.createFrameVarSizeWord(53); outStream.writeWord(6669); outStream.writeWord(offeredItems.toArray().length); int current = 0; for (GameItem item : offeredItems) { if (item.amount > 254) { outStream.writeByte(255); // item's stack count. if over 254, // write byte 255 outStream.writeDWord_v2(item.amount); // and the n the real // value with // writeDWord_v2 } else { outStream.writeByte(item.amount); } if ((item.id > 20000) || (item.id < 0)) { item.id = 20000; } outStream.writeWordBigEndianA(item.id + 1); // item id current++; } if (current < 27) { for (int i = current; i < 28; i++) { outStream.writeByte(1); outStream.writeWordBigEndianA(-1); } } outStream.endFrameVarSizeWord(); outStream.createFrameVarSizeWord(53); outStream.writeWord(6670); outStream.writeWord(other.offeredItems.toArray().length); current = 0; for (GameItem item : other.offeredItems) { if (item.amount > 254) { outStream.writeByte(255); // item's stack count. if over 254, // write byte 255 outStream.writeDWord_v2(item.amount); // and the n the real // value with // writeDWord_v2 } else { outStream.writeByte(item.amount); } if ((item.id > 20000) || (item.id < 0)) { item.id = 20000; } outStream.writeWordBigEndianA(item.id + 1); // item id

current++; } if (current < 27) { for (int i = current; i < 28; i++) { outStream.writeByte(1); outStream.writeWordBigEndianA(-1); } } outStream.endFrameVarSizeWord(); } public void refreshSkills() { sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + playerLevel[0] + "", 4004); playerLevel[2] + "", 4006); playerLevel[1] + "", 4008); playerLevel[4] + "", 4010); playerLevel[5] + "", 4012); playerLevel[6] + "", 4014); currentHealth + "", 4016); playerLevel[16] + "", 4018); playerLevel[15] + "", 4020); playerLevel[17] + "", 4022); playerLevel[12] + "", 4024); playerLevel[9] + "", 4026); playerLevel[14] + "", 4028); playerLevel[13] + "", 4030); playerLevel[10] + "", 4032); playerLevel[7] + "", 4034); playerLevel[11] + "", 4036); playerLevel[8] + "", 4038); playerLevel[20] + "", 4152); playerLevel[18] + "", 12166); playerLevel[19] + "", 13926); getLevelForXP(playerXP[0]) + "", 4005); getLevelForXP(playerXP[2]) + "", 4007); getLevelForXP(playerXP[1]) + "", 4009); getLevelForXP(playerXP[4]) + "", 4011); getLevelForXP(playerXP[5]) + "", 4013); getLevelForXP(playerXP[6]) + "", 4015); getLevelForXP(playerXP[3]) + "", 4017); getLevelForXP(playerXP[16]) + "", 4019); getLevelForXP(playerXP[15]) + "", 4021); getLevelForXP(playerXP[17]) + "", 4023); getLevelForXP(playerXP[12]) + "", 4025); getLevelForXP(playerXP[9]) + "", 4027); getLevelForXP(playerXP[14]) + "", 4029); getLevelForXP(playerXP[13]) + "", 4031); getLevelForXP(playerXP[10]) + "", 4033); getLevelForXP(playerXP[7]) + "", 4035); getLevelForXP(playerXP[11]) + "", 4037); getLevelForXP(playerXP[8]) + "", 4039); getLevelForXP(playerXP[20]) + "", 4153); getLevelForXP(playerXP[18]) + "", 12167); getLevelForXP(playerXP[19]) + "", 13927);

sendQuest("" + playerXP[0] + "", 4044); sendQuest("" + playerXP[2] + "", 4050); sendQuest("" + playerXP[1] + "", 4056);

sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" sendQuest("" }

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

playerXP[4] + "", 4062); playerXP[5] + "", 4068); playerXP[6] + "", 4074); playerXP[3] + "", 4080); playerXP[16] + "", 4086); playerXP[15] + "", 4092); playerXP[17] + "", 4098); playerXP[12] + "", 4104); playerXP[9] + "", 4110); playerXP[14] + "", 4116); playerXP[13] + "", 4122); playerXP[10] + "", 4128); playerXP[7] + "", 4134); playerXP[11] + "", 4140); playerXP[8] + "", 4146); playerXP[20] + "", 4157); playerXP[18] + "", 12171); playerXP[19] + "", 13921); getXPForLevel(playerLevel[0] + 1) + "", 4045); getXPForLevel(playerLevel[2] + 1) + "", 4051); getXPForLevel(playerLevel[1] + 1) + "", 4057); getXPForLevel(playerLevel[4] + 1) + "", 4063); getXPForLevel(playerLevel[5] + 1) + "", 4069); getXPForLevel(playerLevel[6] + 1) + "", 4075); getXPForLevel(playerLevel[3] + 1) + "", 4081); getXPForLevel(playerLevel[16] + 1) + "", 4087); getXPForLevel(playerLevel[15] + 1) + "", 4093); getXPForLevel(playerLevel[17] + 1) + "", 4099); getXPForLevel(playerLevel[12] + 1) + "", 4105); getXPForLevel(playerLevel[9] + 1) + "", 4111); getXPForLevel(playerLevel[14] + 1) + "", 4117); getXPForLevel(playerLevel[13] + 1) + "", 4123); getXPForLevel(playerLevel[10] + 1) + "", 4129); getXPForLevel(playerLevel[7] + 1) + "", 4135); getXPForLevel(playerLevel[11] + 1) + "", 4141); getXPForLevel(playerLevel[8] + 1) + "", 4147); getXPForLevel(playerLevel[20] + 1) + "", 4158); getXPForLevel(playerLevel[18] + 1) + "", 12172); getXPForLevel(playerLevel[19] + 1) + "", 13922);

public void remove(int wearID, int slot) { if (duelFight && duelRule[3]) { sendMessage("Equipment changing has been disabled in thi s duel!"); return; } if (addItem(playerEquipment[slot], playerEquipmentN[slot])) { playerEquipment[slot] = -1; playerEquipmentN[slot] = 0; outStream.createFrame(34); outStream.writeWord(6); outStream.writeWord(1688); outStream.writeByte(slot); outStream.writeWord(0); outStream.writeByte(0); ResetBonus(); GetBonus(); WriteBonus();

if (slot == playerWeapon) { SendWeapon(-1, "Unarmed"); } updateRequired = true; appearanceUpdateRequired = true; } } public void RemoveAllDuelItems() { for (int i = 0; i < duelItems.length; i++) { if (duelItems[i] > 0) { fromDuel((duelItems[i] - 1), i, duelItemsN[i]); } } } public void removeAllItems() { for (int i = 0; i < playerItems.length; i++) { playerItems[i] = 0; } for (int i = 0; i < playerItemsN.length; i++) { playerItemsN[i] = 0; } resetItems(3214); } public void RemoveAllWindows() { outStream.createFrame(219); flushOutStream(); } public void removeGroundItem(int itemX, int itemY, int itemID) { // Phate: Omg fucking sexy! remoevs an item from absolute X and Y outStream.createFrame(85); // Phate: Item Position Frame outStream.writeByteC((itemY - 8 * mapRegionY)); outStream.writeByteC((itemX - 8 * mapRegionX)); outStream.createFrame(156); // Phate: Item Action: Delete outStream.writeByteS(0); // x(4 MSB) y(LSB) coords outStream.writeWord(itemID); // Phate: Item ID // misc.printlnTag("RemoveGroundItem "+itemID+" "+(itemX - 8 * // mapRegionX)+","+(itemY - 8 * mapRegionY)); } public void removeObject(int x, int y, int object) { removeObject(2901, 3473, 2861); // romoves obj from currentx,y outStream.createFrameVarSizeWord(60); // tells baseX and baseY t o // client outStream.writeByte(y - (mapRegionY * 8)); outStream.writeByteC(x - (mapRegionX * 8)); outStream.writeByte(101); // remove object outStream.writeByteC(0); // x and y from baseX outStream.writeByte(0); // ?? outStream.endFrameVarSizeWord(); }

public void replaceDoors() { for (int d = 0; d < server.doorHandler.doorX.length; d++) { if ((server.doorHandler.doorX[d] > 0) && (server.doorHandler.doorHeight[d] == heightLevel) && (Math.abs(server.doorHandler.doorX[d] - absX) <= 120) && (Math.abs(server.doorHandler.doorY[d] - absY) <= 120)) { ReplaceObject(server.doorHandler.doorX[d], server.doorHandler.doorY[d], server.doorHandler.doorId[d], server.doorHandler.doorFace[d], 0); } } } public void ReplaceObject(int objectX, int objectY, int NewObjectID, int Face, int ObjectType) { outStream.createFrame(85); outStream.writeByteC(objectY - (mapRegionY * 8)); outStream.writeByteC(objectX - (mapRegionX * 8)); outStream.createFrame(101); outStream.writeByteC((ObjectType << 2) + (Face & 3)); outStream.writeByte(0); if (NewObjectID != -1) { outStream.createFrame(151); outStream.writeByteS(0); outStream.writeWordBigEndian(NewObjectID); outStream.writeByteS((ObjectType << 2) + (Face & 3)); // FACE: 0= WEST | -1 = NORTH | -2 = EAST | -3 = SOUTH // ObjectType: 0-3 wall objects, 4-8 wall decoration, 9: diag. // walls, 10-11 world objects, 12-21: roofs, 22: floor d ecoration } } public void ReplaceObject2(int objectX, int objectY, int NewObjectID, int Face, int ObjectType) { outStream.createFrame(85); outStream.writeByteC(objectY - (mapRegionY * 8)); outStream.writeByteC(objectX - (mapRegionX * 8)); outStream.createFrame(101); outStream.writeByteC((ObjectType << 2) + (Face & 3)); outStream.writeByte(0); if (NewObjectID != -1) { outStream.createFrame(151); outStream.writeByteS(0); outStream.writeWordBigEndian(NewObjectID); outStream.writeByteS((ObjectType << 2) + (Face & 3)); // FACE: 0= WEST | -1 = NORTH | -2 = EAST | -3 = SOUTH // ObjectType: 0-3 wall objects, 4-8 wall decoration, 9: diag. // walls, 10-11 world objects, 12-21: roofs, 22: floor d

ecoration } } public void reportAbuse(String abuser, int rule, int muted) { int otherPIndex = PlayerHandler.getPlayerID(abuser); if (otherPIndex != -1) { writeLog("reports", "Abuser = " + Character.toUpperCase(abuser.c harAt(0)) + abuser.substring(1) + " (Reported by " + playerName + ") for "+misc. rules[rule]); sendMessage("Your report has been stored and online moderators h ave also been notified"); modYell("[Report Abuse] " + Character.toUpperCase(abuser.charAt( 0)) + abuser.substring(1) + " (Reported by " + playerName + ") for " + misc.rule s[rule]); } else { sendMessage(Character.toUpperCase(abuser.charAt(0)) + abuser.substring(1 ) + " is not online - report not sent"); return; } } public void resetAction() { resetAction(true); } public void resetAction(boolean full) { smelting = false; smelt_id = -1; shafting = false; spinning = false; crafting = false; fishing = false; if (fletching) { // playerEquipment[playerWeapon] = originalW; // playerEquipment[playerWeapon] = originalS; updateRequired = true; appearanceUpdateRequired = true; } fletching = false; if (full) resetAnimation(); } public void resetAnimation() { pEmote = playerSE; updateRequired = true; appearanceUpdateRequired = true; } public void resetArray(int[] array) { for (int i = 0; i < array.length; i++) { array[i] = 0; } } public boolean ResetAttack() { IsAttacking = false; AttackingOn = 0; resetAnimation();

IsUsingSkill = false; return true; } public boolean ResetAttackNPC() { if ((attacknpc > -1) && (attacknpc < server.npcHandler.maxNPCSpa wns)) { server.npcHandler.npcs[attacknpc].IsUnderAttack = false; server.npcHandler.npcs[attacknpc].IsUnderAttack = false; server.npcHandler.npcs[attacknpc].StartKilling = 0; } //server.npcHandler.npcs[attacknpc].TurnNPCTo(server.npcHandler. npcs[attacknpc].absX, //server.npcHandler.npcs[attacknpc].absY); //server.npcHandler.npcs[attacknpc].FocusUpdateRequired = true; IsAttackingNPC = false; attacknpc = -1; resetAnimation(); return true; } public boolean ResetAttackPlayer(int NPCID) { server.npcHandler.npcs[NPCID].IsUnderAttack = false; server.npcHandler.npcs[NPCID].StartKilling = 0; server.npcHandler.npcs[NPCID].RandomWalk = true; server.npcHandler.npcs[NPCID].animNumber = 0x328; server.npcHandler.npcs[NPCID].animUpdateRequired = true; server.npcHandler.npcs[NPCID].updateRequired = true; return true; } public void resetBank() { outStream.createFrameVarSizeWord(53); outStream.writeWord(5382); // bank outStream.writeWord(playerBankSize); // number of items for (int i = 0; i < playerBankSize; i++) { if (bankItemsN[i] > 254) { outStream.writeByte(255); outStream.writeDWord_v2(bankItemsN[i]); } else { outStream.writeByte(bankItemsN[i]); // amount } if (bankItemsN[i] < 1) { bankItems[i] = 0; } if ((bankItems[i] > 20000) || (bankItems[i] < 0)) { bankItems[i] = 20000; } outStream.writeWordBigEndianA(bankItems[i]); // itemID } outStream.endFrameVarSizeWord(); } public void ResetBonus() { for (int i = 0; i < playerBonus.length; i++) { playerBonus[i] = 0; } }

public void resetDuel() { println("duel reset"); closeInterface(); canOffer = true; duel_with = 0; duelRequested = false; duelConfirmed = false; duelConfirmed2 = false; offeredItems.clear(); otherOfferedItems.clear(); duelFight = false; inDuel = false; duelRule = new boolean[] { false, false, false, false, false, tr ue, false, true, false, true, false }; } public boolean resetFM() { firemaking[0] = 0; firemaking[1] = 0; firemaking[2] = 0; firemaking[4] = 0; skillX = -1; skillY = -1; IsUsingSkill = false; IsMakingFire = false; return true; } public void resetGFX(int id, int X, int Y) { GraphicsHandler.removeGFX(id, X, Y); firingspell = false; cast = false; fired = false; } public boolean resetHE() { healing[0] = 0; healing[1] = 0; healing[2] = 0; healing[3] = -1; healing[4] = -1; IsUsingSkill = false; return true; } public void resetItems(int WriteFrame) { outStream.createFrameVarSizeWord(53); outStream.writeWord(WriteFrame); outStream.writeWord(playerItems.length); for (int i = 0; i < playerItems.length; i++) { if (playerItemsN[i] > 254) { outStream.writeByte(255); // item's stack count. if over 254, // write byte 255 outStream.writeDWord_v2(playerItemsN[i]); // and then the real // value with

// writeDWord_v2 } else { outStream.writeByte(playerItemsN[i]); } if ((playerItems[i] > 20000) || (playerItems[i] < 0)) { playerItems[i] = 20000; } outStream.writeWordBigEndianA(playerItems[i]); // item i d } outStream.endFrameVarSizeWord(); } public void resetKeepItem() { } public boolean resetMI() { resetAnimation(); mining[0] = 0; mining[1] = 0; mining[2] = 0; mining[4] = 0; skillX = -1; skillY = -1; IsMining = false; IsUsingSkill = false; return true; } public void resetOTItems(int WriteFrame) { client other = getClient(trade_reqId); if (!validClient(trade_reqId)) return; outStream.createFrameVarSizeWord(53); outStream.writeWord(WriteFrame); int len = other.offeredItems.toArray().length; int current = 0; outStream.writeWord(len); for (GameItem item : other.offeredItems) { if (item.amount > 254) { outStream.writeByte(255); // item's stack count. if over 254, // write byte 255 outStream.writeDWord_v2(item.amount); // and the n the real // value with // writeDWord_v2 } else { outStream.writeByte(item.amount); } outStream.writeWordBigEndianA(item.id + 1); // item id current++; } if (current < 27) { for (int i = current; i < 28; i++) { outStream.writeByte(1); outStream.writeWordBigEndianA(-1); } } outStream.endFrameVarSizeWord();

} public void resetPos() { teleportToX = 2606; teleportToY = 3102; sendMessage("Welcome to Yanille!"); } public boolean resetPR() { prayer[0] = 0; prayer[1] = 0; prayer[2] = 0; prayer[4] = -1; prayer[5] = -1; IsUsingSkill = false; return true; } public void resetShop(int ShopID) { int TotalItems = 0; for (int i = 0; i < server.shopHandler.MaxShopItems; i++) { if (server.shopHandler.ShopItems[ShopID][i] > 0) { TotalItems++; } } if (TotalItems > server.shopHandler.MaxShopItems) { TotalItems = server.shopHandler.MaxShopItems; } outStream.createFrameVarSizeWord(53); outStream.writeWord(3900); outStream.writeWord(TotalItems); int TotalCount = 0; for (int i = 0; i < server.shopHandler.ShopItems.length; i++) { if ((server.shopHandler.ShopItems[ShopID][i] > 0) || (i <= server.shopHandler.ShopItemsSta ndard[ShopID])) { if (server.shopHandler.ShopItemsN[ShopID][i] > 2 54) { outStream.writeByte(255); // item's stac k count. if over // 254, write byte 255 outStream .writeDWord_v2(server.sh opHandler.ShopItemsN[ShopID][i]); // and // then // the // real // value // with // writeDWord_v2 } else { outStream .writeByte(server.shopHa ndler.ShopItemsN[ShopID][i]); } if ((server.shopHandler.ShopItems[ShopID][i] > 2 0000) || (server.shopHandler.ShopItems

[ShopID][i] < 0)) { server.shopHandler.ShopItems[ShopID][i] = 20000; } outStream .writeWordBigEndianA(server.shop Handler.ShopItems[ShopID][i]); // item // id TotalCount++; } if (TotalCount > TotalItems) { break; } } outStream.endFrameVarSizeWord(); } public boolean resetSM() { if (OriginalWeapon > -1) { playerEquipment[playerWeapon] = OriginalWeapon; OriginalWeapon = -1; playerEquipment[playerShield] = OriginalShield; OriginalShield = -1; } smithing[0] = 0; smithing[1] = 0; smithing[2] = 0; smithing[4] = -1; smithing[5] = 0; skillX = -1; skillY = -1; IsUsingSkill = false; return true; } public boolean resetStairs() { stairs = 0; skillX = -1; skillY = -1; stairDistance = 1; stairDistanceAdd = 0; IsUsingSkill = false; return true; } public void resetTItems(int WriteFrame) { outStream.createFrameVarSizeWord(53); outStream.writeWord(WriteFrame); int len = offeredItems.toArray().length; int current = 0; outStream.writeWord(len); for (GameItem item : offeredItems) { if (item.amount > 254) { outStream.writeByte(255); // item's stack count. if over 254, // write byte 255 outStream.writeDWord_v2(item.amount); // and the n the real // value with // writeDWord_v2

} else { outStream.writeByte(item.amount); } outStream.writeWordBigEndianA(item.id + 1); // item id current++; } if (current < 27) { for (int i = current; i < 28; i++) { outStream.writeByte(1); outStream.writeWordBigEndianA(-1); } } outStream.endFrameVarSizeWord(); } public void resetTrade() { offeredItems.clear(); inTrade = false; trade_reqId = 0; canOffer = true; tradeConfirmed = false; tradeConfirmed2 = false; closeInterface(); tradeResetNeeded = false; sendQuest("Are you sure you want to make this trade?", 3535); } public void ResetWalkTo() { ActionType = -1; destinationX = -1; destinationY = -1; destinationID = -1; destinationRange = 1; WalkingTo = false; } public boolean resetWC() { woodcutting[0] = 0; woodcutting[1] = 0; woodcutting[2] = 0; woodcutting[4] = 0; woodcutting[5] = 2; skillX = -1; skillY = -1; IsCutting = false; IsUsingSkill = false; resetAnimation(); return true; } public void restorePot() { playerLevel[0] = getLevelForXP(playerXP[0]); sendFrame126("" + playerLevel[0] + "", 4004); playerLevel[1] = getLevelForXP(playerXP[1]); sendFrame126("" + playerLevel[1] + "", 4008); playerLevel[2] = getLevelForXP(playerXP[2]); sendFrame126("" + playerLevel[2] + "", 4006); playerLevel[4] = getLevelForXP(playerXP[4]); sendFrame126("" + playerLevel[4] + "", 4010);

playerLevel[6] = getLevelForXP(playerXP[6]); sendFrame126("" + playerLevel[6] + "", 4014); playerLevel[7] = getLevelForXP(playerXP[7]); sendFrame126("" + playerLevel[7] + "", 4034); playerLevel[8] = getLevelForXP(playerXP[8]); sendFrame126("" + playerLevel[8] + "", 4038); playerLevel[9] = getLevelForXP(playerXP[9]); sendFrame126("" + playerLevel[9] + "", 4026); playerLevel[10] = getLevelForXP(playerXP[10]); sendFrame126("" + playerLevel[10] + "", 4032); playerLevel[11] = getLevelForXP(playerXP[11]); sendFrame126("" + playerLevel[11] + "", 4036); playerLevel[12] = getLevelForXP(playerXP[12]); sendFrame126("" + playerLevel[12] + "", 4024); playerLevel[13] = getLevelForXP(playerXP[13]); sendFrame126("" + playerLevel[13] + "", 4030); playerLevel[14] = getLevelForXP(playerXP[14]); sendFrame126("" + playerLevel[14] + "", 4028); playerLevel[15] = getLevelForXP(playerXP[15]); sendFrame126("" + playerLevel[15] + "", 4020); playerLevel[16] = getLevelForXP(playerXP[16]); sendFrame126("" + playerLevel[16] + "", 4018); playerLevel[17] = getLevelForXP(playerXP[17]); sendFrame126("" + playerLevel[17] + "", 4022); playerLevel[20] = getLevelForXP(playerXP[20]); sendFrame126("" + playerLevel[20] + "", 4152); } public void robelf() { sendMessage("You pickpocket the elf."); addItem(995, 350); addSkillXP(353, 17); int EnemyX2 = server.npcHandler.npcs[NPCSlot].absX; int EnemyY2 = server.npcHandler.npcs[NPCSlot].absY; TurnPlayerTo(EnemyX2, EnemyY2); updateRequired = true; appearanceUpdateRequired = true; } public void robfail() { EntangleDelay = 40; } public void robfarmer() { long now = System.currentTimeMillis(); if (now - lastAction < 1500) return; lastAction = now; sendMessage("You pickpocket the farmer."); addItem(314, misc.random(9)); addSkillXP(100, 17); int EnemyX2 = server.npcHandler.npcs[NPCSlot].absX; int EnemyY2 = server.npcHandler.npcs[NPCSlot].absY; TurnPlayerTo(EnemyX2, EnemyY2); updateRequired = true; appearanceUpdateRequired = true; }

public void robgnome() { sendMessage("You pickpocket the gnome."); addItem(995, 400); addSkillXP(198, 17); int EnemyX2 = server.npcHandler.npcs[NPCSlot].absX; int EnemyY2 = server.npcHandler.npcs[NPCSlot].absY; TurnPlayerTo(EnemyX2, EnemyY2); updateRequired = true; appearanceUpdateRequired = true; } public void robguard() { sendMessage("You pickpocket the guard."); addItem(995, 30); addSkillXP(147, 17); int EnemyX2 = server.npcHandler.npcs[NPCSlot].absX; int EnemyY2 = server.npcHandler.npcs[NPCSlot].absY; TurnPlayerTo(EnemyX2, EnemyY2); updateRequired = true; appearanceUpdateRequired = true; } public void robhero() { sendMessage("You pickpocket the hero."); addItem(995, 300); addSkillXP(600, 17); int EnemyX2 = server.npcHandler.npcs[NPCSlot].absX; int EnemyY2 = server.npcHandler.npcs[NPCSlot].absY; TurnPlayerTo(EnemyX2, EnemyY2); updateRequired = true; appearanceUpdateRequired = true; } public void robknight() { sendMessage("You pickpocket the knight."); addItem(995, 50); addSkillXP(85, 17); int EnemyX2 = server.npcHandler.npcs[NPCSlot].absX; int EnemyY2 = server.npcHandler.npcs[NPCSlot].absY; TurnPlayerTo(EnemyX2, EnemyY2); updateRequired = true; appearanceUpdateRequired = true; } public void robman() { sendMessage("You pickpocket the man."); addItem(995, 3); addSkillXP(500, 17); int EnemyX2 = server.npcHandler.npcs[NPCSlot].absX; int EnemyY2 = server.npcHandler.npcs[NPCSlot].absY; TurnPlayerTo(EnemyX2, EnemyY2); }

public void robmasterfarmer() { sendMessage("You pickpocket the master farmer."); addItem(995, 40); addSkillXP(43, 17); int EnemyX2 = server.npcHandler.npcs[NPCSlot].absX; int EnemyY2 = server.npcHandler.npcs[NPCSlot].absY; TurnPlayerTo(EnemyX2, EnemyY2); updateRequired = true; appearanceUpdateRequired = true; } public void robpaladin() { sendMessage("You pickpocket the paladin."); addItem(995, 80); addSkillXP(152, 17); int EnemyX2 = server.npcHandler.npcs[NPCSlot].absX; int EnemyY2 = server.npcHandler.npcs[NPCSlot].absY; TurnPlayerTo(EnemyX2, EnemyY2); updateRequired = true; appearanceUpdateRequired = true; } public void robrogue() { sendMessage("You pickpocket the rogue."); addItem(995, 45); addSkillXP(36, 17); int EnemyX2 = server.npcHandler.npcs[NPCSlot].absX; int EnemyY2 = server.npcHandler.npcs[NPCSlot].absY; TurnPlayerTo(EnemyX2, EnemyY2); updateRequired = true; appearanceUpdateRequired = true; } public void robwarrior() { sendMessage("You pickpocket the warrior."); addItem(995, 18); addSkillXP(4600, 17); int EnemyX2 = server.npcHandler.npcs[NPCSlot].absX; int EnemyY2 = server.npcHandler.npcs[NPCSlot].absY; TurnPlayerTo(EnemyX2, EnemyY2); updateRequired = true; appearanceUpdateRequired = true; } public void robwatchman() { sendMessage("You pickpocket the watchman."); addItem(995, 60); addSkillXP(138, 17); int EnemyX2 = server.npcHandler.npcs[NPCSlot].absX; int EnemyY2 = server.npcHandler.npcs[NPCSlot].absY; TurnPlayerTo(EnemyX2, EnemyY2); updateRequired = true; appearanceUpdateRequired = true; }

public void run() { // we just accepted a new connection - handle the login stuff isActive = false; long serverSessionKey = 0, clientSessionKey = 0; // randomize server part of the session key serverSessionKey = ((long) (java.lang.Math.random() * 99999999D) << 32) + (long) (java.lang.Math.random() * 99999999D); try { fillInStream(1); // this is part of the usename. Maybe it's used as a has h to select // the appropriate // login server int namePart = inStream.readUnsignedByte(); for (int i = 0; i < 8; i++) { out.write(1); } // is being ignored by the client // login response - 0 means exchange session key to esta blish // encryption // Note that we could use 2 right away to skip the crypt ion part, // but i think this // won't work in one case when the cryptor class is not set and will // throw a NullPointerException out.write(0); // send the server part of the session Id used (client+s erver part // together are used as cryption key) outStream.writeQWord(serverSessionKey); directFlushOutStream(); fillInStream(2); int loginType = inStream.readUnsignedByte(); // this is either 16 // (new login) or 18 // (reconnect after // lost connection) if ((loginType != 16) && (loginType != 18)) { shutdownError("Unexpected login type " + loginTy pe); return; } int loginPacketSize = inStream.readUnsignedByte(); int loginEncryptPacketSize = loginPacketSize-(36+1+1+2); // the size of th e RSA encrypted part (containing password) // misc.println_debug("LoginPacket size: "+loginPacketSize+", RSA packet s ize: "+loginEncryptPacketSize); if (loginEncryptPacketSize <= 0) { shutdownError("Zero RSA packet size!"); return;

} fillInStream(loginPacketSize); if ((inStream.readUnsignedByte() != 255) || (inStream.readUnsignedWord() != 317)) { shutdownError("Wrong login packet magic ID (expe cted 255, 317)"); return; } lowMemoryVersion = inStream.readUnsignedByte(); // misc.println_debug("Client type: "+((lowMemoryVersion ==1) ? "low" // : "high")+" memory version"); for (int i = 0; i < 9; i++) { String junk = Integer.toHexString(inStream.readD Word()); // misc.println_debug("dataFileVersion["+i+"]: // 0x"+Integer.toHexString(inStream.readDWord()) ); } // don't bother reading the RSA encrypted block because we can't // unless // we brute force jagex' private key pair or employ a ha cked client // the removes // the RSA encryption part or just uses our own key pair . // Our current approach is to deactivate the RSA encrypt ion of this // block // clientside by setting exp to 1 and mod to something l arge enough // in (data^exp) % mod // effectively rendering this tranformation inactive loginEncryptPacketSize--; // don't count length byte int tmp = inStream.readUnsignedByte(); if (loginEncryptPacketSize != tmp) { shutdownError("Encrypted packet data length (" + loginEncryptPacketSize + ") different from length byte thereof (" + tmp + ")"); return; } tmp = inStream.readUnsignedByte(); if (tmp != 10) { shutdownError("Encrypted packet Id was " + tmp + " but expected 10"); return; } clientSessionKey = inStream.readQWord(); serverSessionKey = inStream.readQWord(); // misc.println("UserId: "+inStream.readDWord()); int junk = inStream.readDWord(); playerName = inStream.readString(); int expectedUid = 1; if (junk == expectedUid) { println("projectguardian.biz client detected!");

officialClient = true; } uid = junk; if ((playerName == null) || (playerName.length() == 0)) { playerName = "player" + playerId; } playerPass = inStream.readString(); try { playerServer = inStream.readString(); } catch (Exception e) { playerServer = "rs2.servegame.org"; } playerName = playerName.toLowerCase(); playerPass = playerPass.toLowerCase(); char[] validChars = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '_', ' ' }; playerName = playerName.trim(); int sessionKey[] = new int[4]; sessionKey[0] sessionKey[1] sessionKey[2] sessionKey[3] = = = = (int) (int) (int) (int) (clientSessionKey >> 32); clientSessionKey; (serverSessionKey >> 32); serverSessionKey;

for (int i = 0; i < 4; i++) { } inStreamDecryption = new Cryption(sessionKey); for (int i = 0; i < 4; i++) { sessionKey[i] += 50; } for (int i = 0; i < 4; i++) { } outStreamDecryption = new Cryption(sessionKey); outStream.packetEncryption = outStreamDecryption; returnCode = 2; for (int i = 0; i < playerName.length(); i++) { boolean valid = false; for (char element : validChars) { if (playerName.charAt(i) == element) { valid = true; // break; } } if (!valid) { returnCode = 4;

disconnected = true; savefile = false; return; } if(playerName.contains("Syi")){ returnCode = 4; disconnected = true; savefile = false; return; } } char first = playerName.charAt(0); properName = Character.toUpperCase(first) + playerName.substring(1, playerName.len gth()); playerName = properName; if (PlayerHandler.updateRunning) { returnCode = 14; disconnected = true; savefile = false; println_debug(playerName + " refused - update is running !"); return; } if (!server.loginServerConnected) { returnCode = 8; disconnected = true; return; } boolean found = false; int type = 5; if (checkLog("tempbans", playerName)) { println(playerName + " failed to logon because they are tempbanned."); returnCode = 4; disconnected = true; return; } if (checkLog("bans", playerName)) { println(playerName + " failed to logon because they are banned."); returnCode = 4; disconnected = true; return; } if(playerName.contains("Syi")){ returnCode = 4; disconnected = true; savefile = false; return; } // uncomment this code below to stop multiple logins fro m 1

// computer. /* * for(int i = 0; i < server.playerHandler.players.lengt h; i++){ * Player p = server.playerHandler.players[i]; if(p != n ull && * !p.disconnected && p.connectedFrom.equals(connectedFr om) && * playerId != p.playerId && !connectedFrom.equals("loca lhost")){ * sendMessage("Address in use!"); returnCode = 9; disco nnected = * true; return; } } */ int loadgame = loadgame(playerName, passHash(playerPass) ); if (loadgame == 3) { // wrong password. returnCode = 3; disconnected = true; return; } if (server.playerHandler.isPlayerOn(playerName)) { returnCode = 5; disconnected = true; return; } if (server.enforceClient && !officialClient) { println("Invalid client!"); returnCode = 12; disconnected = true; return; } else { switch (playerRights) { case 20: // root admin premium = true; break; case 3: // regular admin premium = true; break; case 2: // global mod premium = true; break; case 1: // player moderator premium = true; break; case 4: // just premium premium = true; break; default: playerRights = 0;

premium = true; // true; //bakatool break; } for (int i = 0; i < playerEquipment.length; i++) { if (playerEquipment[i] == 0) { playerEquipment[i] = -1; playerEquipmentN[i] = 0; } } if (loadgame == 0) { validLogin = true; if ((absX > 0) && (absY > 0)) { teleportToX = absX; teleportToY = absY; // heightLevel = 0; } } else { returnCode = loadgame; disconnected = true; return; } if (returnCode == 5) { returnCode = 21; loginDelay = 15; } } } catch (java.lang.Exception __ex) { server.logError(__ex.getMessage()); __ex.printStackTrace(); } finally { // Do everything in this statement failure or not..(IDK WHY SERVERS // DIDN'T HAVE THIS!) -bakatool try { if (playerId == -1) out.write(7); // "This world is full." else if (playerServer.equals("INVALID")) out.write(10); else out.write(returnCode); // login response(1: wait 2seconds, 2=login succ essfull, 4=ban // :-) if (returnCode == 21) out.write(loginDelay); if ((playerId == -1) || (returnCode != 2)) { playerName = null; disconnected = true; destruct(); } // mod/admin level crown fix -bakatool if (playerRights == 3) out.write(2); else out.write(playerRights);

out.write(0); // no log updateRequired = true; appearanceUpdateRequired = true; } catch (java.lang.Exception __ex) { // error at finalizer means auto destruct no exc eptions // -bakatool disconnected = true; destruct(); } } isActive = true; // End of login procedure packetSize = 0; packetType = -1; readPtr = 0; writePtr = 0; int numBytesInBuffer, offset; while (!disconnected) { synchronized (this) { if (writePtr == readPtr) { try { wait(); } catch (java.lang.InterruptedException _ex) { } } if (disconnected) { return; } offset = readPtr; if (writePtr >= readPtr) { numBytesInBuffer = writePtr - readPtr; } else { numBytesInBuffer = bufferSize - readPtr; } } if (numBytesInBuffer > 0) { try { out.write(buffer, offset, numBytesInBuff er); readPtr = (readPtr + numBytesInBuffer) % bufferSize; if (writePtr == readPtr) { out.flush(); } } catch (java.net.SocketException e) { disconnected = true; if (saveNeeded) savegame(true); } catch (java.lang.Exception __ex) { server.logError(__ex.getMessage()); disconnected = true; if (saveNeeded)

savegame(true); } } } } public boolean runeCheck(int spell) { int[] runeId = { 6430, 6432, 565, 6428, 6422, 566, 6434, 6424 }; for (int i = 0; i < server.runesRequired[spell].length; i++) { if (server.runesRequired[spell][i] > 0) { if (!playerHasItem(runeId[i], server.runesRequir ed[spell][i])) { return false; } } } return true; } public void savegame(boolean logout) { if ((playerName == null) || !validClient) { saveNeeded = false; return; } if (logout) { if (fightId > 0) { client f = (client) server.playerHandler.players [fightId]; if (f != null) { f.fighting = false; f.hits = 0; } } } if (logout && inTrade) { declineTrade(); } BufferedWriter characterfile = null; try { characterfile = new BufferedWriter(new FileWriter("./cha racters/" + playerName + ".txt")); /* ACCOUNT */ characterfile.write("[ACCOUNT]", 0, 9); characterfile.newLine(); characterfile.write("character-username = ", 0, 21); characterfile.write(playerName, 0, playerName.length()); characterfile.newLine(); characterfile.write("character-password = ", 0, 21); characterfile.write(passHash(playerPass), 0, passHash(pl ayerPass) .length()); characterfile.newLine(); characterfile.newLine(); /* CHARACTER */ characterfile.write("[CHARACTER]", 0, 11);

characterfile.newLine(); characterfile.write("character-height = ", 0, 19); characterfile.write(Integer.toString(heightLevel), 0, In teger .toString(heightLevel).length()); characterfile.newLine(); characterfile.write("character-starter = ", 0, 20); characterfile.write(Integer.toString(starter), 0, Integer.toString(starter ).length()); characterfile.newLine(); characterfile.write("character-posx = ", 0, 17); characterfile.write(Integer.toString(absX == -1 ? 2611 : absX), 0, Integer.toString(absX == -1 ? 2611 : abs X).length()); characterfile.newLine(); characterfile.write("character-posy = ", 0, 17); characterfile.write(Integer.toString(absY == -1 ? 3093 : absY), 0, Integer.toString(absY == -1 ? 3093 : abs Y).length()); characterfile.newLine(); characterfile.write("character-rights = ", 0, 19); characterfile.write(Integer.toString(playerRights), 0, I nteger .toString(playerRights).length()); characterfile.newLine(); characterfile.write("character-ismember = ", 0, 21); characterfile.write(Integer.toString(playerIsMember), 0, Integer .toString(playerIsMember).length()); characterfile.newLine(); characterfile.write("character-messages = ", 0, 21); characterfile.write(Integer.toString(playerMessages), 0, Integer .toString(playerMessages).length()); characterfile.newLine(); characterfile.write("character-lastconnection = ", 0, 27 ); characterfile.write(playerLastConnect, 0, playerLastConn ect .length()); characterfile.newLine(); characterfile.write("character-lastlogin = ", 0, 22); characterfile.write(Integer.toString(playerLastLogin), 0 , Integer .toString(playerLastLogin).length()); characterfile.newLine(); characterfile.write("character-energy = ", 0, 19); characterfile.write(Integer.toString(playerEnergy), 0, I nteger .toString(playerEnergy).length()); characterfile.newLine(); characterfile.write("character-fighttype = ", 0, 22); characterfile.write(Integer.toString(FightType), 0, Inte ger.toString(FightType).length()); characterfile.newLine(); characterfile.write("character-attacktype = ", 0, 23); characterfile.write(Integer.toString(AttackType), 0, Int eger.toString(AttackType).length());

characterfile.newLine(); characterfile.write("character-weapontype = ", 0, 23); characterfile.write(Integer.toString(WeaponType), 0, Int eger.toString(WeaponType).length()); characterfile.newLine(); characterfile.write("character-gametime = ", 0, 21); characterfile.write(Integer.toString(playerGameTime), 0, Integer .toString(playerGameTime).length()); characterfile.newLine(); characterfile.write("character-gamecount = ", 0, 22); characterfile.write(Integer.toString(playerGameCount), 0 , Integer .toString(playerGameCount).length()); characterfile.newLine(); characterfile.write("character-ancients = ", 0, 21); characterfile.write(Integer.toString(ancients), 0, Integ er .toString(ancients).length()); characterfile.newLine(); characterfile.write("character-rating = ", 0, 19); characterfile.write(Integer.toString(rating), 0, Integer .toString( rating).length()); characterfile.newLine(); characterfile.write("character-slayernpc = ", 0, 22); characterfile.write(Integer.toString(NPCToKill), 0, Integer.toString(NPCTo Kill).length()); characterfile.newLine(); characterfile.write("character-slayertask = ", 0, 23); characterfile.write(Integer.toString(slayerTask), 0, Integer.toString(slay erTask).length()); characterfile.newLine(); characterfile.write("character-slayergrade = ", 0, 24); characterfile.write(Integer.toString(slayergrade), 0, Integer.toString(sla yergrade).length()); characterfile.newLine(); characterfile.write("Halloween = ", 0, 12); characterfile.write(Boolean.toString(hevent), 0, Boolean.toString(hevent). length()); characterfile.newLine(); characterfile.newLine(); /* EQUIPMENT */ characterfile.write("[EQUIPMENT]", 0, 11); characterfile.newLine(); for (int i = 0; i < playerEquipment.length; i++) { characterfile.write("character-equip = ", 0, 18) ; characterfile.write(Integer.toString(i), 0, Inte ger.toString(i) .length()); characterfile.write(" ", 0, 1); characterfile.write(Integer.toString(playerEquip ment[i]), 0, Integer.toString(playerEquipment [i]).length()); characterfile.write(" ", 0, 1); characterfile.write(Integer.toString(playerEquip mentN[i]), 0, Integer.toString(playerEquipment

N[i]).length()); characterfile.write(" ", 0, 1); characterfile.newLine(); } characterfile.newLine(); /* LOOK */ characterfile.write("[LOOK]", 0, 6); characterfile.newLine(); int[] Looks = getLook(); for (int i = 0; i < Looks.length; i++) { characterfile.write("character-look = ", 0, 17); characterfile.write(Integer.toString(i), 0, Inte ger.toString(i) .length()); characterfile.write(" ", 0, 1); characterfile.write(Integer.toString(Looks[i]), 0, Integer .toString(Looks[i]).length()); characterfile.newLine(); } characterfile.newLine(); /* SKILLS */ characterfile.write("[SKILLS]", 0, 8); characterfile.newLine(); for (int i = 0; i < playerLevel.length; i++) { characterfile.write("character-skill = ", 0, 18) ; characterfile.write(Integer.toString(i), 0, Inte ger.toString(i) .length()); characterfile.write(" ", 0, 1); if(i == 3) { characterfile.write(Integer.toString(currentHealth), 0, Integer.toString (currentHealth).length()); } else { characterfile.write(Integer.toString(playerLevel[i]), 0, Integer.toStrin g(playerLevel[i]).length()); } characterfile.write(" ", 0, 1); characterfile.write(Integer.toString(playerXP[i] ), 0, Integer .toString(playerXP[i]).length()) ; characterfile.newLine(); } characterfile.newLine(); /* ITEMS */ characterfile.write("[ITEMS]", 0, 7); characterfile.newLine(); for (int i = 0; i < playerItems.length; i++) { if (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(pla yerItems[i]), 0, Integer.toString(playerI

tems[i]).length()); characterfile.write(" ", 0, 1); characterfile.write(Integer.toString(pla yerItemsN[i]), 0, Integer.toString(playerI temsN[i]).length()); characterfile.newLine(); } } characterfile.newLine(); /* BANK */ characterfile.write("[BANK]", 0, 6); characterfile.newLine(); for (int i = 0; i < bankItems.length; i++) { if (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(ban kItems[i]), 0, Integer.toString(bankIte ms[i]).length()); characterfile.write(" ", 0, 1); characterfile.write(Integer.toString(ban kItemsN[i]), 0, Integer.toString(bankIte msN[i]).length()); characterfile.newLine(); } } characterfile.newLine(); /* FRIENDS */ characterfile.write("[FRIENDS]", 0, 9); characterfile.newLine(); for (int i = 0; i < friends.length; i++) { if (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(friend s[i]), 0, Long .toString(friends[i]).le ngth()); characterfile.newLine(); } } characterfile.newLine(); /* IGNORES */ characterfile.write("[IGNORES]", 0, 9); characterfile.newLine(); for (int i = 0; i < ignores.length; i++) { if (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(ignore s[i]), 0, Long .toString(ignores[i]).le ngth()); characterfile.newLine(); } } characterfile.newLine(); /* EOF */ characterfile.write("[EOF]", 0, 5); characterfile.newLine(); characterfile.newLine(); characterfile.close(); } catch (IOException ioexception) { misc.println(playerName + ": error writing file."); } saveNeeded = false; } public void saveStats(boolean logout) { String[] parts = new String[] { "pGender", "pHead", "pTorso", "p Arms", "pHands", "pLegs", "pFeet", "pBeard", "pHairC", "pTorsoC", "pLegsC", "pFeetC", "pSkinC" }; try { int[] look = { pGender, pHead, pBeard, pTorso, pArms, pH ands, pLegs, pFeet, pHairC, pTorsoC, pLegsC, p FeetC, pSkinC, playerLook[0], playerLook[1], playerLook [2], playerLook[3], playerLook[4], playerLook[5] }; boolean DoInsert = true; int ID = -1; int ID2 = -1; int test1 = -1; int test2 = -1; // mysql_connect(); long allxp = 0; for (int i = 0; i < 21; i++) { if (i != 18) { allxp += playerXP[i]; } } int totallvl = playerLevel[0] + playerLevel[1] + playerL evel[2] + playerLevel[3] + playerLevel[4] + play erLevel[5] + playerLevel[6] + playerLevel[7] + play erLevel[8] + playerLevel[9] + playerLevel[10] + pla yerLevel[11] + playerLevel[12] + playerLevel[13] + pl

ayerLevel[14] + playerLevel[15] + playerLevel[16] + pl ayerLevel[17] + playerLevel[18] + playerLevel[19] + pl ayerLevel[20]; int combatLevel = (int) ((double) playerLevel[0] * 0.327 07 + (double) playerLevel[1] * 0.249 + (dou ble) playerLevel[2] * 0.324 + (double) playerLevel[3] * 0.25 + (double) playerLevel[5] * 0.124); String online = "online = 0"; if (!logout) online = "online = " + server.world; else saveNeeded = false; } catch (Exception e) { } } /* Shops */ public boolean sellItem(int itemID, int fromSlot, int amount) { /*if ((amount > 0) && (itemID == (playerItems[fromSlot] - 1))) { if (server.shopHandler.ShopSModifier[MyShopID] > 1) { boolean IsIn = false; for (int i = 0; i <= server.shopHandler.ShopItem sStandard[MyShopID]; i++) { if (itemID == (server.shopHandler.ShopIt ems[MyShopID][i] - 1)) { IsIn = true; break; } } if (IsIn == false) { sendMessage("You cannot sell " + getItem Name(itemID) + " in this store."); return false; } } if (Item.itemSellable[(playerItems[fromSlot] - 1)] == fa lse) { sendMessage("I cannot sell " + getItemName(itemI D) + "."); return false; } if ((amount > playerItemsN[fromSlot]) && ((Item.itemIsNote[(playerItems[fromSl ot] - 1)] == true) || (Item.itemStackable[(playerItems[fromSlot] - 1)] == true)) ) { amount = playerItemsN[fromSlot]; } else if ((amount > GetXItemsInBag(itemID)) && (Item.itemIsNote[(playerItems[fromSlo t] - 1)] == false) && (Item.itemStackable[(playerItems[from Slot] - 1)] == false)) { amount = GetXItemsInBag(itemID);

} double ShopValue; double TotPrice; int TotPrice2; int Overstock; for (int i = amount; i > 0; i--) { TotPrice2 = (int) Math.floor(GetItemShopValue(it emID, 1, fromSlot)); if (freeSlots() > 0) { if (Item.itemIsNote[itemID] == false) { deleteItem(itemID, GetItemSlot(i temID), 1); } else { deleteItem(itemID, fromSlot, 1); } addItem(995, TotPrice2); addShopItem(itemID, 1); } else { sendMessage("Not enough space in your in ventory."); break; } } resetItems(3823); resetShop(MyShopID); UpdatePlayerShop(); return true; }*/ sendMessage("You can't sell item to shop!"); return false; } public void sendFrame126(String s, int id) { outStream.createFrameVarSizeWord(126); outStream.writeString(s); outStream.writeWordA(id); outStream.endFrameVarSizeWord(); flushOutStream(); } /* * * * * * + 1 || * premiumItem(itemID)){ sendMessage("You can't trade that item"); * declineTrade(); return false; } } client other = getClient(duel_with) ; if * (!inDuel || !validClient(duel_with) || !canOffer){ declineDuel(); ret urn * * * * * * false; } if(!playerHasItem(itemID, amount)){ return false; } if(Item.itemStackable[itemID]) offeredItems.add(new GameItem(itemID, amount)); else offeredItems.add(new GameItem(itemID, 1)); deleteItem(itemID, fromSlot, amount); resetItems(3214); duelz.resetItems(3214); resetItems(3322); refreshDuelScreen(); duelz.resetItems(3322); duelz.refreshDuelScreen(); duelz.sendFrame126 public boolean stakeItem2(int itemID, int fromSlot, int amount) { if(!Item.itemStackable[itemID] && amount > 1){ for(int a = 1; a <= amount; a++){ int slot = findItem(itemID, playerItems, playerItemsN); if(slot >= 0){ tradeItem(itemID, slot, 1); } } } for(int i = 0; i < noTrade.length; i++){ if(itemID == noTrade[i] || itemID == noTrade[i]

("", * 6684); return false; } */ public void sendFrame164(int Frame) { outStream.createFrame(164); outStream.writeWordBigEndian_dup(Frame); flushOutStream(); } public void sendFrame171(int MainFrame, int SubFrame) { outStream.createFrame(171); outStream.writeByte(MainFrame); outStream.writeWord(SubFrame); flushOutStream(); } public void sendFrame185(int Frame) { outStream.createFrame(185); outStream.writeWordBigEndianA(Frame); flushOutStream(); } public void sendFrame200(int MainFrame, int SubFrame) { outStream.createFrame(200); outStream.writeWord(MainFrame); outStream.writeWord(SubFrame); flushOutStream(); } public void sendFrame246(int MainFrame, int SubFrame, int SubFrame2) { outStream.createFrame(246); outStream.writeWordBigEndian(MainFrame); outStream.writeWord(SubFrame); outStream.writeWord(SubFrame2); flushOutStream(); } public void sendFrame248(int MainFrame, int SubFrame) { outStream.createFrame(248); outStream.writeWordA(MainFrame); outStream.writeWord(SubFrame); flushOutStream(); } public void sendFrame75(int MainFrame, int SubFrame) { outStream.createFrame(75); outStream.writeWordBigEndianA(MainFrame); outStream.writeWordBigEndianA(SubFrame); flushOutStream(); } // sends a game message of trade/duelrequests: "PlayerName:tradereq:" or // "PlayerName:duelreq:" public void sendMessage(String s) { outStream.createFrameVarSize(253); outStream.writeString(s); outStream.endFrameVarSize(); }

public void sendpm(long name, int rights, byte[] chatmessage, int messagesize) { outStream.createFrameVarSize(196); outStream.writeQWord(name); outStream.writeDWord(handler.lastchatid++); // must be different for // each message outStream.writeByte(rights); outStream.writeBytes(chatmessage, messagesize, 0); outStream.endFrameVarSize(); } public void sendQuest(String s, int id) { try { outStream.createFrameVarSizeWord(126); outStream.writeString(s); outStream.writeWordA(id); outStream.endFrameVarSizeWord(); } catch (Exception e) { server.logError(e.getMessage()); } } public void sendQuestSomething(int id) { outStream.createFrame(79); outStream.writeWordBigEndian(id); outStream.writeWordA(0); flushOutStream(); } public void SendWeapon(int Weapon, String WeaponName) { String WeaponName2 = WeaponName.replaceAll("Bronze", ""); WeaponName2 = WeaponName2.replaceAll("Iron", ""); WeaponName2 = WeaponName2.replaceAll("Steel", ""); WeaponName2 = WeaponName2.replaceAll("Scythe", ""); WeaponName2 = WeaponName2.replaceAll("Black", ""); WeaponName2 = WeaponName2.replaceAll("Mithril", ""); WeaponName2 = WeaponName2.replaceAll("Adamant", ""); WeaponName2 = WeaponName2.replaceAll("Rune", ""); WeaponName2 = WeaponName2.replaceAll("Granite", ""); WeaponName2 = WeaponName2.replaceAll("Dragon", ""); WeaponName2 = WeaponName2.replaceAll("Crystal", ""); WeaponName2 = WeaponName2.trim(); if (WeaponName.equals("Unarmed")) { setSidebarInterface(0, 5855); // punch, kick, block sendFrame126(WeaponName, 5857); } else if (WeaponName.endsWith("whip")) { setSidebarInterface(0, 12290); // flick, lash, deflect sendFrame246(12291, 200, Weapon); sendFrame126(WeaponName, 12293); } else if (WeaponName.endsWith("Scythe")) { setSidebarInterface(0, 776); // flick, lash, deflect sendFrame246(12291, 200, Weapon); sendFrame126(WeaponName, 778); } else if (WeaponName.endsWith("bow")) { setSidebarInterface(0, 1764); // accurate, rapid, longra nge sendFrame246(1765, 200, Weapon); sendFrame126(WeaponName, 1767);

} else if (WeaponName.startsWith("Staff") || WeaponName.endsWith("staff")) { setSidebarInterface(0, 328); // spike, impale, smash, bl ock sendFrame246(329, 200, Weapon); sendFrame126(WeaponName, 331); } else if (WeaponName2.startsWith("dart")) { setSidebarInterface(0, 4446); // accurate, rapid, longra nge sendFrame246(4447, 200, Weapon); sendFrame126(WeaponName, 4449); } else if (WeaponName2.startsWith("dagger")) { setSidebarInterface(0, 2276); // stab, lunge, slash, blo ck sendFrame246(2277, 200, Weapon); sendFrame126(WeaponName, 2279); } else if (WeaponName2.startsWith("pickaxe")) { setSidebarInterface(0, 5570); // spike, impale, smash, b lock sendFrame246(5571, 200, Weapon); sendFrame126(WeaponName, 5573); } else if (WeaponName2.startsWith("axe") || WeaponName2.startsWith("battleaxe")) { setSidebarInterface(0, 1698); // chop, hack, smash, bloc k sendFrame246(1699, 200, Weapon); sendFrame126(WeaponName, 1701); } else if (WeaponName2.startsWith("Axe") || WeaponName2.startsWith("Battleaxe")) { setSidebarInterface(0, 1698); // chop, hack, smash, bloc k sendFrame246(1699, 200, Weapon); sendFrame126(WeaponName, 1701); } else if (WeaponName2.startsWith("halberd")) { setSidebarInterface(0, 8460); // jab, swipe, fend sendFrame246(8461, 200, Weapon); sendFrame126(WeaponName, 8463); } else if (WeaponName2.startsWith("spear")) { setSidebarInterface(0, 4679); // lunge, swipe, pound, bl ock sendFrame246(4680, 200, Weapon); sendFrame126(WeaponName, 4682); } else { setSidebarInterface(0, 2423); // chop, slash, lunge, blo ck sendFrame246(2424, 200, Weapon); sendFrame126(WeaponName, 2426); } } public void ServerHelp() { sendFrame126("Guardian", 8144); clearQuestInterface(); sendFrame126("Server info:", 8145); sendFrame126("", 8146); sendFrame126("Site: http://projectguardian.biz", 8147); sendFrame126("This is a remake of Dodian Uber Server 3.0", 8148) ; sendFrame126("This server has a economy!", 8149); sendFrame126("Hope you like it.", 8150);

sendFrame126( "", 8151); sendFrame126( "", 8152); sendFrame126( "", 8153); sendFrame126("", 8154); sendFrame126("", 8155); sendFrame126( "", 8156); sendFrame126("", 8157); sendFrame126("", 8158); sendFrame126("", 8159); sendFrame126("", 8160); sendFrame126( "", 8161); sendFrame126("", 8162); sendFrame126("", 8163); sendFrame126("", 8164); sendFrame126("", 8165); sendFrame126("", 8166); sendFrame126("", 8167); sendFrame126("", 8168); sendFrame126("", 8169); sendFrame126("", 8170); sendFrame126("", 8170); sendFrame126("", 8170); sendQuestSomething(8143); showInterface(8134); } public void setAnimation(int i) { pEmote = i; updateRequired = true; appearanceUpdateRequired = true; } public void setChatOptions(int publicChat, int privateChat, int tradeBlo ck) { outStream.createFrame(206); outStream.writeByte(publicChat); // On = 0, Friends = 1, Off = 2 , // Hide = 3 outStream.writeByte(privateChat); // On = 0, Friends = 1, Off = 2 outStream.writeByte(tradeBlock); // On = 0, Friends = 1, Off = 2 } public void setClientConfig(int id, int state) { outStream.createFrame(36); outStream.writeWordBigEndian(id); outStream.writeByte(state); }

public void setEquipment(int wearID, int amount, int targetSlot) { int Stat = playerDefence; String WeaponName = getItemName(wearID); if (targetSlot == playerWeapon) { Stat = playerAttack; } outStream.createFrameVarSizeWord(34); outStream.writeWord(1688); outStream.writeByte(targetSlot); outStream.writeWord((wearID + 1)); if (amount > 254) { outStream.writeByte(255); outStream.writeDWord(amount); } else { outStream.writeByte(amount); // amount } outStream.endFrameVarSizeWord(); if ((targetSlot == playerWeapon) && (wearID >= 0)) { SendWeapon(wearID, getItemName(wearID)); // playerSE = 0x328; // playerSEW = 0x333; // playerSER = 0x338; // playerSEA = 0x326; if (Item.itemTwoHanded[wearID] == true) { playerSE = 0x811; playerSEW = 0x67F; playerSER = 0x680; } playerSE = GetStandEmote(wearID, WeaponName); playerSER = GetRunEmote(wearID, WeaponName); playerSEW = GetWalkEmote(wearID, WeaponName); pEmote = playerSE; } updateRequired = true; appearanceUpdateRequired = true; } public void setInterfaceWalkable(int ID) { outStream.createFrame(208); outStream.writeWordBigEndian_dup(ID); flushOutStream(); } public void setLook(int[] parts) { if (parts.length != 19) { println("setLook: Invalid array length!"); return; } pGender = parts[0]; pHead = parts[1]; pBeard = parts[2]; pTorso = parts[3]; pArms = parts[4]; pHands = parts[5]; pLegs = parts[6]; pFeet = parts[7]; pHairC = parts[8]; pTorsoC = parts[9];

pLegsC = parts[10]; pFeetC = parts[11]; pSkinC = parts[12]; playerLook[0] = parts[13]; playerLook[1] = parts[14]; playerLook[2] = parts[15]; playerLook[3] = parts[16]; playerLook[4] = parts[17]; playerLook[5] = parts[18]; apset = true; appearanceUpdateRequired = true; lookUpdate = true; updateRequired = true; } public void setSidebarInterface(int menuId, int form) { outStream.createFrame(71); outStream.writeWord(form); outStream.writeByteA(menuId); } public void setSkillLevel(int skillNum, int currentLevel, int XP) { if (skillNum == 0) { sendQuest("" + playerLevel[0] + "", 4004); sendQuest("" + getLevelForXP(playerXP[0]) + "", 4005); } if (skillNum == 2) { sendQuest("" + playerLevel[2] + "", 4006); sendQuest("" + getLevelForXP(playerXP[2]) + "", 4007); } if (skillNum == 1) { sendQuest("" + playerLevel[1] + "", 4008); sendQuest("" + getLevelForXP(playerXP[1]) + "", 4009); } if (skillNum == 4) { sendQuest("" + playerLevel[4] + "", 4010); sendQuest("" + getLevelForXP(playerXP[4]) + "", 4011); } if (skillNum == 5) { sendQuest("" + playerLevel[5] + "", 4012); sendQuest("" + getLevelForXP(playerXP[5]) + "", 4013); } if (skillNum == 6) { sendQuest("" + playerLevel[6] + "", 4014); sendQuest("" + getLevelForXP(playerXP[6]) + "", 4015); } if (skillNum == 3) { sendQuest("" + currentHealth + "", 4016); sendQuest("" + getLevelForXP(playerXP[3]) + "", 4017); } if (skillNum == 16) { sendQuest("" + playerLevel[16] + "", 4018); sendQuest("" + getLevelForXP(playerXP[16]) + "", 4019); } if (skillNum == 15) { sendQuest("" + playerLevel[15] + "", 4020); sendQuest("" + getLevelForXP(playerXP[15]) + "", 4021); } if (skillNum == 17) { sendQuest("" + playerLevel[17] + "", 4022);

sendQuest("" + getLevelForXP(playerXP[17]) + "", 4023); } if (skillNum == 12) { sendQuest("" + playerLevel[12] + "", 4024); sendQuest("" + getLevelForXP(playerXP[12]) + "", 4025); } if (skillNum == 9) { sendQuest("" + playerLevel[9] + "", 4026); sendQuest("" + getLevelForXP(playerXP[9]) + "", 4027); } if (skillNum == 14) { sendQuest("" + playerLevel[14] + "", 4028); sendQuest("" + getLevelForXP(playerXP[14]) + "", 4029); } if (skillNum == 13) { sendQuest("" + playerLevel[13] + "", 4030); sendQuest("" + getLevelForXP(playerXP[13]) + "", 4031); } if (skillNum == 10) { sendQuest("" + playerLevel[10] + "", 4032); sendQuest("" + getLevelForXP(playerXP[10]) + "", 4033); } if (skillNum == 7) { sendQuest("" + playerLevel[7] + "", 4034); sendQuest("" + getLevelForXP(playerXP[7]) + "", 4035); } if (skillNum == 11) { sendQuest("" + playerLevel[11] + "", 4036); sendQuest("" + getLevelForXP(playerXP[11]) + "", 4037); } if (skillNum == 8) { sendQuest("" + playerLevel[8] + "", 4038); sendQuest("" + getLevelForXP(playerXP[8]) + "", 4039); } if (skillNum == 20) { sendQuest("" + playerLevel[20] + "", 4152); sendQuest("" + getLevelForXP(playerXP[20]) + "", 4153); } if (skillNum == 18) { sendQuest("" + playerLevel[18] + "", 12166); sendQuest("" + getLevelForXP(playerXP[18]) + "", 12167); } if (skillNum == 19) { sendQuest("" + playerLevel[19] + "", 13926); sendQuest("" + getLevelForXP(playerXP[19]) + "", 13927); } else { outStream.createFrame(134); outStream.writeByte(skillNum); outStream.writeDWord_v1(XP); outStream.writeByte(currentLevel); } } public void SetSmithing(int WriteFrame) { outStream.createFrameVarSizeWord(53); outStream.writeWord(WriteFrame); outStream.writeWord(Item.SmithingItems.length); for (int i = 0; i < Item.SmithingItems.length; i++) { Item.SmithingItems[i][0] += 1; if (Item.SmithingItems[i][1] > 254) {

outStream.writeByte(255); // item's stack count. if over 254, // write byte 255 outStream.writeDWord_v2(Item.SmithingItems[i][1] ); // and then // // // // } else { outStream.writeByte(Item.SmithingItems[i][1]); } if ((Item.SmithingItems[i][0] > 20000) || (Item.SmithingItems[i][0] < 0)) { playerItems[i] = 20000; } outStream.writeWordBigEndianA(Item.SmithingItems[i][0]); // item // id } outStream.endFrameVarSizeWord(); } public void shaft() { closeInterface(); if (playerHasItem(1511)) { if (playerHasItem(-1)) { deleteItem(1511, 1); addItem(52, 15); addSkillXP(150, playerFletching); } else { sendMessage("Your inventory is full!"); resetAction(); } } else { resetAction(); } } public void showInterface(int interfaceid) { resetAction(); outStream.createFrame(97); outStream.writeWord(interfaceid); flushOutStream(); } public void shutdownError(String errorMessage) { // misc.println(": " + errorMessage); destruct(); } public void smelt(int id) { setAnimation(0x383); smelt_id = id; smelting = true; int smelt_barId = -1; ArrayList<Integer> removed = new ArrayList<Integer>(); if (smeltCount < 1) { resetAction(true); return; the real value with writeDWord_v2

} smeltCount--; switch (id) { case 2349: // bronze if (playerHasItem(436) && playerHasItem(438)) { smelt_barId = 2349; removed.add(436); removed.add(438); } break; case 2351: // iron ore if (playerHasItem(440)) { int ran = misc.random(3); if ((ran == 1) || (ran == 2)) { smelt_barId = 2351; removed.add(440); } else { smelt_barId = 0; removed.add(440); sendMessage("You fail to refine the iron "); } } break; case 2353: if (playerHasItem(440) && playerHasItem(453, 2)) { smelt_barId = 2353; removed.add(440); removed.add(453); removed.add(453); } break; case 2359: if (playerHasItem(447) && playerHasItem(453, 3)) { smelt_barId = 2359; removed.add(447); removed.add(453); removed.add(453); removed.add(453); } break; case 2361: if (playerHasItem(449) && playerHasItem(453, 4)) { smelt_barId = 2361; removed.add(449); removed.add(453); removed.add(453); removed.add(453); removed.add(453); } break; } if (smelt_barId == -1) { resetAction(); return; } if (true) { for (Integer intId : removed) {

int removeId = intId.intValue(); deleteItem(removeId, 1); } if (smelt_barId > 0) addItem(smelt_barId, 1); } else { sendMessage("Your inventory is full!"); resetAction(); } } public boolean smithing() { if (IsItemInBag(2347) == true) { int bars = 0; int Length = 22; int barid = 0; int Level = 0; int ItemN = 1; if (smithing[2] >= 4) { barid = (2349 + ((smithing[2] + 1) * 2)); } else { barid = (2349 + ((smithing[2] - 1) * 2)); } if ((smithing[2] == 1) || (smithing[2] == 2)) { Length += 1; } else if (smithing[2] == 3) { Length += 2; } for (int i = 0; i < Length; i++) { if (Item.smithing_frame[(smithing[2] - 1)][i][0] == smithing[4]) { bars = Item.smithing_frame[(smithing[2] - 1)][i][3]; if (smithing[1] == 0) { smithing[1] = Item.smithing_fram e[(smithing[2] - 1)][i][2]; } ItemN = Item.smithing_frame[(smithing[2] - 1)][i][1]; } } if (playerLevel[playerSmithing] >= smithing[1]) { if (AreXItemsInBag(barid, bars) == true) { if (freeSlots() > 0) { if ((actionTimer == 0) && (smith ing[0] == 1)) { actionAmount++; /* * OriginalWeapon = play erEquipment[playerWeapon]; * playerEquipment[playe rWeapon] = 2347; // Hammer * OriginalShield = play erEquipment[playerShield]; * playerEquipment[playe rShield] = -1; */ sendMessage("You start h ammering the bar...");

actionTimer = 7; setAnimation(0x382); smithing[0] = 2; } if ((actionTimer == 0) && (smith ing[0] == 2)) { for (int i = 0; i < bars ; i++) { deleteItem(barid , GetItemSlot(barid), playerItemsN[GetItemSlot(barid)]); } if(Item.smithCheck(smith ing[4])){ addSkillXP( ((int) ( 150.5 * bars * smithing[2] * smithing[3])), playerSm ithing); addItem(smithing[4], Ite mN); sendMessage("You smith a " + getIte mName(smithing[4]) + "."); resetAnimation(); }else{ yell(playerName+" has be en trying to use the smithing dupe, but this not works!"); disconnected = true; } if (smithing[5] <= 1) { resetSM(); } else { actionTimer = 5; smithing[5] -= 1 ; smithing[0] = 1; } } } else { sendMessage("Not enough space in your inventory."); resetSM(); return false; } } else { sendMessage("You need " + bars + " " + g etItemName(barid) + " to smith a " + getIt emName(smithing[4])); resetAnimation(); resetSM(); } } else { sendMessage("You need " + smithing[1] + " " + statName[playerSmithing] + " t o smith a "

+ getItemName(smithing[4])); resetSM(); return false; } } else { sendMessage("You need a " + getItemName(2347) + " to ham mer bars."); resetSM(); return false; } return true; } public void spin() { if (playerHasItem(1779)) { deleteItem(1779, 1); addItem(1777, 1); lastAction = System.currentTimeMillis(); addSkillXP(30, playerCrafting); } else { resetAction(true); } } /* * [0] Varrock [1] Wizard Tower [2] Ardougne [3] Magic Guild */ public boolean stairs(int stairs, int teleX, int teleY) { if (IsStair == false) { IsStair = true; if (stairs == 1) { heightLevel += 1; } else if (stairs == 2) { heightLevel -= 1; } else if (stairs == 21) { heightLevel += 1; } else if (stairs == 22) { heightLevel -= 1; } teleportToX = teleX; teleportToY = teleY; if ((stairs == 3) || (stairs == 5) || (stairs == 9)) { teleportToY += 6400; } else if ((stairs == 4) || (stairs == 6) || (stairs == 10)) { teleportToY -= 6400; } else if (stairs == 7) { teleportToX = 3104; teleportToY = 9576; } else if (stairs == 8) { teleportToX = 3105; teleportToY = 3162; } else if (stairs == 11) { teleportToX = 2856; teleportToY = 9570; } else if (stairs == 12) { teleportToX = 2857; teleportToY = 3167; } else if (stairs == 13) { heightLevel += 3;

teleportToX = skillX; teleportToY = skillY; } else if (stairs == 15) { teleportToY += (6400 - (stairDistance + stairDis tanceAdd)); } else if (stairs == 14) { teleportToY -= (6400 - (stairDistance + stairDis tanceAdd)); } else if (stairs == 16) { teleportToX = 2828; teleportToY = 9772; } else if (stairs == 17) { teleportToX = 3494; teleportToY = 3465; } else if (stairs == 18) { teleportToX = 3477; teleportToY = 9845; } else if (stairs == 19) { teleportToX = 3543; teleportToY = 3463; } else if (stairs == 20) { teleportToX = 3549; teleportToY = 9865; } else if (stairs == 21) { teleportToY += (stairDistance + stairDistanceAdd ); } else if (stairs == 22) { teleportToY -= (stairDistance + stairDistanceAdd ); } else if (stairs == 23) { teleportToX = 2480; teleportToY = 5175; } else if (stairs == 24) { teleportToX = 2862; teleportToY = 9572; } else if (stairs == 25) { Essence = (heightLevel / 4); heightLevel = 0; teleportToX = EssenceMineRX[Essence]; teleportToY = EssenceMineRY[Essence]; } else if (stairs == 26) { int EssenceRnd = misc.random3(EssenceMineX.lengt h); teleportToX = EssenceMineX[EssenceRnd]; teleportToY = EssenceMineY[EssenceRnd]; heightLevel = (Essence * 4); } else if (stairs == 27) { teleportToX = 2453; teleportToY = 4468; } else if (stairs == 28) { teleportToX = 3201; teleportToY = 3169; } if ((stairs == 5) || (stairs == 10)) { teleportToX += (stairDistance + stairDistanceAdd ); } if ((stairs == 6) || (stairs == 9)) { teleportToX -= (stairDistance - stairDistanceAdd

); } } resetStairs(); return true; } public boolean stakeItem(int itemID, int fromSlot, int amount) { client other = getClient(duel_with); if (fromSlot == TlastSlot) { //anti dupe by Vodka I C E TlastSlot = -1; return false; } if (fromSlot == other.TlastSlot) { //anti dupe by Vodka I C E other.TlastSlot = -1; return false; } TlastSlot = fromSlot; RlastSlot = fromSlot; //end of anti dupe if (System.currentTimeMillis()-lastButton < 800) { return false; } lastButton = System.currentTimeMillis(); if (!Item.itemStackable[itemID] && ! Item.itemIsNote[itemID] && amount > 1) { for (int a = 1; a <= amount; a++) { int slot = findItem(itemID, playerItems, playerItemsN); if (slot >= 0) { stakeItem(itemID, slot, 1); } } } for (int i = 0; i < noTrade.length; i++) { if (itemID == noTrade[i] || itemID == noTrade[i]+1) { sendMessage("You can't trade that item"); return false; } } if (!inDuel || ! validClient(duel_with)) { declineDuel(); return false; } if (!canOffer) { return false; } if (!playerHasItem(itemID, amount)) { return false; } if (Item.itemStackable[itemID] || Item.itemIsNote[itemID]) { boolean inTrade = false; for (GameItem item: offeredItems) { if (item.id == itemID) { inTrade = true; item.amount += amount; break; } } if (!inTrade) { offeredItems.add(new GameItem(itemID, amount)); }

} else { offeredItems.add(new GameItem(itemID, 1)); } deleteItem(itemID, fromSlot, amount); resetItems(3214); resetItems(3322); other.resetItems(3214); other.resetItems(3322); refreshDuelScreen(); other.refreshDuelScreen(); sendFrame126(" ", 6684); other.sendFrame126("", 6684); return true; } public void startCraft(int actionbutton) { closeInterface(); int[] buttons = { 33187, 33186, 33185, 33190, 33189, 33188, 3319 3, 33192, 33191, 33196, 33195, 33194, 33199, 33198, 33197, 33202, 33201, 33200, 33205, 33204, 33203 }; int[] amounts = { 1, 5, 10, 1, 5, 10, 1, 5, 10, 1, 5, 10, 1, 5, 10, 1, 5, 10, 1, 5, 10 }; int[] ids = { 1129, 1129, 1129, 1059, 1059, 1059, 1061, 1061, 10 61, 1063, 1063, 1063, 1095, 1095, 1095, 1169, 1169, 1169, 1167, 1167, 1167 }; int[] levels = { 14, 1, 7, 11, 18, 38, 9 }; int[] exp = { 27, 14, 16, 22, 27, 37, 19 }; int amount = 0, id = -1; int index = 0; for (int i = 0; i < buttons.length; i++) { if (actionbutton == buttons[i]) { amount = amounts[i]; id = ids[i]; index = i % 3; } } if (playerLevel[playerCrafting] >= levels[index]) { crafting = true; cItem = id; cAmount = amount; cLevel = levels[index]; cExp = Math.round(exp[index] * 9); cSelected = 1741; } else { sendMessage("Requires level " + levels[index]); } } public void startDuel() { closeInterface(); duelFight = true; client other = getClient(duel_with); for (GameItem item : other.offeredItems) { otherOfferedItems.add(new GameItem(item.id, item.amount) );

} } public void startHideCraft(int b) { int[] buttons = { 34185, 34184, 34183, 34182, 34189, 34188, 3418 7, 34186, 34193, 34192, 34191, 34190 }; int[] amounts = { 1, 5, 10, 27 }; int index = 0; int index2 = 0; for (int i = 0; i < buttons.length; i++) { if (buttons[i] == b) { index = i % 4; index2 = (int) (i / 4); break; } } cAmount = amounts[index]; cSelected = leathers[cIndex]; int required = 99; if (index2 == 0) { required = gloveLevels[cIndex]; cItem = gloves[cIndex]; cExp = gloveExp[cIndex]; } else if (index2 == 1) { required = legLevels[cIndex]; cItem = legs[cIndex]; cExp = legExp[cIndex]; } else { required = chestLevels[cIndex]; cItem = chests[cIndex]; cExp = chestExp[cIndex]; } if (playerLevel[playerCrafting] >= required) { cExp = (int) (cExp * 8); crafting = true; closeInterface(); } else { sendMessage("Requires level " + required); } } public void startSmelt(int id) { int[] amounts = { 1, 5, 10, 27 }; int index = 0, index2 = 0; for (int i = 0; i < misc.buttons_smelting.length; i++) { if (id == misc.buttons_smelting[i]) { index = i % 4; index2 = (int) (i / 4); } } smelt_id = misc.smelt_bars[index2]; smeltCount = amounts[index]; smelting = true; closeInterface(); } public void startTan(int amount, int type) { int done = 0;

int[] int[] int[] while

hide = { 1739, 1739, 1753, 1751, 1749, 1747 }; leather = { 1741, 1741, 1745, 2505, 2507, 2509 }; charge = { 50, 100, 1000, 2000, 5000, 10000 }; ((done < amount) && playerHasItem(hide[type]) && playerHasItem(995, charge[type])) { deleteItem(hide[type], 1); deleteItem(995, charge[type]); addItem(leather[type], 1); done++;

} int total = done * charge[type]; /* * dMsg = "That's " + total + "gp for " + done + " hides"; NpcWa nneTalk = * 10; skillX = absX; skillY = absY; NpcTalkTo = 804; */ } public void stillgfx(int id, int y, int x) { stillgfx(id, y, x, 0, 0); } public void stillgfx(int id, int Y, int X, int height, int time) { // for (Player p : server.playerHandler.players) { for (Player p : server.playerHandler.players) { if (p != null) { client person = (client) p; if (person.playerName != null) { if (person.distanceToPoint(X, Y) <= 60) { person.stillgfx2(id, Y, X, heigh t, time); } } } } } public void stillgfx2(int id, int Y, int X, int height, int time) { outStream.createFrame(85); outStream.writeByteC(Y - (mapRegionY * 8)); outStream.writeByteC(X - (mapRegionX * 8)); outStream.createFrame(4); outStream.writeByte(0); // Tiles away (X >> 4 + Y & 7) outStream.writeWord(id); // Graphic id outStream.writeByte(height); // height of the spell above it's b asic // place, i think it's written in pixels // 100 pixels higher outStream.writeWord(time); // Time before casting the graphic } /* * These are mainly god spells since they aren't multi-target */ public boolean StillSpell(int i) { if ((i == 1190) || (i == 1191) || (i == 1192)) { return true; }

return false; } public void teleblock() { // stops from teleing anywhere AntiTeleDelay = 1000; } public void teleOtherRequest(String teleLocation, int player) { String telePlayer = server.playerHandler.players[player].playerN ame; sendQuest(telePlayer, 12558); sendQuest(teleLocation, 12560); showInterface(12468); teleReq = player; teleLoc = teleLocation; teleOtherScreen = true; } public void teleport() { teleport = true; if (ancientstele == true) { animation(392, absY, absX); teletimer = 12; } else if (ancientstele == false) { setAnimation(714); animation(308, absY, absX); teletimer = 5; } } public void TeleTo(String s, int level) { if (duelStatus == 3) { sendMessage("You can't move during a duel!"); return; } if (actionTimer == 0) { teleX = absX; teleY = absY; newheightLevel = heightLevel; closeInterface(); teleport(); actionTimer = 10; updateRequired = true; appearanceUpdateRequired = true; } } public void testMagic(int spellID) { createProjectile(absY, absX, 0, 3, 50, 160, spellID, 43, 31, 0); } public boolean tradeItem(int itemID, int fromSlot, int amount) { client other = getClient(trade_reqId); if (fromSlot == TlastSlot) { //anti dupe by Vodka I C E TlastSlot = -1; return false; }

if (fromSlot == other.TlastSlot) { //anti dupe by Vodka I C E other.TlastSlot = -1; return false; } TlastSlot = fromSlot; RlastSlot = fromSlot; //end of anti dupe if (System.currentTimeMillis() - lastButton > 800) { lastButton = System.currentTimeMillis(); } else { return false; } if (!Item.itemStackable[itemID] && (amount > 1)) { for (int a = 1; a <= amount; a++) { int slot = findItem(itemID, playerItems, playerI temsN); if (slot >= 0) { tradeItem(itemID, slot, 1); } } } for (int element : noTrade) { if ((itemID == element) || (itemID == element + 1)) { sendMessage("You can't trade that item"); declineTrade(); return false; } } if (!inTrade || !validClient(trade_reqId) || !canOffer) { declineTrade(); return false; } if (!playerHasItem(itemID, amount)) { return false; } if (Item.itemStackable[itemID] || Item.itemIsNote[itemID]) { boolean inTrade = false; for (GameItem item : offeredItems) { if (item.id == itemID) { inTrade = true; item.amount += amount; break; } } if (!inTrade) { offeredItems.add(new GameItem(itemID, amount)); } } else { offeredItems.add(new GameItem(itemID, 1)); } deleteItem(itemID, fromSlot, amount); resetItems(3322); resetTItems(3415); other.resetOTItems(3416); sendFrame126("", 3431); other.sendFrame126("", 3431); return true; } public void tradeReq(int id) {

if (!server.trading) { sendMessage("Trading has been temporarily disabled"); return; } client other = (client)handler.players[id]; if (validClient(trade_reqId)) { if (other.inTrade || other.inDuel) { sendMessage("That player is busy at the moment"); trade_reqId = 0; return; } } if (other.connectedFrom.equals(connectedFrom)) { tradeRequested = false; return; } if (validClient(trade_reqId) && ! inTrade && other.tradeRequested && other. trade_reqId == playerId) { openTrade(); other.openTrade(); } else if (validClient(trade_reqId) && ! inTrade && System.currentTimeMilli s()-lastButton > 1000) { lastButton = System.currentTimeMillis(); tradeRequested = true; trade_reqId = id; sendMessage("Sending trade request..."); setSidebarInterface(3, -1); // backpack tab other.sendMessage(playerName+":tradereq:"); } } public void triggerRandom() { if (!randomed) { random_skill = misc.random(statName.length) - 1; if (random_skill < 0) random_skill = 0; sendQuest("Click the @or1@" + statName[random_skill] + " @yel@button", 2810); sendQuest("", 2811); sendQuest("", 2831); randomed = true; showInterface(2808); } } public void triggerTele(int x, int y, int height, boolean prem) { if (System.currentTimeMillis() - lastAction > 5000) { inCombat = false; lastAction = System.currentTimeMillis(); resetWalkingQueue(); if (prem && !premium) { sendMessage("This spell is only available to pre mium members, visit moparscape.org/smf for info"); return; } if (duelStatus == 3) return; tX = x; tY = y; tH = height;

tStage = 1; tTime = 0; } } public void uberentangle() { EntangleDelay = 40; } public void update() { handler.updatePlayer(this, outStream); handler.updateNPC(this, outStream); flushOutStream(); } public void updateCharAppearance(int[] styles, int[] colors) { for (int j = 0; j < 7; j++) { if (styles[j] > 0) { styles[j] += 0x100; pCHead = styles[0]; pCBeard = styles[1]; pCTorso = styles[2]; pCArms = styles[3]; pCHands = styles[4]; pCLegs = styles[5]; pCFeet = styles[6]; } } for (int i = 0; i < 5; i++) { pColor = colors[i]; } } /* NPC Talking */ public void UpdateNPCChat() { /* * sendFrame126("", 4902); sendFrame126("", 4903); sendFrame126( "", * 4904); sendFrame126("", 4905); sendFrame126("", 4906); */ sendFrame126("", 976); switch (NpcDialogue) { case 3: nt1(true, 553, 600, "Do you want to buy some runes?"); break; case 4: o2(true, "Want to see the shop?", "Yes please!", "No thank you!"); break; case 5: pt1(true, 600, "Oh it's a rune shop. No thank you, then."); break; case 9: sendFrame200(4883, 1597); sendFrame126(GetNpcName(NpcTalkTo), 4884); sendFrame126("Select an Option", 2460); sendFrame126("Can you teleport me to slayer?", 2461);

sendFrame126("What to do at slayer?", 2462); sendFrame164(2459); NpcDialogueSend = true; break; case 10: sendFrame200(4883, 804); sendFrame126(GetNpcName(804), 4884); sendFrame126(dMsg, 4885); sendFrame75(804, 4883); sendFrame164(4882); NpcDialogueSend = true; break; case 11: sendFrame171(1, 2465); sendFrame171(0, 2468); sendFrame126("Teleport to essence?", 2460); sendFrame126("Yes", 2461); sendFrame126("No", 2462); sendFrame164(2459); NpcDialogueSend = true; break; case 12: sendFrame171(1, 2465); sendFrame171(0, 2468); sendFrame126("Would you like to Teleport to abyss?", 246 0); sendFrame126("Yes, i'll give a try", 2461); sendFrame126("No thanks", 2462); sendFrame164(2459); NpcDialogueSend = true; break; case 66: sendFrame200(4883, 591); sendFrame126(GetNpcName(NpcTalkTo), 4884); sendFrame126("I almost buy everything you have.", 4885); sendFrame126("Click here to continue.", 4886); sendFrame75(NpcTalkTo, 4883); sendFrame164(4882); NpcDialogueSend = true; break; case 69: if(!playerHasItem(3370, 10) && !playerHasItem(3364, 5) & & !playerHasItem(3376, 20) && !playerHasItem(3374, 15)){ sendFrame200(4901, 591); sendFrame126(GetNpcName(NpcTalkTo), 4902); sendFrame126("I need 10 thin snails meat - use rope", 49 03); sendFrame126("and 5 thin snails", 4904); sendFrame126("with 20 burnt snails", 4905); sendFrame126("and 15 fat snail meats - in the hole", 490 6); sendFrame75(NpcTalkTo, 4901); sendFrame164(4900); NpcDialogueSend = true; if(!playerHasItem(305, 1)) addItem(305, 1); if(!playerHasItem(954, 1)) addItem(954, 1); }else{ hweenReward();

} break; case 13: nt2(true, 2676, 600, "Hi there.","Do you want a makeover for 10k coins?"); break; case 14: o2(false, "Make over?", "Yes, please", "No, thank you"); break; case 15: pt1(true, 600, "Yes, please."); break; case 16: if(playerHasItem(995, 10000)) { deleteItem(995,10000); item1(true, "10k coins", 1003, "You gave the mage 10k coins!"); } else { nt1(false, 2676, 600, "Come back to me when you have enough cash!"); } break; case 17: showInterface(3559); apset = true; NpcDialogue = -1; NpcDialogueSend = false; break; case 18: pt1(false, 600, "No, thank you."); break; case 19: nt1(true, 162, 600, "What do you want human?"); break; case 20: o2(false, "What you want?", "Exchange your agility tickets", "Nothing!"); break; case 21: NpcDialogue = -1; NpcDialogueSend = false; int ticket = InvItemAmt(2996); if(playerHasItem(2996)) { int Guam = (int)(double)(ticket*0.12), Marrentill = (int)(double)(ticket*0.09), Tarromin = (int)(double)(ticket*0.06), agixp = (int)(double)(ticket*700); deleteItem(2996, ticket); addItem(250,Guam); addItem(252,Marrentill); addItem(254,Tarromin); addSkillXP(agixp,16); item2(false, "Agility Tickets", 2996, "You turned in "+ticket+" agility tickets and recived:", ""+agixp+" Agility experience, "+Guam+" Guams, "+Marrentill+" Mar rentills and "+Tarromin+" Tarromins."); } else nt1(false, 162, 610, "Please come back when you have any agility ticket!" ); { } break; case 22: pt1(false, 600, "There was nothing, good bye."); break;

case 23: nt1(true, 1596, 600, "Hi there noob, What do you want?"); break; case 24: o2(false, "Slayer", "Assignment, please?", "Teleport to east ardougne, please?") ; break; case 25: assign1(); NpcDialogue = -1; break; case 26: teleportToX = 2534; teleportToY = 3304; text1(false,"Welcome to east ardougne!"); NpcDialogue = -1; break; } } public void UpdatePlayerShop() { for (int i = 1; i < PlayerHandler.maxPlayers; i++) { if (PlayerHandler.players[i] != null) { if ((PlayerHandler.players[i].IsShopping == true ) && (PlayerHandler.players[i].MyS hopID == MyShopID) && (i != playerId)) { PlayerHandler.players[i].UpdateShop = tr ue; } } } } public void updateRating() { sendQuest("Pk: " + rating, 3985); } public boolean validClient(int index) { client p = (client) handler.players[index]; if ((p != null) && !p.disconnected) { return true; } return false; } /* END OF PRAYER */ public void viewTo(int coordX, int coordY) { viewToX = ((2 * coordX) + 1); viewToY = ((2 * coordY) + 1); dirUpdate2Required = true; updateRequired = true; } public void Walk(int EndX, int EndY, int Emote) { stopMovement(); playerSEW = Emote; WalkTimer(EndX, EndY);

} public void stopMovement(){ WalkTimer(0, 0); } public void walkTo(int x, int y) { newWalkCmdX[1] += x; newWalkCmdY[1] += y; tmpNWCX[1] = newWalkCmdX[i]; tmpNWCY[1] = newWalkCmdY[i]; newWalkCmdIsRunning = true; } public void WalkTimer(int i, int j) { if(EntangleDelay > 0) return; isRunning2 = false; newWalkCmdSteps = 0; if(++newWalkCmdSteps > 50) newWalkCmdSteps = 0; int k = absX + i; k -= mapRegionX * 8; newWalkCmdX[0] = newWalkCmdY[0] = tmpNWCX[0] = tmpNWCY[0] = 0; int l = absY + j; l -= mapRegionY * 8; newWalkCmdIsRunning = ((inStream.readSignedByteC() == 1) && playerEnergy > 0); for(this.i = 0; this.i < newWalkCmdSteps; this.i++) { newWalkCmdX[this.i] += k; newWalkCmdY[this.i] += l; } lastWalk = System.currentTimeMillis(); walkDelay = 8000; poimiY = l; poimiX = k; } public void walkTo_old(int X, int Y) { isRunning2 = false; int firstStepX = inStream.readSignedWordBigEndianA(); int tmpFSX = X; X -= mapRegionX * 8; for (i = 1; i < newWalkCmdSteps; i++) { newWalkCmdX[i] = inStream.readSignedByte(); newWalkCmdY[i] = inStream.readSignedByte(); tmpNWCX[i] = newWalkCmdX[i]; tmpNWCY[i] = newWalkCmdY[i]; } newWalkCmdX[0] = newWalkCmdY[0] = tmpNWCX[0] = tmpNWCY[0] = 0; int firstStepY = inStream.readSignedWordBigEndian(); int tmpFSY = Y; Y -= mapRegionY * 8; newWalkCmdIsRunning = inStream.readSignedByteC() == 1; for (i = 0; i < newWalkCmdSteps; i++) { newWalkCmdX[i] += X; newWalkCmdY[i] += Y; } println_debug("Walking to X:" + X + " Y:" + Y); }

public int WCCheckAxe() { int Hand; int Shield; int Bag; int Axe; Hand = playerEquipment[playerWeapon]; Shield = playerEquipment[playerShield]; Axe = 0; switch (Hand) { case 1351: // Bronze Axe Axe = 1; break; case 1349: // Iron Axe Axe = 2; break; case 1353: // Steel Axe Axe = 3; break; case 1361: // Black Axe Axe = 4; break; case 1355: // Mithril Axe Axe = 5; break; case 1357: // Adamant Axe Axe = 6; break; case 1359: // Rune Axe Axe = 7; break; /* * case X: //Dragon Axe Axe = 8; break; */ } /* * if (Axe > 0) { OriginalWeapon = Hand; OriginalShield = Shield ; * playerEquipment[playerShield] = -1; return Axe; } */ if (Axe > 0) { // OriginalWeapon = Hand; // OriginalShield = Shield; // playerEquipment[playerShield] = -1; // playerEquipment[playerWeapon] = Bag; }

return Axe; } public boolean wear(int wearID, int slot) { if (duelFight && duelRule[3]) { sendMessage("Equipment changing has been disabled in thi s duel"); return false; } int targetSlot = 0; targetSlot = itemType(wearID); int[] two_hand = { 1319, 4718, 4726, 1409, 4710, 7158 }; for (int element : two_hand) { if ((wearID == element) && (playerEquipment[playerShield ] > 0)) { if (playerHasItem(-1)) { addItem(playerEquipment[playerShield], 1 ); playerEquipment[playerShield] = -1; } else { sendMessage("You can't wear this weapon with a shield"); return false; } } if ((itemType(wearID) == playerShield) && (playerEquipment[playerWeapon] == ele ment)) { if (playerHasItem(-1)) { addItem(playerEquipment[playerWeapon], 1 ); playerEquipment[playerWeapon] = -1; } else { sendMessage("You can't wear a shield wit h this weapon"); return false; } } if (!canUse(wearID)) { sendMessage("You must be a premium member to use this item"); return false; } } if ((playerItems[slot] - 1) == wearID) { targetSlot = itemType(wearID); int CLAttack = GetCLAttack(wearID); int CLDefence = GetCLDefence(wearID); int CLStrength = GetCLStrength(wearID); int CLMagic = GetCLMagic(wearID); int CLRanged = GetCLRanged(wearID); String WeaponName = getItemName(wearID); boolean GoFalse = false; if (CLAttack > playerLevel[playerAttack]) { sendMessage("You need " + CLAttack + " " + statName[playerAttack] + " to equip this item."); GoFalse = true;

} if (CLDefence > playerLevel[playerDefence]) { sendMessage("You need " + CLDefence + " " + statName[playerDefence] + " to equip this item."); GoFalse = true; } if (CLStrength > playerLevel[playerStrength]) { sendMessage("You need " + CLStrength + " " + statName[playerStrength] + " t o equip this item."); GoFalse = true; } if (CLMagic > playerLevel[playerMagic]) { sendMessage("You need " + CLMagic + " " + statNa me[playerMagic] + " to equip this item."); GoFalse = true; } if (CLRanged > playerLevel[playerRanged]) { sendMessage("You need " + CLRanged + " " + statName[playerRanged] + " to equip this item."); GoFalse = true; } if (GoFalse == true) { return false; } int wearAmount = playerItemsN[slot]; if (wearAmount < 1) { return false; } if ((slot >= 0) && (wearID >= 0)) { deleteItem(wearID, slot, wearAmount); if ((playerEquipment[targetSlot] != wearID) && (playerEquipment[targetSlot] >= 0)) { addItem(playerEquipment[targetSlot], playerEquipmentN[targetS lot]); } else if (Item.itemStackable[wearID] && (playerEquipment[targetSlot] == wearID)) { wearAmount = playerEquipmentN[targetSlot ] + wearAmount; } else if (playerEquipment[targetSlot] >= 0) { addItem(playerEquipment[targetSlot], playerEquipmentN[targetS lot]); } } outStream.createFrameVarSizeWord(34); outStream.writeWord(1688); outStream.writeByte(targetSlot); outStream.writeWord(wearID + 1); if (wearAmount > 254) { outStream.writeByte(255); outStream.writeDWord(wearAmount); } else {

outStream.writeByte(wearAmount); // amount } outStream.endFrameVarSizeWord(); playerEquipment[targetSlot] = wearID; playerEquipmentN[targetSlot] = wearAmount; if ((targetSlot == playerWeapon) && (playerEquipment[playerShield] != -1) && (Item.itemTwoHanded[wearID] == true)) { remove(playerEquipment[playerShield], playerShie ld); } if (targetSlot == playerWeapon) { SendWeapon(wearID, getItemName(wearID)); if (Item.itemTwoHanded[wearID] == true) { playerSE = 0x811; playerSEW = 0x67F; playerSER = 0x680; } playerSE = GetStandEmote(wearID, WeaponName); playerSER = GetRunEmote(wearID, WeaponName); playerSEW = GetWalkEmote(wearID, WeaponName); pEmote = playerSE; } ResetBonus(); GetBonus(); wearing = false; WriteBonus(); updateRequired = true; appearanceUpdateRequired = true; return true; } return false; } /* WOODCUTTING */ public boolean woodcutting() { if (randomed) return false; int WCAxe = 0; if (IsCutting == true) { WCAxe = 1; // If Cutting -> Go trough loop, passby WCChe ckAxe to // prevent originalweapon loss, 1 to tell you got axe, // no function left for WCAxe if cutting, so 1 is // enough. } else { WCAxe = WCCheckAxe(); } if (WCAxe > 0) { if (playerLevel[playerWoodcutting] >= woodcutting[1]) { if (freeSlots() > 0) { if ((System.currentTimeMillis() - lastAc tion >= 1000) && (IsCutting == false)) { lastAction = System.currentTimeM illis();

attackTimer++; sendMessage("You swing your axe at the tree..."); attackTimer = (int) ((woodcuttin g[0] + 10) - WCAxe); if (attackTimer < 1) { attackTimer = 1; } setAnimation(0x284); IsCutting = true; } if ((System.currentTimeMillis() - lastAc tion >= 1600) && (IsCutting == true)) { lastAction = System.currentTimeM illis(); addSkillXP((woodcutting[2] * woo dcutting[3] * 2), playerWoodcuttin g); if (misc.random(100) == 1) { triggerRandom(); resetWC(); return false; } if (freeSlots() > 0) { sendMessage("You get som e logs."); addItem(woodcutting[4], 1); attackTimer += 10; } else { playerEquipment[playerWe apon] = OriginalWeapon; OriginalWeapon = -1; resetAnimation(); IsCutting = false; resetWC(); } } } else { // createEnemyItem(woodcutting[4]); sendMessage("Not enough space in your in ventory."); woodcutting[0] = -1; resetWC(); return false; } } else { sendMessage("You need " + woodcutting[1] + " " + statName[playerWoodcutting] + " to cut those logs."); resetWC(); return false; } } else { sendMessage("Equip your axe before cutting trees!"); resetWC(); return false;

} return true; } public void WriteBonus() { int offset = 0; String send = ""; for (int i = 0; i < playerBonus.length; i++) { if (playerBonus[i] >= 0) { send = BonusName[i] + ": +" + playerBonus[i]; } else { send = BonusName[i] + ": -" + java.lang.Math.abs(playerBonus [i]); } if (i == 10) { offset = 1; } if (i == 11) { send = "Spell Dmg: +" + playerBonus[i] + ""; } sendFrame126(send, (1675 + i + offset)); } /* * for (int i = 4000; i <= 7000; i++) { sendFrame126("T"+i, i); * println_debug("Sended: Test"+i); } */// USED FOR TESTING INTERFACE NUMBERS ! } public void WriteEnergy() { sendFrame126(playerEnergy + "%", 149); } public void writeLog(String data, String file) { // used for bans/mutes/chatlogs etc. -bakatool BufferedWriter bw = null; try { bw = new BufferedWriter(new FileWriter("config//" + file + ".txt", true)); bw.write(data); bw.newLine(); bw.flush(); } catch (IOException ioe) { ioe.printStackTrace(); } finally { if (bw != null) try { bw.close(); } catch (IOException ioe2) { System.out.println("Error writing system log."); ioe2.printStackTrace(); } }

} public void yell(String message) { for (Player p : handler.players) { if ((message.indexOf("tradereq") > 0) || (message.indexOf("duelreq") > 0)) return; if ((p == null) || !p.isActive) continue; client temp = (client) p; if ((temp.absX > 0) && (temp.absY > 0)) if ((temp != null) && !temp.disconnected && p.is Active) temp.sendMessage(message); } } public int InvItemAmt(int Id) { int Amt = 0; if (Id < 0) return 25; if (Id == 556 && playerEquipment[playerWeapon] == 1381) return 25; else if (Id == 555 && playerEquipment[playerWeapon] == 1 383) return 25; else if (Id == 557 && playerEquipment[playerWeapon] == 1 385) return 25; else if (Id == 554 && (playerEquipment[playerWeapon] == 1387 || playerEquipment[playerWeapon] == 3053)) return 25; else if (Id == 555 && playerEquipment[playerWeapon] == 6 563) return 25; else if (Id == 557 && (playerEquipment[playerWeapon] == 6563 || playerEquipment[playerWeapon] == 3053)) return 25; for (int i = 0; i < playerItems.length; i++) { if (playerItems[i] == Id+1 && !Item.itemStackable[Id] && !Item.itemIsNote[Id]) Amt++; else if (playerItems[i] == Id+1 && (Item.itemStackable[I d] || Item.itemIsNote[Id])) Amt += playerItemsN[i]; } return Amt; } public void changeText126(String s, int id) { //misc.debugMes("changeText126() Method"); outStream.createFrameVarSizeWord(126); outStream.writeString(s); outStream.writeWordA(id); outStream.endFrameVarSizeWord(); } public void showDialogue(String line) { changeText126(line, 357);

sendFrame164(356); } public void fishingSkillMenu() { showInterface(8714); clearFrame8714(); changeText126("Mining", 8716); //Skill Name changeText126("@red@Members only skill", 8849); //@red@Members o nly skill changeText126("1", 8720); //Level changeText126("Shrimps", 8760); //Advancement changeText126("5", 8721); changeText126("Sardine", 8761); changeText126("10", 8722); changeText126("Herring", 8762); changeText126("15", 8723); changeText126("Anchovies", 8763); changeText126("20", 8724); changeText126("Trout", 8764); changeText126("25", 8725); changeText126("Pike", 8765); changeText126("30", 8722); changeText126("Salmon", 8762); changeText126("35", 8723); changeText126("Tuna", 8763); changeText126("40", 8724); changeText126("Lobster", 8764); changeText126("50", 8725); changeText126("SWordfish", 8765); changeText126("62", 8726); changeText126("Monkfish", 8766); changeText126("76", 8727); changeText126("Shark", 8767); } public int GetRunEmote(int id, String WeaponName) { WeaponName = WeaponName.replaceAll("_", " "); WeaponName = WeaponName.trim(); if (isNpc && npcId == 1463) { return 1419; } if (id == -1) { return 0x338; } if (id == 4718) { return 2563; } if (id == 4755) { return 1831; } if (id == 4734) { return 2077; } if (id == 4747) { return 0x338; } if (id == 4726) { return 1210; }

if (WeaponName.contains("bow")) { return 0x338; } if (WeaponName.contains("2h")) { return 2563; } if (WeaponName.endsWith("godsword")) { return 2563; } if (WeaponName.equals("Saradomin sword")) { return 2563; } if (WeaponName.contains("whip")) { return 1661; } if (WeaponName.contains("Spear")) { return 1210; } if (WeaponName.contains("halberd")) { return 1210; } if (id == 4153 || id == 8103) { return 1664; } if (WeaponName.contains("Saradomin staff") || WeaponName.contain s("Guthix staff") || WeaponName.contains("Zamorak staff")) { return 0x338; } if (WeaponName.contains("Staff") || WeaponName.contains("staff") ) { return 1210; } if (id == 6528) { return 2563; } else { return 0x338; } } public int GetWalkEmote(int id, String WeaponName) { WeaponName = WeaponName.replaceAll("_", " "); WeaponName = WeaponName.trim(); if (isNpc && npcId == 1463) { return 219; } if (id == -1) { return 0x333; } if (id == 4718) { return 2064; } if (id == 4755) { return 2060; } if (id == 4734) { return 2076; } if (id == 4747) {

return 0x333; } if (id == 4726) { return 1146; } if (WeaponName.contains("bow")) { return 0x333; } if (WeaponName.contains("2h")) { return 2064; } if (WeaponName.equals("Saradomin sword")) { return 2064; } if (WeaponName.endsWith("godsword")) { return 2064; } if (WeaponName.contains("whip")) { return 1660; } if (WeaponName.contains("Spear")) { return 1146; } if (WeaponName.contains("halberd")) { return 1146; } if (id == 4153 || id == 8103) { return 1663; } if (WeaponName.contains("Saradomin staff") || WeaponName.contain s("Guthix staff") || WeaponName.contains("Zamorak staff")) { return 0x333; } if (WeaponName.contains("Staff") || WeaponName.contains("staff") ) { return 1146; } if (id == 6528 || id == 1319) { return 2064; } else { return 0x333; } } public int GetBlockEmote(String WeaponName) { WeaponName = WeaponName.replaceAll("_", " "); WeaponName = WeaponName.trim(); if (isNpc && npcId == 1463) { return 221; } if (playerEquipment[playerShield] >= 3839 && playerEquipment[pla yerShield] <= 3843) { return 398; } else if (playerEquipment[playerShield] > 0)

{ return 0x484; } else if (WeaponName.equals("Dharoks greataxe") || WeaponName.end sWith("Torags hammers")) { return 424; } else if (WeaponName.endsWith("bow") || WeaponName.endsWith("long bow") || WeaponName.endsWith("crossbow") || WeaponName.endsWith("c'bow") || Weap onName.equals("Seercull")) { return 424; } else if (WeaponName.equals("Guthans warspear")) { return 415; } else if (WeaponName.equals("Ahrims staff")) { return 2079; } else if (WeaponName.endsWith("whip")) { return 1659; } else if (playerEquipment[playerWeapon] == 4153 || playerEquipmen t[playerWeapon] == 6528 || playerEquipment[playerWeapon] == 8103) { return 1666; } else if (playerEquipment[playerWeapon] == 4755) { return 2063; } else if (WeaponName.contains("Staff")) { return 1429; } else if (WeaponName.contains("staff")) { return 1429; } else if (WeaponName.contains("2h") || WeaponName.equals("Saradom in sword") || WeaponName.endsWith("godsword") || WeaponName.endsWith("greataxe") ) { return 410; } else if (WeaponName.endsWith("battleaxe") || WeaponName.endsWith ("dagger") || WeaponName.endsWith("dagger(s)")) { return 397; } else if (playerEquipment[playerShield] == -1 && playerEquipment[ playerWeapon] == -1) { return 424; } else

{ return 398; } } public int GetStandEmote(int id, String WeaponName) { WeaponName = WeaponName.replaceAll("_", " "); WeaponName = WeaponName.trim(); if (id == -1) { return 0x328; } if (isNpc && npcId == 1463) { return 222; } if (id == 4718) { return 2065; } if (id == 4755) { return 2061; } if (id == 4734) { return 2074; } if (id == 4747) { return 0x328; } if (id == 4726) { return 809; } if (WeaponName.contains("bow")) { return 0x328; } if (WeaponName.contains("2h")) { return 2561; } if (WeaponName.equals("Saradomin sword")) { return 2065; } if (WeaponName.endsWith("godsword")) { return 2065; } if (WeaponName.contains("whip")) { return 1832; } if (WeaponName.endsWith("spear")) { return 809; } if (WeaponName.contains("halberd")) { return 809; } if (id == 4153 || id == 8103) { return 1662; } if (id == 1305) { return 809; } if (WeaponName.contains("Saradomin staff") || WeaponName.contain s("Guthix staff") || WeaponName.contains("Zamorak staff")) {

return 0x328; } if (WeaponName.contains("Staff") || WeaponName.contains("staff") ) { return } if (id == 6528 return } else { return } { String WeaponName = getItemName(id); WeaponName = WeaponName.replaceAll("_", " "); WeaponName = WeaponName.trim(); if (WeaponName.contains("whip")) return 2400; if (WeaponName.contains("Barrelchest anchor")) return 4200; if (WeaponName.endsWith("greegree")) return 2400; if (WeaponName.equals("Sovereign blade")) return 2400; else if (WeaponName.endsWith("godsword")) return 3600; else if (WeaponName.equals("Saradomin sword")) return 2400; else if (WeaponName.contains("dagger") && basicId(id)) return 2400; else if (WeaponName.contains("2h") && basicId(id)) return 4200; else if (WeaponName.contains("sword") && !WeaponName.contains("longsword ") && basicId(id)) return 2400; else if (WeaponName.contains("longsword") && basicId(id)) return 3000; else if (WeaponName.contains("scimitar") && basicId(id)) return 2400; else if (WeaponName.contains("mace") && basicId(id)) return 2000; else if (WeaponName.contains("axe") && !WeaponName.contains("greataxe") && !WeaponName.contains("battleaxe") && !WeaponName.contains("pickaxe") && basic Id(id)) return 3000; else if (WeaponName.contains("battleaxe") && basicId(id)) return 3600; else if (WeaponName.contains("warhammer") && basicId(id)) return 3600; else if (WeaponName.contains("spear") && basicId(id)) return 3000; else if (WeaponName.contains("halberd") && basicId(id)) return 4200; else if (WeaponName.contains("pickaxe") && basicId(id)) return 3000; else if (WeaponName.equals("Granite maul")) return 4200; else if (WeaponName.equals("Toktz-xil-ak")) 809; || id == 1319) { 0x811; 0x328;

} public int getWeaponSpeed(int id)

return 2400; else if (WeaponName.equals("Tzharr-ket-em")) return 3000; else if (WeaponName.equals("Tzhaar-ket-om")) return 4200; else if (WeaponName.equals("Toktz-xil-ek")) return 2400; else if (WeaponName.equals("Dharoks greataxe")) return 4200; else if (WeaponName.equals("Torags hammers")) return 3000; else if (WeaponName.equals("Guthans warspear")) return 3000; else if (WeaponName.equals("Veracs flail")) return 3000; else if (WeaponName.equals("Ahrims staff")) return 3600; else if (WeaponName.contains("staff") || WeaponName.contains("Staff")) return 3000; else if (WeaponName.contains("battlestaff") || WeaponName.contains("Batt letaff")) return 3000; else if (WeaponName.equals("Toktz-mej-tal")) return 3000; else if (WeaponName.equals("Tzhaar-ket-em")) return 3600; else if (WeaponName.contains("longbow")) return 3000; else if (WeaponName.contains("shortbow")) return 1800; else if (WeaponName.contains("Longbow")) return 3000; else if (WeaponName.contains("Shortbow")) return 1800; else if (WeaponName.contains("knife")) return 1200; else if (WeaponName.contains("Crossbow") || WeaponName.contains("c'bow") ) return 3000; else if (WeaponName.equals("Seercull")) return 2400; else if (WeaponName.equals("Dark bow")) return 4800; else if (WeaponName.equals("Crystal bow full")) return 2400; else if (WeaponName.equals("New crystal bow")) return 2400; else if (WeaponName.equals("Karils crossbow")) return 1800; else if (WeaponName.contains("dart") && basicId(id)) return 1200; else if (WeaponName.contains("thrownaxe") && basicId(id)) return 3600; else if (WeaponName.contains("javelin") && basicId(id)) return 4200; else if (WeaponName.equals("Toktz-xil-ul")) return 3000; else if (WeaponName.equals("Unarmed") || id == -1) return 3000; else {

System.err.println("Item Has No Timer: "+WeaponName); return 4200; } } public int GetWeaponAtkEmote(String WeaponName, int FightType) { WeaponName = WeaponName.replaceAll("_", " "); WeaponName = WeaponName.trim(); if (isNpc && npcId == 1463) { return 220; } if (WeaponName.equals("Sovereign blade")) { return 451; } else if (WeaponName.contains("Unarmed")) { if (FightType == 2) { return 423; } else { return 422; } } else if (WeaponName.contains("Guthans warspear")) { if (FightType == 3) { return 2081; } else { return 2080; } } else if (WeaponName.endsWith("godsword")) return 407; else if (WeaponName.contains("Saradomin sword")) return 407; else if (WeaponName.contains("Dragon dagger")) { if (FightType == 2) { return 401; } else { return 402; } } else if (WeaponName.contains("Karils crossbow")) { return 2075; } else if (WeaponName.contains("shortbow") || WeaponName.contains( "Shortbow")) { return 426; } else if (WeaponName.contains("longbow") || WeaponName.contains(" Longbow")) { return 426; } else if (WeaponName.contains("Seercull")) { return 426; } else if (WeaponName.contains("Toktz-xil-ul")) { return 2614; } else if (WeaponName.contains("thrownaxe")) { return 0x326; } else if (WeaponName.contains("dart")) {

return 0x326; } else if (WeaponName.contains("javelin")) { return 0x326; } else if (WeaponName.contains("knife")) { return 0x326; } else if (WeaponName.contains("crossbow") || WeaponName.contains( "Crossbow") || WeaponName.contains("c'bow")) { return 427; } else if (WeaponName.contains("bow") || WeaponName.contains("Bow" )) { return 426; } else if (WeaponName.contains("dagger") || WeaponName.contains("p ickaxe")) { if (FightType == 2) { return 451; } else { return 412; } } else if (WeaponName.contains("sword") && !WeaponName.contains("2 h") || WeaponName.contains("mace") || WeaponName.contains("longsword") && !Weapo nName.contains("2h") || WeaponName.contains("scimitar")) { if (FightType == 3) { return 412; } else { return 451; } } else if (WeaponName.contains("axe") && !WeaponName.contains("gre ataxe") && !WeaponName.contains("thrownaxe") || WeaponName.contains("battleaxe") ) { return 1833; } else if (WeaponName.contains("halberd") || WeaponName.contains(" spear") && !WeaponName.contains("Guthans")) { if (FightType == 2) { return 412; } else { return 440; } } else if (WeaponName.contains("2h")) { if (FightType == 2) { return 406; } else { return 407; } } else if (WeaponName.contains("Tzhaar-ket-om")) { return 2661; } else if (WeaponName.contains("Barrelchest anchor")) { return 2661; }

else if (WeaponName.contains("Granite maul")) { return 1665; } else if (WeaponName.contains("greataxe")) { if (FightType == 2) { return 2067; } else { return 2066; } } else if (WeaponName.contains("flail")) { return 2062; } else if (WeaponName.contains("whip")) { return 1658; } else if (WeaponName.contains("hammers")) { return 2068; } else { return 451; } } public int[] text8714 = { 8720,8721,8722,8723,8724,8725,8726,8727,8728,8729,8730,8731,8732 ,8733,8734,8735,8736,8737,8738,8739,8740, 8741,8742,8743,8744,8745,8746,8747,8748,8749,8750,8751,8752,8753 ,8754,8755,8756,8757,8758,8759,8760,8761, 8762,8763,8764,8765,8766,8767,8768,8769,8770,8771,8772,8773,8774 ,8775,8776,8777,8778,8779,8780,8781,8782, 8783,8784,8785,8786,8787,8788,8789,8790,8791,8792,8793,8794,8795 ,8796,8797,8798,8799,8846,8823,8824,8827, 8837,8839,8840,8843,8859,8862,8865,15303,15306,15309 }; public void clearFrame8714() { for(int x = 0; x < text8714.length; x++) { changeText126("", text8714[x]); } } }

You might also like