Jump to content

Recommended Posts

Posted (edited)

simplest custom buffer - easy in use, intuitive window. magical support has been divided onto five independent groups where users can buffup themselves manually or automatically via two pre-definied sets (mage, fighter).

 

also there's an additional option to bestow heroic valor effect in exchange for any item (in this case: gold bar).

i recommend to combine this feature with vote reward system :)

 

preview: http://s9.postimg.org/czbrb670v/buffer.gif

 

 

create new instance:

java/gameserver/model/actor/instance/L2BufferInstance.java

/*
 * 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.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.model.actor.template.NpcTemplate;

/**
*
* @author Caparso
*/

public final class L2BufferInstance extends L2NpcInstance
{
	int fighterbuffs [] = {1397,1087,1044,1243,1304,1259,1204,1068,1388,1040,1036,1035,1048,1045,1077,1242,1086,1043,1240,1268,1032,1033,1191,1189,1182,1354,1353,1352,1392,1393,4699,4700,1416,1363,277,307,309,311,310,272,271,275,274,264,269,265,270,267,268,266,364,349,308,306,304};
	int magebuffs [] = {1397,1087,1044,1243,1304,1259,1204,1040,1389,1036,1035,1048,1045,1085,1078,1303,1059,1032,1033,1191,1189,1182,1353,1354,1352,1392,1393,4703,1416,1363,273,276,365,307,309,311,264,265,270,267,268,266,363,349,308,306,304};
	int voterewards [] = {1374};
	
    public L2BufferInstance(int objectId, NpcTemplate 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, -1, 0);
				SkillTable.getInstance().getInfo(buffid, bufflevel).getEffects(this, player);
				showMessageWindow(player);
				player.broadcastPacket(mgc);
                showChatWindow(player, nextWindow);
			}
		}
		else if (actualCommand.equalsIgnoreCase("fighterset"))
		{
			for (int id: fighterbuffs)
			{
				SkillTable.getInstance().getInfo(id, SkillTable.getInstance().getMaxLevel(id)).getEffects(this, player);
			}
			showChatWindow(player);
		}
		else if (actualCommand.equalsIgnoreCase("mageset"))
		{
			for (int id: magebuffs)
			{
				SkillTable.getInstance().getInfo(id, SkillTable.getInstance().getMaxLevel(id)).getEffects(this, player);
			}
    	  showChatWindow(player);
		}
		else if (actualCommand.equalsIgnoreCase("rewards"))
		{
			if (player.destroyItemByItemId("voterewards",10600,1, player.getCurrentFolkNPC(), true))
			{
				for (int id: voterewards)
				{
    			SkillTable.getInstance().getInfo(id, SkillTable.getInstance().getMaxLevel(id)).getEffects(this, player);
				}
			}	
			else
			{
				player.sendMessage("You don't have heroic's certifications to exchange.");
			}
			showChatWindow(player);
		}
		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(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(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";
   }   
}
create new npc:

<npc id="9001" idTemplate="31081" name="BUFFER" title="L2EUPHORIA.COM">
        <set name="level" val="70"/>
        <set name="radius" val="8"/>
        <set name="height" val="30.5"/>
        <set name="rHand" val="0"/>
        <set name="lHand" val="5802"/>
        <set name="type" val="L2Buffer"/>
        <set name="exp" val="0"/>
        <set name="sp" val="0"/>
        <set name="hp" val="2444.46819"/>
        <set name="mp" val="1345.8"/>
        <set name="hpRegen" val="7.5"/>
        <set name="mpRegen" val="2.7"/>
        <set name="pAtk" val="688.86373"/>
        <set name="pDef" val="295.91597"/>
        <set name="mAtk" val="470.40463"/>
        <set name="mDef" val="216.53847"/>
        <set name="crit" val="4"/>
        <set name="atkSpd" val="253"/>
        <set name="str" val="40"/>
        <set name="int" val="21"/>
        <set name="dex" val="30"/>
        <set name="wit" val="20"/>
        <set name="con" val="43"/>
        <set name="men" val="20"/>
        <set name="corpseTime" val="7"/>
        <set name="walkSpd" val="50"/>
        <set name="runSpd" val="120"/>
        <set name="dropHerbGroup" val="0"/>
        <set name="attackRange" val="40"/>
        <ai type="default" ssCount="0" ssRate="0" spsCount="0" spsRate="0" aggro="0" canMove="true" seedable="false"/>
        <skills>
            <skill id="4045" level="1"/>
            <skill id="4416" level="14"/>
        </skills>
    </npc>
don't forget to paste this folder within htmls in the right section (gameserver/data/html), then spawn 9001. Edited by Caparso
  • 4 months later...
Posted (edited)


    [javac] C:\Users\ElTyto\workspace\aCis_gameserver\java\net\sf\l2j\gameserver\model\actor\instance\L2BufferInstance.java:23: error: package net.sf.l2j.commons.random does not exist

    [javac] import net.sf.l2j.commons.random.Rnd;

    [javac]                                 ^

    [javac] C:\Users\ElTyto\workspace\aCis_gameserver\java\net\sf\l2j\gameserver\model\actor\instance\L2BufferInstance.java:139: error: cannot find symbol

    [javac] SocialAction sa = new SocialAction(this, Rnd.get(8));

    [javac]                                         ^

    [javac]   symbol:   variable Rnd

    [javac]   location: class L2BufferInstance

    [javac] 2 errors

