March 7th, 2013, 12:27 AM
-
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
March 7th, 2013, 05:01 AM
-
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.
March 7th, 2013, 03:53 PM
-
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();
}
}
}
March 7th, 2013, 05:23 PM
-
It fails in the function readH() from the extended class ClientBasePacket.
How does this function looks like?
March 7th, 2013, 08:58 PM
-
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
March 8th, 2013, 03:39 AM
-
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?
March 8th, 2013, 08:27 PM
-
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.
March 9th, 2013, 03:36 AM
-
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.
March 9th, 2013, 06:21 PM
-
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.