Search in sources :

Example 1 with MapleData

use of provider.MapleData in project HeavenMS by ronancpl.

the class SkillFactory method loadFromData.

private static Skill loadFromData(int id, MapleData data) {
    Skill ret = new Skill(id);
    boolean isBuff = false;
    int skillType = MapleDataTool.getInt("skillType", data, -1);
    String elem = MapleDataTool.getString("elemAttr", data, null);
    if (elem != null) {
        ret.setElement(Element.getFromChar(elem.charAt(0)));
    } else {
        ret.setElement(Element.NEUTRAL);
    }
    MapleData effect = data.getChildByPath("effect");
    if (skillType != -1) {
        if (skillType == 2) {
            isBuff = true;
        }
    } else {
        MapleData action_ = data.getChildByPath("action");
        boolean action = false;
        if (action_ == null) {
            if (data.getChildByPath("prepare/action") != null) {
                action = true;
            } else {
                switch(id) {
                    case Gunslinger.INVISIBLE_SHOT:
                    case Corsair.HYPNOTIZE:
                        action = true;
                        break;
                }
            }
        } else {
            action = true;
        }
        ret.setAction(action);
        MapleData hit = data.getChildByPath("hit");
        MapleData ball = data.getChildByPath("ball");
        isBuff = effect != null && hit == null && ball == null;
        isBuff |= action_ != null && MapleDataTool.getString("0", action_, "").equals("alert2");
        switch(id) {
            case Hero.RUSH:
            case Paladin.RUSH:
            case DarkKnight.RUSH:
            case DragonKnight.SACRIFICE:
            case FPMage.EXPLOSION:
            case FPMage.POISON_MIST:
            case Cleric.HEAL:
            case Ranger.MORTAL_BLOW:
            case Sniper.MORTAL_BLOW:
            case Assassin.DRAIN:
            case Hermit.SHADOW_WEB:
            case Bandit.STEAL:
            case Shadower.SMOKE_SCREEN:
            case SuperGM.HEAL_PLUS_DISPEL:
            case Hero.MONSTER_MAGNET:
            case Paladin.MONSTER_MAGNET:
            case DarkKnight.MONSTER_MAGNET:
            case Evan.ICE_BREATH:
            case Evan.FIRE_BREATH:
            case Gunslinger.RECOIL_SHOT:
            case Marauder.ENERGY_DRAIN:
            case BlazeWizard.FLAME_GEAR:
            case NightWalker.SHADOW_WEB:
            case NightWalker.POISON_BOMB:
            case NightWalker.VAMPIRE:
            case ChiefBandit.CHAKRA:
            case Evan.RECOVERY_AURA:
                isBuff = false;
                break;
            case Beginner.RECOVERY:
            case Beginner.NIMBLE_FEET:
            case Beginner.MONSTER_RIDER:
            case Beginner.ECHO_OF_HERO:
            case Beginner.MAP_CHAIR:
            case Swordsman.IRON_BODY:
            case Fighter.AXE_BOOSTER:
            case Fighter.POWER_GUARD:
            case Fighter.RAGE:
            case Fighter.SWORD_BOOSTER:
            case Crusader.ARMOR_CRASH:
            case Crusader.COMBO:
            case Hero.ENRAGE:
            case Hero.HEROS_WILL:
            case Hero.MAPLE_WARRIOR:
            case Hero.STANCE:
            case Page.BW_BOOSTER:
            case Page.POWER_GUARD:
            case Page.SWORD_BOOSTER:
            case Page.THREATEN:
            case WhiteKnight.BW_FIRE_CHARGE:
            case WhiteKnight.BW_ICE_CHARGE:
            case WhiteKnight.BW_LIT_CHARGE:
            case WhiteKnight.MAGIC_CRASH:
            case WhiteKnight.SWORD_FIRE_CHARGE:
            case WhiteKnight.SWORD_ICE_CHARGE:
            case WhiteKnight.SWORD_LIT_CHARGE:
            case Paladin.BW_HOLY_CHARGE:
            case Paladin.HEROS_WILL:
            case Paladin.MAPLE_WARRIOR:
            case Paladin.STANCE:
            case Paladin.SWORD_HOLY_CHARGE:
            case Spearman.HYPER_BODY:
            case Spearman.IRON_WILL:
            case Spearman.POLEARM_BOOSTER:
            case Spearman.SPEAR_BOOSTER:
            case DragonKnight.DRAGON_BLOOD:
            case DragonKnight.POWER_CRASH:
            case DarkKnight.AURA_OF_BEHOLDER:
            case DarkKnight.BEHOLDER:
            case DarkKnight.HEROS_WILL:
            case DarkKnight.HEX_OF_BEHOLDER:
            case DarkKnight.MAPLE_WARRIOR:
            case DarkKnight.STANCE:
            case Magician.MAGIC_GUARD:
            case Magician.MAGIC_ARMOR:
            case FPWizard.MEDITATION:
            case FPWizard.SLOW:
            case FPMage.SEAL:
            case FPMage.SPELL_BOOSTER:
            case FPArchMage.HEROS_WILL:
            case FPArchMage.INFINITY:
            case FPArchMage.MANA_REFLECTION:
            case FPArchMage.MAPLE_WARRIOR:
            case ILWizard.MEDITATION:
            case ILMage.SEAL:
            case ILWizard.SLOW:
            case ILMage.SPELL_BOOSTER:
            case ILArchMage.HEROS_WILL:
            case ILArchMage.INFINITY:
            case ILArchMage.MANA_REFLECTION:
            case ILArchMage.MAPLE_WARRIOR:
            case Cleric.INVINCIBLE:
            case Cleric.BLESS:
            case Priest.DISPEL:
            case Priest.DOOM:
            case Priest.HOLY_SYMBOL:
            case Priest.MYSTIC_DOOR:
            case Bishop.HEROS_WILL:
            case Bishop.HOLY_SHIELD:
            case Bishop.INFINITY:
            case Bishop.MANA_REFLECTION:
            case Bishop.MAPLE_WARRIOR:
            case Archer.FOCUS:
            case Hunter.BOW_BOOSTER:
            case Hunter.SOUL_ARROW:
            case Ranger.PUPPET:
            case Bowmaster.CONCENTRATE:
            case Bowmaster.HEROS_WILL:
            case Bowmaster.MAPLE_WARRIOR:
            case Bowmaster.SHARP_EYES:
            case Crossbowman.CROSSBOW_BOOSTER:
            case Crossbowman.SOUL_ARROW:
            case Sniper.PUPPET:
            case Marksman.BLIND:
            case Marksman.HEROS_WILL:
            case Marksman.MAPLE_WARRIOR:
            case Marksman.SHARP_EYES:
            case Rogue.DARK_SIGHT:
            case Assassin.CLAW_BOOSTER:
            case Assassin.HASTE:
            case Hermit.MESO_UP:
            case Hermit.SHADOW_PARTNER:
            case NightLord.HEROS_WILL:
            case NightLord.MAPLE_WARRIOR:
            case NightLord.NINJA_AMBUSH:
            case NightLord.SHADOW_STARS:
            case Bandit.DAGGER_BOOSTER:
            case Bandit.HASTE:
            case ChiefBandit.MESO_GUARD:
            case ChiefBandit.PICKPOCKET:
            case Shadower.HEROS_WILL:
            case Shadower.MAPLE_WARRIOR:
            case Shadower.NINJA_AMBUSH:
            case Pirate.DASH:
            case Marauder.TRANSFORMATION:
            case Buccaneer.SUPER_TRANSFORMATION:
            case Corsair.BATTLE_SHIP:
            case GM.HIDE:
            case SuperGM.HASTE:
            case SuperGM.HOLY_SYMBOL:
            case SuperGM.BLESS:
            case SuperGM.HIDE:
            case SuperGM.HYPER_BODY:
            case Noblesse.BLESSING_OF_THE_FAIRY:
            case Noblesse.ECHO_OF_HERO:
            case Noblesse.MONSTER_RIDER:
            case Noblesse.NIMBLE_FEET:
            case Noblesse.RECOVERY:
            case Noblesse.MAP_CHAIR:
            case DawnWarrior.COMBO:
            case DawnWarrior.FINAL_ATTACK:
            case DawnWarrior.IRON_BODY:
            case DawnWarrior.RAGE:
            case DawnWarrior.SOUL:
            case DawnWarrior.SOUL_CHARGE:
            case DawnWarrior.SWORD_BOOSTER:
            case BlazeWizard.ELEMENTAL_RESET:
            case BlazeWizard.FLAME:
            case BlazeWizard.IFRIT:
            case BlazeWizard.MAGIC_ARMOR:
            case BlazeWizard.MAGIC_GUARD:
            case BlazeWizard.MEDITATION:
            case BlazeWizard.SEAL:
            case BlazeWizard.SLOW:
            case BlazeWizard.SPELL_BOOSTER:
            case WindArcher.BOW_BOOSTER:
            case WindArcher.EAGLE_EYE:
            case WindArcher.FINAL_ATTACK:
            case WindArcher.FOCUS:
            case WindArcher.PUPPET:
            case WindArcher.SOUL_ARROW:
            case WindArcher.STORM:
            case WindArcher.WIND_WALK:
            case NightWalker.CLAW_BOOSTER:
            case NightWalker.DARKNESS:
            case NightWalker.DARK_SIGHT:
            case NightWalker.HASTE:
            case NightWalker.SHADOW_PARTNER:
            case ThunderBreaker.DASH:
            case ThunderBreaker.ENERGY_CHARGE:
            case ThunderBreaker.ENERGY_DRAIN:
            case ThunderBreaker.KNUCKLER_BOOSTER:
            case ThunderBreaker.LIGHTNING:
            case ThunderBreaker.SPARK:
            case ThunderBreaker.LIGHTNING_CHARGE:
            case ThunderBreaker.SPEED_INFUSION:
            case ThunderBreaker.TRANSFORMATION:
            case Legend.BLESSING_OF_THE_FAIRY:
            case Legend.AGILE_BODY:
            case Legend.ECHO_OF_HERO:
            case Legend.RECOVERY:
            case Legend.MONSTER_RIDER:
            case Legend.MAP_CHAIR:
            case Aran.MAPLE_WARRIOR:
            case Aran.HEROS_WILL:
            case Aran.POLEARM_BOOSTER:
            case Aran.COMBO_DRAIN:
            case Aran.SNOW_CHARGE:
            case Aran.BODY_PRESSURE:
            case Aran.SMART_KNOCKBACK:
            case Aran.COMBO_BARRIER:
            case Aran.COMBO_ABILITY:
            case Evan.BLESSING_OF_THE_FAIRY:
            case Evan.RECOVERY:
            case Evan.NIMBLE_FEET:
            case Evan.HEROS_WILL:
            case Evan.ECHO_OF_HERO:
            case Evan.MAGIC_BOOSTER:
            case Evan.MAGIC_GUARD:
            case Evan.ELEMENTAL_RESET:
            case Evan.MAPLE_WARRIOR:
            case Evan.MAGIC_RESISTANCE:
            case Evan.MAGIC_SHIELD:
            case Evan.SLOW:
                isBuff = true;
                break;
        }
    }
    for (MapleData level : data.getChildByPath("level")) {
        ret.addLevelEffect(MapleStatEffect.loadSkillEffectFromData(level, id, isBuff));
    }
    ret.setAnimationTime(0);
    if (effect != null) {
        for (MapleData effectEntry : effect) {
            ret.incAnimationTime(MapleDataTool.getIntConvert("delay", effectEntry, 0));
        }
    }
    return ret;
}
Also used : MapleData(provider.MapleData)

