Party XP/SP not working.

Issue #314 resolved
roothere created an issue

A hardcoded fix:

private final long calculateExpSpPartyCutoff(L2PcInstance player, int topLvl, long addExp, int addSp, boolean vit) {
        long xp = addExp;
        int sp = addSp;
        if (character().getPartyXpCutoffMethod().equalsIgnoreCase("highfive")) {
                int i = 0;
                final int lvlDiff = topLvl - player.getLevel();
                for (Entry<Integer, Integer> gap : character().getPartyXpCutoffGaps().entrySet()) {
                        int baranka = 0;
                        if(i==0)
                                baranka = 100;
                        if(i==1)
                                baranka = 30;
                        if(i==2)
                                baranka = 0;
                        System.out.print("Baranka prasideda");
                        System.out.print(i);
                        System.out.print(baranka);
                        System.out.print(gap.getKey());
                        System.out.print(gap.getValue());
                        System.out.print(i);
                        if ((lvlDiff >= gap.getKey()) && (lvlDiff <= gap.getValue())) {
                                xp = (addExp * baranka) / 100;
                                sp = (addSp * baranka) / 100;
                                player.addExpAndSp(xp, sp, vit);
                                break;
                        }
                        i++;
                }
        } else {
                player.addExpAndSp(addExp, addSp, vit);
        }
        return xp;
}

Comments (7)

  1. Luka Lelashvili

    the problem is in config file, PartyXpCutoffGaps instead of “;” it should be seperated with “,” commas so that CharacterConfiguration can convert it into a list of 3 elements, in this case it only takes 1 element 100;30;0 so Integer parse error occurs

  2. Vagiz Duseev

    The line that interests us is in the src/main/resources/config/character.properties:
    PartyXpCutoffGapPercent = 100;30;0
    It is parsed by src/main/java/com/l2jserver/gameserver/config/CharacterConfiguration.java as a config statement into the list of integers:

    @Key("PartyXpCutoffGapPercent")
    List<Integer> getPartyXpCutoffGapPercent()
    

    The thing is – the CharacterConfiguration is inherited from org.aeonbits.owner.Reloadable and parses list of integers from property files using its own internal logic.
    According to owner library we can use an explicit @Separator(”;”) decorator or we can change the line in the config file itself.

    So, there are two ways to fix this:

    1. Change the delimiter in the src/main/resources/config/character.properties to comma ,.
      Which automatically inflicts problems on those running L2J long term and updating the server using Git, because they will suddenly find out that their old character configs are incompatible with the current version.
    2. Add @Separator decorator, which enforces ; delimiter.

  3. Log in to comment