Edited by ElTyto
Posted
    [javac] C:\Users\ElTyto\workspace\aCis_gameserver\java\net\sf\l2j\gameserver\model\actor\instance\L2BufferInstance.java:23: error: package net.sf.l2j.commons.random does not exist
    [javac] import net.sf.l2j.commons.random.Rnd;
    [javac]                                 ^
    [javac] C:\Users\ElTyto\workspace\aCis_gameserver\java\net\sf\l2j\gameserver\model\actor\instance\L2BufferInstance.java:139: error: cannot find symbol
    [javac]  SocialAction sa = new SocialAction(this, Rnd.get(8));
    [javac]                                           ^
    [javac]   symbol:   variable Rnd
    [javac]   location: class L2BufferInstance
    [javac] 2 errors

 

Replace it with this:

/*
 * 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.model.actor.template.NpcTemplate;

/**
*
* @author Caparso
*/

public final class L2BufferInstance extends L2NpcInstance
{
	int fighterbuffs [] = {1397,1087,1044,1243,1304,1259,1204,1068,1388,1040,1036,1035,1048,1045,1077,1242,1086,1043,1240,1268,1032,1033,1191,1189,1182,1354,1353,1352,1392,1393,4699,4700,1416,1363,277,307,309,311,310,272,271,275,274,264,269,265,270,267,268,266,364,349,308,306,304};
	int magebuffs [] = {1397,1087,1044,1243,1304,1259,1204,1040,1389,1036,1035,1048,1045,1085,1078,1303,1059,1032,1033,1191,1189,1182,1353,1354,1352,1392,1393,4703,1416,1363,273,276,365,307,309,311,264,265,270,267,268,266,363,349,308,306,304};
	int voterewards [] = {1374};
	
    public L2BufferInstance(int objectId, NpcTemplate 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, -1, 0);
				SkillTable.getInstance().getInfo(buffid, bufflevel).getEffects(this, player);
				showMessageWindow(player);
				player.broadcastPacket(mgc);
                showChatWindow(player, nextWindow);
			}
		}
		else if (actualCommand.equalsIgnoreCase("fighterset"))
		{
			for (int id: fighterbuffs)
			{
				SkillTable.getInstance().getInfo(id, SkillTable.getInstance().getMaxLevel(id)).getEffects(this, player);
			}
			showChatWindow(player);
		}
		else if (actualCommand.equalsIgnoreCase("mageset"))
		{
			for (int id: magebuffs)
			{
				SkillTable.getInstance().getInfo(id, SkillTable.getInstance().getMaxLevel(id)).getEffects(this, player);
			}
    	  showChatWindow(player);
		}
		else if (actualCommand.equalsIgnoreCase("rewards"))
		{
			if (player.destroyItemByItemId("voterewards",10600,1, player.getCurrentFolkNPC(), true))
			{
				for (int id: voterewards)
				{
    			SkillTable.getInstance().getInfo(id, SkillTable.getInstance().getMaxLevel(id)).getEffects(this, player);
				}
			}	
			else
			{
				player.sendMessage("You don't have heroic's certifications to exchange.");
			}
			showChatWindow(player);
		}
		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, 1);
			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(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";
   }   

It will work...

Posted (edited)

There is no errors, else you use old rev :P About your 'error', ush Ctrl + Shift + O.

 

If you still have error here SocialAction sa = new SocialAction(this, Rnd.get( 8)); do like SocialAction sa = new SocialAction(this, 2); or any number, it's social action animation or remove it.

Edited by SweeTs
Posted

There is no errors, else you use old rev :P About your 'error', ush Ctrl + Shift + O.

 

If you still have error here SocialAction sa = new SocialAction(this, Rnd.get( 8)); do like SocialAction sa = new SocialAction(this, 2); or any number, it's social action animation or remove it.

I dont get it ^^

  • 4 months later...
Posted (edited)

what item id need for buff valor?

also there's an additional option to bestow heroic valor effect in exchange for any item (in this case: gold bar).

Edited by thanosdk

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



  • Posts

    • I had friends who played on Elegant and I can confirm it wasn't a bad server. I don't know about the AI bots running around, but in my opinion the price is simply too high. I don't think many people will spend that much money on Lineage 2 files when alternatives like L2Scripts already exist.   Of course it's all about personal preference, but for such an old chronicle the price seems ridiculously expensive. Modern chronicles usually offer more value.   Anyway, I wish you the best of luck with the sale. This is just my personal opinion. Whoever likes it, good for them, and whoever doesn't, that's fine too. Everyone has different preferences.
    • https://l2avokado.com/ Hello everyone,   After some time of development, we've decided to open L2Avokado to the public in its current development stage. We're looking for players who enjoy Interlude and would like to help shape the project before its official release.   This isn't a "launch" announcement. Instead, we're inviting the community to log in, explore the server, test the systems we've built, and provide honest feedback. Whether it's bug reports, balance suggestions, progression ideas, or quality-of-life improvements, we'd love to hear them.   Our goal has always been to create an Interlude server that feels familiar while offering a fresh progression experience. We've intentionally avoided custom weapons, armor, and client modifications. Instead, we've focused on redesigning progression through reworked hunting grounds, quests, crafting, and gameplay systems while remaining compatible with a clean Interlude client.   At this stage, the core progression path has been implemented, including the main hunting grounds, quests, custom systems, and events. However, as the project is still under active development, there will inevitably be bugs, balance issues, and areas that require further polishing.   This is exactly why we'd like your help.   We're looking for players who are willing to: Test gameplay and progression. Report bugs and exploits. Suggest balance improvements. Share ideas for new features or quality-of-life changes. Help us build a server that the community genuinely enjoys playing.   The Client and System downloads are already available on our website, so you can jump straight into the game. We're also working on a dedicated launcher that will simplify installation and future updates.   If you're interested in helping develop a unique Interlude project and want your feedback to genuinely influence the direction of the server, we'd love to have you with us.   We look forward to seeing you in-game and hearing your thoughts on Discord. https://l2avokado.com/
    • Mate your server used to play with full of bots, from where you find that revenue? 
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..