PartySearchHandler.java
资源名称:src.rar [点击查看]
上传用户:gwt600
上传日期:2021-06-03
资源大小:704k
文件大小:15k
源码类别:
游戏
开发平台:
Java
- package net.sf.odinms.net.channel.handler;
- import java.util.ArrayList;
- import net.sf.odinms.client.MapleClient;
- import net.sf.odinms.net.AbstractMaplePacketHandler;
- import net.sf.odinms.tools.data.input.SeekableLittleEndianAccessor;
- /**
- *
- * @author XoticStory
- */
- public class PartySearchHandler extends AbstractMaplePacketHandler {
- //All bolleans as for now, all is useless... just for testing somehow, but I changed method while making
- boolean All = false;
- boolean Beginner = false;
- boolean AllWarriors = false;
- boolean Warrior1 = false;
- boolean Warrior2 = false;
- boolean Warrior3 = false;
- boolean AllMagician = false;
- boolean Magician1 = false;
- boolean Magician2 = false;
- boolean Magician3 = false;
- boolean AllPirate = false;
- boolean Pirate1 = false;
- boolean Pirate2 = false;
- boolean AllThief = false;
- boolean Thief1 = false;
- boolean Thief2 = false;
- boolean AllBowman = false;
- boolean Bowman1 = false;
- boolean Bowman2 = false;
- final int[] boxsum = {2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144};
- ArrayList<Integer> boxsumconstructor = new ArrayList<Integer>();
- public void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
- c.getPlayer().resetAfkTime();
- int min = slea.readInt(); //I now that it need to do the party part, but meh, box is more important atm.
- int max = slea.readInt(); //same
- int person = slea.readInt(); // same
- int box = slea.readInt();
- System.out.println("MINIMUM PLAYERS: " + min);
- System.out.println("MAXIMUM PLAYERS: " + max);
- System.out.println("AMOUNT OF PLAYERS: " + person);
- System.out.println("BOX VALUE: " + box);
- int i = box;
- String binary = Integer.toBinaryString(i);
- String reverse = "";
- System.out.println("Binary: " + binary);
- for (int z = 0; z < binary.length(); z++) {
- reverse = binary.charAt(z) + reverse;
- }
- System.out.println("Total Reverse: " + reverse);
- char letters;
- for (int z = 0; z < reverse.length(); z++) {
- letters = reverse.charAt(z);
- System.out.println("1 By 1 for jobs Current one is : " + letters);
- isJob(letters,z,c);
- }
- }
- public void isJob(char binary, int times, MapleClient c) {
- times++;
- if (binary == 1) {
- if (times == 1) {
- All = true;
- System.out.println("All have been choosen");
- } else if (times == 2) {
- Beginner = true;
- System.out.println("Oh Noes, it's Beginners!!");
- } else if (times == 3) {
- AllWarriors = true;
- System.out.println("All Warriors are here");
- } else if (times == 4) {
- if (c.getPlayer().getLevel() < 70) {
- System.out.println("Oh Noes, it's a Fighter!!");
- } else if (c.getPlayer().getLevel() < 120) {
- System.out.println("Oh Noes, it's a Crusader!!");
- } else {
- System.out.println("Oh Noes, it's a Hero!!");
- }
- Warrior1 = true;
- } else if (times == 5) {
- if (c.getPlayer().getLevel() < 70) {
- System.out.println("Oh Noes, it's a Page!!");
- } else if (c.getPlayer().getLevel() < 120) {
- System.out.println("Oh Noes, it's a White Knight!!");
- } else {
- System.out.println("Oh Noes, it's a Paladin!!");
- }
- Warrior2 = true;
- } else if (times == 6) {
- if (c.getPlayer().getLevel() < 70) {
- System.out.println("Oh Noes, it's a Spearman!!");
- } else if (c.getPlayer().getLevel() < 120) {
- System.out.println("Oh Noes, it's a Dragon Knight!!");
- } else {
- System.out.println("Oh Noes, it's a Dark Knight!!");
- }
- Warrior3 = true;
- } else if (times == 7) {
- AllMagician = true;
- System.out.println("All Magicians are here");
- } else if (times == 8) {
- Magician1 = true;
- if (c.getPlayer().getLevel() < 70) {
- System.out.println("Oh Noes, it's a Ice Lighting Wizard!!");
- } else if (c.getPlayer().getLevel() < 120) {
- System.out.println("Oh Noes, it's a Ice Lighting Mage!!");
- } else {
- System.out.println("Oh Noes, it's a Ice Lighting ArchMage!!");
- }
- } else if (times == 9) {
- if (c.getPlayer().getLevel() < 70) {
- System.out.println("Oh Noes, it's a Fire Poison Wizard!!");
- } else if (c.getPlayer().getLevel() < 120) {
- System.out.println("Oh Noes, it's a Fire Poison Mage!!");
- } else {
- System.out.println("Oh Noes, it's a Fire Posion ArchMage!!");
- }
- Magician2 = true;
- } else if (times == 10) {
- if (c.getPlayer().getLevel() < 70) {
- System.out.println("Oh Noes, it's a Cleric!!");
- } else if (c.getPlayer().getLevel() < 120) {
- System.out.println("Oh Noes, it's a Priest!!");
- } else {
- System.out.println("Oh Noes, it's a Bishop!!");
- }
- Magician3 = true;
- } else if (times == 11) {
- AllPirate = true;
- System.out.println("All Pirate are here");
- } else if (times == 12) {
- if (c.getPlayer().getLevel() < 70) {
- System.out.println("Oh Noes, it's a Gunslinger!!");
- } else if (c.getPlayer().getLevel() < 120) {
- System.out.println("Oh Noes, it's a Outlaw!!");
- } else {
- System.out.println("Oh Noes, it's a Corsair!!");
- }
- Pirate1 = true;
- } else if (times == 13) {
- if (c.getPlayer().getLevel() < 70) {
- System.out.println("Oh Noes, it's a Brawler!!");
- } else if (c.getPlayer().getLevel() < 120) {
- System.out.println("Oh Noes, it's a Marauder!!");
- } else {
- System.out.println("Oh Noes, it's a Buccaneer!!");
- }
- Pirate2 = true;
- } else if (times == 14) {
- System.out.println("All Thiefs are here");
- AllThief = true;
- } else if (times == 15) {
- if (c.getPlayer().getLevel() < 70) {
- System.out.println("Oh Noes, it's a Assasin!!");
- } else if (c.getPlayer().getLevel() < 120) {
- System.out.println("Oh Noes, it's a Hermit!!");
- } else {
- System.out.println("Oh Noes, it's a Night Lord!!");
- }
- Thief1 = true;
- } else if (times == 16) {
- if (c.getPlayer().getLevel() < 70) {
- System.out.println("Oh Noes, it's a Bandit!!");
- } else if (c.getPlayer().getLevel() < 120) {
- System.out.println("Oh Noes, it's a Chief Bandit!!");
- } else {
- System.out.println("Oh Noes, it's a Shadower!!");
- }
- Thief2 = true;
- } else if (times == 17) {
- AllBowman = true;
- System.out.println("All Bowmans are here");
- } else if (times == 18) {
- Bowman1 = true;
- if (c.getPlayer().getLevel() < 70) {
- System.out.println("Oh Noes, it's a Hunter!!");
- } else if (c.getPlayer().getLevel() < 120) {
- System.out.println("Oh Noes, it's a Ranger!!");
- } else {
- System.out.println("Oh Noes, it's a Bow Master!!");
- }
- } else if (times == 19) {
- Bowman2 = true;
- if (c.getPlayer().getLevel() < 70) {
- System.out.println("Oh Noes, it's a Crossbow Man!!");
- } else if (c.getPlayer().getLevel() < 120) {
- System.out.println("Oh Noes, it's a Sniper!!");
- } else {
- System.out.println("Oh Noes, it's a Marksman!!");
- }
- }
- }
- }
- public boolean jobs(int boxcheck, MapleClient c) {
- switch (boxcheck) {
- case 524287:
- //All
- System.out.println("All have been choosen");
- return true;
- case 2:
- //Beginner
- System.out.println("Oh Noes, it's Beginners!!");
- return true;
- case 4:
- //All Warriors
- System.out.println("All Warriors are here");
- return true;
- case 8:
- //FirstBox Warrior
- if (c.getPlayer().getLevel() < 70) {
- System.out.println("Oh Noes, it's a Fighter!!");
- } else if (c.getPlayer().getLevel() < 120) {
- System.out.println("Oh Noes, it's a Crusader!!");
- } else {
- System.out.println("Oh Noes, it's a Hero!!");
- }
- return true;
- case 16:
- //2ndBox Warrior
- if (c.getPlayer().getLevel() < 70) {
- System.out.println("Oh Noes, it's a Page!!");
- } else if (c.getPlayer().getLevel() < 120) {
- System.out.println("Oh Noes, it's a White Knight!!");
- } else {
- System.out.println("Oh Noes, it's a Paladin!!");
- }
- return true;
- case 32:
- //3rdBox Warrior
- if (c.getPlayer().getLevel() < 70) {
- System.out.println("Oh Noes, it's a Spearman!!");
- } else if (c.getPlayer().getLevel() < 120) {
- System.out.println("Oh Noes, it's a Dragon Knight!!");
- } else {
- System.out.println("Oh Noes, it's a Dark Knight!!");
- }
- return true;
- case 64:
- //All Magicians
- System.out.println("All Magicians are here");
- return true;
- case 128:
- //FirstBox Magician
- if (c.getPlayer().getLevel() < 70) {
- System.out.println("Oh Noes, it's a Ice Lighting Wizard!!");
- } else if (c.getPlayer().getLevel() < 120) {
- System.out.println("Oh Noes, it's a Ice Lighting Mage!!");
- } else {
- System.out.println("Oh Noes, it's a Ice Lighting ArchMage!!");
- }
- return true;
- case 256:
- //2ndBox Magician
- if (c.getPlayer().getLevel() < 70) {
- System.out.println("Oh Noes, it's a Fire Poison Wizard!!");
- } else if (c.getPlayer().getLevel() < 120) {
- System.out.println("Oh Noes, it's a Fire Poison Mage!!");
- } else {
- System.out.println("Oh Noes, it's a Fire Posion ArchMage!!");
- }
- return true;
- case 512:
- //3rdBox Magician
- if (c.getPlayer().getLevel() < 70) {
- System.out.println("Oh Noes, it's a Cleric!!");
- } else if (c.getPlayer().getLevel() < 120) {
- System.out.println("Oh Noes, it's a Priest!!");
- } else {
- System.out.println("Oh Noes, it's a Bishop!!");
- }
- return true;
- case 1024:
- //All Pirate
- System.out.println("All Pirate are here");
- return true;
- case 2048:
- //FirstBox Pirate
- if (c.getPlayer().getLevel() < 70) {
- System.out.println("Oh Noes, it's a Gunslinger!!");
- } else if (c.getPlayer().getLevel() < 120) {
- System.out.println("Oh Noes, it's a Outlaw!!");
- } else {
- System.out.println("Oh Noes, it's a Corsair!!");
- }
- return true;
- case 4096:
- //2ndBox Pirate
- if (c.getPlayer().getLevel() < 70) {
- System.out.println("Oh Noes, it's a Brawler!!");
- } else if (c.getPlayer().getLevel() < 120) {
- System.out.println("Oh Noes, it's a Marauder!!");
- } else {
- System.out.println("Oh Noes, it's a Buccaneer!!");
- }
- return true;
- case 8192:
- //All Thiefs
- System.out.println("All Thiefs are here");
- return true;
- case 16384:
- //FirstBox Rouge
- if (c.getPlayer().getLevel() < 70) {
- System.out.println("Oh Noes, it's a Assasin!!");
- } else if (c.getPlayer().getLevel() < 120) {
- System.out.println("Oh Noes, it's a Hermit!!");
- } else {
- System.out.println("Oh Noes, it's a Night Lord!!");
- }
- return true;
- case 32768:
- //2ndBox Rouge
- if (c.getPlayer().getLevel() < 70) {
- System.out.println("Oh Noes, it's a Bandit!!");
- } else if (c.getPlayer().getLevel() < 120) {
- System.out.println("Oh Noes, it's a Chief Bandit!!");
- } else {
- System.out.println("Oh Noes, it's a Shadower!!");
- }
- return true;
- case 65536:
- //All Bowmans
- System.out.println("All Bowmans are here");
- return true;
- case 131072:
- //FirstBox Bowman
- if (c.getPlayer().getLevel() < 70) {
- System.out.println("Oh Noes, it's a Hunter!!");
- } else if (c.getPlayer().getLevel() < 120) {
- System.out.println("Oh Noes, it's a Ranger!!");
- } else {
- System.out.println("Oh Noes, it's a Bow Master!!");
- }
- return true;
- case 262144:
- //2ndBox Bowman
- if (c.getPlayer().getLevel() < 70) {
- System.out.println("Oh Noes, it's a Crossbow Man!!");
- } else if (c.getPlayer().getLevel() < 120) {
- System.out.println("Oh Noes, it's a Sniper!!");
- } else {
- System.out.println("Oh Noes, it's a Marksman!!");
- }
- return true;
- default:
- return false;
- }
- }
- public void Recreate() {
- for (int x : boxsumconstructor) {
- boxsumconstructor.remove(x);
- }
- for (int x : boxsum) {
- boxsumconstructor.add(x);
- }
- }
- }