EdenEternal Posted January 18, 2013 Posted January 18, 2013 Thanks for help to An4rchy Preview: Code: /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. * * http://www.gnu.org/copyleft/gpl.html */ package net.sf.l2j.gameserver.model.actor.instance; import java.util.StringTokenizer; import net.sf.l2j.gameserver.ai.CtrlIntention; import net.sf.l2j.gameserver.datatables.SkillTable; import net.sf.l2j.gameserver.network.serverpackets.ActionFailed; import net.sf.l2j.gameserver.network.serverpackets.MyTargetSelected; import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage; import net.sf.l2j.gameserver.network.serverpackets.SocialAction; import net.sf.l2j.gameserver.network.serverpackets.ValidateLocation; import net.sf.l2j.gameserver.network.serverpackets.MagicSkillUse; import net.sf.l2j.gameserver.templates.chars.L2NpcTemplate; import net.sf.l2j.util.StringUtil; import net.sf.l2j.util.Rnd; /** * * @author Leki */ public final class L2BufferInstance extends L2NpcInstance { public L2BufferInstance(int objectId, L2NpcTemplate template) { super(objectId, template); } @Override public void onBypassFeedback(L2PcInstance player, String command) { StringTokenizer st = new StringTokenizer(command, " "); String actualCommand = st.nextToken(); int buffid = 0; int bufflevel = 1; String nextWindow = null; if (st.countTokens() == 3) { buffid = Integer.valueOf(st.nextToken()); bufflevel = Integer.valueOf(st.nextToken()); nextWindow = st.nextToken(); } else if (st.countTokens() == 1) buffid = Integer.valueOf(st.nextToken()); if (actualCommand.equalsIgnoreCase("getbuff")) { if (buffid != 0) { MagicSkillUse mgc = new MagicSkillUse(this, player, buffid, bufflevel, 5, 0); SkillTable.getInstance().getInfo(buffid, bufflevel).getEffects(this, player); showMessageWindow(player); player.broadcastPacket(mgc); showChatWindow(player, nextWindow); } } else if (actualCommand.equalsIgnoreCase("restore")) { player.setCurrentHpMp(player.getMaxHp(), player.getMaxMp()); player.setCurrentCp(player.getMaxCp()); showMessageWindow(player); } else if (actualCommand.equalsIgnoreCase("cancel")) { player.stopAllEffects(); showMessageWindow(player); } else super.onBypassFeedback(player, command); } @Override public void onAction(L2PcInstance player) { if (this != player.getTarget()) { player.setTarget(this); player.sendPacket(new MyTargetSelected(getObjectId(), player.getLevel() - getLevel())); player.sendPacket(new ValidateLocation(this)); } else if (isInsideRadius(player, INTERACTION_DISTANCE, false, false)) { SocialAction sa = new SocialAction(this, Rnd.get(); broadcastPacket(sa); player.setCurrentFolkNPC(this); showMessageWindow(player); player.sendPacket(ActionFailed.STATIC_PACKET); } else { player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, this); player.sendPacket(ActionFailed.STATIC_PACKET); } } private void showMessageWindow(L2PcInstance player) { String filename = "data/html/buffer/" + getNpcId() + ".htm"; filename = getHtmlPath(getNpcId(), 0); NpcHtmlMessage html = new NpcHtmlMessage(getObjectId()); html.setFile(filename); html.replace("%objectId%", String.valueOf(getObjectId())); html.replace("%npcname%", getName()); player.sendPacket(html); } @Override public String getHtmlPath(int npcId, int val) { String pom = ""; if (val == 0) pom = "" + npcId; else pom = npcId + "-" + val; return "data/html/buffer/" + pom + ".htm"; } } htmls: http://www.4shared.com/rar/a1SBGWyx/Buffer.html? Copy to data/html/buffer/ Buffer id 36003
ElTyto Posted October 14, 2015 Posted October 14, 2015 [javac] C:\Users\ElTyto\workspace\aCis_gameserver\java\net\sf\l2j\gameserver\model\actor\instance\L2BufferInstance.java:1: error: class, interface, or enum expected [javac] program is free software; you can redistribute it and/or modify [javac] ^ [javac] C:\Users\ElTyto\workspace\aCis_gameserver\java\net\sf\l2j\gameserver\model\actor\instance\L2BufferInstance.java:1: error: class, interface, or enum expected [javac] program is free software; you can redistribute it and/or modify [javac] ^ [javac] C:\Users\ElTyto\workspace\aCis_gameserver\java\net\sf\l2j\gameserver\model\actor\instance\L2BufferInstance.java:3: error: class, interface, or enum expected [javac] * the Free Software Foundation; either version 2, or (at your option) [javac] ^ [javac] C:\Users\ElTyto\workspace\aCis_gameserver\java\net\sf\l2j\gameserver\model\actor\instance\L2BufferInstance.java:7: error: class, interface, or enum expected [javac] * but WITHOUT ANY WARRANTY; without even the implied warranty of [javac] ^ [javac] C:\Users\ElTyto\workspace\aCis_gameserver\java\net\sf\l2j\gameserver\model\actor\instance\L2BufferInstance.java:12: error: class, interface, or enum expected [javac] * along with this program; if not, write to the Free Software [javac] ^ [javac] C:\Users\ElTyto\workspace\aCis_gameserver\java\net\sf\l2j\gameserver\model\actor\instance\L2BufferInstance.java:102: error: ')' expected [javac] SocialAction sa = new SocialAction(this, Rnd.get(); [javac] ^ [javac] 6 errors BUILD FAILED
ElTyto Posted October 14, 2015 Posted October 14, 2015 C/p properly i copied and pasted his code in to my l2bufferinstance.java and it doesnt compile, how can i copy & paste not properly? would you mind to explain?
SweeTs Posted October 14, 2015 Posted October 14, 2015 (edited) 5 first errors... If you read it you would realise that its the GNU. About the 6th, you miss ) Dont you see errors when you add code? Edited October 14, 2015 by SweeTs
Rootware Posted October 14, 2015 Posted October 14, 2015 I don't understand some people who, posted errors from the console. What you doing, what Eclipse does not show errors in the project tree? Every second builds the project in console w/o of IDE help? Or NetBeans not highlights the errors? :dat:
ElTyto Posted October 14, 2015 Posted October 14, 2015 I don't understand some people who, posted errors from the console. What you doing, what Eclipse does not show errors in the project tree? Every second builds the project in console w/o of IDE help? Or NetBeans not highlights the errors? :dat: it highlights tho i cant fix all of them
SweeTs Posted October 14, 2015 Posted October 14, 2015 Move your cursor on the error, you will know what's wrong and possible solutions.
ElTyto Posted October 14, 2015 Posted October 14, 2015 Move your cursor on the error, you will know what's wrong and possible solutions. yeah i dont know java, so i cannot resolve those issues and im pretty sure that you wont help me either
SweeTs Posted October 15, 2015 Posted October 15, 2015 I already told you what to do in another topic, even gave a correct line.
ElTyto Posted October 15, 2015 Posted October 15, 2015 (edited) I already told you what to do in another topic, even gave a correct line. i know you did, but i still cant make it work -.- Edited October 15, 2015 by ElTyto
Recommended Posts