Jump to content

Sabrent

Members
  • Posts

    21
  • Credits

  • Joined

  • Last visited

  • Feedback

    0%

About Sabrent

Profile Information

  • Gender
    Male
  • Country
    Israel
  • Location
    Yisrael

Recent Profile Visitors

584 profile views

Sabrent's Achievements

Newbie

Newbie (1/16)

0

Reputation

  1. I try what you tell me but I do not get any results...
  2. What I want is that when the item is finished, the player is teleport to another site. my script /** * MyNpc AI. */ public final class MyNpc extends AbstractNpcAI { // NPC private static final int NPC1 = 36655; private static final int NPC2 = 36656; // Item private static final int ITEM_NAME = 47811; private static final Location DIMENSIONAL = new Location(-190313, -112464, -7752); private MyNpc() { addStartNpc(NPC1, NPC2); addTalkId(NPC1, NPC2); addFirstTalkId(NPC1, NPC2); } @Override public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; if (npc.getId() == NPC1) { switch (event) { case "36655.htm": { htmltext = event; break; } case "give_coin": { if (hasQuestItems(player, ITEM_NAME)) { return "haveitem_b.htm"; }else { giveItems(player, ITEM_NAME, 1); playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET); } } } break; } } if (npc.getId() == NPC2) { switch (event) { case "36656.htm": { htmltext = event; break; } case "give_coin": { if (hasQuestItems(player, ITEM_NAME)) { return "haveitem_s.htm"; } else { giveItems(player, ITEM_NAME, 1); playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET); } } } break; } } return htmltext; } @Override public String onFirstTalk(L2Npc npc, L2PcInstance player) { String htmltext = null; switch (npc.getId()) { case NPC1: { htmltext = "36655.htm"; break; } case NPC2: { htmltext = "36656.htm"; break; } } return htmltext; } public void onItemExpire(L2Item item) { L2PcInstance player = null; if (item.getId() == ITEM_NAME) { if (item.getId() == -1) { player.teleToLocation(DIMENSIONAL); } } } public static void main(String[] args) { new MyNpc(); } } try custom item and skill and it not work <skill id="55032" displayId="770" toLevel="1" name="Dimensional"> <magicLvl>1</magicLvl> <operateType>P</operateType> <targetType>SELF</targetType> <affectScope>SINGLE</affectScope> <conditions> <condition name="OpCanEscape" /> </conditions> <effects> <effect name="Teleport"> <x>-120313</x> <y>-182464</y> <z>-6752</z> </effect> </effects> </skill> <item id="47811" name="Dimensional" type="EtcItem"> <set name="is_tradable" val="false" /> <set name="immediate_effect" val="true" /> <set name="is_oly_restricted" val="true" /> <set name="handler" val="ItemSkills" /> <set name="is_dropable" val="false" /> <set name="is_destroyable" val="false" /> <set name="is_depositable" val="false" /> <set name="is_sellable" val="false" /> <set name="is_clan_depositable" val="false" /> <set name="is_mailable" val="false" /> <set name="is_commissionable" val="false" /> <set name="is_private_storeable" val="false" /> <set name="is_stackable" val="false" /> <set name="time" val="60" /><!-- Mints --> <skills> <skill id="55032" level="1" /> <!-- Dimensional --> </skills> </item>
  3. Yeah! I was observing the examples in L2ItemInstance and L2Item on the getTime and getDuration of the mana, I also observed the behavior of the shadows weapons and cursed weapons, try to do a method, but I am not an expert in Java but I am a student and I am not ashamed to ask. Thx friend
  4. Hi friends. I'm doing a method where when the item expires teleport the player to another site. public void onItemExpire(L2Item item) { L2PcInstance player = null; if (item.getId() == ITEM_NAME) { if (item.getId() == -1) { player.teleToLocation(DIMENSIONAL_CRACK); } } } some developer colleague can give me some suggestion? thx
  5. L2Character (2729) public boolean updatePosition() { // Get movement data MoveData m = _move; if (m == null) { return true; } if (!isSpawned()) { _move = null; return true; } // Check if this is the first update if (m._moveTimestamp == 0) { m._moveTimestamp = m._moveStartTime; m._xAccurate = getX(); m._yAccurate = getY(); } int gameTicks = GameTimeManager.getInstance().getGameTicks(); // Check if the position has already been calculated if (m._moveTimestamp == gameTicks) { return false; } double xPrev = getX(); double yPrev = getY(); double zPrev = getZ(); // the z coordinate may be modified by coordinate synchronizations double dx, dy, dz; if (GeoDataConfig.COORD_SYNCHRONIZE == 1) // the only method that can modify x,y while moving (otherwise _move would/should be set null) { dx = m._xDestination - xPrev; dy = m._yDestination - yPrev; } else // otherwise we need saved temporary values to avoid rounding errors { dx = m._xDestination - m._xAccurate; dy = m._yDestination - m._yAccurate; } final boolean isFloating = isFlying() || isInsideZone(ZoneId.WATER); // Z coordinate will follow geodata or client values if ((GeoDataConfig.COORD_SYNCHRONIZE == 2) && !isFloating && !m.disregardingGeodata && ((GameTimeManager.getInstance().getGameTicks() % 10) == 0 // once a second to reduce possible cpu load ) && GeoData.getInstance().hasGeo(xPrev, yPrev)) { double geoHeight = GeoData.getInstance().getSpawnHeight(xPrev, yPrev, zPrev); dz = m._zDestination - geoHeight; // quite a big difference, compare to validatePosition packet if (isPlayer() && (Math.abs(getActingPlayer().getClientZ() - geoHeight) > 200) && (Math.abs(getActingPlayer().getClientZ() - geoHeight) < 1500)) { dz = m._zDestination - zPrev; // allow diff } else if (isInCombat() && (Math.abs(dz) > 200) && (((dx * dx) + (dy * dy)) < 40000)) // allow mob to climb up to pcinstance { dz = m._zDestination - zPrev; // climbing } else { zPrev = geoHeight; } } else { dz = m._zDestination - zPrev; } double delta = (dx * dx) + (dy * dy); if ((delta < 10000) && ((dz * dz) > 2500) // close enough, allows error between client and server geodata if it cannot be avoided && !isFloating) { delta = Math.sqrt(delta); } else { delta = Math.sqrt(delta + (dz * dz)); } double distFraction = Double.MAX_VALUE; if (delta > 1) { final double distPassed = (getMoveSpeed() * (gameTicks - m._moveTimestamp)) / GameTimeManager.TICKS_PER_SECOND; distFraction = distPassed / delta; } // if (Config.DEVELOPER) LOGGER.warn("Move Ticks:" + (gameTicks - m._moveTimestamp) + ", distPassed:" + distPassed + ", distFraction:" + distFraction); if (distFraction > 1) { // Set the position of the L2Character to the destination final double x = m._xDestination; final double y = m._yDestination; final double z = m._zDestination; super.setXYZ(x, y, z); if (isDebug()) { final ExShowTrace trace = new ExShowTrace(); trace.addLocation(x, y, z); sendDebugPacket(trace, DebugType.MOVEMENT); } } else { m._xAccurate += dx * distFraction; m._yAccurate += dy * distFraction; final double x = m._xAccurate; final double y = m._yAccurate; final double z = zPrev + ((dz * distFraction) + 0.5); // Set the position of the L2Character to estimated after partial move super.setXYZ(x, y, z); // HERE LINE 2729 if (isDebug()) { final ExShowTrace trace = new ExShowTrace(); trace.addLocation(x, y, z); sendDebugPacket(trace, DebugType.MOVEMENT); } } revalidateZone(false); // Set the timer of last position update to now m._moveTimestamp = gameTicks; if (distFraction > 1) { if (isDebug()) { Position.drawPosition(this); } ThreadPool.execute(() -> getAI().notifyEvent(CtrlEvent.EVT_ARRIVED)); return true; } return false; }
  6. Hello friends. I have a doubt with this Exception: Null, in my knowledge, which is not much, I am looking for the object that has not been initialized, i has it took several days looking how to solve it. L2Object.java:780 @Override public void setXYZ(double x, double y, double z) { _x = x; _y = y; _z = z; if (_isSpawned) { final WorldRegion oldRegion = getWorldRegion(); final WorldRegion newRegion = World.getInstance().getRegion(this); if (newRegion != oldRegion) { if (oldRegion != null) { oldRegion.removeVisibleObject(this); } newRegion.addVisibleObject(this); World.getInstance().switchRegion(this, newRegion); setWorldRegion(newRegion); } } }
  7. Hi all. I ve been all day looking for the way to do it but I could not, cans give me a suggestion on how to do it? I want an NPC that when spawn, the zone becomes debuff and when the NPC is death, the debuff disappears. L2jServer HF
  8. sorry session wrong, delete post.
  9. public class SkillData implements IGameXmlReader { private static final Logger LOGGER = Logger.getLogger(SkillData.class.getName()); private final Map<Long, Skill> _skills = new HashMap<>(); private final Map<Integer, Integer> _skillsMaxLevel = new HashMap<>(); private class NamedParamInfo { private final String _name; private final Integer _fromLevel; private final Integer _toLevel; private final Integer _fromSubLevel; private final Integer _toSubLevel; private final Map<Integer, Map<Integer, StatsSet>> _info; public NamedParamInfo(String name, Integer fromLevel, Integer toLevel, Integer fromSubLevel, Integer toSubLevel, Map<Integer, Map<Integer, StatsSet>> info) { _name = name; _fromLevel = fromLevel; _toLevel = toLevel; _fromSubLevel = fromSubLevel; _toSubLevel = toSubLevel; _info = info; } public String getName() { return _name; } public Integer getFromLevel() { return _fromLevel; } public Integer getToLevel() { return _toLevel; } public Integer getFromSubLevel() { return _fromSubLevel; } public Integer getToSubLevel() { return _toSubLevel; } public Map<Integer, Map<Integer, StatsSet>> getInfo() { return _info; } } protected SkillData() { load(); } public static long getSkillHashCode(Skill skill) { return getSkillHashCode(skill.getId(), skill.getLevel(), skill.getSubLevel()); } public static long getSkillHashCode(int skillId, int skillLevel) { return getSkillHashCode(skillId, skillLevel, 0); } public static long getSkillHashCode(int skillId, int skillLevel, int subSkillLevel) { return subSkillLevel > 0 ? ((skillId * 4294967296L) + (subSkillLevel * 65536) + skillLevel) : (skillId * 65536) + skillLevel; } public Skill getSkill(int skillId, int level) { return getSkill(skillId, level, 0); } public Skill getSkill(int skillId, int level, int subLevel) { final Skill result = _skills.get(getSkillHashCode(skillId, level, subLevel)); if (result != null) { return result; } final int maxLvl = getMaxLevel(skillId); if ((maxLvl > 0) && (level > maxLvl)) { LOGGER.log(Level.WARNING, this.getClass().getSimpleName() + ": Call to unexisting skill level id: " + skillId + " requested level: " + level + " max level: " + maxLvl + ".", new Throwable()); return _skills.get(getSkillHashCode(skillId, maxLvl, 0)); } LOGGER.warning(this.getClass().getSimpleName() + ": No skill info found for skill id " + skillId + " and skill level " + level); return null; } public int getMaxLevel(int skillId) { final Integer maxLevel = _skillsMaxLevel.get(skillId); return maxLevel != null ? maxLevel : 0; } public List<Skill> getSiegeSkills(boolean addNoble, boolean hasCastle) { final List<Skill> temp = new LinkedList<>(); temp.add(_skills.get(SkillData.getSkillHashCode(CommonSkill.IMPRIT_OF_LIGHT.getId(), 1))); temp.add(_skills.get(SkillData.getSkillHashCode(CommonSkill.IMPRIT_OF_DARKNESS.getId(), 1))); temp.add(_skills.get(SkillData.getSkillHashCode(247, 1))); if (addNoble) { temp.add(_skills.get(SkillData.getSkillHashCode(326, 1))); } if (hasCastle) { temp.add(_skills.get(SkillData.getSkillHashCode(844, 1))); temp.add(_skills.get(SkillData.getSkillHashCode(845, 1))); } return temp; } @Override public boolean isValidating() { return false; } @Override public synchronized void load() { _skills.clear(); _skillsMaxLevel.clear(); parseDatapackDirectory("data/stats/skills/", true); LOGGER.info(this.getClass().getSimpleName() + ": Loaded " + this._skills.size() + " Skills."); } public void reload() { load(); SkillTreesData.getInstance().load(); } @Override public void parseDocument(Document doc, File f) { for (Node node = doc.getFirstChild(); node != null; node = node.getNextSibling()) { if ("list".equalsIgnoreCase(node.getNodeName())) { for (Node listNode = node.getFirstChild(); listNode != null; listNode = listNode.getNextSibling()) { if ("skill".equalsIgnoreCase(listNode.getNodeName())) { NamedNodeMap attributes = listNode.getAttributes(); final Map<Integer, Set<Integer>> levels = new HashMap<>(); final Map<Integer, Map<Integer, StatsSet>> skillInfo = new HashMap<>(); final StatsSet generalSkillInfo = skillInfo.computeIfAbsent(-1, (k) -> new HashMap<>()).computeIfAbsent(-1, (k) -> new StatsSet()); parseAttributes(attributes, "", generalSkillInfo); final Map<String, Map<Integer, Map<Integer, Object>>> variableValues = new HashMap<>(); final Map<EffectScope, List<NamedParamInfo>> effectParamInfo = new HashMap<>(); final Map<SkillConditionScope, List<NamedParamInfo>> conditionParamInfo = new HashMap<>(); for (Node skillNode = listNode.getFirstChild(); skillNode != null; skillNode = skillNode.getNextSibling()) { final String skillNodeName = skillNode.getNodeName(); switch (skillNodeName.toLowerCase()) { case "variable": { attributes = skillNode.getAttributes(); final String name = "@" + parseString(attributes, "name"); variableValues.put(name, parseValues(skillNode)); break; } case "#text": { break; } default: { final EffectScope effectScope = EffectScope.findByXmlNodeName(skillNodeName); if (effectScope != null) { for (Node effectsNode = skillNode.getFirstChild(); effectsNode != null; effectsNode = effectsNode.getNextSibling()) { switch (effectsNode.getNodeName().toLowerCase()) { case "effect": { effectParamInfo.computeIfAbsent(effectScope, (k) -> new LinkedList<>()).add(parseNamedParamInfo(effectsNode, variableValues)); break; } } } break; } final SkillConditionScope skillConditionScope = SkillConditionScope.findByXmlNodeName(skillNodeName); if (skillConditionScope != null) { for (Node conditionNode = skillNode.getFirstChild(); conditionNode != null; conditionNode = conditionNode.getNextSibling()) { switch (conditionNode.getNodeName().toLowerCase()) { case "condition": { conditionParamInfo.computeIfAbsent(skillConditionScope, (k) -> new LinkedList<>()).add(parseNamedParamInfo(conditionNode, variableValues)); break; } } } } else { parseInfo(skillNode, variableValues, skillInfo); } break; } } } final int fromLevel = generalSkillInfo.getInt(".fromLevel", 1); final int toLevel = generalSkillInfo.getInt(".toLevel", 0); for (int i = fromLevel; i <= toLevel; i++) { levels.computeIfAbsent(i, (k) -> new HashSet<>()).add(0); } skillInfo.forEach((level, subLevelMap) -> { if (level == -1) { return; } subLevelMap.forEach((subLevel, statsSet) -> { if (subLevel == -1) { return; } levels.computeIfAbsent(level, (k) -> new HashSet<>()).add(subLevel); }); }); Stream.concat(effectParamInfo.values().stream(), conditionParamInfo.values().stream()).forEach(namedParamInfos -> { namedParamInfos.forEach(namedParamInfo -> { namedParamInfo.getInfo().forEach((level, subLevelMap) -> { if (level == -1) { return; } subLevelMap.forEach((subLevel, statsSet) -> { if (subLevel == -1) { return; } levels.computeIfAbsent(level, (k) -> new HashSet<>()).add(subLevel); }); }); if ((namedParamInfo.getFromLevel() != null) && (namedParamInfo.getToLevel() != null)) { for (int i = namedParamInfo.getFromLevel(); i <= namedParamInfo.getToLevel(); i++) { if ((namedParamInfo.getFromSubLevel() != null) && (namedParamInfo.getToSubLevel() != null)) { for (int j = namedParamInfo.getFromSubLevel(); j <= namedParamInfo.getToSubLevel(); j++) { levels.computeIfAbsent(i, (k) -> new HashSet<>()).add(j); } } else { levels.computeIfAbsent(i, (k) -> new HashSet<>()).add(0); } } } }); }); levels.forEach((level, subLevels) -> { subLevels.forEach(subLevel -> { final StatsSet statsSet = Optional.ofNullable(skillInfo.getOrDefault(level, Collections.emptyMap()).get(subLevel)).orElseGet(StatsSet::new); skillInfo.getOrDefault(level, Collections.emptyMap()).getOrDefault(-1, StatsSet.EMPTY_STATSET).getSet().forEach(statsSet.getSet()::putIfAbsent); skillInfo.getOrDefault(-1, Collections.emptyMap()).getOrDefault(-1, StatsSet.EMPTY_STATSET).getSet().forEach(statsSet.getSet()::putIfAbsent); statsSet.set(".level", level); statsSet.set(".subLevel", subLevel); final Skill skill = new Skill(statsSet); forEachNamedParamInfoParam(effectParamInfo, level, subLevel, ((effectScope, params) -> { final String effectName = params.getString(".name"); params.remove(".name"); try { final Function<StatsSet, AbstractEffect> effectFunction = EffectHandler.getInstance().getHandlerFactory(effectName); if (effectFunction != null) { skill.addEffect(effectScope, effectFunction.apply(params)); } else { LOGGER.warning(this.getClass().getSimpleName() + ": Missing effect for Skill Id[" + statsSet.getInt(".id") + "] Level[" + level + "] SubLevel[" + subLevel + "] Effect Scope[" + effectScope + "] Effect Name[" + effectName + "]"); } } catch (Exception e) { LOGGER.log(Level.WARNING, this.getClass().getSimpleName() + ": Failed loading effect for Skill Id[" + statsSet.getInt(".id") + "] Level[" + level + "] SubLevel[" + subLevel + "] Effect Scope[" + effectScope + "] Effect Name[" + effectName + "]", e); } })); forEachNamedParamInfoParam(conditionParamInfo, level, subLevel, ((skillConditionScope, params) -> { final String conditionName = params.getString(".name"); params.remove(".name"); try { final Function<StatsSet, ISkillCondition> conditionFunction = SkillConditionHandler.getInstance().getHandlerFactory(conditionName); if (conditionFunction != null) { skill.addCondition(skillConditionScope, conditionFunction.apply(params)); } else { LOGGER.warning(this.getClass().getSimpleName() + ": Missing condition for Skill Id[" + statsSet.getInt(".id") + "] Level[" + level + "] SubLevel[" + subLevel + "] Effect Scope[" + skillConditionScope + "] Effect Name[" + conditionName + "]"); } } catch (Exception e) { LOGGER.log(Level.WARNING, this.getClass().getSimpleName() + ": Failed loading condition for Skill Id[" + statsSet.getInt(".id") + "] Level[" + level + "] SubLevel[" + subLevel + "] Condition Scope[" + skillConditionScope + "] Condition Name[" + conditionName + "]", e); } })); _skills.put(getSkillHashCode(skill), skill); _skillsMaxLevel.merge(skill.getId(), skill.getLevel(), Integer::max); if ((skill.getSubLevel() % 1000) == 1) { EnchantSkillGroupsData.getInstance().addRouteForSkill(skill.getId(), skill.getLevel(), skill.getSubLevel()); } }); }); } } } } } private <T> void forEachNamedParamInfoParam(Map<T, List<NamedParamInfo>> paramInfo, int level, int subLevel, BiConsumer<T, StatsSet> consumer) { paramInfo.forEach((scope, namedParamInfos) -> { namedParamInfos.forEach(namedParamInfo -> { if (((namedParamInfo.getFromLevel() == null) && (namedParamInfo.getToLevel() == null)) || ((namedParamInfo.getFromLevel() <= level) && (namedParamInfo.getToLevel() >= level))) { if (((namedParamInfo.getFromSubLevel() == null) && (namedParamInfo.getToSubLevel() == null)) || ((namedParamInfo.getFromSubLevel() <= subLevel) && (namedParamInfo.getToSubLevel() >= subLevel))) { final StatsSet params = Optional.ofNullable(namedParamInfo.getInfo().getOrDefault(level, Collections.emptyMap()).get(subLevel)).orElseGet(StatsSet::new); namedParamInfo.getInfo().getOrDefault(level, Collections.emptyMap()).getOrDefault(-1, StatsSet.EMPTY_STATSET).getSet().forEach(params.getSet()::putIfAbsent); namedParamInfo.getInfo().getOrDefault(-1, Collections.emptyMap()).getOrDefault(-1, StatsSet.EMPTY_STATSET).getSet().forEach(params.getSet()::putIfAbsent); params.set(".name", namedParamInfo.getName()); consumer.accept(scope, params); } } }); }); } private NamedParamInfo parseNamedParamInfo(Node node, Map<String, Map<Integer, Map<Integer, Object>>> variableValues) { final NamedNodeMap attributes = node.getAttributes(); final String name = parseString(attributes, "name"); final Integer level = parseInteger(attributes, "level"); final Integer fromLevel = parseInteger(attributes, "fromLevel", level); final Integer toLevel = parseInteger(attributes, "toLevel", level); final Integer subLevel = parseInteger(attributes, "subLevel"); final Integer fromSubLevel = parseInteger(attributes, "fromSubLevel", subLevel); final Integer toSubLevel = parseInteger(attributes, "toSubLevel", subLevel); final Map<Integer, Map<Integer, StatsSet>> info = new HashMap<>(); for (node = node.getFirstChild(); node != null; node = node.getNextSibling()) { if (!node.getNodeName().equals("#text")) { parseInfo(node, variableValues, info); } } return new NamedParamInfo(name, fromLevel, toLevel, fromSubLevel, toSubLevel, info); } private void parseInfo(Node node, Map<String, Map<Integer, Map<Integer, Object>>> variableValues, Map<Integer, Map<Integer, StatsSet>> info) { Map<Integer, Map<Integer, Object>> values = parseValues(node); final Object generalValue = values.getOrDefault(-1, Collections.emptyMap()).get(-1); if (generalValue != null) { final String stringGeneralValue = String.valueOf(generalValue); if (stringGeneralValue.startsWith("@")) { Map<Integer, Map<Integer, Object>> variableValue = variableValues.get(stringGeneralValue); if (variableValue != null) { values = variableValue; } else { throw new IllegalArgumentException("undefined variable " + stringGeneralValue); } } } values.forEach((level, subLevelMap) -> { subLevelMap.forEach((subLevel, value) -> { info.computeIfAbsent(level, (k) -> new HashMap<>()).computeIfAbsent(subLevel, (k) -> new StatsSet()).set(node.getNodeName(), value); }); }); } private Map<Integer, Map<Integer, Object>> parseValues(Node node) { final Map<Integer, Map<Integer, Object>> values = new HashMap<>(); Object parsedValue = parseValue(node, true, false, Collections.emptyMap()); if (parsedValue != null) { values.computeIfAbsent(-1, (k) -> new HashMap<>()).put(-1, parsedValue); } else { for (node = node.getFirstChild(); node != null; node = node.getNextSibling()) { if (node.getNodeName().equalsIgnoreCase("value")) { final NamedNodeMap attributes = node.getAttributes(); final Integer level = parseInteger(attributes, "level"); if (level != null) { parsedValue = parseValue(node, false, false, Collections.emptyMap()); if (parsedValue != null) { final Integer subLevel = parseInteger(attributes, "subLevel", -1); values.computeIfAbsent(level, (k) -> new HashMap<>()).put(subLevel, parsedValue); } } else { final int fromLevel = parseInteger(attributes, "fromLevel"); final int toLevel = parseInteger(attributes, "toLevel"); final int fromSubLevel = parseInteger(attributes, "fromSubLevel", -1); final int toSubLevel = parseInteger(attributes, "toSubLevel", -1); for (int i = fromLevel; i <= toLevel; i++) { for (int j = fromSubLevel; j <= toSubLevel; j++) { Map<Integer, Object> subValues = values.computeIfAbsent(i, (k) -> new HashMap<>()); Map<String, Double> variables = new HashMap<>(); variables.put("index", (i - fromLevel) + 1d); variables.put("subIndex", (j - fromSubLevel) + 1d); Object base = values.getOrDefault(i, Collections.emptyMap()).get(-1); if ((base != null) && !(base instanceof StatsSet)) { variables.put("base", Double.parseDouble(String.valueOf(base))); } parsedValue = parseValue(node, false, false, variables); if (parsedValue != null) { subValues.put(j, parsedValue); } } } } } } } return values; } Object parseValue(Node node, boolean blockValue, boolean parseAttributes, Map<String, Double> variables) { StatsSet statsSet = null; List<Object> list = null; Object text = null; if (parseAttributes && (!node.getNodeName().equals("value") || !blockValue) && (node.getAttributes().getLength() > 0)) { statsSet = new StatsSet(); parseAttributes(node.getAttributes(), "", statsSet, variables); } for (node = node.getFirstChild(); node != null; node = node.getNextSibling()) { final String nodeName = node.getNodeName(); switch (node.getNodeName()) { case "#text": { final String value = node.getNodeValue().trim(); if (!value.isEmpty()) { text = parseNodeValue(value, variables); } break; } case "item": { if (list == null) { list = new LinkedList<>(); } final Object value = parseValue(node, false, true, variables); if (value != null) { list.add(value); } break; } case "value": { if (blockValue) { break; } } default: { final Object value = parseValue(node, false, true, variables); if (value != null) { if (statsSet == null) { statsSet = new StatsSet(); } statsSet.set(nodeName, value); } } } } if (list != null) { if (text != null) { throw new IllegalArgumentException("Text and list in same node are not allowed. Node[" + node + "]"); } if (statsSet != null) { statsSet.set(".", list); } else { return list; } } if (text != null) { if (list != null) { throw new IllegalArgumentException("Text and list in same node are not allowed. Node[" + node + "]"); } if (statsSet != null) { statsSet.set(".", text); } else { return text; } } return statsSet; } private void parseAttributes(NamedNodeMap attributes, String prefix, StatsSet statsSet, Map<String, Double> variables) { for (int i = 0; i < attributes.getLength(); i++) { final Node attributeNode = attributes.item(i); statsSet.set(prefix + "." + attributeNode.getNodeName(), parseNodeValue(attributeNode.getNodeValue(), variables)); } } private void parseAttributes(NamedNodeMap attributes, String prefix, StatsSet statsSet) { parseAttributes(attributes, prefix, statsSet, Collections.emptyMap()); } private Object parseNodeValue(String value, Map<String, Double> variables) { if (value.startsWith("{") && value.endsWith("}")) { return new ExpressionBuilder(value).variables(variables.keySet()).build().setVariables(variables).evaluate(); } return value; } public static SkillData getInstance() { return SingletonHolder._instance; } private static class SingletonHolder { protected static final SkillData _instance = new SkillData(); } } this is my SkillData and my database and XML are fine
  10. hi all. I have a problem with the game server, check affect and all the handler. already verify the xml, and this is all fine, this error occurs when finish loading the Handlers Can any give me a suggestion?
  11. <skill id="10010" levels="4" name="Horn Melody"> <table name="#abnormalLvls"> 1 2 3 4 </table> <table name="#pAtk"> 1.17 1.19 1.21 1.23 </table> <table name="#pDef"> 1.15 1.15 1.15 1.15 </table> <table name="#mAtk"> 1.79 1.83 1.87 1.91 </table> <table name="#mDef"> 1.30 1.30 1.30 1.30 </table> <table name="#aggroPoints"> 379 457 532 610 </table> <table name="#mpConsume"> 28 35 41 47</table> <table name="#mpInitialConsume"> 7 9 11 13</table> <set name="abnormalLvl" val="#abnormalLvls" /> <set name="abnormalTime" val="1200" /> <set name="abnormalType" val="MELODY_HORN" /> <set name="aggroPoints" val="#aggroPoints" /> <set name="castRange" val="400" /> <set name="effectRange" val="900" /> <set name="hitTime" val="4000" /> <set name="isMagic" val="1" /> <!-- Magic Skill --> <set name="mpConsume" val="#mpConsume" /> <set name="mpInitialConsume" val="#mpInitialConsume" /> <set name="operateType" val="A2" /> <set name="reuseDelay" val="2000" /> <set name="skillType" val="BUFF" /> <set name="targetType" val="PARTY_MEMBER" /> <set name="blockBuffSlot" val="PA_UP;PD_UP;MA_UP;MD_UP;IMPROVE_MA_MD_UP;IMPROVE_PA_PD_UP" /> <for> <effect name="Buff" val="0"> <mul order="0x30" stat="pAtk" val="#pAtk" /> <mul order="0x30" stat="pDef" val="#pDef" /> <mul order="0x30" stat="mAtk" val="#mAtk" /> <mul order="0x30" stat="mDef" val="#mDef" /> </effect> <effect name="DispelBySlotProbability" noicon="1" val="0"> <param dispel="PA_UP,9;PD_UP,9;MA_UP,9;MD_UP,9;IMPROVE_MA_MD_UP,9;IMPROVE_PA_PD_UP,9" /> </effect> <effect name="BlockBuffSlot" noicon="1" val="0"> <param slot="PA_UP;PD_UP;MA_UP;MD_UP;IMPROVE_MA_MD_UP;IMPROVE_PA_PD_UP" /> </effect> </for> </skill> Yeah, Only adap the part of XML the GOD. thanks for replying me.
  12. Hi all. Plz. I need help with this. :- Ver: High Five. feb 18, 2017 3:43:00 PM com.l2jserver.gameserver.engines.DocumentBase parse GRAVE: Error in file F:\L2\Server\Porn\game\data\stats\skills\custom\10000-10999.xml java.lang.NullPointerException at com.l2jserver.gameserver.engines.DocumentBase.attachFunc(DocumentBase.java:268) at com.l2jserver.gameserver.engines.DocumentBase.parseTemplate(DocumentBase.java:228) at com.l2jserver.gameserver.engines.DocumentBase.attachEffect(DocumentBase.java:459) at com.l2jserver.gameserver.engines.DocumentBase.parseTemplate(DocumentBase.java:260) at com.l2jserver.gameserver.engines.skills.DocumentSkill.parseSkill(DocumentSkill.java:503) at com.l2jserver.gameserver.engines.skills.DocumentSkill.parseDocument(DocumentSkill.java:125) at com.l2jserver.gameserver.engines.DocumentBase.parse(DocumentBase.java:160) at com.l2jserver.gameserver.engines.DocumentEngine.loadSkills(DocumentEngine.java:88) at com.l2jserver.gameserver.engines.DocumentEngine.loadAllSkills(DocumentEngine.java:97) at com.l2jserver.gameserver.datatables.SkillTable.load(SkillTable.java:60) at com.l2jserver.gameserver.datatables.SkillTable.<init>(SkillTable.java:47) at com.l2jserver.gameserver.datatables.SkillTable$SingletonHolder.<clinit>(SkillTable.java:222) at com.l2jserver.gameserver.datatables.SkillTable.getInstance(SkillTable.java:217) at com.l2jserver.gameserver.GameServer.<init>(GameServer.java:241) at com.l2jserver.gameserver.GameServer.main(GameServer.java:566)
  13. L2Character.java public Inventory getInventory() { return null; } public boolean destroyItemByItemId(String process, int itemId, long count, L2Object reference, boolean sendMessage) { // Default: NPCs consume virtual items for their skills // TODO: should be logged if even happens.. should be false return true; } public boolean destroyItem(String process, int objectId, long count, L2Object reference, boolean sendMessage) { // Default: NPCs consume virtual items for their skills // TODO: should be logged if even happens.. should be false return true; } testing other method
×
×
  • Create New...