#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    8
    Rep Power
    0

    Server issue code.


    Hey guys I've been trying to crack this bug I'm not the best at java but i keep getting this error on my server I'm running.
    Any help is greatly appreciated thanks again.

    i49.tinypic. com/51r7lx.jpg
  2. #2
  3. Lord of the Dance
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Oct 2003
    Posts
    3,600
    Rep Power
    1906
    Do you have access to the source code?

    The program try to read objects number 9 in a array which does not exists. The array have less then 9 objects.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    8
    Rep Power
    0

    hm


    I have the C_UseSkill file its messing up on..


    */
    package l1j.server.server.clientpackets;

    import java.util.logging.Level;
    import java.util.logging.Logger;

    import l1j.server.Config;
    import l1j.server.server.ActionCodes;
    import l1j.server.server.ClientThread;
    import l1j.server.server.datatables.SkillsTable;
    import l1j.server.server.model.AcceleratorChecker;
    import l1j.server.server.model.L1World;
    import l1j.server.server.model.Instance.L1PcInstance;
    import l1j.server.server.model.skill.L1SkillUse;
    import l1j.server.server.serverpackets.S_ServerMessage;
    import static l1j.server.server.model.skill.L1SkillId.*;

    // Referenced classes of package l1j.server.server.clientpackets:
    // ClientBasePacket
    public class C_UseSkill extends ClientBasePacket {

    private static Logger _log = Logger.getLogger(C_UseSkill.class.getName());

    public C_UseSkill(byte abyte0[], ClientThread client) throws Exception {
    super(abyte0);
    int row = readC();
    int column = readC();
    int skillId = (row * 8) + column + 1;
    String charName = null;
    String message = null;
    int targetId = 0;
    int targetX = 0;
    int targetY = 0;
    L1PcInstance pc = client.getActiveChar();

    if (pc.isTeleport() || pc.isDead()) {
    return;
    }

    if (!pc.getMap().isUsableSkill()) {
    pc.sendPackets(new S_ServerMessage(563));
    return;
    }

    if (!pc.isSkillMastery(skillId)) {
    return;
    }

    if (Config.CHECK_SPELL_INTERVAL) {
    int result;
    // FIXME dir/no dir
    if (SkillsTable.getInstance().getTemplate(skillId).getActionId() == ActionCodes.ACTION_SkillAttack) {
    result = pc.getAcceleratorChecker().checkInterval(AcceleratorChecker.ACT_TYPE.SPELL_DIR);
    } else {
    result = pc.getAcceleratorChecker().checkInterval(AcceleratorChecker.ACT_TYPE.SPELL_NODIR);
    }
    if (result == AcceleratorChecker.R_DISCONNECTED) {
    return;
    }
    }

    if (abyte0.length > 4) {
    try {
    if (skillId == CALL_CLAN || skillId == RUN_CLAN) {
    charName = readS();
    } else if (skillId == TRUE_TARGET) {
    targetId = readD();
    targetX = readH();
    targetY = readH();
    message = readS();
    } else if (skillId == TELEPORT || skillId == MASS_TELEPORT) {
    readH(); // MapID
    targetId = readD(); // Bookmark ID
    } else if (skillId == FIRE_WALL || skillId == LIFE_STREAM) {
    targetX = readH();
    targetY = readH();
    } else {
    targetId = readD();
    //targetX = readH();
    //targetY = readH();
    }
    } catch (Exception e) {
    _log.log(Level.SEVERE, "", e);
    }
    }

    if (pc.isTeleport()) {
    return;
    }

    if (pc.isDead()) {
    return;
    }

    if (pc.hasSkillEffect(ABSOLUTE_BARRIER)) {
    pc.killSkillEffectTimer(ABSOLUTE_BARRIER);
    pc.startHpRegeneration();
    pc.startMpRegeneration();
    pc.startMpRegenerationByDoll();
    }
    pc.killSkillEffectTimer(MEDITATION);

    try {
    if (skillId == CALL_CLAN || skillId == RUN_CLAN) {
    if (charName.isEmpty()) {
    return;
    }

    L1PcInstance target = L1World.getInstance().getPlayer(charName);

    if (target == null) {
    pc.sendPackets(new S_ServerMessage(73, charName));
    return;
    }

    if (pc.getClanid() != target.getClanid()) {
    pc.sendPackets(new S_ServerMessage(414));
    return;
    }
    targetId = target.getId();
    if (skillId == CALL_CLAN) {
    int callClanId = pc.getCallClanId();
    if (callClanId == 0 || callClanId != targetId) {
    pc.setCallClanId(targetId);
    pc.setCallClanHeading(pc.getHeading());
    }
    }
    }
    L1SkillUse l1skilluse = new L1SkillUse();
    l1skilluse.handleCommands(pc, skillId, targetId, targetX, targetY, message, 0, L1SkillUse.TYPE_NORMAL);
    } catch (Exception e) {
    e.printStackTrace();
    }
    }
    }
  6. #4
  7. Lord of the Dance
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Oct 2003
    Posts
    3,600
    Rep Power
    1906
    It fails in the function readH() from the extended class ClientBasePacket.
    How does this function looks like?
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    8
    Rep Power
    0
    not sure exactly what you mean.
    I get the error code while someone uses a spell in game.
    Thats the only time it comes up.

    Thats why im soo confused
  10. #6
  11. Lord of the Dance
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Oct 2003
    Posts
    3,600
    Rep Power
    1906
    I am talking about the error you received as shown on the screen shot you linked to.
    It tells that the error relates to the function readH().

    What does readH() do?
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    8
    Rep Power
    0
    Thats why i am lost. If you wanna send me a private message i could look and find but its really killing the server i run it for free just trying to have some fun.
    Wish i knew a bit more about java.
  14. #8
  15. Lord of the Dance
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Oct 2003
    Posts
    3,600
    Rep Power
    1906
    I can see you are trying to fix a complete game project (https://java2s.com/Open-Source/Java/Game/l1j-tw-99nets/Catalogl1j-tw-99nets.htm).

    Without any knowledge of what is doing what, it is hard to come with a fix.
    It looks like it just increase the index number without resetting it.

    Furthermore, the ClientBasePacket class is one big code with ZERO comments of how it works.

    if you know Chinese, you can try ask here:
    http://www.l1j-tw.com/L1J-TW_bbs/
    Last edited by MrFujin; March 9th, 2013 at 03:42 AM.
  16. #9
  17. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    8
    Rep Power
    0

    hm


    github . com/l1j/en is the current server im working on and with before i had no issues its a change up for me new files new stuff.

IMN logo majestic logo threadwatch logo seochat tools logo