Example 2 with MapleData

use of provider.MapleData in project HeavenMS by ronancpl.

the class SkillFactory method loadAllSkills.

public static void loadAllSkills() {
    final MapleDataDirectoryEntry root = datasource.getRoot();
    int skillid;
    for (MapleDataFileEntry topDir : root.getFiles()) {
        // Loop thru jobs
        if (topDir.getName().length() <= 8) {
            for (MapleData data : datasource.getData(topDir.getName())) {
                // Loop thru each jobs
                if (data.getName().equals("skill")) {
                    for (MapleData data2 : data) {
                        // Loop thru each jobs
                        if (data2 != null) {
                            skillid = Integer.parseInt(data2.getName());
                            skills.put(skillid, loadFromData(skillid, data2));
                        }
                    }
                }
            }
        }
    }
}
Also used : MapleData(provider.MapleData) MapleDataDirectoryEntry(provider.MapleDataDirectoryEntry) MapleDataFileEntry(provider.MapleDataFileEntry)

Example 3 with MapleData

use of provider.MapleData in project HeavenMS by ronancpl.

the class MCSkillFactory method getMCSkill.

public static MCSkill getMCSkill(int skillId) {
    skillLock.readLock().lock();
    try {
        MCSkill ret = mcSkills.get(skillId);
        if (ret != null) {
            return ret;
        }
    } finally {
        skillLock.readLock().unlock();
    }
    skillLock.writeLock().lock();
    try {
        MCSkill ret;
        ret = mcSkills.get(skillId);
        if (ret == null) {
            MapleData skillData = mcSkillRoot.getChildByPath(String.valueOf(skillId));
            if (skillData != null) {
                int target = MapleDataTool.getInt("target", skillData, 0);
                int spendCP = MapleDataTool.getInt("spendCP", skillData, 0);
                int mobSkillID = MapleDataTool.getInt("mobSkillID", skillData, 0);
                int level = MapleDataTool.getInt("level", skillData, 0);
                ret = new MCSkill(skillId, target, mobSkillID, level, spendCP);
                if (MonsterCarnival.DEBUG) {
                    String name = MapleDataTool.getString("name", skillData, "");
                    String desc = MapleDataTool.getString("desc", skillData, "");
                    ret.setName(name);
                    ret.setDesc(desc);
                }
                mcSkills.put(skillId, ret);
            }
        }
        return ret;
    } finally {
        skillLock.writeLock().unlock();
    }
}
Also used : MapleData(provider.MapleData)

Example 4 with MapleData

use of provider.MapleData in project HeavenMS by ronancpl.

the class MCWZData method populateGuardianGenPos.

private void populateGuardianGenPos(MapleData src) {
    for (MapleData n : src) {
        MCGuardianGenPos nn = new MCGuardianGenPos(MapleDataTool.getInt("x", n, 0), MapleDataTool.getInt("y", n, 0), MapleDataTool.getInt("f", n, 0), MapleDataTool.getInt("team", n, -1));
        guardianGenPosList.add(nn);
    }
}
Also used : MapleData(provider.MapleData)

Example 5 with MapleData

use of provider.MapleData in project HeavenMS by ronancpl.

the class MCWZData method populateGuardians.

private void populateGuardians(MapleData src) {
    for (MapleData n : src) {
        int key = Integer.parseInt(n.getName());
        int val = MapleDataTool.getInt(n);
        guardians.put(key, val);
    }
}
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