From 04c4fac58dcba85b27095beacba348f016e8180f Mon Sep 17 00:00:00 2001 From: P0nk Date: Sun, 11 Jul 2021 14:45:52 +0200 Subject: [PATCH] Remove DropSpider tool It was meant to crawl hidden-street.net, but it doesn't work --- .../client/inventory/MapleInventoryType.java | 73 ---- .../src/constants/CharsetConstants.java | 48 --- .../src/constants/ItemConstants.java | 234 ------------ .../src/dropspider/DataTool.java | 129 ------- .../src/dropspider/DropEntry.java | 177 --------- .../src/dropspider/Errors.java | 19 - .../src/dropspider/Main.java | 339 ------------------ .../src/provider/MapleCanvas.java | 30 -- .../src/provider/MapleData.java | 34 -- .../src/provider/MapleDataDirectoryEntry.java | 34 -- .../src/provider/MapleDataEntity.java | 31 -- .../src/provider/MapleDataEntry.java | 33 -- .../src/provider/MapleDataFileEntry.java | 30 -- .../src/provider/MapleDataProvider.java | 27 -- .../provider/MapleDataProviderFactory.java | 55 --- .../src/provider/MapleDataTool.java | 145 -------- .../provider/wz/FileStoredPngMapleCanvas.java | 70 ---- .../src/provider/wz/ImgMapleSound.java | 39 -- .../src/provider/wz/ListWZFile.java | 86 ----- .../src/provider/wz/MapleDataType.java | 26 -- .../src/provider/wz/PNGMapleCanvas.java | 151 -------- .../src/provider/wz/WZDirectoryEntry.java | 68 ---- .../src/provider/wz/WZEntry.java | 61 ---- .../src/provider/wz/WZFile.java | 154 -------- .../src/provider/wz/WZFileEntry.java | 42 --- .../src/provider/wz/WZIMGEntry.java | 118 ------ .../src/provider/wz/WZIMGFile.java | 227 ------------ .../src/provider/wz/WZTool.java | 188 ---------- .../src/provider/wz/XMLDomMapleData.java | 225 ------------ .../src/provider/wz/XMLWZFile.java | 85 ----- .../server/MapleItemInformationProvider.java | 147 -------- .../SpiderDropFetcher/src/tools/HexTool.java | 87 ----- tools/SpiderDropFetcher/src/tools/Pair.java | 123 ------- .../tools/data/input/ByteArrayByteStream.java | 72 ---- .../src/tools/data/input/ByteInputStream.java | 35 -- .../input/GenericLittleEndianAccessor.java | 239 ------------ .../GenericSeekableLittleEndianAccessor.java | 91 ----- .../data/input/InputStreamByteStream.java | 93 ----- .../data/input/LittleEndianAccessor.java | 45 --- .../data/input/RandomAccessByteStream.java | 84 ----- .../input/SeekableInputStreamBytestream.java | 51 --- .../input/SeekableLittleEndianAccessor.java | 27 -- .../data/output/BAOSByteOutputStream.java | 56 --- .../tools/data/output/ByteOutputStream.java | 38 -- .../output/GenericLittleEndianWriter.java | 184 ---------- .../tools/data/output/LittleEndianWriter.java | 114 ------ .../output/MaplePacketLittleEndianWriter.java | 73 ---- tools/spider.bat | 5 - 48 files changed, 4542 deletions(-) delete mode 100644 tools/SpiderDropFetcher/src/client/inventory/MapleInventoryType.java delete mode 100644 tools/SpiderDropFetcher/src/constants/CharsetConstants.java delete mode 100644 tools/SpiderDropFetcher/src/constants/ItemConstants.java delete mode 100644 tools/SpiderDropFetcher/src/dropspider/DataTool.java delete mode 100644 tools/SpiderDropFetcher/src/dropspider/DropEntry.java delete mode 100644 tools/SpiderDropFetcher/src/dropspider/Errors.java delete mode 100644 tools/SpiderDropFetcher/src/dropspider/Main.java delete mode 100644 tools/SpiderDropFetcher/src/provider/MapleCanvas.java delete mode 100644 tools/SpiderDropFetcher/src/provider/MapleData.java delete mode 100644 tools/SpiderDropFetcher/src/provider/MapleDataDirectoryEntry.java delete mode 100644 tools/SpiderDropFetcher/src/provider/MapleDataEntity.java delete mode 100644 tools/SpiderDropFetcher/src/provider/MapleDataEntry.java delete mode 100644 tools/SpiderDropFetcher/src/provider/MapleDataFileEntry.java delete mode 100644 tools/SpiderDropFetcher/src/provider/MapleDataProvider.java delete mode 100644 tools/SpiderDropFetcher/src/provider/MapleDataProviderFactory.java delete mode 100644 tools/SpiderDropFetcher/src/provider/MapleDataTool.java delete mode 100644 tools/SpiderDropFetcher/src/provider/wz/FileStoredPngMapleCanvas.java delete mode 100644 tools/SpiderDropFetcher/src/provider/wz/ImgMapleSound.java delete mode 100644 tools/SpiderDropFetcher/src/provider/wz/ListWZFile.java delete mode 100644 tools/SpiderDropFetcher/src/provider/wz/MapleDataType.java delete mode 100644 tools/SpiderDropFetcher/src/provider/wz/PNGMapleCanvas.java delete mode 100644 tools/SpiderDropFetcher/src/provider/wz/WZDirectoryEntry.java delete mode 100644 tools/SpiderDropFetcher/src/provider/wz/WZEntry.java delete mode 100644 tools/SpiderDropFetcher/src/provider/wz/WZFile.java delete mode 100644 tools/SpiderDropFetcher/src/provider/wz/WZFileEntry.java delete mode 100644 tools/SpiderDropFetcher/src/provider/wz/WZIMGEntry.java delete mode 100644 tools/SpiderDropFetcher/src/provider/wz/WZIMGFile.java delete mode 100644 tools/SpiderDropFetcher/src/provider/wz/WZTool.java delete mode 100644 tools/SpiderDropFetcher/src/provider/wz/XMLDomMapleData.java delete mode 100644 tools/SpiderDropFetcher/src/provider/wz/XMLWZFile.java delete mode 100644 tools/SpiderDropFetcher/src/server/MapleItemInformationProvider.java delete mode 100644 tools/SpiderDropFetcher/src/tools/HexTool.java delete mode 100644 tools/SpiderDropFetcher/src/tools/Pair.java delete mode 100644 tools/SpiderDropFetcher/src/tools/data/input/ByteArrayByteStream.java delete mode 100644 tools/SpiderDropFetcher/src/tools/data/input/ByteInputStream.java delete mode 100644 tools/SpiderDropFetcher/src/tools/data/input/GenericLittleEndianAccessor.java delete mode 100644 tools/SpiderDropFetcher/src/tools/data/input/GenericSeekableLittleEndianAccessor.java delete mode 100644 tools/SpiderDropFetcher/src/tools/data/input/InputStreamByteStream.java delete mode 100644 tools/SpiderDropFetcher/src/tools/data/input/LittleEndianAccessor.java delete mode 100644 tools/SpiderDropFetcher/src/tools/data/input/RandomAccessByteStream.java delete mode 100644 tools/SpiderDropFetcher/src/tools/data/input/SeekableInputStreamBytestream.java delete mode 100644 tools/SpiderDropFetcher/src/tools/data/input/SeekableLittleEndianAccessor.java delete mode 100644 tools/SpiderDropFetcher/src/tools/data/output/BAOSByteOutputStream.java delete mode 100644 tools/SpiderDropFetcher/src/tools/data/output/ByteOutputStream.java delete mode 100644 tools/SpiderDropFetcher/src/tools/data/output/GenericLittleEndianWriter.java delete mode 100644 tools/SpiderDropFetcher/src/tools/data/output/LittleEndianWriter.java delete mode 100644 tools/SpiderDropFetcher/src/tools/data/output/MaplePacketLittleEndianWriter.java delete mode 100644 tools/spider.bat diff --git a/tools/SpiderDropFetcher/src/client/inventory/MapleInventoryType.java b/tools/SpiderDropFetcher/src/client/inventory/MapleInventoryType.java deleted file mode 100644 index 778262f463..0000000000 --- a/tools/SpiderDropFetcher/src/client/inventory/MapleInventoryType.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 Patrick Huy - Matthias Butz - Jan Christian Meyer - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as - published by the Free Software Foundation version 3 as published by - the Free Software Foundation. You may not use, modify or distribute - this program under any other version of the GNU Affero General Public - License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . -*/ -package client.inventory; - -/** - * @author Matze - */ -public enum MapleInventoryType { - UNDEFINED(0), - EQUIP(1), - USE(2), - SETUP(3), - ETC(4), - CASH(5), - CANHOLD(6), //Proof-guard for inserting after removal checks - EQUIPPED(-1); //Seems nexon screwed something when removing an item T_T - final byte type; - - private MapleInventoryType(int type) { - this.type = (byte) type; - } - - public byte getType() { - return type; - } - - public short getBitfieldEncoding() { - return (short) (2 << type); - } - - public static MapleInventoryType getByType(byte type) { - for (MapleInventoryType l : MapleInventoryType.values()) { - if (l.getType() == type) { - return l; - } - } - return null; - } - - public static MapleInventoryType getByWZName(String name) { - if (name.equals("Install")) { - return SETUP; - } else if (name.equals("Consume")) { - return USE; - } else if (name.equals("Etc")) { - return ETC; - } else if (name.equals("Cash")) { - return CASH; - } else if (name.equals("Pet")) { - return CASH; - } - return UNDEFINED; - } -} diff --git a/tools/SpiderDropFetcher/src/constants/CharsetConstants.java b/tools/SpiderDropFetcher/src/constants/CharsetConstants.java deleted file mode 100644 index a9a3cd6973..0000000000 --- a/tools/SpiderDropFetcher/src/constants/CharsetConstants.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package constants; - -/* - * Courtesy of GabrielSin (gabrielsin@playellin.net) - * Ellin - * MapleStory Server - * CharsetConstants - */ - -public class CharsetConstants { - - public static MapleLanguageType MAPLE_TYPE = MapleLanguageType.LANGUAGE_PT_BR; - - public enum MapleLanguageType { - LANGUAGE_PT_BR(1, "ISO-8859-1"), - LANGUAGE_US(2, "US-ASCII"); - final byte type; - final String ascii; - - private MapleLanguageType(int type, String ascii) { - this.type = (byte) type; - this.ascii = ascii; - } - - public String getAscii() { - return ascii; - } - - public byte getType() { - return type; - } - - public static MapleLanguageType getByType(byte type) { - for (MapleLanguageType l : MapleLanguageType.values()) { - if (l.getType() == type) { - return l; - } - } - return LANGUAGE_PT_BR; - } - } -} \ No newline at end of file diff --git a/tools/SpiderDropFetcher/src/constants/ItemConstants.java b/tools/SpiderDropFetcher/src/constants/ItemConstants.java deleted file mode 100644 index 860c392f34..0000000000 --- a/tools/SpiderDropFetcher/src/constants/ItemConstants.java +++ /dev/null @@ -1,234 +0,0 @@ -/* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 Patrick Huy - Matthias Butz - Jan Christian Meyer - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as - published by the Free Software Foundation version 3 as published by - the Free Software Foundation. You may not use, modify or distribute - this program under any other version of the GNU Affero General Public - License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . -*/ -package constants; - -import client.inventory.MapleInventoryType; -import java.util.HashSet; -import java.util.Set; -import java.util.HashMap; -import java.util.Map; - -/** - * - * @author Jay Estrella - * @author Ronan - */ -public final class ItemConstants { - protected static Map inventoryTypeCache = new HashMap<>(); - - public final static int LOCK = 0x01; - public final static int SPIKES = 0x02; - public final static int KARMA_USE = 0x02; - public final static int COLD = 0x04; - public final static int UNTRADEABLE = 0x08; - public final static int KARMA_EQP = 0x10; - public final static int KARMA_UNTRADEABLE = 0x20; // let 0x20 until it's proven something uses this - public final static int SANDBOX = 0x40; // let 0x40 until it's proven something uses this - public final static int PET_COME = 0x80; - public final static int ACCOUNT_SHARING = 0x100; - - public final static boolean EXPIRING_ITEMS = true; - public final static Set permanentItemids = new HashSet<>(); - - static { - int[] pi = {5000060, 5000100, 5000101, 5000102}; // i ain't going to open one gigantic itemid cache just for 4 perma itemids, no way! - for(int i : pi) { - permanentItemids.add(i); - } - } - - public static int getFlagByInt(int type) { - if (type == 128) { - return PET_COME; - } else if (type == 256) { - return ACCOUNT_SHARING; - } - return 0; - } - - public static boolean isThrowingStar(int itemId) { - return itemId / 10000 == 207; - } - - public static boolean isBullet(int itemId) { - return itemId / 10000 == 233; - } - - public static boolean isPotion(int itemId) { - return itemId / 1000 == 2000; - } - - public static boolean isFood(int itemId) { - int useType = itemId / 1000; - return useType == 2022 || useType == 2010 || useType == 2020; - } - - public static boolean isConsumable(int itemId) { - return isPotion(itemId) || isFood(itemId); - } - - public static boolean isRechargeable(int itemId) { - return isThrowingStar(itemId) || isBullet(itemId); - } - - public static boolean isArrowForCrossBow(int itemId) { - return itemId / 1000 == 2061; - } - - public static boolean isArrowForBow(int itemId) { - return itemId / 1000 == 2060; - } - - public static boolean isArrow(int itemId) { - return isArrowForBow(itemId) || isArrowForCrossBow(itemId); - } - - public static boolean isPet(int itemId) { - return itemId / 1000 == 5000; - } - - public static boolean isExpirablePet(int itemId) { - return itemId == 5000054; - } - - public static boolean isPermanentItem(int itemId) { - return permanentItemids.contains(itemId); - } - - public static boolean isNewYearCardEtc(int itemId) { - return itemId / 10000 == 430; - } - - public static boolean isNewYearCardUse(int itemId) { - return itemId / 10000 == 216; - } - - public static boolean isAccessory(int itemId) { - return itemId >= 1110000 && itemId < 1140000; - } - - public static boolean isTaming(int itemId) { - int itemType = itemId / 1000; - return itemType == 1902 || itemType == 1912; - } - - public static boolean isTownScroll(int itemId) { - return itemId >= 2030000 && itemId < 2030100; - } - - public static boolean isAntibanishScroll(int itemId) { - return itemId == 2030100; - } - - public static boolean isCleanSlate(int scrollId) { - return scrollId > 2048999 && scrollId < 2049004; - } - - public static boolean isFlagModifier(int scrollId, byte flag) { - if(scrollId == 2041058 && ((flag & ItemConstants.COLD) == ItemConstants.COLD)) return true; - if(scrollId == 2040727 && ((flag & ItemConstants.SPIKES) == ItemConstants.SPIKES)) return true; - return false; - } - - public static boolean isChaosScroll(int scrollId) { - return scrollId >= 2049100 && scrollId <= 2049103; - } - - public static boolean isRateCoupon(int itemId) { - int itemType = itemId / 1000; - return itemType == 5211 || itemType == 5360; - } - - public static boolean isExpCoupon(int couponId) { - return couponId / 1000 == 5211; - } - - public static boolean isPartyItem(int itemId) { - return itemId >= 2022430 && itemId <= 2022433; - } - - public static boolean isPartyAllcure(int itemId) { - return itemId == 2022433; - } - - public static boolean isHiredMerchant(int itemId) { - return itemId / 10000 == 503; - } - - public static boolean isPlayerShop(int itemId) { - return itemId / 10000 == 514; - } - - public static MapleInventoryType getInventoryType(final int itemId) { - if (inventoryTypeCache.containsKey(itemId)) { - return inventoryTypeCache.get(itemId); - } - - MapleInventoryType ret = MapleInventoryType.UNDEFINED; - - final byte type = (byte) (itemId / 1000000); - if (type >= 1 && type <= 5) { - ret = MapleInventoryType.getByType(type); - } - - inventoryTypeCache.put(itemId, ret); - return ret; - } - - public static boolean isMakerReagent(int itemId) { - return itemId / 10000 == 425; - } - - public static boolean isOverall(int itemId) { - return itemId / 10000 == 105; - } - - public static boolean isCashStore(int itemId) { - int itemType = itemId / 10000; - return itemType == 503 || itemType == 514; - } - - public static boolean isMapleLife(int itemId) { - int itemType = itemId / 10000; - return itemType == 543 && itemId != 5430000; - } - - public static boolean isWeapon(int itemId) { - return itemId >= 1302000 && itemId < 1492024; - } - - public static boolean isEquipment(int itemId) { - return itemId < 2000000 && itemId != 0; - } - - public static boolean isMedal(int itemId) { - return itemId >= 1140000 && itemId < 1143000; - } - - public static boolean isWeddingRing(int itemId) { - return itemId >= 1112803 && itemId <= 1112809; - } - - public static boolean isWeddingToken(int itemId) { - return itemId >= 4031357 && itemId <= 4031364; - } -} diff --git a/tools/SpiderDropFetcher/src/dropspider/DataTool.java b/tools/SpiderDropFetcher/src/dropspider/DataTool.java deleted file mode 100644 index e0c4d3b144..0000000000 --- a/tools/SpiderDropFetcher/src/dropspider/DataTool.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -package dropspider; - -import java.io.File; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import provider.MapleData; -import provider.MapleDataDirectoryEntry; -import provider.MapleDataFileEntry; -import provider.MapleDataProvider; -import provider.MapleDataProviderFactory; -import provider.MapleDataTool; -import server.MapleItemInformationProvider; -import tools.Pair; - -/** - * - * @author Simon (DropSpider) - */ -public class DataTool { - private static Map hardcodedMobs = new HashMap<>(); - - private static ArrayList> npc_list = null; - private static LinkedList> mob_pairs = null; - private static MapleDataProvider data = MapleDataProviderFactory.getDataProvider(MapleDataProviderFactory.fileInWZPath("Mob.wz")); - private static HashSet bosses = null; - - public static void setHardcodedMobNames() { - hardcodedMobs.put("Red Slime [2]", 7120103); - hardcodedMobs.put("Gold Slime", 7120105); - hardcodedMobs.put("Nibelung [3]", 8220015); - } - - public static void addMonsterIdsFromHardcodedName(List monster_ids, String monster_name) { - Integer id = hardcodedMobs.get(monster_name); - if(id != null) { - monster_ids.add(id); - } - } - - public static ArrayList monsterIdsFromName(String name) { - MapleData data = null; - MapleDataProvider dataProvider = MapleDataProviderFactory.getDataProvider(new File(System.getProperty("wzpath") + "/" + "String.wz")); - ArrayList ret = new ArrayList<>(); - data = dataProvider.getData("Mob.img"); - if (mob_pairs == null) { - mob_pairs = new LinkedList<>(); - for (MapleData mobIdData : data.getChildren()) { - int mobIdFromData = Integer.parseInt(mobIdData.getName()); - String mobNameFromData = MapleDataTool.getString(mobIdData.getChildByPath("name"), "NO-NAME"); - mob_pairs.add(new Pair<>(mobIdFromData, mobNameFromData)); - } - } - for (Pair mobPair : mob_pairs) { - if (mobPair.getRight().toLowerCase().equals(name.toLowerCase())) { - ret.add(mobPair.getLeft()); - } - } - return ret; - } - - private static void populateBossList() { - bosses = new HashSet<>(); - MapleDataDirectoryEntry mob_data = data.getRoot(); - for (MapleDataFileEntry mdfe : mob_data.getFiles()) { - MapleData boss_candidate = data.getData(mdfe.getName()); - MapleData monsterInfoData = boss_candidate.getChildByPath("info"); - int mid = Integer.valueOf(boss_candidate.getName().replaceAll("[^0-9]", "")); - boolean boss = MapleDataTool.getIntConvert("boss", monsterInfoData, 0) > 0 || mid == 8810018 || mid == 9410066; - if (boss) { - bosses.add(mid); - } - } - } - - public static boolean isBoss(int mid) { - if (bosses == null) { - populateBossList(); - } - return bosses.contains(mid); - } - - public static ArrayList itemIdsFromName(String name) { - - ArrayList ret = new ArrayList<>(); - for (Pair itemPair : MapleItemInformationProvider.getInstance().getAllItems()) { - String item_name = itemPair.getRight().toLowerCase().replaceAll("\\"", ""); - item_name = item_name.replaceAll("'", ""); - item_name = item_name.replaceAll("\\'", ""); - - name = name.toLowerCase().replaceAll("\\"", ""); - name = name.replaceAll("'", ""); - name = name.replaceAll("\\'", ""); - - if (item_name.equals(name)) { - ret.add(itemPair.getLeft()); - return ret; - } - } - return ret; - } - - public static ArrayList npcIdsFromName(String name) { - MapleDataProvider dataProvider = MapleDataProviderFactory.getDataProvider(new File(System.getProperty("wzpath") + "/" + "String.wz")); - ArrayList ret = new ArrayList<>(); - if (npc_list == null) { - ArrayList> searchList = new ArrayList<>(); - for (MapleData searchData : dataProvider.getData("Npc.img").getChildren()) { - int searchFromData = Integer.parseInt(searchData.getName()); - String infoFromData = MapleDataTool.getString(searchData.getChildByPath("name"), "NO-NAME"); - searchList.add(new Pair<>(searchFromData, infoFromData)); - } - npc_list = searchList; - } - for (Pair searched : npc_list) { - if (searched.getRight().toLowerCase().contains(name.toLowerCase())) { - ret.add(searched.getLeft()); - } - } - return ret; - } -} diff --git a/tools/SpiderDropFetcher/src/dropspider/DropEntry.java b/tools/SpiderDropFetcher/src/dropspider/DropEntry.java deleted file mode 100644 index 3fc865166d..0000000000 --- a/tools/SpiderDropFetcher/src/dropspider/DropEntry.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -package dropspider; - -import client.inventory.MapleInventoryType; -import constants.ItemConstants; - -/** - * - * @author Simon (DropSpider) - */ -public class DropEntry { - private int version; - private int item_id; - private int monster_id; - private int chance; - private int mindrop; - private int maxdrop; - - public DropEntry(int item_id, int monster_id, int version) { - this.item_id = item_id; - this.monster_id = monster_id; - mindrop = 1; - maxdrop = 1; - chance = calculateChance(item_id); - this.version = version; - } - - private int calculateChance(int item_id) { - MapleInventoryType mit = ItemConstants.getInventoryType(item_id); - boolean boss = DataTool.isBoss(monster_id); - int number = (item_id / 1000) % 1000; - switch (mit) { - case EQUIP: - if (boss) { - return 40000; - } - return 700; - case USE: - if (boss) { - mindrop = 1; - maxdrop = 4; - } - switch (number) { - case 0: // normal potions - mindrop = 1; - if (version > 98) { - maxdrop = 5; - } - return 40000; - case 1: // watermelons, pills, speed potions, etc - case 2: // same thing - return 10000; - case 3: // advanced potions from crafting (should not drop) - case 4: // same thing - case 11: // poison mushroom - case 28: // cool items - case 30: // return scrolls - case 46: // gallant scrolls - return 0; - case 10: // strange potions like apples, eggs - case 12: // drakes blood, sap of ancient tree (rare use) - case 20: // salad, fried chicken, dews - case 22: // air bubbles and stuff. ALSO nependeath honey but oh well - case 50: // antidotes and stuff - return 3000; - case 290: // mastery books - if(boss) - return 40000; - else - return 1000; - case 40: // Scrolls - case 41: // Scrolls - case 43: // Scrolls - case 44: // Scrolls - case 48: // pet scrolls - if(boss) - return 10000; - else - return 750; - case 100: // summon bags - case 101: // summon bags - case 102: // summon bags - case 109: // summon bags - case 120: // pet food - case 211: // cliffs special potion - case 240: // rings - case 270: // pheromone, additional weird stuff - case 310: // teleport rock - case 320: // weird drops - case 390: // weird - case 430: // Scripted items - case 440: // jukebox - case 460: // magnifying glass - case 470: // golden hammer - case 490: // crystanol - case 500: // sp reset - return 0; - case 47: // tablets from dragon rider - return 220000; - case 49: // clean slats, potential scroll, ees - case 70: // throwing stars - case 210: // rare monster piece drops - case 330: // bullets - if(boss) - return 2500; - else - return 400; - case 60: // bow arrows - case 61: // crossbow arrows - mindrop = 10; - maxdrop = 50; - return 10000; - case 213: // boss transfrom - return 100000; - case 280: // skill books - if(boss) - return 20000; - else - return 1000; - case 381: // monster book things - case 382: - case 383: - case 384: - case 385: - case 386: - case 387: - case 388: - return 20000; - case 510: // recipes - case 511: - case 512: - return 10000; - default: - return 0; - - } - case ETC: - switch (number) { - case 0: // monster pieces - return 200000; - case 4: // crystal ores - case 130: // simulators - case 131: // manuals - return 3000; - case 30: // game pieces - return 10000; - case 32: // misc items - return 10000; - default: - return 7000; - } - default: - return 7000; - } - } - - public String getQuerySegment() { - StringBuilder sb = new StringBuilder(); - sb.append("("); - sb.append(monster_id); - sb.append(", "); - sb.append(item_id); - sb.append(", "); - sb.append(mindrop);//min - sb.append(", "); - sb.append(maxdrop);//max - sb.append(", "); - sb.append(0);//quest - sb.append(", "); - sb.append(chance); - sb.append(")"); - return sb.toString(); - } -} \ No newline at end of file diff --git a/tools/SpiderDropFetcher/src/dropspider/Errors.java b/tools/SpiderDropFetcher/src/dropspider/Errors.java deleted file mode 100644 index a54b8543ab..0000000000 --- a/tools/SpiderDropFetcher/src/dropspider/Errors.java +++ /dev/null @@ -1,19 +0,0 @@ -package dropspider; - -import java.util.LinkedList; - -public class Errors { - - public String mobName; - public LinkedList wrong = new LinkedList<>(); - - public String createErrorLog() { - StringBuilder sb = new StringBuilder(); - - for (String w : wrong) { - sb.append(mobName).append(" : ").append(w).append("\r\n"); - } - - return sb.toString(); - } -} diff --git a/tools/SpiderDropFetcher/src/dropspider/Main.java b/tools/SpiderDropFetcher/src/dropspider/Main.java deleted file mode 100644 index c5711c9fd4..0000000000 --- a/tools/SpiderDropFetcher/src/dropspider/Main.java +++ /dev/null @@ -1,339 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -package dropspider; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.io.InputStream; -import java.io.PrintWriter; -import java.net.Authenticator; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Scanner; -import javax.net.ssl.HttpsURLConnection; - -/** - * - * @author Simon (DropSpider) - */ - -//NOTE: this tool is currently unsupported since HS started using HTTPS. Missing proper SSL certificates to access Hidden-Street's website. -public class Main { - - private static ArrayList drop_entries = new ArrayList<>(); - private static HashMap problems = new HashMap<>(); -// private static final String TEST_STRING = " Ligator Skin, The Magic Rock, Witch Grass Leaves "; - private static final String BASE_URL = "https://bbb.hidden-street.net"; - private static final int VERSION = 83; - private static String[] pages = {"1-10", "11-20", "21-30", "31-40", "41-50", "51-60", "61-70", "71-80", "81-90", "91-100"}; - private static String[] additionalPages88 = {"101-150", "151-200"}; - private static String[] additionalPagesBB = {"101-120,", "121-140", "141-160", "161-180", "181-200"}; - - public static void main(String[] args) { - System.setProperty("wzpath", "../../wz"); - - //DataTool.setHardcodedMobNames(); - //parsePage("https://bbb.hidden-street.net/monster/nibelung-3"); - - crawlProgram(); - - dumpQuery(); - dumpErrors(); - } - - private static void crawlProgram() { - //parseMonsterSection(TEST_STRING); - for (String s : pages) { - crawlPage("https://bbb.hidden-street.net/monster/" + s); - } - if (VERSION > 92) { // big bang - for (String s : additionalPagesBB) { - crawlPage("https://bbb.hidden-street.net/monster/" + s); - } - crawlPage("https://bbb.hidden-street.net/monster/101-120?page=1"); //page 1's bugged - } else { - for (String s : additionalPages88) { - crawlPage("https://bbb.hidden-street.net/monster/" + s); - } - } - } - - private static void crawlPage(String url) { //recursive method - try { - URL page = new URL(url); - //Authenticator.setDefault( new MyAuthenticator()); // todo keystore/truststore pass - HttpsURLConnection http = (HttpsURLConnection)page.openConnection(); - http.setAllowUserInteraction(true); - http.setRequestMethod("GET"); - http.connect(); - - InputStream is = http.getInputStream(); - Scanner s = new Scanner(is); - String temp_data = ""; - while (s.hasNext()) { - temp_data += s.nextLine() + "\n"; - } - s.close(); - is.close(); - while (temp_data.contains("class=\"monster\">")) { - String monster_section = getStringBetween(temp_data, "class=\"monster\">", ""); - parseMonsterSection(monster_section); - temp_data = trimUntil(temp_data, ""); - } - if (temp_data.contains("Go to next page")) { - String next_url_segment = getStringBetween(temp_data, "
  • ")) { - String monster_section = getStringBetween(temp_data, "class=\"monster\">", ""); - parseMonsterSection(monster_section); - temp_data = trimUntil(temp_data, ""); - } - if (temp_data.contains("Go to next page")) { - String next_url_segment = getStringBetween(temp_data, "
  • ", ""), monster_name); - - //parse useable drop - parseItemSection(getStringBetween(html_data, "Useable drop:", ""), monster_name); - - //parse ore drop - parseItemSection(getStringBetween(html_data, "Ore drop:", ""), monster_name); - - //parse equips - parseItemSection(getStringBetween(html_data, "Common equipment:", ""), monster_name); - parseItemSection(getStringBetween(html_data, "Warrior equipment:", ""), monster_name); - parseItemSection(getStringBetween(html_data, "Magician equipment:", ""), monster_name); - parseItemSection(getStringBetween(html_data, "Bowman equipment:", ""), monster_name); - parseItemSection(getStringBetween(html_data, "Thief equipment:", ""), monster_name); - parseItemSection(getStringBetween(html_data, "Pirate equipment:", ""), monster_name); - - //System.out.println(monster_name); - } - - private static void parseItemSection(String html_data, String monster_name) { - String temp_data = html_data; - while (temp_data.contains(""); - String item_name = getStringBetween(s1, "", ""); - temp_data = trimUntil(temp_data, ""); - - boolean gender_equip = false; - if (item_name.contains("(M)") || item_name.contains("(F)")) { - item_name = item_name.replaceAll("(\\(M\\))|(\\(F\\))", ""); - gender_equip = true; - } - item_name = item_name.replaceAll("Throwing-Star", "Throwing-Stars").trim(); - item_name = item_name.replaceAll("for Magic Attack", "for Magic Att.").trim(); - item_name = item_name.replaceAll("\\(50%\\)", "").trim(); - item_name = item_name.replaceAll("\\(70%\\)", "").trim(); - item_name = item_name.replaceAll("\\'s", "").trim(); - - - monster_name = monster_name.replaceAll("Horntail\\'s Head B", "Horntail"); - // Process scrolls, nexon doesn't have the % on most of the scrolls. So we need to remove it - // Unfortunately they do for some, so we have to handle that too. - boolean scroll = false; - int scrollType = 0; - - if(item_name.contains("100%")) { - scroll = true; - item_name = item_name.replaceAll("100%", "").trim(); - item_name = item_name.replaceAll("\\(\\)", "").trim(); // Hidden Street has a few scroll %'s with ()s around them.. sigh - } else if(item_name.contains("60%")) { - scroll = true; - scrollType = 1; - item_name = item_name.replaceAll("60%", "").trim(); - item_name = item_name.replaceAll("\\(\\)", "").trim(); - } else if(item_name.contains("10%")) { - scroll = true; - scrollType = 2; - item_name = item_name.replaceAll("10%", "").trim(); - item_name = item_name.replaceAll("\\(\\)", "").trim(); - //f(item_name.contains(" ()")) item_name = item_name.substring(0, item_name.lastIndexOf(" (")); - } else if(item_name.contains("70%")) { - scroll = true; - scrollType = 4; - item_name = item_name.replaceAll("70%", "").trim(); - item_name = item_name.replaceAll("\\(\\)", "").trim(); - } else if(item_name.contains("30%")) { - scroll = true; - scrollType = 5; - item_name = item_name.replaceAll("30%", "").trim(); - item_name = item_name.replaceAll("\\(\\)", "").trim(); - } - - -// System.out.println("Item name: " + item_name); - - //drop entry - ArrayList monster_ids = DataTool.monsterIdsFromName(monster_name); - //DataTool.addMonsterIdsFromHardcodedName(monster_ids, monster_name); - - ArrayList item_ids = DataTool.itemIdsFromName(item_name); - - if(scroll && item_ids.isEmpty()) { - // Try adding on the % again. Ty nexon... - if(scrollType == 0) item_name += " 100%"; - if(scrollType == 1) item_name += " 60%"; - if(scrollType == 2) item_name += " 10%"; - if(scrollType == 4) item_name += " 70%"; - if(scrollType == 5) item_name += " 30%"; - - item_ids = DataTool.itemIdsFromName(item_name); - } - - if (!monster_ids.isEmpty() && !item_ids.isEmpty()) { - int item_id = item_ids.get(0); - if(scroll) { - item_id += scrollType; - } - int item_id_2 = -1; - for (Integer mob_id : monster_ids) { - System.out.println("Monster ID: " + mob_id + ", Item ID: " + item_id); - drop_entries.add(new DropEntry(item_id, mob_id, VERSION)); - if (gender_equip && item_ids.size() > 1) { - item_id_2 = item_ids.get(1); - drop_entries.add(new DropEntry(item_id_2, mob_id, VERSION)); - - } - } - } else { - System.out.println("Error parsing item " + item_name + " dropped by " + monster_name + "."); - - if (!monster_ids.isEmpty()) { - if (!problems.containsKey(monster_name)) { - Errors e = new Errors(); - e.mobName = monster_name; - - problems.put(monster_name, e); - } - - problems.get(monster_name).wrong.add(item_name); - } - //System.out.println("Monster ids size: " + monster_ids.size() + ", Item IDs size: " + item_ids.size()); - } - - } - } - - /** - * Returns the string lying between the two specified strings. - * - * @param line The string to parse - * @param start The first string - * @param end The last string - * @return The string between the two specified strings - */ - public static String getStringBetween(String line, String start, String end) { - int start_offset = line.indexOf(start) + start.length(); - return line.substring(start_offset, line.substring(start_offset).indexOf(end) + start_offset); - } - - public static String trimUntil(String line, String until) { - int until_pos = line.indexOf(until); - if (until_pos == -1) { - return null; - } else { - return line.substring(until_pos + until.length()); - } - } - - public static void dumpErrors() { - String file = "errors.txt"; - try { - File f = new File(file); - BufferedWriter bw = new BufferedWriter(new FileWriter(f)); - PrintWriter pw = new PrintWriter(bw); - - for (Errors err : problems.values()) { - pw.write(err.createErrorLog()); - } - - pw.flush(); - - pw.close(); - bw.close(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - public static void dumpQuery() { - String filename = "drops.sql"; - try { - File output = new File(filename); - BufferedWriter bw = new BufferedWriter(new FileWriter(output)); - PrintWriter pw = new PrintWriter(bw); - StringBuilder sb = new StringBuilder(); - pw.write("TRUNCATE TABLE `drop_data`;\r\n"); - pw.write("INSERT INTO `drop_data` (`dropperid`, `itemid`, `minimum_quantity`, `maximum_quantity`, `questid`, `chance`) VALUES "); - for (Iterator i = drop_entries.iterator(); i.hasNext();) { - DropEntry de = i.next(); - pw.write(de.getQuerySegment()); - if (i.hasNext()) { - pw.write(", \r\n"); - } - } - pw.write(sb.toString()); - pw.close(); - bw.close(); - } catch (IOException ioe) { - ioe.printStackTrace(); - System.out.println("Error writing to file: " + ioe.getLocalizedMessage()); - } - } -} diff --git a/tools/SpiderDropFetcher/src/provider/MapleCanvas.java b/tools/SpiderDropFetcher/src/provider/MapleCanvas.java deleted file mode 100644 index 10ab682196..0000000000 --- a/tools/SpiderDropFetcher/src/provider/MapleCanvas.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 Patrick Huy - Matthias Butz - Jan Christian Meyer - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as - published by the Free Software Foundation version 3 as published by - the Free Software Foundation. You may not use, modify or distribute - this program under any other version of the GNU Affero General Public - License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . -*/ -package provider; - -import java.awt.image.BufferedImage; - -public interface MapleCanvas { - int getHeight(); - int getWidth(); - BufferedImage getImage(); -} diff --git a/tools/SpiderDropFetcher/src/provider/MapleData.java b/tools/SpiderDropFetcher/src/provider/MapleData.java deleted file mode 100644 index 4d90a93804..0000000000 --- a/tools/SpiderDropFetcher/src/provider/MapleData.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 Patrick Huy - Matthias Butz - Jan Christian Meyer - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as - published by the Free Software Foundation version 3 as published by - the Free Software Foundation. You may not use, modify or distribute - this program under any other version of the GNU Affero General Public - License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . -*/ -package provider; - -import java.util.List; -import provider.wz.MapleDataType; - -public interface MapleData extends MapleDataEntity, Iterable { - @Override - public String getName(); - public MapleDataType getType(); - public List getChildren(); - public MapleData getChildByPath(String path); - public Object getData(); -} diff --git a/tools/SpiderDropFetcher/src/provider/MapleDataDirectoryEntry.java b/tools/SpiderDropFetcher/src/provider/MapleDataDirectoryEntry.java deleted file mode 100644 index cb043e0c94..0000000000 --- a/tools/SpiderDropFetcher/src/provider/MapleDataDirectoryEntry.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 Patrick Huy - Matthias Butz - Jan Christian Meyer - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as - published by the Free Software Foundation version 3 as published by - the Free Software Foundation. You may not use, modify or distribute - this program under any other version of the GNU Affero General Public - License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . -*/ -package provider; - -import java.util.List; - -/** - * - * @author Matze - */ -public interface MapleDataDirectoryEntry extends MapleDataEntry { - public List getSubdirectories(); - public List getFiles(); - public MapleDataEntry getEntry(String name); -} diff --git a/tools/SpiderDropFetcher/src/provider/MapleDataEntity.java b/tools/SpiderDropFetcher/src/provider/MapleDataEntity.java deleted file mode 100644 index 03ff77649c..0000000000 --- a/tools/SpiderDropFetcher/src/provider/MapleDataEntity.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 Patrick Huy - Matthias Butz - Jan Christian Meyer - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as - published by the Free Software Foundation version 3 as published by - the Free Software Foundation. You may not use, modify or distribute - this program under any other version of the GNU Affero General Public - License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . -*/ -package provider; - -/** - * - * @author Matze - */ -public interface MapleDataEntity { - public String getName(); - public MapleDataEntity getParent(); -} diff --git a/tools/SpiderDropFetcher/src/provider/MapleDataEntry.java b/tools/SpiderDropFetcher/src/provider/MapleDataEntry.java deleted file mode 100644 index 62db6d0abe..0000000000 --- a/tools/SpiderDropFetcher/src/provider/MapleDataEntry.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 Patrick Huy - Matthias Butz - Jan Christian Meyer - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as - published by the Free Software Foundation version 3 as published by - the Free Software Foundation. You may not use, modify or distribute - this program under any other version of the GNU Affero General Public - License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . -*/ -package provider; - -/** - * - * @author Matze - */ -public interface MapleDataEntry extends MapleDataEntity { - public String getName(); - public int getSize(); - public int getChecksum(); - public int getOffset(); -} diff --git a/tools/SpiderDropFetcher/src/provider/MapleDataFileEntry.java b/tools/SpiderDropFetcher/src/provider/MapleDataFileEntry.java deleted file mode 100644 index 902130a612..0000000000 --- a/tools/SpiderDropFetcher/src/provider/MapleDataFileEntry.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 Patrick Huy - Matthias Butz - Jan Christian Meyer - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as - published by the Free Software Foundation version 3 as published by - the Free Software Foundation. You may not use, modify or distribute - this program under any other version of the GNU Affero General Public - License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . -*/ -package provider; - -/** - * - * @author Matze - */ -public interface MapleDataFileEntry extends MapleDataEntry { - public void setOffset(int offset); -} diff --git a/tools/SpiderDropFetcher/src/provider/MapleDataProvider.java b/tools/SpiderDropFetcher/src/provider/MapleDataProvider.java deleted file mode 100644 index 5237b7ac37..0000000000 --- a/tools/SpiderDropFetcher/src/provider/MapleDataProvider.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 Patrick Huy - Matthias Butz - Jan Christian Meyer - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as - published by the Free Software Foundation version 3 as published by - the Free Software Foundation. You may not use, modify or distribute - this program under any other version of the GNU Affero General Public - License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . -*/ -package provider; - -public interface MapleDataProvider { - MapleData getData(String path); - MapleDataDirectoryEntry getRoot(); -} diff --git a/tools/SpiderDropFetcher/src/provider/MapleDataProviderFactory.java b/tools/SpiderDropFetcher/src/provider/MapleDataProviderFactory.java deleted file mode 100644 index 14753d4406..0000000000 --- a/tools/SpiderDropFetcher/src/provider/MapleDataProviderFactory.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 Patrick Huy - Matthias Butz - Jan Christian Meyer - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as - published by the Free Software Foundation version 3 as published by - the Free Software Foundation. You may not use, modify or distribute - this program under any other version of the GNU Affero General Public - License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . -*/ -package provider; - -import java.io.File; -import java.io.IOException; -import provider.wz.WZFile; -import provider.wz.XMLWZFile; - -public class MapleDataProviderFactory { - private final static String wzPath = System.getProperty("wzpath"); - - private static MapleDataProvider getWZ(File in, boolean provideImages) { - if (in.getName().toLowerCase().endsWith("wz") && !in.isDirectory()) { - try { - return new WZFile(in, provideImages); - } catch (IOException e) { - throw new RuntimeException("Loading WZ File failed", e); - } - } else { - return new XMLWZFile(in); - } - } - - public static MapleDataProvider getDataProvider(File in) { - return getWZ(in, false); - } - - public static MapleDataProvider getImageProvidingDataProvider(File in) { - return getWZ(in, true); - } - - public static File fileInWZPath(String filename) { - return new File(wzPath, filename); - } -} \ No newline at end of file diff --git a/tools/SpiderDropFetcher/src/provider/MapleDataTool.java b/tools/SpiderDropFetcher/src/provider/MapleDataTool.java deleted file mode 100644 index 25f4c7f817..0000000000 --- a/tools/SpiderDropFetcher/src/provider/MapleDataTool.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 Patrick Huy - Matthias Butz - Jan Christian Meyer - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as - published by the Free Software Foundation version 3 as published by - the Free Software Foundation. You may not use, modify or distribute - this program under any other version of the GNU Affero General Public - License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . -*/ -package provider; - -import java.awt.Point; -import java.awt.image.BufferedImage; -import provider.wz.MapleDataType; - -public class MapleDataTool { - public static String getString(MapleData data) { - return ((String) data.getData()); - } - - public static String getString(MapleData data, String def) { - if (data == null || data.getData() == null) { - return def; - } else { - return ((String) data.getData()); - } - } - - public static String getString(String path, MapleData data) { - return getString(data.getChildByPath(path)); - } - - public static String getString(String path, MapleData data, String def) { - return getString(data.getChildByPath(path), def); - } - - public static double getDouble(MapleData data) { - return ((Double) data.getData()).doubleValue(); - } - - public static float getFloat(MapleData data) { - return ((Float) data.getData()).floatValue(); - } - - public static int getInt(MapleData data) { - if (data == null || data.getData() == null) { - return 0;// DEF? - } - return ((Integer) data.getData()).intValue(); - } - - public static int getInt(String path, MapleData data) { - return getInt(data.getChildByPath(path)); - } - - public static int getIntConvert(MapleData data) { - if (data.getType() == MapleDataType.STRING) { - return Integer.parseInt(getString(data)); - } else { - return getInt(data); - } - } - - public static int getIntConvert(String path, MapleData data) { - MapleData d = data.getChildByPath(path); - if (d.getType() == MapleDataType.STRING) { - return Integer.parseInt(getString(d)); - } else { - return getInt(d); - } - } - - public static int getInt(MapleData data, int def) { - if (data == null || data.getData() == null) { - return def; - } else if (data.getType() == MapleDataType.STRING) { - return Integer.parseInt(getString(data)); - } else { - return ((Integer) data.getData()).intValue(); - } - } - - public static int getInt(String path, MapleData data, int def) { - return getInt(data.getChildByPath(path), def); - } - - public static int getIntConvert(String path, MapleData data, int def) { - MapleData d = data.getChildByPath(path); - if (d == null) { - return def; - } - if (d.getType() == MapleDataType.STRING) { - try { - return Integer.parseInt(getString(d)); - } catch (NumberFormatException nfe) { - nfe.printStackTrace(); - return def; - } - } else { - return getInt(d, def); - } - } - - public static BufferedImage getImage(MapleData data) { - return ((MapleCanvas) data.getData()).getImage(); - } - - public static Point getPoint(MapleData data) { - return ((Point) data.getData()); - } - - public static Point getPoint(String path, MapleData data) { - return getPoint(data.getChildByPath(path)); - } - - public static Point getPoint(String path, MapleData data, Point def) { - final MapleData pointData = data.getChildByPath(path); - if (pointData == null) { - return def; - } - return getPoint(pointData); - } - - public static String getFullDataPath(MapleData data) { - String path = ""; - MapleDataEntity myData = data; - while (myData != null) { - path = myData.getName() + "/" + path; - myData = myData.getParent(); - } - return path.substring(0, path.length() - 1); - } -} diff --git a/tools/SpiderDropFetcher/src/provider/wz/FileStoredPngMapleCanvas.java b/tools/SpiderDropFetcher/src/provider/wz/FileStoredPngMapleCanvas.java deleted file mode 100644 index 21736c2c16..0000000000 --- a/tools/SpiderDropFetcher/src/provider/wz/FileStoredPngMapleCanvas.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 Patrick Huy - Matthias Butz - Jan Christian Meyer - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as - published by the Free Software Foundation version 3 as published by - the Free Software Foundation. You may not use, modify or distribute - this program under any other version of the GNU Affero General Public - License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . -*/ -package provider.wz; - -import java.awt.image.BufferedImage; -import java.io.File; -import java.io.IOException; -import javax.imageio.ImageIO; -import provider.MapleCanvas; - -public class FileStoredPngMapleCanvas implements MapleCanvas { - private File file; - private int width; - private int height; - private BufferedImage image; - - public FileStoredPngMapleCanvas(int width, int height, File fileIn) { - this.width = width; - this.height = height; - this.file = fileIn; - } - - @Override - public int getHeight() { - return height; - } - - @Override - public int getWidth() { - return width; - } - - @Override - public BufferedImage getImage() { - loadImageIfNecessary(); - return image; - } - - private void loadImageIfNecessary() { - if (image == null) { - try { - image = ImageIO.read(file); - // replace the dimensions loaded from the wz by the REAL dimensions from the image - should be equal tho - width = image.getWidth(); - height = image.getHeight(); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - } -} diff --git a/tools/SpiderDropFetcher/src/provider/wz/ImgMapleSound.java b/tools/SpiderDropFetcher/src/provider/wz/ImgMapleSound.java deleted file mode 100644 index 8add2ccb36..0000000000 --- a/tools/SpiderDropFetcher/src/provider/wz/ImgMapleSound.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 Patrick Huy - Matthias Butz - Jan Christian Meyer - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as - published by the Free Software Foundation version 3 as published by - the Free Software Foundation. You may not use, modify or distribute - this program under any other version of the GNU Affero General Public - License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . -*/ -package provider.wz; - -public class ImgMapleSound { - private int dataLength, offset; - - public ImgMapleSound(int dataLength, int offset) { - this.dataLength = dataLength; - this.offset = offset; - } - - public int getDataLength() { - return dataLength; - } - - public int getOffset() { - return offset; - } -} diff --git a/tools/SpiderDropFetcher/src/provider/wz/ListWZFile.java b/tools/SpiderDropFetcher/src/provider/wz/ListWZFile.java deleted file mode 100644 index 1672a08c59..0000000000 --- a/tools/SpiderDropFetcher/src/provider/wz/ListWZFile.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 Patrick Huy - Matthias Butz - Jan Christian Meyer - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as - published by the Free Software Foundation version 3 as published by - the Free Software Foundation. You may not use, modify or distribute - this program under any other version of the GNU Affero General Public - License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . -*/ -package provider.wz; - -import java.io.BufferedInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import provider.MapleDataProviderFactory; -import tools.data.input.GenericLittleEndianAccessor; -import tools.data.input.InputStreamByteStream; -import tools.data.input.LittleEndianAccessor; - -public class ListWZFile { - private LittleEndianAccessor lea; - private List entries = new ArrayList(); - private static Collection modernImgs = new HashSet(); - - public static byte[] xorBytes(byte[] a, byte[] b) { - byte[] wusched = new byte[a.length]; - for (int i = 0; i < a.length; i++) { - wusched[i] = (byte) (a[i] ^ b[i]); - } - return wusched; - } - - public ListWZFile(File listwz) throws FileNotFoundException { - lea = new GenericLittleEndianAccessor(new InputStreamByteStream(new BufferedInputStream(new FileInputStream(listwz)))); - while (lea.available() > 0) { - int l = lea.readInt() * 2; - byte[] chunk = new byte[l]; - for (int i = 0; i < chunk.length; i++) { - chunk[i] = lea.readByte(); - } - lea.readChar(); - final String value = String.valueOf(WZTool.readListString(chunk)); - entries.add(value); - } - entries = Collections.unmodifiableList(entries); - } - - public List getEntries() { - return entries; - } - - public static void init() { - final String listWz = System.getProperty("listwz"); - if (listWz != null) { - ListWZFile listwz; - try { - listwz = new ListWZFile(MapleDataProviderFactory.fileInWZPath("List.wz")); - modernImgs = new HashSet(listwz.getEntries()); - } catch (FileNotFoundException e) { - e.printStackTrace(); - } - } - } - - public static boolean isModernImgFile(String path) { - return modernImgs.contains(path); - } -} diff --git a/tools/SpiderDropFetcher/src/provider/wz/MapleDataType.java b/tools/SpiderDropFetcher/src/provider/wz/MapleDataType.java deleted file mode 100644 index e074d57d14..0000000000 --- a/tools/SpiderDropFetcher/src/provider/wz/MapleDataType.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 Patrick Huy - Matthias Butz - Jan Christian Meyer - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as - published by the Free Software Foundation version 3 as published by - the Free Software Foundation. You may not use, modify or distribute - this program under any other version of the GNU Affero General Public - License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . -*/ -package provider.wz; - -public enum MapleDataType { - NONE, IMG_0x00, SHORT, INT, FLOAT, DOUBLE, STRING, EXTENDED, PROPERTY, CANVAS, VECTOR, CONVEX, SOUND, UOL, UNKNOWN_TYPE, UNKNOWN_EXTENDED_TYPE; -} \ No newline at end of file diff --git a/tools/SpiderDropFetcher/src/provider/wz/PNGMapleCanvas.java b/tools/SpiderDropFetcher/src/provider/wz/PNGMapleCanvas.java deleted file mode 100644 index 97c2303804..0000000000 --- a/tools/SpiderDropFetcher/src/provider/wz/PNGMapleCanvas.java +++ /dev/null @@ -1,151 +0,0 @@ -/* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 Patrick Huy - Matthias Butz - Jan Christian Meyer - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as - published by the Free Software Foundation version 3 as published by - the Free Software Foundation. You may not use, modify or distribute - this program under any other version of the GNU Affero General Public - License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . -*/ -package provider.wz; - -import java.awt.Point; -import java.awt.image.BufferedImage; -import java.awt.image.DataBuffer; -import java.awt.image.DataBufferByte; -import java.awt.image.PixelInterleavedSampleModel; -import java.awt.image.Raster; -import java.awt.image.SampleModel; -import java.awt.image.WritableRaster; -import java.util.zip.DataFormatException; -import java.util.zip.Inflater; -import provider.MapleCanvas; - -public class PNGMapleCanvas implements MapleCanvas { - private static final int[] ZAHLEN = new int[]{2, 1, 0, 3}; - private int height; - private int width; - private int dataLength; - private int format; - private byte[] data; - - public PNGMapleCanvas(int width, int height, int dataLength, int format, byte[] data) { - super(); - this.height = height; - this.width = width; - this.dataLength = dataLength; - this.format = format; - this.data = data; - } - - public int getHeight() { - return height; - } - - public int getWidth() { - return width; - } - - public int getFormat() { - return format; - } - - private byte[] getData() { - return data; - } - - @Override - public BufferedImage getImage() { - int sizeUncompressed = 0; - int size8888 = 0; - int maxWriteBuf = 2; - int maxHeight = 3; - byte[] writeBuf = new byte[maxWriteBuf]; - @SuppressWarnings ("unused") - byte[] rowPointers = new byte[maxHeight]; - switch (getFormat()) { - case 1: - case 513: - sizeUncompressed = getHeight() * getWidth() * 4; - break; - case 2: - sizeUncompressed = getHeight() * getWidth() * 8; - break; - case 517: - sizeUncompressed = getHeight() * getWidth() / 128; - break; - } - size8888 = getHeight() * getWidth() * 8; - if (size8888 > maxWriteBuf) { - maxWriteBuf = size8888; - writeBuf = new byte[maxWriteBuf]; - } - if (getHeight() > maxHeight) { - maxHeight = getHeight(); - rowPointers = new byte[maxHeight]; - } - Inflater dec = new Inflater(); - dec.setInput(getData(), 0, dataLength); - int declen = 0; - byte[] uc = new byte[sizeUncompressed]; - try { - declen = dec.inflate(uc); - } catch (DataFormatException ex) { - throw new RuntimeException("zlib fucks", ex); - } - dec.end(); - if (getFormat() == 1) { - for (int i = 0; i < sizeUncompressed; i++) { - byte low = (byte) (uc[i] & 0x0F); - byte high = (byte) (uc[i] & 0xF0); - writeBuf[(i << 1)] = (byte) (((low << 4) | low) & 0xFF); - writeBuf[(i << 1) + 1] = (byte) (high | ((high >>> 4) & 0xF)); - } - } else if (getFormat() == 2) { - writeBuf = uc; - } else if (getFormat() == 513) { - for (int i = 0; i < declen; i += 2) { - byte bBits = (byte) ((uc[i] & 0x1F) << 3); - byte gBits = (byte) (((uc[i + 1] & 0x07) << 5) | ((uc[i] & 0xE0) >> 3)); - byte rBits = (byte) (uc[i + 1] & 0xF8); - writeBuf[(i << 1)] = (byte) (bBits | (bBits >> 5)); - writeBuf[(i << 1) + 1] = (byte) (gBits | (gBits >> 6)); - writeBuf[(i << 1) + 2] = (byte) (rBits | (rBits >> 5)); - writeBuf[(i << 1) + 3] = (byte) 0xFF; - } - } else if (getFormat() == 517) { - byte b = 0x00; - int pixelIndex = 0; - for (int i = 0; i < declen; i++) { - for (int j = 0; j < 8; j++) { - b = (byte) (((uc[i] & (0x01 << (7 - j))) >> (7 - j)) * 255); - for (int k = 0; k < 16; k++) { - pixelIndex = (i << 9) + (j << 6) + k * 2; - writeBuf[pixelIndex] = b; - writeBuf[pixelIndex + 1] = b; - writeBuf[pixelIndex + 2] = b; - writeBuf[pixelIndex + 3] = (byte) 0xFF; - } - } - } - } - DataBufferByte imgData = new DataBufferByte(writeBuf, sizeUncompressed); - SampleModel sm = new PixelInterleavedSampleModel(DataBuffer.TYPE_BYTE, getWidth(), getHeight(), 4, getWidth() * 4, ZAHLEN); - WritableRaster imgRaster = Raster.createWritableRaster(sm, imgData, new Point(0, 0)); - BufferedImage aa = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_ARGB); - aa.setData(imgRaster); - return aa; - } -} diff --git a/tools/SpiderDropFetcher/src/provider/wz/WZDirectoryEntry.java b/tools/SpiderDropFetcher/src/provider/wz/WZDirectoryEntry.java deleted file mode 100644 index d24b8cb2b9..0000000000 --- a/tools/SpiderDropFetcher/src/provider/wz/WZDirectoryEntry.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 Patrick Huy - Matthias Butz - Jan Christian Meyer - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as - published by the Free Software Foundation version 3 as published by - the Free Software Foundation. You may not use, modify or distribute - this program under any other version of the GNU Affero General Public - License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . -*/ -package provider.wz; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import provider.MapleDataDirectoryEntry; -import provider.MapleDataEntity; -import provider.MapleDataEntry; -import provider.MapleDataFileEntry; - -public class WZDirectoryEntry extends WZEntry implements MapleDataDirectoryEntry { - private List subdirs = new ArrayList(); - private List files = new ArrayList(); - private Map entries = new HashMap(); - - public WZDirectoryEntry(String name, int size, int checksum, MapleDataEntity parent) { - super(name, size, checksum, parent); - } - - public WZDirectoryEntry() { - super(null, 0, 0, null); - } - - public void addDirectory(MapleDataDirectoryEntry dir) { - subdirs.add(dir); - entries.put(dir.getName(), dir); - } - - public void addFile(MapleDataFileEntry fileEntry) { - files.add(fileEntry); - entries.put(fileEntry.getName(), fileEntry); - } - - public List getSubdirectories() { - return Collections.unmodifiableList(subdirs); - } - - public List getFiles() { - return Collections.unmodifiableList(files); - } - - public MapleDataEntry getEntry(String name) { - return entries.get(name); - } -} diff --git a/tools/SpiderDropFetcher/src/provider/wz/WZEntry.java b/tools/SpiderDropFetcher/src/provider/wz/WZEntry.java deleted file mode 100644 index 1e921b2082..0000000000 --- a/tools/SpiderDropFetcher/src/provider/wz/WZEntry.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 Patrick Huy - Matthias Butz - Jan Christian Meyer - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as - published by the Free Software Foundation version 3 as published by - the Free Software Foundation. You may not use, modify or distribute - this program under any other version of the GNU Affero General Public - License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . -*/ -package provider.wz; - -import provider.MapleDataEntity; -import provider.MapleDataEntry; - -public class WZEntry implements MapleDataEntry { - private String name; - private int size; - private int checksum; - private int offset; - private MapleDataEntity parent; - - public WZEntry(String name, int size, int checksum, MapleDataEntity parent) { - super(); - this.name = name; - this.size = size; - this.checksum = checksum; - this.parent = parent; - } - - public String getName() { - return name; - } - - public int getSize() { - return size; - } - - public int getChecksum() { - return checksum; - } - - public int getOffset() { - return offset; - } - - public MapleDataEntity getParent() { - return parent; - } -} diff --git a/tools/SpiderDropFetcher/src/provider/wz/WZFile.java b/tools/SpiderDropFetcher/src/provider/wz/WZFile.java deleted file mode 100644 index c6c0abf537..0000000000 --- a/tools/SpiderDropFetcher/src/provider/wz/WZFile.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 Patrick Huy - Matthias Butz - Jan Christian Meyer - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as - published by the Free Software Foundation version 3 as published by - the Free Software Foundation. You may not use, modify or distribute - this program under any other version of the GNU Affero General Public - License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . -*/ -package provider.wz; - -import java.io.BufferedInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.RandomAccessFile; -import provider.MapleData; -import provider.MapleDataDirectoryEntry; -import provider.MapleDataFileEntry; -import provider.MapleDataProvider; -import tools.data.input.GenericLittleEndianAccessor; -import tools.data.input.GenericSeekableLittleEndianAccessor; -import tools.data.input.InputStreamByteStream; -import tools.data.input.LittleEndianAccessor; -import tools.data.input.RandomAccessByteStream; -import tools.data.input.SeekableLittleEndianAccessor; - -public class WZFile implements MapleDataProvider { - static { - ListWZFile.init(); - } - private File wzfile; - private LittleEndianAccessor lea; - private SeekableLittleEndianAccessor slea; - private int headerSize; - private WZDirectoryEntry root; - private boolean provideImages; - private int cOffset; - - public WZFile(File wzfile, boolean provideImages) throws IOException { - this.wzfile = wzfile; - lea = new GenericLittleEndianAccessor(new InputStreamByteStream(new BufferedInputStream(new FileInputStream(wzfile)))); - RandomAccessFile raf = new RandomAccessFile(wzfile, "r"); - slea = new GenericSeekableLittleEndianAccessor(new RandomAccessByteStream(raf)); - root = new WZDirectoryEntry(wzfile.getName(), 0, 0, null); - this.provideImages = provideImages; - load(); - } - - private void load() throws IOException { - lea.readAsciiString(4); - lea.readInt(); - lea.readInt(); - headerSize = lea.readInt(); - lea.readNullTerminatedAsciiString(); - lea.readShort(); - parseDirectory(root); - cOffset = (int) lea.getBytesRead(); - getOffsets(root); - } - - private void getOffsets(MapleDataDirectoryEntry dir) { - for (MapleDataFileEntry file : dir.getFiles()) { - file.setOffset(cOffset); - cOffset += file.getSize(); - } - for (MapleDataDirectoryEntry sdir : dir.getSubdirectories()) { - getOffsets(sdir); - } - } - - private void parseDirectory(WZDirectoryEntry dir) { - int entries = WZTool.readValue(lea); - for (int i = 0; i < entries; i++) { - byte marker = lea.readByte(); - String name = null; - int size, checksum; - switch (marker) { - case 0x02: - name = WZTool.readDecodedStringAtOffsetAndReset(slea, lea.readInt() + this.headerSize + 1); - size = WZTool.readValue(lea); - checksum = WZTool.readValue(lea); - lea.readInt(); //dummy int - dir.addFile(new WZFileEntry(name, size, checksum, dir)); - break; - case 0x03: - case 0x04: - name = WZTool.readDecodedString(lea); - size = WZTool.readValue(lea); - checksum = WZTool.readValue(lea); - lea.readInt(); //dummy int - if (marker == 3) { - dir.addDirectory(new WZDirectoryEntry(name, size, checksum, dir)); - } else { - dir.addFile(new WZFileEntry(name, size, checksum, dir)); - } - break; - default: - } - } - for (MapleDataDirectoryEntry idir : dir.getSubdirectories()) { - parseDirectory((WZDirectoryEntry) idir); - } - } - - public WZIMGFile getImgFile(String path) throws IOException { - String segments[] = path.split("/"); - WZDirectoryEntry dir = root; - for (int x = 0; x < segments.length - 1; x++) { - dir = (WZDirectoryEntry) dir.getEntry(segments[x]); - if (dir == null) { - return null; - } - } - WZFileEntry entry = (WZFileEntry) dir.getEntry(segments[segments.length - 1]); - if (entry == null) { - return null; - } - String fullPath = wzfile.getName().substring(0, wzfile.getName().length() - 3).toLowerCase() + "/" + path; - return new WZIMGFile(this.wzfile, entry, provideImages, ListWZFile.isModernImgFile(fullPath)); - } - - @Override - public synchronized MapleData getData(String path) { - try { - WZIMGFile imgFile = getImgFile(path); - if (imgFile == null) { - return null; - } - MapleData ret = imgFile.getRoot(); - return ret; - } catch (IOException e) { - e.printStackTrace(); - } - return null; - } - - @Override - public MapleDataDirectoryEntry getRoot() { - return root; - } -} diff --git a/tools/SpiderDropFetcher/src/provider/wz/WZFileEntry.java b/tools/SpiderDropFetcher/src/provider/wz/WZFileEntry.java deleted file mode 100644 index 792371d9cf..0000000000 --- a/tools/SpiderDropFetcher/src/provider/wz/WZFileEntry.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 Patrick Huy - Matthias Butz - Jan Christian Meyer - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as - published by the Free Software Foundation version 3 as published by - the Free Software Foundation. You may not use, modify or distribute - this program under any other version of the GNU Affero General Public - License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . -*/ -package provider.wz; - -import provider.MapleDataEntity; -import provider.MapleDataFileEntry; - -public class WZFileEntry extends WZEntry implements MapleDataFileEntry { - private int offset; - - public WZFileEntry(String name, int size, int checksum, MapleDataEntity parent) { - super(name, size, checksum, parent); - } - - @Override - public int getOffset() { - return offset; - } - - public void setOffset(int offset) { - this.offset = offset; - } -} diff --git a/tools/SpiderDropFetcher/src/provider/wz/WZIMGEntry.java b/tools/SpiderDropFetcher/src/provider/wz/WZIMGEntry.java deleted file mode 100644 index 385d785183..0000000000 --- a/tools/SpiderDropFetcher/src/provider/wz/WZIMGEntry.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 Patrick Huy - Matthias Butz - Jan Christian Meyer - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as - published by the Free Software Foundation version 3 as published by - the Free Software Foundation. You may not use, modify or distribute - this program under any other version of the GNU Affero General Public - License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . -*/ -package provider.wz; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import provider.MapleData; -import provider.MapleDataEntity; - -public class WZIMGEntry implements MapleData { - private String name; - private MapleDataType type; - private List children = new ArrayList(10); - private Object data; - private MapleDataEntity parent; - - public WZIMGEntry(MapleDataEntity parent) { - this.parent = parent; - } - - @Override - public String getName() { - return name; - } - - @Override - public MapleDataType getType() { - return type; - } - - @Override - public List getChildren() { - return Collections.unmodifiableList(children); - } - - @Override - public MapleData getChildByPath(String path) { - String segments[] = path.split("/"); - if (segments[0].equals("..")) { - return ((MapleData) getParent()).getChildByPath(path.substring(path.indexOf("/") + 1)); - } - MapleData ret = this; - for (int x = 0; x < segments.length; x++) { - boolean foundChild = false; - for (MapleData child : ret.getChildren()) { - if (child.getName().equals(segments[x])) { - ret = child; - foundChild = true; - break; - } - } - if (!foundChild) { - return null; - } - } - return ret; - } - - @Override - public Object getData() { - return data; - } - - public void setName(String name) { - this.name = name; - } - - public void setType(MapleDataType type) { - this.type = type; - } - - public void setData(Object data) { - this.data = data; - } - - public void addChild(WZIMGEntry entry) { - children.add(entry); - } - - @Override - public Iterator iterator() { - return getChildren().iterator(); - } - - @Override - public String toString() { - return getName() + ":" + getData(); - } - - public MapleDataEntity getParent() { - return parent; - } - - public void finish() { - ((ArrayList) children).trimToSize(); - } -} diff --git a/tools/SpiderDropFetcher/src/provider/wz/WZIMGFile.java b/tools/SpiderDropFetcher/src/provider/wz/WZIMGFile.java deleted file mode 100644 index bec06c78bd..0000000000 --- a/tools/SpiderDropFetcher/src/provider/wz/WZIMGFile.java +++ /dev/null @@ -1,227 +0,0 @@ -/* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 Patrick Huy - Matthias Butz - Jan Christian Meyer - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as - published by the Free Software Foundation version 3 as published by - the Free Software Foundation. You may not use, modify or distribute - this program under any other version of the GNU Affero General Public - License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . -*/ -package provider.wz; - -import java.awt.Point; -import java.io.DataOutputStream; -import java.io.File; -import java.io.IOException; -import java.io.OutputStream; -import java.io.RandomAccessFile; -import tools.data.input.GenericSeekableLittleEndianAccessor; -import tools.data.input.RandomAccessByteStream; -import tools.data.input.SeekableLittleEndianAccessor; - -public class WZIMGFile { - private WZFileEntry file; - private WZIMGEntry root; - private boolean provideImages; - @SuppressWarnings ("unused") - private boolean modernImg; - - public WZIMGFile(File wzfile, WZFileEntry file, boolean provideImages, boolean modernImg) throws IOException { - RandomAccessFile raf = new RandomAccessFile(wzfile, "r"); - SeekableLittleEndianAccessor slea = new GenericSeekableLittleEndianAccessor(new RandomAccessByteStream(raf)); - slea.seek(file.getOffset()); - this.file = file; - this.provideImages = provideImages; - root = new WZIMGEntry(file.getParent()); - root.setName(file.getName()); - root.setType(MapleDataType.EXTENDED); - this.modernImg = modernImg; - parseExtended(root, slea, 0); - root.finish(); - raf.close(); - } - - protected void dumpImg(OutputStream out, SeekableLittleEndianAccessor slea) throws IOException { - DataOutputStream os = new DataOutputStream(out); - long oldPos = slea.getPosition(); - slea.seek(file.getOffset()); - for (int x = 0; x < file.getSize(); x++) { - os.write(slea.readByte()); - } - slea.seek(oldPos); - } - - public WZIMGEntry getRoot() { - return root; - } - - private void parse(WZIMGEntry entry, SeekableLittleEndianAccessor slea) { - byte marker = slea.readByte(); - switch (marker) { - case 0: { - String name = WZTool.readDecodedString(slea); - entry.setName(name); - break; - } - case 1: { - String name = WZTool.readDecodedStringAtOffsetAndReset(slea, file.getOffset() + slea.readInt()); - entry.setName(name); - break; - } - default: - System.out.println("Unknown Image identifier: " + marker + " at offset " + (slea.getPosition() - file.getOffset())); - } - marker = slea.readByte(); - switch (marker) { - case 0: - entry.setType(MapleDataType.IMG_0x00); - break; - case 2: - case 11: //??? no idea, since 0.49 - entry.setType(MapleDataType.SHORT); - entry.setData(Short.valueOf(slea.readShort())); - break; - case 3: - entry.setType(MapleDataType.INT); - entry.setData(Integer.valueOf(WZTool.readValue(slea))); - break; - case 4: - entry.setType(MapleDataType.FLOAT); - entry.setData(Float.valueOf(WZTool.readFloatValue(slea))); - break; - case 5: - entry.setType(MapleDataType.DOUBLE); - entry.setData(Double.valueOf(slea.readDouble())); - break; - case 8: - entry.setType(MapleDataType.STRING); - byte iMarker = slea.readByte(); - if (iMarker == 0) { - entry.setData(WZTool.readDecodedString(slea)); - } else if (iMarker == 1) { - entry.setData(WZTool.readDecodedStringAtOffsetAndReset(slea, slea.readInt() + file.getOffset())); - } else { - System.out.println("Unknown String type " + iMarker); - } - break; - case 9: - entry.setType(MapleDataType.EXTENDED); - long endOfExtendedBlock = slea.readInt(); - endOfExtendedBlock += slea.getPosition(); - parseExtended(entry, slea, endOfExtendedBlock); - break; - default: - System.out.println("Unknown Image type " + marker); - } - } - - private void parseExtended(WZIMGEntry entry, SeekableLittleEndianAccessor slea, long endOfExtendedBlock) { - byte marker = slea.readByte(); - String type; - switch (marker) { - case 0x73: - type = WZTool.readDecodedString(slea); - break; - case 0x1B: - type = WZTool.readDecodedStringAtOffsetAndReset(slea, file.getOffset() + slea.readInt()); - break; - default: - throw new RuntimeException("Unknown extended image identifier: " + marker + " at offset " + - (slea.getPosition() - file.getOffset())); - } - if (type.equals("Property")) { - entry.setType(MapleDataType.PROPERTY); - slea.readByte(); - slea.readByte(); - int children = WZTool.readValue(slea); - for (int i = 0; i < children; i++) { - WZIMGEntry cEntry = new WZIMGEntry(entry); - parse(cEntry, slea); - cEntry.finish(); - entry.addChild(cEntry); - } - } else if (type.equals("Canvas")) { - entry.setType(MapleDataType.CANVAS); - slea.readByte(); - marker = slea.readByte(); - if (marker == 0) { - // do nothing - } else if (marker == 1) { - slea.readByte(); - slea.readByte(); - int children = WZTool.readValue(slea); - for (int i = 0; i < children; i++) { - WZIMGEntry child = new WZIMGEntry(entry); - parse(child, slea); - child.finish(); - entry.addChild(child); - } - } else { - System.out.println("Canvas marker != 1 (" + marker + ")"); - } - int width = WZTool.readValue(slea); - int height = WZTool.readValue(slea); - int format = WZTool.readValue(slea); - int format2 = slea.readByte(); - slea.readInt(); - int dataLength = slea.readInt() - 1; - slea.readByte(); - if (provideImages) { - byte[] pngdata = slea.read(dataLength); - entry.setData(new PNGMapleCanvas(width, height, dataLength, format + format2, pngdata)); - } else { - entry.setData(new PNGMapleCanvas(width, height, dataLength, format + format2, null)); - slea.skip(dataLength); - } - } else if (type.equals("Shape2D#Vector2D")) { - entry.setType(MapleDataType.VECTOR); - int x = WZTool.readValue(slea); - int y = WZTool.readValue(slea); - entry.setData(new Point(x, y)); - } else if (type.equals("Shape2D#Convex2D")) { - int children = WZTool.readValue(slea); - for (int i = 0; i < children; i++) { - WZIMGEntry cEntry = new WZIMGEntry(entry); - parseExtended(cEntry, slea, 0); - cEntry.finish(); - entry.addChild(cEntry); - } - } else if (type.equals("Sound_DX8")) { - entry.setType(MapleDataType.SOUND); - slea.readByte(); - int dataLength = WZTool.readValue(slea); - WZTool.readValue(slea); // no clue what this is - int offset = (int) slea.getPosition(); - entry.setData(new ImgMapleSound(dataLength, offset - file.getOffset())); - slea.seek(endOfExtendedBlock); - } else if (type.equals("UOL")) { - entry.setType(MapleDataType.UOL); - slea.readByte(); - byte uolmarker = slea.readByte(); - switch (uolmarker) { - case 0: - entry.setData(WZTool.readDecodedString(slea)); - break; - case 1: - entry.setData(WZTool.readDecodedStringAtOffsetAndReset(slea, file.getOffset() + slea.readInt())); - break; - default: - System.out.println("Unknown UOL marker: " + uolmarker + " " + entry.getName()); - } - } else { - throw new RuntimeException("Unhandled extended type: " + type); - } - } -} diff --git a/tools/SpiderDropFetcher/src/provider/wz/WZTool.java b/tools/SpiderDropFetcher/src/provider/wz/WZTool.java deleted file mode 100644 index 7f5452cd03..0000000000 --- a/tools/SpiderDropFetcher/src/provider/wz/WZTool.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 Patrick Huy - Matthias Butz - Jan Christian Meyer - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as - published by the Free Software Foundation version 3 as published by - the Free Software Foundation. You may not use, modify or distribute - this program under any other version of the GNU Affero General Public - License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . -*/ -package provider.wz; - -import tools.data.input.LittleEndianAccessor; -import tools.data.input.SeekableLittleEndianAccessor; - -import javax.crypto.BadPaddingException; -import javax.crypto.Cipher; -import javax.crypto.IllegalBlockSizeException; -import javax.crypto.NoSuchPaddingException; -import javax.crypto.spec.SecretKeySpec; -import java.security.InvalidKeyException; -import java.security.NoSuchAlgorithmException; - -/* - * Ported Code, see WZFile.java for more info - */ -public class WZTool { - private static byte[] encKey; - - static { - byte[] iv = new byte[]{(byte) 0x4d, (byte) 0x23, (byte) 0xc7, (byte) 0x2b, - (byte) 0x4d, (byte) 0x23, (byte) 0xc7, (byte) 0x2b, - (byte) 0x4d, (byte) 0x23, (byte) 0xc7, (byte) 0x2b, - (byte) 0x4d, (byte) 0x23, (byte) 0xc7, (byte) 0x2b,}; - byte[] key = new byte[]{(byte) 0x13, 0x00, 0x00, 0x00, - (byte) 0x08, 0x00, 0x00, 0x00, - (byte) 0x06, 0x00, 0x00, 0x00, - (byte) 0xB4, 0x00, 0x00, 0x00, - (byte) 0x1B, 0x00, 0x00, 0x00, - (byte) 0x0F, 0x00, 0x00, 0x00, - (byte) 0x33, 0x00, 0x00, 0x00, - (byte) 0x52, 0x00, 0x00, 0x00 - }; - Cipher cipher = null; - SecretKeySpec skeySpec = new SecretKeySpec(key, "AES"); - try { - cipher = Cipher.getInstance("AES"); - } catch (NoSuchAlgorithmException e) { - e.printStackTrace(); - } catch (NoSuchPaddingException e) { - e.printStackTrace(); - } - try { - cipher.init(Cipher.ENCRYPT_MODE, skeySpec); - } catch (InvalidKeyException e) { - e.printStackTrace(); - } - encKey = new byte[0xFFFF]; - for (int i = 0; i < (0xFFFF / 16); i++) { - try { - iv = cipher.doFinal(iv); - } catch (IllegalBlockSizeException e) { - e.printStackTrace(); - } catch (BadPaddingException e) { - e.printStackTrace(); - } - System.arraycopy(iv, 0, encKey, (i * 16), 16); - } - try { - iv = cipher.doFinal(iv); - } catch (IllegalBlockSizeException e) { - e.printStackTrace(); - } catch (BadPaddingException e) { - e.printStackTrace(); - } - System.arraycopy(iv, 0, encKey, 65520, 15); - } - - public static byte[] readListString(byte[] str) { - for (int i = 0; i < str.length; i++) { - str[i] = (byte) (str[i] ^ encKey[i]); - } - return str; - } - - public static String readDecodedString(LittleEndianAccessor llea) { - int strLength; - byte b = llea.readByte(); - if (b == 0x00) { - return ""; - } - if (b >= 0) { - if (b == 0x7F) { - strLength = llea.readInt(); - } else { - strLength = b; - } - if (strLength < 0) { - return ""; - } - byte str[] = new byte[strLength * 2]; - for (int i = 0; i < strLength * 2; i++) { - str[i] = llea.readByte(); - } - return DecryptUnicodeStr(str); - } else { - if (b == -128) { - strLength = llea.readInt(); - } else { - strLength = -b; - } - if (strLength < 0) { - return ""; - } - byte str[] = new byte[strLength]; - for (int i = 0; i < strLength; i++) { - str[i] = llea.readByte(); - } - return DecryptAsciiStr(str); - } - } - - public static String DecryptAsciiStr(byte[] str) { - byte xorByte = (byte) 0xAA; - for (int i = 0; i < str.length; i++) { - str[i] = (byte) (str[i] ^ xorByte ^ encKey[i]); - xorByte++; - } - return new String(str); - } - - public static String DecryptUnicodeStr(byte[] str) { - int xorByte = 0xAAAA; - char[] charRet = new char[str.length / 2]; - for (int i = 0; i < str.length; i++) { - str[i] = (byte) (str[i] ^ encKey[i]); - } - for (int i = 0; i < (str.length / 2); i++) { - char toXor = (char) ((str[i] << 8) | str[i + 1]); - charRet[i] = (char) (toXor ^ xorByte); - xorByte++; - } - return String.valueOf(charRet); - } - - public static String readDecodedStringAtOffset(SeekableLittleEndianAccessor slea, int offset) { - slea.seek(offset); - return readDecodedString(slea); - } - - public static String readDecodedStringAtOffsetAndReset(SeekableLittleEndianAccessor slea, int offset) { - long pos = 0; - pos = slea.getPosition(); - slea.seek(offset); - String ret = readDecodedString(slea); - slea.seek(pos); - return ret; - } - - public static int readValue(LittleEndianAccessor lea) { - byte b = lea.readByte(); - if (b == -128) { - return lea.readInt(); - } else { - return b; - } - } - - public static float readFloatValue(LittleEndianAccessor lea) { - byte b = lea.readByte(); - if (b == -128) { - return lea.readFloat(); - } else { - return 0; - } - } -} \ No newline at end of file diff --git a/tools/SpiderDropFetcher/src/provider/wz/XMLDomMapleData.java b/tools/SpiderDropFetcher/src/provider/wz/XMLDomMapleData.java deleted file mode 100644 index f8756a8696..0000000000 --- a/tools/SpiderDropFetcher/src/provider/wz/XMLDomMapleData.java +++ /dev/null @@ -1,225 +0,0 @@ -/* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 Patrick Huy - Matthias Butz - Jan Christian Meyer - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as - published by the Free Software Foundation version 3 as published by - the Free Software Foundation. You may not use, modify or distribute - this program under any other version of the GNU Affero General Public - License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . - */ -package provider.wz; - -import java.awt.Point; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.text.NumberFormat; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Locale; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import provider.MapleData; -import provider.MapleDataEntity; -import org.w3c.dom.Document; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.SAXException; - -public class XMLDomMapleData implements MapleData { - private Node node; - private File imageDataDir; - private final static NumberFormat nfParser = NumberFormat.getInstance(Locale.FRANCE); - - public XMLDomMapleData(FileInputStream fis, File imageDataDir) { - try { - DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); - DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); - Document document = documentBuilder.parse(fis); - this.node = document.getFirstChild(); - } catch (ParserConfigurationException e) { - throw new RuntimeException(e); - } catch (SAXException e) { - throw new RuntimeException(e); - } catch (IOException e) { - throw new RuntimeException(e); - } - this.imageDataDir = imageDataDir; - } - - private XMLDomMapleData(Node node) { - this.node = node; - } - - @Override - public synchronized MapleData getChildByPath(String path) { // the whole XML reading system seems susceptible to give nulls on strenuous read scenarios - String segments[] = path.split("/"); - if (segments[0].equals("..")) { - return ((MapleData) getParent()).getChildByPath(path.substring(path.indexOf("/") + 1)); - } - - Node myNode; - myNode = node; - for (String s : segments) { - NodeList childNodes = myNode.getChildNodes(); - boolean foundChild = false; - for (int i = 0; i < childNodes.getLength(); i++) { - Node childNode = childNodes.item(i); - if (childNode.getNodeType() == Node.ELEMENT_NODE && childNode.getAttributes().getNamedItem("name").getNodeValue().equals(s)) { - myNode = childNode; - foundChild = true; - break; - } - } - if (!foundChild) { - return null; - } - } - - XMLDomMapleData ret = new XMLDomMapleData(myNode); - ret.imageDataDir = new File(imageDataDir, getName() + "/" + path).getParentFile(); - return ret; - } - - @Override - public synchronized List getChildren() { - List ret = new ArrayList<>(); - - NodeList childNodes = node.getChildNodes(); - for (int i = 0; i < childNodes.getLength(); i++) { - Node childNode = childNodes.item(i); - if (childNode.getNodeType() == Node.ELEMENT_NODE) { - XMLDomMapleData child = new XMLDomMapleData(childNode); - child.imageDataDir = new File(imageDataDir, getName()); - ret.add(child); - } - } - - return ret; - } - - public synchronized static Number parseNumber(String value) { - try { - return nfParser.parse(value); - } catch(Exception e) { - e.printStackTrace(); - return 0.0f; - } - } - - @Override - public synchronized Object getData() { - NamedNodeMap attributes = node.getAttributes(); - MapleDataType type = getType(); - switch (type) { - case DOUBLE: - case FLOAT: - case INT: - case SHORT: { - String value = attributes.getNamedItem("value").getNodeValue(); - Number nval = parseNumber(value); - - switch (type) { - case DOUBLE: - return nval.doubleValue(); - case FLOAT: - return nval.floatValue(); - case INT: - return nval.intValue(); - case SHORT: - return nval.shortValue(); - default: - return null; - } - } - case STRING: - case UOL: { - String value = attributes.getNamedItem("value").getNodeValue(); - return value; - } - case VECTOR: { - String x = attributes.getNamedItem("x").getNodeValue(); - String y = attributes.getNamedItem("y").getNodeValue(); - return new Point(Integer.parseInt(x), Integer.parseInt(y)); - } - case CANVAS: { - String width = attributes.getNamedItem("width").getNodeValue(); - String height = attributes.getNamedItem("height").getNodeValue(); - return new FileStoredPngMapleCanvas(Integer.parseInt(width), Integer.parseInt(height), new File( - imageDataDir, getName() + ".png")); - } - default: - return null; - } - } - - @Override - public synchronized MapleDataType getType() { - String nodeName = node.getNodeName(); - - switch (nodeName) { - case "imgdir": - return MapleDataType.PROPERTY; - case "canvas": - return MapleDataType.CANVAS; - case "convex": - return MapleDataType.CONVEX; - case "sound": - return MapleDataType.SOUND; - case "uol": - return MapleDataType.UOL; - case "double": - return MapleDataType.DOUBLE; - case "float": - return MapleDataType.FLOAT; - case "int": - return MapleDataType.INT; - case "short": - return MapleDataType.SHORT; - case "string": - return MapleDataType.STRING; - case "vector": - return MapleDataType.VECTOR; - case "null": - return MapleDataType.IMG_0x00; - } - return null; - } - - @Override - public synchronized MapleDataEntity getParent() { - Node parentNode; - parentNode = node.getParentNode(); - if (parentNode.getNodeType() == Node.DOCUMENT_NODE) { - return null; - } - XMLDomMapleData parentData = new XMLDomMapleData(parentNode); - parentData.imageDataDir = imageDataDir.getParentFile(); - return parentData; - } - - @Override - public synchronized String getName() { - return node.getAttributes().getNamedItem("name").getNodeValue(); - } - - @Override - public synchronized Iterator iterator() { - return getChildren().iterator(); - } -} diff --git a/tools/SpiderDropFetcher/src/provider/wz/XMLWZFile.java b/tools/SpiderDropFetcher/src/provider/wz/XMLWZFile.java deleted file mode 100644 index 2a7694fdc9..0000000000 --- a/tools/SpiderDropFetcher/src/provider/wz/XMLWZFile.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 Patrick Huy - Matthias Butz - Jan Christian Meyer - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as - published by the Free Software Foundation version 3 as published by - the Free Software Foundation. You may not use, modify or distribute - this program under any other version of the GNU Affero General Public - License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . -*/ -package provider.wz; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import provider.MapleData; -import provider.MapleDataDirectoryEntry; -import provider.MapleDataProvider; - -public class XMLWZFile implements MapleDataProvider { - private File root; - private WZDirectoryEntry rootForNavigation; - - public XMLWZFile(File fileIn) { - root = fileIn; - rootForNavigation = new WZDirectoryEntry(fileIn.getName(), 0, 0, null); - fillMapleDataEntitys(root, rootForNavigation); - } - - private void fillMapleDataEntitys(File lroot, WZDirectoryEntry wzdir) { - for (File file : lroot.listFiles()) { - String fileName = file.getName(); - if (file.isDirectory() && !fileName.endsWith(".img")) { - WZDirectoryEntry newDir = new WZDirectoryEntry(fileName, 0, 0, wzdir); - wzdir.addDirectory(newDir); - fillMapleDataEntitys(file, newDir); - } else if (fileName.endsWith(".xml")) { - wzdir.addFile(new WZFileEntry(fileName.substring(0, fileName.length() - 4), 0, 0, wzdir)); - } - } - } - - @Override - public MapleData getData(String path) { - File dataFile = new File(root, path + ".xml"); - File imageDataDir = new File(root, path); - if (!dataFile.exists()) { - return null;//bitches - } - FileInputStream fis; - try { - fis = new FileInputStream(dataFile); - } catch (FileNotFoundException e) { - throw new RuntimeException("Datafile " + path + " does not exist in " + root.getAbsolutePath()); - } - final XMLDomMapleData domMapleData; - try { - domMapleData = new XMLDomMapleData(fis, imageDataDir.getParentFile()); - } finally { - try { - fis.close(); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - return domMapleData; - } - - @Override - public MapleDataDirectoryEntry getRoot() { - return rootForNavigation; - } -} diff --git a/tools/SpiderDropFetcher/src/server/MapleItemInformationProvider.java b/tools/SpiderDropFetcher/src/server/MapleItemInformationProvider.java deleted file mode 100644 index b215841610..0000000000 --- a/tools/SpiderDropFetcher/src/server/MapleItemInformationProvider.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 Patrick Huy - Matthias Butz - Jan Christian Meyer - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as - published by the Free Software Foundation version 3 as published by - the Free Software Foundation. You may not use, modify or distribute - this program under any other version of the GNU Affero General Public - License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . - */ -package server; - -import java.io.File; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import provider.MapleData; -import provider.MapleDataProvider; -import provider.MapleDataProviderFactory; -import provider.MapleDataTool; -import tools.Pair; - -/** - * - * @author Matze - * - */ -public class MapleItemInformationProvider { - private final static MapleItemInformationProvider instance = new MapleItemInformationProvider(); - - public static MapleItemInformationProvider getInstance() { - return instance; - } - - protected MapleDataProvider itemData; - protected MapleDataProvider equipData; - protected MapleDataProvider stringData; - protected MapleDataProvider etcData; - protected MapleData cashStringData; - protected MapleData consumeStringData; - protected MapleData eqpStringData; - protected MapleData etcStringData; - protected MapleData insStringData; - protected MapleData petStringData; - protected Map isQuestItemCache = new HashMap<>(); - protected Map isPartyQuestItemCache = new HashMap<>(); - protected List> itemNameCache = new ArrayList<>(); - - private MapleItemInformationProvider() { - itemData = MapleDataProviderFactory.getDataProvider(new File(System.getProperty("wzpath") + "/Item.wz")); - equipData = MapleDataProviderFactory.getDataProvider(new File(System.getProperty("wzpath") + "/Character.wz")); - stringData = MapleDataProviderFactory.getDataProvider(new File(System.getProperty("wzpath") + "/String.wz")); - etcData = MapleDataProviderFactory.getDataProvider(new File(System.getProperty("wzpath") + "/Etc.wz")); - cashStringData = stringData.getData("Cash.img"); - consumeStringData = stringData.getData("Consume.img"); - eqpStringData = stringData.getData("Eqp.img"); - etcStringData = stringData.getData("Etc.img"); - insStringData = stringData.getData("Ins.img"); - petStringData = stringData.getData("Pet.img"); - - isQuestItemCache.put(0, false); - isPartyQuestItemCache.put(0, false); - } - -// public MapleInventoryType getInventoryType(int itemId) { -// if (inventoryTypeCache.containsKey(itemId)) { -// return inventoryTypeCache.get(itemId); -// } -// MapleInventoryType ret; -// String idStr = "0" + String.valueOf(itemId); -// MapleDataDirectoryEntry root = itemData.getRoot(); -// for (MapleDataDirectoryEntry topDir : root.getSubdirectories()) { -// for (MapleDataFileEntry iFile : topDir.getFiles()) { -// if (iFile.getName().equals(idStr.substring(0, 4) + ".img")) { -// ret = MapleInventoryType.getByWZName(topDir.getName()); -// inventoryTypeCache.put(itemId, ret); -// return ret; -// } else if (iFile.getName().equals(idStr.substring(1) + ".img")) { -// ret = MapleInventoryType.getByWZName(topDir.getName()); -// inventoryTypeCache.put(itemId, ret); -// return ret; -// } -// } -// } -// root = equipData.getRoot(); -// for (MapleDataDirectoryEntry topDir : root.getSubdirectories()) { -// for (MapleDataFileEntry iFile : topDir.getFiles()) { -// if (iFile.getName().equals(idStr + ".img")) { -// ret = MapleInventoryType.EQUIP; -// inventoryTypeCache.put(itemId, ret); -// return ret; -// } -// } -// } -// ret = MapleInventoryType.UNDEFINED; -// inventoryTypeCache.put(itemId, ret); -// return ret; -// } - - public List> getAllItems() { - if (!itemNameCache.isEmpty()) { - return itemNameCache; - } - List> itemPairs = new ArrayList<>(); - MapleData itemsData; - itemsData = stringData.getData("Cash.img"); - for (MapleData itemFolder : itemsData.getChildren()) { - itemPairs.add(new Pair<>(Integer.parseInt(itemFolder.getName()), MapleDataTool.getString("name", itemFolder, "NO-NAME"))); - } - itemsData = stringData.getData("Consume.img"); - for (MapleData itemFolder : itemsData.getChildren()) { - itemPairs.add(new Pair<>(Integer.parseInt(itemFolder.getName()), MapleDataTool.getString("name", itemFolder, "NO-NAME"))); - } - itemsData = stringData.getData("Eqp.img").getChildByPath("Eqp"); - for (MapleData eqpType : itemsData.getChildren()) { - for (MapleData itemFolder : eqpType.getChildren()) { - itemPairs.add(new Pair<>(Integer.parseInt(itemFolder.getName()), MapleDataTool.getString("name", itemFolder, "NO-NAME"))); - } - } - itemsData = stringData.getData("Etc.img").getChildByPath("Etc"); - for (MapleData itemFolder : itemsData.getChildren()) { - itemPairs.add(new Pair<>(Integer.parseInt(itemFolder.getName()), MapleDataTool.getString("name", itemFolder, "NO-NAME"))); - } - itemsData = stringData.getData("Ins.img"); - for (MapleData itemFolder : itemsData.getChildren()) { - itemPairs.add(new Pair<>(Integer.parseInt(itemFolder.getName()), MapleDataTool.getString("name", itemFolder, "NO-NAME"))); - } - itemsData = stringData.getData("Pet.img"); - for (MapleData itemFolder : itemsData.getChildren()) { - itemPairs.add(new Pair<>(Integer.parseInt(itemFolder.getName()), MapleDataTool.getString("name", itemFolder, "NO-NAME"))); - } - return itemPairs; - } -} diff --git a/tools/SpiderDropFetcher/src/tools/HexTool.java b/tools/SpiderDropFetcher/src/tools/HexTool.java deleted file mode 100644 index 428baf3115..0000000000 --- a/tools/SpiderDropFetcher/src/tools/HexTool.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 Patrick Huy - Matthias Butz - Jan Christian Meyer - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as - published by the Free Software Foundation version 3 as published by - the Free Software Foundation. You may not use, modify or distribute - this program under any other version of the GNU Affero General Public - License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . -*/ -package tools; - -import java.io.ByteArrayOutputStream; - -public class HexTool { - private static final char[] HEX = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; - - private static String toString(byte byteValue) { - int tmp = byteValue << 8; - char[] retstr = new char[]{HEX[(tmp >> 12) & 0x0F], HEX[(tmp >> 8) & 0x0F]}; - return String.valueOf(retstr); - } - - public static String toString(byte[] bytes) { - StringBuilder hexed = new StringBuilder(); - for (int i = 0; i < bytes.length; i++) { - hexed.append(toString(bytes[i])); - hexed.append(' '); - } - return hexed.substring(0, hexed.length() - 1); - } - - public static String toCompressedString(byte[] bytes) { - StringBuilder hexed = new StringBuilder(); - for (int i = 0; i < bytes.length; i++) { - hexed.append(toString(bytes[i])); - } - return hexed.substring(0, hexed.length()); - } - - public static byte[] getByteArrayFromHexString(String hex) { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int nexti = 0; - int nextb = 0; - boolean highoc = true; - outer: - for (;;) { - int number = -1; - while (number == -1) { - if (nexti == hex.length()) { - break outer; - } - char chr = hex.charAt(nexti); - if (chr >= '0' && chr <= '9') { - number = chr - '0'; - } else if (chr >= 'a' && chr <= 'f') { - number = chr - 'a' + 10; - } else if (chr >= 'A' && chr <= 'F') { - number = chr - 'A' + 10; - } else { - number = -1; - } - nexti++; - } - if (highoc) { - nextb = number << 4; - highoc = false; - } else { - nextb |= number; - highoc = true; - baos.write(nextb); - } - } - return baos.toByteArray(); - } -} diff --git a/tools/SpiderDropFetcher/src/tools/Pair.java b/tools/SpiderDropFetcher/src/tools/Pair.java deleted file mode 100644 index e784f3d397..0000000000 --- a/tools/SpiderDropFetcher/src/tools/Pair.java +++ /dev/null @@ -1,123 +0,0 @@ -package tools; - -/* -This file is part of the OdinMS Maple Story Server -Copyright (C) 2008 ~ 2010 Patrick Huy -Matthias Butz -Jan Christian Meyer - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License version 3 -as published by the Free Software Foundation. You may not use, modify -or distribute this program under any other version of the -GNU Affero General Public License. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see . - */ - - -/** - * Represents a pair of values. - * - * @author Frz - * @since Revision 333 - * @version 1.0 - * - * @param The type of the left value. - * @param The type of the right value. - */ -public class Pair { - - public E left; - public F right; - - /** - * Class constructor - pairs two objects together. - * - * @param left The left object. - * @param right The right object. - */ - public Pair(E left, F right) { - this.left = left; - this.right = right; - } - - /** - * Gets the left value. - * - * @return The left value. - */ - public E getLeft() { - return left; - } - - /** - * Gets the right value. - * - * @return The right value. - */ - public F getRight() { - return right; - } - - /** - * Turns the pair into a string. - * - * @return Each value of the pair as a string joined with a colon. - */ - @Override - public String toString() { - return left.toString() + ":" + right.toString(); - } - - /** - * Gets the hash code of this pair. - */ - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((left == null) ? 0 : left.hashCode()); - result = prime * result + ((right == null) ? 0 : right.hashCode()); - return result; - } - - /** - * Checks to see if two pairs are equal. - */ - @SuppressWarnings("unchecked") - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final Pair other = (Pair) obj; - if (left == null) { - if (other.left != null) { - return false; - } - } else if (!left.equals(other.left)) { - return false; - } - if (right == null) { - if (other.right != null) { - return false; - } - } else if (!right.equals(other.right)) { - return false; - } - return true; - } -} \ No newline at end of file diff --git a/tools/SpiderDropFetcher/src/tools/data/input/ByteArrayByteStream.java b/tools/SpiderDropFetcher/src/tools/data/input/ByteArrayByteStream.java deleted file mode 100644 index eac7de21ea..0000000000 --- a/tools/SpiderDropFetcher/src/tools/data/input/ByteArrayByteStream.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 Patrick Huy - Matthias Butz - Jan Christian Meyer - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as - published by the Free Software Foundation version 3 as published by - the Free Software Foundation. You may not use, modify or distribute - this program under any other version of the GNU Affero General Public - License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . -*/ -package tools.data.input; - -import java.io.IOException; -import tools.HexTool; - -public class ByteArrayByteStream implements SeekableInputStreamBytestream { - private int pos = 0; - private long bytesRead = 0; - private byte[] arr; - - public ByteArrayByteStream(byte[] arr) { - this.arr = arr; - } - - @Override - public long getPosition() { - return pos; - } - - @Override - public void seek(long offset) throws IOException { - pos = (int) offset; - } - - @Override - public long getBytesRead() { - return bytesRead; - } - - @Override - public int readByte() { - bytesRead++; - return ((int) arr[pos++]) & 0xFF; - } - - @Override - public String toString() { - String nows = "kevintjuh93 pwns";//I lol'd - if (arr.length - pos > 0) { - byte[] now = new byte[arr.length - pos]; - System.arraycopy(arr, pos, now, 0, arr.length - pos); - nows = HexTool.toString(now); - } - return "All: " + HexTool.toString(arr) + "\nNow: " + nows; - } - - @Override - public long available() { - return arr.length - pos; - } -} diff --git a/tools/SpiderDropFetcher/src/tools/data/input/ByteInputStream.java b/tools/SpiderDropFetcher/src/tools/data/input/ByteInputStream.java deleted file mode 100644 index 107f71843e..0000000000 --- a/tools/SpiderDropFetcher/src/tools/data/input/ByteInputStream.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 Patrick Huy - Matthias Butz - Jan Christian Meyer - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as - published by the Free Software Foundation version 3 as published by - the Free Software Foundation. You may not use, modify or distribute - this program under any other version of the GNU Affero General Public - License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . -*/ -package tools.data.input; - -/** - * Represents an abstract stream of bytes. - * - * @author Frz - * @version 1.0 - * @since Revision 323 - */ -public interface ByteInputStream { - int readByte(); - long getBytesRead(); - long available(); -} diff --git a/tools/SpiderDropFetcher/src/tools/data/input/GenericLittleEndianAccessor.java b/tools/SpiderDropFetcher/src/tools/data/input/GenericLittleEndianAccessor.java deleted file mode 100644 index d08a9b8374..0000000000 --- a/tools/SpiderDropFetcher/src/tools/data/input/GenericLittleEndianAccessor.java +++ /dev/null @@ -1,239 +0,0 @@ -/* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 Patrick Huy - Matthias Butz - Jan Christian Meyer - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as - published by the Free Software Foundation version 3 as published by - the Free Software Foundation. You may not use, modify or distribute - this program under any other version of the GNU Affero General Public - License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . -*/ -package tools.data.input; - -import java.awt.Point; -import java.io.ByteArrayOutputStream; - -/** - * Provides a generic interface to a Little Endian stream of bytes. - * - * @version 1.0 - * @author Frz - * @since Revision 323 - */ -public class GenericLittleEndianAccessor implements LittleEndianAccessor { - private ByteInputStream bs; - - /** - * Class constructor - Wraps the accessor around a stream of bytes. - * - * @param bs The byte stream to wrap the accessor around. - */ - public GenericLittleEndianAccessor(ByteInputStream bs) { - this.bs = bs; - } - - /** - * Read a single byte from the stream. - * - * @return The byte read. - * @see tools.data.input.ByteInputStream#readByte - */ - @Override - public byte readByte() { - return (byte) bs.readByte(); - } - - /** - * Reads an integer from the stream. - * - * @return The integer read. - */ - @Override - public int readInt() { - return bs.readByte() + (bs.readByte() << 8) + (bs.readByte() << 16) + (bs.readByte() << 24); - } - - /** - * Reads a short integer from the stream. - * - * @return The short read. - */ - @Override - public short readShort() { - return (short) (bs.readByte() + (bs.readByte() << 8)); - } - - /** - * Reads a single character from the stream. - * - * @return The character read. - */ - @Override - public char readChar() { - return (char) readShort(); - } - - /** - * Reads a long integer from the stream. - * - * @return The long integer read. - */ - @Override - public long readLong() { - long byte1 = bs.readByte(); - long byte2 = bs.readByte(); - long byte3 = bs.readByte(); - long byte4 = bs.readByte(); - long byte5 = bs.readByte(); - long byte6 = bs.readByte(); - long byte7 = bs.readByte(); - long byte8 = bs.readByte(); - return (byte8 << 56) + (byte7 << 48) + (byte6 << 40) + (byte5 << 32) + (byte4 << 24) + (byte3 << 16) + (byte2 << 8) + byte1; - } - - /** - * Reads a floating point integer from the stream. - * - * @return The float-type integer read. - */ - @Override - public float readFloat() { - return Float.intBitsToFloat(readInt()); - } - - /** - * Reads a double-precision integer from the stream. - * - * @return The double-type integer read. - */ - @Override - public double readDouble() { - return Double.longBitsToDouble(readLong()); - } - - /** - * Reads an ASCII string from the stream with length n. - * - * @param n Number of characters to read. - * @return The string read. - */ - public final String readAsciiString(int n) { - char ret[] = new char[n]; - for (int x = 0; x < n; x++) { - ret[x] = (char) readByte(); - } - return String.valueOf(ret); - } - - /** - * Reads a null-terminated string from the stream. - * - * @return The string read. - */ - public final String readNullTerminatedAsciiString() { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - byte b; - while (true) { - b = readByte(); - if (b == 0) { - break; - } - baos.write(b); - } - byte[] buf = baos.toByteArray(); - char[] chrBuf = new char[buf.length]; - for (int x = 0; x < buf.length; x++) { - chrBuf[x] = (char) buf[x]; - } - return String.valueOf(chrBuf); - } - - /** - * Gets the number of bytes read from the stream so far. - * - * @return A long integer representing the number of bytes read. - * @see tools.data.input.ByteInputStream#getBytesRead() - */ - public long getBytesRead() { - return bs.getBytesRead(); - } - - /** - * Reads a MapleStory convention lengthed ASCII string. - * This consists of a short integer telling the length of the string, - * then the string itself. - * - * @return The string read. - */ - @Override - public String readMapleAsciiString() { - return readAsciiString(readShort()); - } - - /** - * Reads num bytes off the stream. - * - * @param num The number of bytes to read. - * @return An array of bytes with the length of num - */ - @Override - public byte[] read(int num) { - byte[] ret = new byte[num]; - for (int x = 0; x < num; x++) { - ret[x] = readByte(); - } - return ret; - } - - /** - * Reads a MapleStory Position information. - * This consists of 2 short integer. - * - * @return The Position read. - */ - @Override - public final Point readPos() { - final int x = readShort(); - final int y = readShort(); - return new Point(x, y); - } - - /** - * Skips the current position of the stream num bytes ahead. - * - * @param num Number of bytes to skip. - */ - @Override - public void skip(int num) { - for (int x = 0; x < num; x++) { - readByte(); - } - } - - /** - * @see tools.data.input.ByteInputStream#available - */ - @Override - public long available() { - return bs.available(); - } - - /** - * @see java.lang.Object#toString - */ - @Override - public String toString() { - return bs.toString(); - } -} \ No newline at end of file diff --git a/tools/SpiderDropFetcher/src/tools/data/input/GenericSeekableLittleEndianAccessor.java b/tools/SpiderDropFetcher/src/tools/data/input/GenericSeekableLittleEndianAccessor.java deleted file mode 100644 index fdd147d796..0000000000 --- a/tools/SpiderDropFetcher/src/tools/data/input/GenericSeekableLittleEndianAccessor.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 Patrick Huy - Matthias Butz - Jan Christian Meyer - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as - published by the Free Software Foundation version 3 as published by - the Free Software Foundation. You may not use, modify or distribute - this program under any other version of the GNU Affero General Public - License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . -*/ -package tools.data.input; - -import java.io.IOException; - -/** - * Provides an abstract accessor to a generic Little Endian byte stream. This - * accessor is seekable. - * - * @author Frz - * @version 1.0 - * @since Revision 323 - * @see tools.data.input.GenericLittleEndianAccessor - */ -public class GenericSeekableLittleEndianAccessor extends GenericLittleEndianAccessor implements SeekableLittleEndianAccessor { - private SeekableInputStreamBytestream bs; - - /** - * Class constructor - * Provide a seekable input stream to wrap this object around. - * - * @param bs The byte stream to wrap this around. - */ - public GenericSeekableLittleEndianAccessor(SeekableInputStreamBytestream bs) { - super(bs); - this.bs = bs; - } - - /** - * Seek the pointer to offset - * - * @param offset The offset to seek to. - * @see tools.data.input.SeekableInputStreamBytestream#seek - */ - @Override - public void seek(long offset) { - try { - bs.seek(offset); - } catch (IOException e) { - e.printStackTrace(); - System.out.println("Seek failed " + e); - } - } - - /** - * Get the current position of the pointer. - * - * @return The current position of the pointer as a long integer. - * @see tools.data.input.SeekableInputStreamBytestream#getPosition - */ - @Override - public long getPosition() { - try { - return bs.getPosition(); - } catch (IOException e) { - e.printStackTrace(); - System.out.println("getPosition failed" + e); - return -1; - } - } - - /** - * Skip num number of bytes in the stream. - * - * @param num The number of bytes to skip. - */ - @Override - public void skip(int num) { - seek(getPosition() + num); - } -} diff --git a/tools/SpiderDropFetcher/src/tools/data/input/InputStreamByteStream.java b/tools/SpiderDropFetcher/src/tools/data/input/InputStreamByteStream.java deleted file mode 100644 index 70aef3489f..0000000000 --- a/tools/SpiderDropFetcher/src/tools/data/input/InputStreamByteStream.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 Patrick Huy - Matthias Butz - Jan Christian Meyer - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as - published by the Free Software Foundation version 3 as published by - the Free Software Foundation. You may not use, modify or distribute - this program under any other version of the GNU Affero General Public - License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . -*/ -package tools.data.input; - -import java.io.IOException; -import java.io.InputStream; - -/** - * Provides an abstract wrapper to a stream of bytes. - * - * @author Frz - * @version 1.0 - * @since Revision 323 - */ -public class InputStreamByteStream implements ByteInputStream { - private InputStream is; - private long read = 0; - - /** - * Class constructor. - * Provide an input stream to wrap this around. - * - * @param is The input stream to wrap this object around. - */ - public InputStreamByteStream(InputStream is) { - this.is = is; - } - - /** - * Reads the next byte from the stream. - * - * @return Then next byte in the stream. - */ - @Override - public int readByte() { - int temp; - try { - temp = is.read(); - if (temp == -1) { - throw new RuntimeException("EOF"); - } - read++; - return temp; - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * Gets the number of bytes read from the stream. - * - * @return The number of bytes read as a long integer. - */ - @Override - public long getBytesRead() { - return read; - } - - /** - * Returns the number of bytes left in the stream. - * - * @return The number of bytes available for reading as a long integer. - */ - @Override - public long available() { - try { - return is.available(); - } catch (IOException e) { - e.printStackTrace(); - System.out.println("ERROR" + e); - return 0; - } - } -} diff --git a/tools/SpiderDropFetcher/src/tools/data/input/LittleEndianAccessor.java b/tools/SpiderDropFetcher/src/tools/data/input/LittleEndianAccessor.java deleted file mode 100644 index f991dbf537..0000000000 --- a/tools/SpiderDropFetcher/src/tools/data/input/LittleEndianAccessor.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 Patrick Huy - Matthias Butz - Jan Christian Meyer - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as - published by the Free Software Foundation version 3 as published by - the Free Software Foundation. You may not use, modify or distribute - this program under any other version of the GNU Affero General Public - License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . -*/ -package tools.data.input; - -import java.awt.Point; - -/** - * @author Frz - */ -public interface LittleEndianAccessor { - byte readByte(); - char readChar(); - short readShort(); - int readInt(); - Point readPos(); - long readLong(); - void skip(int num); - byte[] read(int num); - float readFloat(); - double readDouble(); - String readAsciiString(int n); - String readNullTerminatedAsciiString(); - String readMapleAsciiString(); - long getBytesRead(); - long available(); -} diff --git a/tools/SpiderDropFetcher/src/tools/data/input/RandomAccessByteStream.java b/tools/SpiderDropFetcher/src/tools/data/input/RandomAccessByteStream.java deleted file mode 100644 index c0004be17f..0000000000 --- a/tools/SpiderDropFetcher/src/tools/data/input/RandomAccessByteStream.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 Patrick Huy - Matthias Butz - Jan Christian Meyer - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as - published by the Free Software Foundation version 3 as published by - the Free Software Foundation. You may not use, modify or distribute - this program under any other version of the GNU Affero General Public - License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . -*/ -package tools.data.input; - -import java.io.IOException; -import java.io.RandomAccessFile; - -/** - * Provides an abstract layer to a byte stream. This layer can be accessed - * randomly. - * - * @author Frz - * @version 1.0 - * @since Revision 323 - */ -public class RandomAccessByteStream implements SeekableInputStreamBytestream { - private RandomAccessFile raf; - private long read = 0; - - public RandomAccessByteStream(RandomAccessFile raf) { - super(); - this.raf = raf; - } - - @Override - public int readByte() { - int temp; - try { - temp = raf.read(); - if (temp == -1) { - throw new RuntimeException("EOF"); - } - read++; - return temp; - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - @Override - public void seek(long offset) throws IOException { - raf.seek(offset); - } - - @Override - public long getPosition() throws IOException { - return raf.getFilePointer(); - } - - @Override - public long getBytesRead() { - return read; - } - - @Override - public long available() { - try { - return raf.length() - raf.getFilePointer(); - } catch (IOException e) { - e.printStackTrace(); - System.out.println("ERROR " + e); - return 0; - } - } -} diff --git a/tools/SpiderDropFetcher/src/tools/data/input/SeekableInputStreamBytestream.java b/tools/SpiderDropFetcher/src/tools/data/input/SeekableInputStreamBytestream.java deleted file mode 100644 index f4922dc876..0000000000 --- a/tools/SpiderDropFetcher/src/tools/data/input/SeekableInputStreamBytestream.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 Patrick Huy - Matthias Butz - Jan Christian Meyer - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as - published by the Free Software Foundation version 3 as published by - the Free Software Foundation. You may not use, modify or distribute - this program under any other version of the GNU Affero General Public - License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . -*/ -package tools.data.input; - -import java.io.IOException; - -/** - * Provides an abstract interface to a stream of bytes. This stream can be - * seeked. - * - * @author Frz - * @version 1.0 - * @since 299 - */ -public interface SeekableInputStreamBytestream extends ByteInputStream { - /** - * Seeks the stream by the specified offset. - * - * @param offset - * Number of bytes to seek. - * @throws IOException - */ - void seek(long offset) throws IOException; - - /** - * Gets the current position of the stream. - * - * @return The stream position as a long integer. - * @throws IOException - */ - long getPosition() throws IOException; -} diff --git a/tools/SpiderDropFetcher/src/tools/data/input/SeekableLittleEndianAccessor.java b/tools/SpiderDropFetcher/src/tools/data/input/SeekableLittleEndianAccessor.java deleted file mode 100644 index 16b2317f7a..0000000000 --- a/tools/SpiderDropFetcher/src/tools/data/input/SeekableLittleEndianAccessor.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 Patrick Huy - Matthias Butz - Jan Christian Meyer - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as - published by the Free Software Foundation version 3 as published by - the Free Software Foundation. You may not use, modify or distribute - this program under any other version of the GNU Affero General Public - License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . -*/ -package tools.data.input; - -public interface SeekableLittleEndianAccessor extends LittleEndianAccessor { - void seek(long offset); - long getPosition(); -} diff --git a/tools/SpiderDropFetcher/src/tools/data/output/BAOSByteOutputStream.java b/tools/SpiderDropFetcher/src/tools/data/output/BAOSByteOutputStream.java deleted file mode 100644 index 80cbc9301e..0000000000 --- a/tools/SpiderDropFetcher/src/tools/data/output/BAOSByteOutputStream.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 Patrick Huy - Matthias Butz - Jan Christian Meyer - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as - published by the Free Software Foundation version 3 as published by - the Free Software Foundation. You may not use, modify or distribute - this program under any other version of the GNU Affero General Public - License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . -*/ -package tools.data.output; - -import java.io.ByteArrayOutputStream; - -/** - * Uses a byte array to output a stream of bytes. - * - * @author Frz - * @version 1.0 - * @since Revision 352 - */ -class BAOSByteOutputStream implements ByteOutputStream { - private ByteArrayOutputStream baos; - - /** - * Class constructor - Wraps the stream around a Java BAOS. - * - * @param baos The ByteArrayOutputStream to wrap this around. - */ - BAOSByteOutputStream(ByteArrayOutputStream baos) { - super(); - this.baos = baos; - } - - /** - * Writes a byte to the stream. - * - * @param b The byte to write to the stream. - * @see tools.data.output.ByteOutputStream#writeByte(byte) - */ - @Override - public void writeByte(byte b) { - baos.write(b); - } -} diff --git a/tools/SpiderDropFetcher/src/tools/data/output/ByteOutputStream.java b/tools/SpiderDropFetcher/src/tools/data/output/ByteOutputStream.java deleted file mode 100644 index 0df7ca7753..0000000000 --- a/tools/SpiderDropFetcher/src/tools/data/output/ByteOutputStream.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 Patrick Huy - Matthias Butz - Jan Christian Meyer - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as - published by the Free Software Foundation version 3 as published by - the Free Software Foundation. You may not use, modify or distribute - this program under any other version of the GNU Affero General Public - License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . -*/ -package tools.data.output; - -/** - * Provides an interface to an output stream of bytes. - * - * @author Frz - * @since Revision 323 - * @version 1.0 - */ -interface ByteOutputStream { - /** - * Writes a byte to the stream. - * - * @param b The byte to write. - */ - void writeByte(byte b); -} diff --git a/tools/SpiderDropFetcher/src/tools/data/output/GenericLittleEndianWriter.java b/tools/SpiderDropFetcher/src/tools/data/output/GenericLittleEndianWriter.java deleted file mode 100644 index 91779e4d57..0000000000 --- a/tools/SpiderDropFetcher/src/tools/data/output/GenericLittleEndianWriter.java +++ /dev/null @@ -1,184 +0,0 @@ -/* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 Patrick Huy - Matthias Butz - Jan Christian Meyer - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as - published by the Free Software Foundation version 3 as published by - the Free Software Foundation. You may not use, modify or distribute - this program under any other version of the GNU Affero General Public - License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . -*/ -package tools.data.output; - -import java.awt.Point; -import java.nio.charset.Charset; -import constants.CharsetConstants.MapleLanguageType; - -/** - * Provides a generic writer of a little-endian sequence of bytes. - * - * @author Frz - * @version 1.0 - * @since Revision 323 - */ -public class GenericLittleEndianWriter implements LittleEndianWriter { - private static Charset ASCII = Charset.forName(MapleLanguageType.LANGUAGE_US.getAscii()); - private ByteOutputStream bos; - - /** - * Class constructor - Protected to prevent instantiation with no arguments. - */ - protected GenericLittleEndianWriter() { - // Blah! - } - - /** - * Sets the byte-output stream for this instance of the object. - * - * @param bos The new output stream to set. - */ - void setByteOutputStream(ByteOutputStream bos) { - this.bos = bos; - } - - /** - * Write an array of bytes to the stream. - * - * @param b The bytes to write. - */ - @Override - public void write(byte[] b) { - for (int x = 0; x < b.length; x++) { - bos.writeByte(b[x]); - } - } - - /** - * Write a byte to the stream. - * - * @param b The byte to write. - */ - @Override - public void write(byte b) { - bos.writeByte(b); - } - - /** - * Write a byte in integer form to the stream. - * - * @param b The byte as an Integer to write. - */ - @Override - public void write(int b) { - bos.writeByte((byte) b); - } - - @Override - public void skip(int b) { - write(new byte[b]); - } - - /** - * Write a short integer to the stream. - * - * @param i The short integer to write. - */ - @Override - public void writeShort(int i) { - bos.writeByte((byte) (i & 0xFF)); - bos.writeByte((byte) ((i >>> 8) & 0xFF)); - } - - /** - * Writes an integer to the stream. - * - * @param i The integer to write. - */ - @Override - public void writeInt(int i) { - bos.writeByte((byte) (i & 0xFF)); - bos.writeByte((byte) ((i >>> 8) & 0xFF)); - bos.writeByte((byte) ((i >>> 16) & 0xFF)); - bos.writeByte((byte) ((i >>> 24) & 0xFF)); - } - - /** - * Writes an ASCII string the the stream. - * - * @param s The ASCII string to write. - */ - @Override - public void writeAsciiString(String s) { - write(s.getBytes(ASCII)); - } - - /** - * Writes a maple-convention ASCII string to the stream. - * - * @param s The ASCII string to use maple-convention to write. - */ - @Override - public void writeMapleAsciiString(String s) { - writeShort((short) s.length()); - writeAsciiString(s); - } - - /** - * Writes a null-terminated ASCII string to the stream. - * - * @param s The ASCII string to write. - */ - @Override - public void writeNullTerminatedAsciiString(String s) { - writeAsciiString(s); - write(0); - } - - /** - * Write a long integer to the stream. - * @param l The long integer to write. - */ - @Override - public void writeLong(long l) { - bos.writeByte((byte) (l & 0xFF)); - bos.writeByte((byte) ((l >>> 8) & 0xFF)); - bos.writeByte((byte) ((l >>> 16) & 0xFF)); - bos.writeByte((byte) ((l >>> 24) & 0xFF)); - bos.writeByte((byte) ((l >>> 32) & 0xFF)); - bos.writeByte((byte) ((l >>> 40) & 0xFF)); - bos.writeByte((byte) ((l >>> 48) & 0xFF)); - bos.writeByte((byte) ((l >>> 56) & 0xFF)); - } - - /** - * Writes a 2D 4 byte position information - * - * @param s The Point position to write. - */ - @Override - public void writePos(Point s) { - writeShort(s.x); - writeShort(s.y); - } - - /** - * Writes a boolean true ? 1 : 0 - * - * @param b The boolean to write. - */ - @Override - public void writeBool(final boolean b) { - write(b ? 1 : 0); - } -} diff --git a/tools/SpiderDropFetcher/src/tools/data/output/LittleEndianWriter.java b/tools/SpiderDropFetcher/src/tools/data/output/LittleEndianWriter.java deleted file mode 100644 index f17bd7c72e..0000000000 --- a/tools/SpiderDropFetcher/src/tools/data/output/LittleEndianWriter.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 Patrick Huy - Matthias Butz - Jan Christian Meyer - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as - published by the Free Software Foundation version 3 as published by - the Free Software Foundation. You may not use, modify or distribute - this program under any other version of the GNU Affero General Public - License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . - */ -package tools.data.output; - -import java.awt.Point; - -/** - * Provides an interface to a writer class that writes a little-endian sequence - * of bytes. - * - * @author Frz - * @version 1.0 - * @since Revision 323 - */ -public interface LittleEndianWriter { - - /** - * Write an array of bytes to the sequence. - * - * @param b The bytes to write. - */ - public void write(byte b[]); - - /** - * Write a byte to the sequence. - * - * @param b The byte to write. - */ - public void write(byte b); - - /** - * Write a byte in integer form to the sequence. - * - * @param b The byte as an Integer to write. - */ - public void write(int b); - - public void skip(int b); - - /** - * Writes an integer to the sequence. - * - * @param i The integer to write. - */ - public void writeInt(int i); - - /** - * Write a short integer to the sequence. - * - * @param s The short integer to write. - */ - public void writeShort(int s); - - /** - * Write a long integer to the sequence. - * - * @param l The long integer to write. - */ - public void writeLong(long l); - - /** - * Writes an ASCII string the the sequence. - * - * @param s The ASCII string to write. - */ - void writeAsciiString(String s); - - /** - * Writes a null-terminated ASCII string to the sequence. - * - * @param s The ASCII string to write. - */ - void writeNullTerminatedAsciiString(String s); - - /** - * Writes a maple-convention ASCII string to the sequence. - * - * @param s The ASCII string to use maple-convention to write. - */ - void writeMapleAsciiString(String s); - - /** - * Writes a 2D 4 byte position information - * - * @param s The Point position to write. - */ - void writePos(Point s); - - /** - * Writes a boolean true ? 1 : 0 - * - * @param b The boolean to write. - */ - void writeBool(final boolean b); -} diff --git a/tools/SpiderDropFetcher/src/tools/data/output/MaplePacketLittleEndianWriter.java b/tools/SpiderDropFetcher/src/tools/data/output/MaplePacketLittleEndianWriter.java deleted file mode 100644 index b02365ec62..0000000000 --- a/tools/SpiderDropFetcher/src/tools/data/output/MaplePacketLittleEndianWriter.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - This file is part of the OdinMS Maple Story Server - Copyright (C) 2008 Patrick Huy - Matthias Butz - Jan Christian Meyer - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as - published by the Free Software Foundation version 3 as published by - the Free Software Foundation. You may not use, modify or distribute - this program under any other version of the GNU Affero General Public - License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . -*/ -package tools.data.output; - -import java.io.ByteArrayOutputStream; -import tools.HexTool; - -/** - * Writes a maplestory-packet little-endian stream of bytes. - * - * @author Frz - * @version 1.0 - * @since Revision 352 - */ -public class MaplePacketLittleEndianWriter extends GenericLittleEndianWriter { - private ByteArrayOutputStream baos; - - /** - * Constructor - initializes this stream with a default size. - */ - public MaplePacketLittleEndianWriter() { - this(32); - } - - /** - * Constructor - initializes this stream with size size. - * - * @param size The size of the underlying stream. - */ - public MaplePacketLittleEndianWriter(int size) { - this.baos = new ByteArrayOutputStream(size); - setByteOutputStream(new BAOSByteOutputStream(baos)); - } - - /** - * Gets a MaplePacket instance representing this - * sequence of bytes. - * - * @return A MaplePacket with the bytes in this stream. - */ - public byte[] getPacket() { - return baos.toByteArray(); - } - - /** - * Changes this packet into a human-readable hexadecimal stream of bytes. - * - * @return This packet as hex digits. - */ - @Override - public String toString() { - return HexTool.toString(baos.toByteArray()); - } -} diff --git a/tools/spider.bat b/tools/spider.bat deleted file mode 100644 index 755525fd7b..0000000000 --- a/tools/spider.bat +++ /dev/null @@ -1,5 +0,0 @@ -@echo off -@title Drop Spider -set CLASSPATH=.;dist\* -java -server -Dwzpath=wz\ dropspider.Main -pause \ No newline at end of file