08-02-2013, 04:29 PM
в общем химичил, химичил, получилось вот это
теперь оно ругается на выделенные строки, не подскажите в чем проблема?
Код:
package com.l2jserver.gameserver.communitybbs.Manager;
import com.l2jserver.Config;
import com.l2jserver.L2DatabaseFactory;
import com.l2jserver.gameserver.cache.HtmCache;
import com.l2jserver.gameserver.datatables.SkillTable;
import com.l2jserver.gameserver.model.skills.L2Skill;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.entity.TvTEvent;
import com.l2jserver.gameserver.network.serverpackets.ExShowScreenMessage;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import com.l2jserver.gameserver.model.effects.L2Effect;
public class BuffBBSManager extends BaseBBSManager
{
private static BuffBBSManager _instance = new BuffBBSManager();
public int[][] allskillid_1;
public BuffBBSManager()
{
Load();
}
public static BuffBBSManager getInstance()
{
if (_instance == null)
_instance = new BuffBBSManager();
return _instance;
}
public void Load()
{
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
Statement s = con.createStatement();
ResultSet countt = s.executeQuery("SELECT COUNT(*) FROM communitybuff;");
ResultSet skills = s.executeQuery("SELECT * FROM communitybuff");)
{
countt.next();
this.allskillid_1 = new int[countt.getInt(1)][4];
for (int i = 0; i < this.allskillid_1.length; i++)
{
skills.next();
this.allskillid_1[i][0] = skills.getInt(2);
this.allskillid_1[i][1] = skills.getInt(3);
this.allskillid_1[i][2] = skills.getInt(4);
this.allskillid_1[i][3] = skills.getInt(5);
}
countt.close();
skills.close();
}
catch (Exception ignored)
{
}
}
public void parsecmd(String command, L2PcInstance activeChar)
{
String[] parts = command.split("_");
boolean petbuff = false;
if ((activeChar.isDead()) || (activeChar.isAlikeDead()) || (TvTEvent.isStarted()) || (activeChar.isInSiege()) || (activeChar.isCastingNow()) || (activeChar.isInCombat()) || (activeChar.isAttackingNow()) || (activeChar.isInOlympiadMode()) || (activeChar.isFlying()) || (activeChar.getKarma() > 0) || (activeChar.isInDuel()))
{
activeChar.sendMessage("Вы не можете использовать Бафера в данных условиях!");
}
else
{
if (!parts[2].startsWith("buff"))
return;
String content = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/3.htm");
separateAndSend(content, activeChar);
if ((parts[4] != null) && (parts[4].startsWith("Персонаж")))
{
petbuff = false;
}
if ((parts[4] != null) && (parts[4].startsWith("Питомец")))
{
petbuff = true;
}
if (parts[3].startsWith("FIGHERLIST"))
{
FIGHERLIST(activeChar, petbuff);
}
if (parts[3].startsWith("DANCEFIGHTERLIST"))
{
DANCEFIGHTERLIST(activeChar, petbuff);
}
if (parts[3].startsWith("MAGELIST"))
{
MAGELIST(activeChar, petbuff);
}
if (parts[3].startsWith("DANCEMAGELIST"))
{
DANCEMAGELIST(activeChar, petbuff);
}
if (parts[3].startsWith("SAVE"))
{
SAVE(activeChar, petbuff);
}
if (parts[3].startsWith("BUFF"))
{
BUFF(activeChar, petbuff);
}
if (parts[3].startsWith("CANCEL"))
{
CANCEL(activeChar, petbuff);
}
if (parts[3].startsWith("REGMP"))
{
REGMP(activeChar, petbuff);
}
[color=Red] for (int key = 0; key < this.allskillid_1.length; key++)[/color]
{
int skilllevel = SkillTable.getInstance().getMaxLevel(this.allskillid_1[key][0]);
L2Skill skill = SkillTable.getInstance().getInfo(this.allskillid_1[key][0], skilllevel);
if (parts[3].startsWith(skill.getName()))
SKILL(activeChar, petbuff, key, skill);
}
}
}
private void FIGHERLIST(L2PcInstance activeChar, boolean petbuff)
{
[COLOR="red"] int[][] arr$ = this.allskillid_1;
int len$ = arr$.length;[/COLOR]
for (int i$ = 0; i$ < len$; i$++)
{
int[] aSkillid = arr$[i$];
if ((aSkillid[1] == 1) || (aSkillid[1] == 3))
{
if (Config.MANI_BUFF)
{
if (activeChar.destroyItemByItemId(null, aSkillid[3], aSkillid[2], activeChar, true))
{
int skilllevel = SkillTable.getInstance().getMaxLevel(aSkillid[0]);
L2Skill skill = SkillTable.getInstance().getInfo(aSkillid[0], skilllevel);
if (!petbuff)
skill.getEffects(activeChar, activeChar);
else
skill.getEffects(activeChar.getSummon(), activeChar.getSummon());
}
else
{
activeChar.sendPacket(new ExShowScreenMessage("К сожалению у Вас недостаточно Аден!", 3000));
}
}
else {
int skilllevel = SkillTable.getInstance().getMaxLevel(aSkillid[0]);
L2Skill skill = SkillTable.getInstance().getInfo(aSkillid[0], skilllevel);
if (!petbuff)
skill.getEffects(activeChar, activeChar);
else
skill.getEffects(activeChar.getSummon(), activeChar.getSummon());
}
}
}
}
private void DANCEFIGHTERLIST(L2PcInstance activeChar, boolean petbuff) {
[COLOR="red"]int[][] arr$ = this.allskillid_1;
int len$ = arr$.length;[/COLOR]
for (int i$ = 0; i$ < len$; i$++)
{
int[] aSkillid = arr$[i$];
if ((aSkillid[1] == 4) || (aSkillid[1] == 6))
{
if (Config.MANI_BUFF)
{
if (activeChar.destroyItemByItemId(null, aSkillid[3], aSkillid[2], activeChar, true))
{
int skilllevel = SkillTable.getInstance().getMaxLevel(aSkillid[0]);
L2Skill skill = SkillTable.getInstance().getInfo(aSkillid[0], skilllevel);
if (!petbuff)
skill.getEffects(activeChar, activeChar);
else
skill.getEffects(activeChar.getSummon(), activeChar.getSummon());
}
else
{
activeChar.sendPacket(new ExShowScreenMessage("К сожалению у Вас недостаточно Аден!", 3000));
}
}
else {
int skilllevel = SkillTable.getInstance().getMaxLevel(aSkillid[0]);
L2Skill skill = SkillTable.getInstance().getInfo(aSkillid[0], skilllevel);
if (!petbuff)
skill.getEffects(activeChar, activeChar);
else
skill.getEffects(activeChar.getSummon(), activeChar.getSummon());
}
}
}
}
private void MAGELIST(L2PcInstance activeChar, boolean petbuff) {
int[][] arr$ = this.allskillid_1;
int len$ = arr$.length;
for (int i$ = 0; i$ < len$; i$++)
{
int[] aSkillid = arr$[i$];
if ((aSkillid[1] == 2) || (aSkillid[1] == 3))
{
if (Config.MANI_BUFF)
{
if (activeChar.destroyItemByItemId(null, aSkillid[3], aSkillid[2], activeChar, true))
{
int skilllevel = SkillTable.getInstance().getMaxLevel(aSkillid[0]);
L2Skill skill = SkillTable.getInstance().getInfo(aSkillid[0], skilllevel);
if (!petbuff)
skill.getEffects(activeChar, activeChar);
else
skill.getEffects(activeChar.getSummon(), activeChar.getSummon());
}
else
{
activeChar.sendPacket(new ExShowScreenMessage("К сожалению у Вас недостаточно Аден!", 3000));
}
}
else {
int skilllevel = SkillTable.getInstance().getMaxLevel(aSkillid[0]);
L2Skill skill = SkillTable.getInstance().getInfo(aSkillid[0], skilllevel);
if (!petbuff)
skill.getEffects(activeChar, activeChar);
else
skill.getEffects(activeChar.getSummon(), activeChar.getSummon());
}
}
}
}
private void DANCEMAGELIST(L2PcInstance activeChar, boolean petbuff) {
int[][] arr$ = this.allskillid_1;
int len$ = arr$.length;
for (int i$ = 0; i$ < len$; i$++)
{
int[] aSkillid = arr$[i$];
if ((aSkillid[1] == 5) || (aSkillid[1] == 6))
{
if (Config.MANI_BUFF)
{
if (activeChar.destroyItemByItemId(null, aSkillid[3], aSkillid[2], activeChar, true))
{
int skilllevel = SkillTable.getInstance().getMaxLevel(aSkillid[0]);
L2Skill skill = SkillTable.getInstance().getInfo(aSkillid[0], skilllevel);
if (!petbuff)
skill.getEffects(activeChar, activeChar);
else
skill.getEffects(activeChar.getSummon(), activeChar.getSummon());
}
else
{
activeChar.sendPacket(new ExShowScreenMessage("К сожалению у Вас недостаточно Аден!", 3000));
}
}
else {
int skilllevel = SkillTable.getInstance().getMaxLevel(aSkillid[0]);
L2Skill skill = SkillTable.getInstance().getInfo(aSkillid[0], skilllevel);
if (!petbuff)
skill.getEffects(activeChar, activeChar);
else
skill.getEffects(activeChar.getSummon(), activeChar.getSummon());
}
}
}
}
private void BUFF(L2PcInstance activeChar, boolean petbuff)
{
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
Statement s = con.createStatement();
ResultSet rcln = s.executeQuery("SELECT * FROM community_skillsave WHERE charId=?;");
PreparedStatement statement = con.prepareStatement("SELECT * FROM community_skillsave WHERE charId=?;"))
{
statement.setInt(1, activeChar.getObjectId());
rcln.next();
if (!petbuff)
{
char[] allskills = rcln.getString(2).toCharArray();
if (allskills.length == this.allskillid_1.length)
{
for (int i = 0; i < this.allskillid_1.length; i++) {
if (allskills[i] == '1')
if (Config.MANI_BUFF)
{
if (activeChar.destroyItemByItemId(null, this.allskillid_1[i][3], this.allskillid_1[i][2], activeChar, true))
{
int skilllevel = SkillTable.getInstance().getMaxLevel(this.allskillid_1[i][0]);
L2Skill skill = SkillTable.getInstance().getInfo(this.allskillid_1[i][0], skilllevel);
skill.getEffects(activeChar, activeChar);
activeChar.getLevel();
}
else
{
activeChar.sendPacket(new ExShowScreenMessage("К сожалению у Вас недостаточно Аден!", 3000));
}
}
else
{
int skilllevel = SkillTable.getInstance().getMaxLevel(this.allskillid_1[i][0]);
L2Skill skill = SkillTable.getInstance().getInfo(this.allskillid_1[i][0], skilllevel);
skill.getEffects(activeChar, activeChar);
}
}
}
}
else
{
char[] petskills = rcln.getString(3).toCharArray();
if (petskills.length == this.allskillid_1.length)
{
for (int i = 0; i < this.allskillid_1.length; i++)
{
if (petskills[i] == '1')
{
if (Config.MANI_BUFF)
{
if (activeChar.destroyItemByItemId(null, this.allskillid_1[i][3], this.allskillid_1[i][2], activeChar, true))
{
int skilllevel = SkillTable.getInstance().getMaxLevel(this.allskillid_1[i][0]);
L2Skill skill = SkillTable.getInstance().getInfo(this.allskillid_1[i][0], skilllevel);
skill.getEffects(activeChar.getSummon(), activeChar.getSummon());
}
else
{
activeChar.sendPacket(new ExShowScreenMessage("К сожалению у Вас недостаточно Аден!", 3000));
}
}
else
{
int skilllevel = SkillTable.getInstance().getMaxLevel(this.allskillid_1[i][0]);
L2Skill skill = SkillTable.getInstance().getInfo(this.allskillid_1[i][0], skilllevel);
skill.getEffects(activeChar.getSummon(), activeChar.getSummon());
}
}
}
}
}
rcln.close();
}
catch (Exception ignored)
{
}
}
private void CANCEL(L2PcInstance activeChar, boolean petbuff)
{
if (!petbuff)
activeChar.stopAllEffects();
else
activeChar.getSummon().stopAllEffects();
}
private void REGMP(L2PcInstance activeChar, boolean petbuff)
{
if (!petbuff)
activeChar.setCurrentMp(activeChar.getMaxMp());
else
activeChar.getSummon().setCurrentMp(activeChar.getSummon().getMaxMp());
}
private void SKILL(L2PcInstance activeChar, boolean petbuff, int key, L2Skill skill)
{
if (Config.MANI_BUFF)
{
if (activeChar.destroyItemByItemId(null, this.allskillid_1[key][3], this.allskillid_1[key][2], activeChar, true))
{
if (!petbuff) {
skill.getEffects(activeChar, activeChar);
}
else {
skill.getEffects(activeChar.getSummon(), activeChar.getSummon());
}
}
else {
activeChar.sendPacket(new ExShowScreenMessage("К сожалению у Вас недостаточно Аден!", 3000));
}
}
else if (!petbuff)
skill.getEffects(activeChar, activeChar);
else
skill.getEffects(activeChar.getSummon(), activeChar.getSummon());
}
private void SAVE(L2PcInstance activeChar, boolean petbuff)
{
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
Statement s = con.createStatement();
ResultSet rset = s.executeQuery("SELECT COUNT(*) FROM community_skillsave WHERE charId=?;");
PreparedStatement stat = con.prepareStatement("SELECT COUNT(*) FROM community_skillsave WHERE charId=?;"))
{
stat.setInt(1, activeChar.getObjectId());
rset.next();
String allbuff = "";
if (!petbuff)
{
L2Effect[] skill = activeChar.getAllEffects1();
boolean flag = true;
int[][] arr$ = this.allskillid_1;
int len$ = arr$.length;
for (int i$ = 0; i$ < len$; i$++)
{
int[] aSkillid = arr$[i$];
for (int j = 0; j < skill.length; j++)
{
if (aSkillid[0] == skill[j].getId())
{
allbuff = allbuff + 1;
flag = false;
}
if ((j == skill.length - 1) && (flag))
allbuff = allbuff + 0;
}
flag = true;
}
if (rset.getInt(1) == 0)
{
PreparedStatement statement1 = con.prepareStatement("INSERT INTO community_skillsave (charId,skills) values (?,?)");
statement1.setInt(1, activeChar.getObjectId());
statement1.setString(2, allbuff);
statement1.execute();
statement1.close();
}
else
{
PreparedStatement statement = con.prepareStatement("UPDATE community_skillsave SET skills=? WHERE charId=?;");
statement.setString(1, allbuff);
statement.setInt(2, activeChar.getObjectId());
statement.execute();
statement.close();
}
}
else
{
L2Effect[] skill = activeChar.getSummon().getAllEffects1();
boolean flag = true;
int[][] arr$ = this.allskillid_1;
int len$ = arr$.length;
for (int i$ = 0; i$ < len$; i$++)
{
int[] aSkillid = arr$[i$];
for (int j = 0; j < skill.length; j++)
{
if (aSkillid[0] == skill[j].getId())
{
allbuff = allbuff + 1;
flag = false;
}
if ((j == skill.length - 1) && (flag))
allbuff = allbuff + 0;
}
flag = true;
}
if (rset.getInt(1) == 0)
{
PreparedStatement statement1 = con.prepareStatement("INSERT INTO community_skillsave (charId,pet) values (?,?)");
statement1.setInt(1, activeChar.getObjectId());
statement1.setString(2, allbuff);
statement1.execute();
statement1.close();
}
else
{
PreparedStatement statement = con.prepareStatement("UPDATE community_skillsave SET pet=? WHERE charId=?;");
statement.setString(1, allbuff);
statement.setInt(2, activeChar.getObjectId());
statement.execute();
statement.close();
}
}
rset.close();
stat.close();
}
catch (Exception ignored)
{
}
}
public void parsewrite(String s, String s1, String s2, String s3, String s4, L2PcInstance l2pcinstance)
{
}
}
теперь оно ругается на выделенные строки, не подскажите в чем проблема?