Jump to content
  • 0

L2J Acis Buffer.....again


as3mble

Question

Hello, I'm trying to create a l2j server based on Acis, but cant find out a proper buffer for it. Maybe you can suggest a working java based buffer? ( I tried google, and I was looking in forum). I realy need a good advise, please help :(

Link to comment
Share on other sites

Recommended Posts

  • 0
/*
 * 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.commons.random.Rnd;

import net.sf.l2j.gameserver.data.SkillTable;
import net.sf.l2j.gameserver.model.actor.ai.CtrlIntention;
import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
import net.sf.l2j.gameserver.network.serverpackets.MagicSkillUse;
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;


/**
*
* @author KDerD64
*/
public final class L2BufferInstance extends Folk
{
	public L2BufferInstance(int objectId, NpcTemplate template)
    {
        super(objectId, template);
    }


     @Override
    public void onBypassFeedback(Player 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, -1, 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(Player 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(8));
         broadcastPacket(sa);
         player.setCurrentFolkNPC(this);
         showMessageWindow(player);
         player.sendPacket(ActionFailed.STATIC_PACKET);
      }
      else {
         player.getAI().setIntention(CtrlIntention.INTERACT, this);
         player.sendPacket(ActionFailed.STATIC_PACKET);
      }
    }
   
    private void showMessageWindow(Player 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";
   }   
}

is this correct? i use versuvio acis buffer by KDerD64 and with that formation i didnt have an error in eclipse.

Edited by thepsolartek
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...