Search in sources :

Example 66 with MapleData

use of provider.MapleData in project HeavenMS by ronancpl.

the class DataTool method populateBossList.

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);
        }
    }
}
Also used : MapleData(provider.MapleData) MapleDataDirectoryEntry(provider.MapleDataDirectoryEntry) MapleDataFileEntry(provider.MapleDataFileEntry)

Example 67 with MapleData

use of provider.MapleData in project HeavenMS by ronancpl.

the class MapleMapFactory method loadLife.

private AbstractLoadedMapleLife loadLife(MapleData life, String id, String type) {
    AbstractLoadedMapleLife myLife = MapleLifeFactory.getLife(Integer.parseInt(id), type);
    if (life == null)
        System.out.println("lf null");
    if (myLife == null)
        System.out.println("mlf null");
    myLife.setCy(MapleDataTool.getInt(life.getChildByPath("cy")));
    MapleData dF = life.getChildByPath("f");
    if (dF != null) {
        myLife.setF(MapleDataTool.getInt(dF));
    }
    myLife.setFh(MapleDataTool.getInt(life.getChildByPath("fh")));
    myLife.setRx0(MapleDataTool.getInt(life.getChildByPath("rx0")));
    myLife.setRx1(MapleDataTool.getInt(life.getChildByPath("rx1")));
    int x = MapleDataTool.getInt(life.getChildByPath("x"));
    int y = MapleDataTool.getInt(life.getChildByPath("y"));
    myLife.setPosition(new Point(x, y));
    int hide = MapleDataTool.getInt("hide", life, 0);
    if (hide == 1) {
        myLife.setHide(true);
    }
    return myLife;
}
Also used : MapleData(provider.MapleData) Point(java.awt.Point) AbstractLoadedMapleLife(server.life.AbstractLoadedMapleLife) Point(java.awt.Point)

Example 68 with MapleData

use of provider.MapleData in project HeavenMS by ronancpl.

the class ItemAction method processData.

@Override
public void processData(MapleData data) {
    for (MapleData iEntry : data.getChildren()) {
        int id = MapleDataTool.getInt(iEntry.getChildByPath("id"));
        int count = MapleDataTool.getInt(iEntry.getChildByPath("count"), 1);
        Integer prop = null;
        MapleData propData = iEntry.getChildByPath("prop");
        if (propData != null)
            prop = MapleDataTool.getInt(propData);
        int gender = 2;
        if (iEntry.getChildByPath("gender") != null)
            gender = MapleDataTool.getInt(iEntry.getChildByPath("gender"));
        int job = -1;
        if (iEntry.getChildByPath("job") != null)
            job = MapleDataTool.getInt(iEntry.getChildByPath("job"));
        items.add(new ItemData(Integer.parseInt(iEntry.getName()), id, count, prop, job, gender));
    }
    Collections.sort(items, new Comparator<ItemData>() {

        @Override
        public int compare(ItemData o1, ItemData o2) {
            return o1.map - o2.map;
        }
    });
}
Also used : MapleData(provider.MapleData)

Example 69 with MapleData

use of provider.MapleData in project HeavenMS by ronancpl.

the class MapleReactorFactory method getReactor.

public static MapleReactorStats getReactor(int rid) {
    MapleReactorStats stats = reactorStats.get(Integer.valueOf(rid));
    if (stats == null) {
        int infoId = rid;
        MapleData reactorData = data.getData(StringUtil.getLeftPaddedStr(Integer.toString(infoId) + ".img", '0', 11));
        MapleData link = reactorData.getChildByPath("info/link");
        if (link != null) {
            infoId = MapleDataTool.getIntConvert("info/link", reactorData);
            stats = reactorStats.get(Integer.valueOf(infoId));
        }
        MapleData activateOnTouch = reactorData.getChildByPath("info/activateByTouch");
        boolean loadArea = false;
        if (activateOnTouch != null) {
            loadArea = MapleDataTool.getInt("info/activateByTouch", reactorData, 0) != 0;
        }
        if (stats == null) {
            reactorData = data.getData(StringUtil.getLeftPaddedStr(Integer.toString(infoId) + ".img", '0', 11));
            MapleData reactorInfoData = reactorData.getChildByPath("0");
            stats = new MapleReactorStats();
            List<StateData> statedatas = new ArrayList<>();
            if (reactorInfoData != null) {
                boolean areaSet = false;
                byte i = 0;
                while (reactorInfoData != null) {
                    MapleData eventData = reactorInfoData.getChildByPath("event");
                    if (eventData != null) {
                        int timeOut = -1;
                        for (MapleData fknexon : eventData.getChildren()) {
                            if (fknexon.getName().equals("timeOut")) {
                                timeOut = MapleDataTool.getInt(fknexon);
                            } else {
                                Pair<Integer, Integer> reactItem = null;
                                int type = MapleDataTool.getIntConvert("type", fknexon);
                                if (type == 100) {
                                    // reactor waits for item
                                    reactItem = new Pair<Integer, Integer>(MapleDataTool.getIntConvert("0", fknexon), MapleDataTool.getIntConvert("1", fknexon));
                                    if (!areaSet || loadArea) {
                                        // only set area of effect for item-triggered reactors once
                                        stats.setTL(MapleDataTool.getPoint("lt", fknexon));
                                        stats.setBR(MapleDataTool.getPoint("rb", fknexon));
                                        areaSet = true;
                                    }
                                }
                                MapleData activeSkillID = fknexon.getChildByPath("activeSkillID");
                                List<Integer> skillids = null;
                                if (activeSkillID != null) {
                                    skillids = new ArrayList<Integer>();
                                    for (MapleData skill : activeSkillID.getChildren()) {
                                        skillids.add(MapleDataTool.getInt(skill));
                                    }
                                }
                                byte nextState = (byte) MapleDataTool.getIntConvert("state", fknexon);
                                statedatas.add(new StateData(type, reactItem, skillids, nextState));
                            }
                        }
                        stats.addState(i, statedatas, timeOut);
                    }
                    i++;
                    reactorInfoData = reactorData.getChildByPath(Byte.toString(i));
                    statedatas = new ArrayList<>();
                }
            } else // sit there and look pretty; likely a reactor such as Zakum/Papulatus doors that shows if player can enter
            {
                statedatas.add(new StateData(999, null, null, (byte) 0));
                stats.addState((byte) 0, statedatas, -1);
            }
            reactorStats.put(Integer.valueOf(infoId), stats);
            if (rid != infoId) {
                reactorStats.put(Integer.valueOf(rid), stats);
            }
        } else // stats exist at infoId but not rid; add to map
        {
            reactorStats.put(Integer.valueOf(rid), stats);
        }
    }
    return stats;
}
Also used : MapleData(provider.MapleData) ArrayList(java.util.ArrayList) StateData(server.maps.MapleReactorStats.StateData)

Example 70 with MapleData

use of provider.MapleData in project HeavenMS by ronancpl.

the class QuestRequirement method processData.

/**
 * @param data
 */
@Override
public void processData(MapleData data) {
    for (MapleData questEntry : data.getChildren()) {
        int questID = MapleDataTool.getInt(questEntry.getChildByPath("id"));
        int stateReq = MapleDataTool.getInt(questEntry.getChildByPath("state"));
        quests.put(questID, stateReq);
    }
}
Also used : MapleData(provider.MapleData)

Aggregations

MapleData (provider.MapleData)90 ArrayList (java.util.ArrayList)19 Pair (tools.Pair)11 File (java.io.File)8 Point (java.awt.Point)7 LinkedList (java.util.LinkedList)6 MapleDataDirectoryEntry (provider.MapleDataDirectoryEntry)6 MapleDataFileEntry (provider.MapleDataFileEntry)6 LinkedHashMap (java.util.LinkedHashMap)5 SQLException (java.sql.SQLException)4 MapleDataProvider (provider.MapleDataProvider)4 Skill (client.Skill)2 IOException (java.io.IOException)2 Node (org.w3c.dom.Node)2 NodeList (org.w3c.dom.NodeList)2 AbstractLoadedMapleLife (server.life.AbstractLoadedMapleLife)2 MapleCharacter (client.MapleCharacter)1 Item (client.inventory.Item)1 MonsterStatus (client.status.MonsterStatus)1 Rectangle (java.awt.Rectangle)1