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)

some changes were necessary, topic updated. it should works within latest rev now :)

Edited by Caparso
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

    • TELEGRAM SEO TRAINING (Bot Ranking in Search) I teach a complete system for ranking Telegram bots at the top of search results by keywords and countries. The method works for services, shops, crypto projects, and any type of Telegram bot. You can also direct the traffic to your groups, channels, websites, or sales funnels. ⸻  Countries I work with USA, Israel, Russia, India, Turkey, China, Ukraine, Uzbekistan. If you need another country — message me, we’ll find a solution. ⸻ ️ Results First search results appear in 2–3 days. ⸻  What’s included in the training • how the Telegram search algorithm works and key ranking factors • keyword research for your country and niche • bot optimization: description, settings, greeting text • fixing and maintaining positions • specific promotion nuances for different countries ⸻  What you will receive • a complete system for ranking bots in search • understanding how to work with keywords, traffic, and positions • a skill you can use to promote your own projects or earn from clients ⸻  Who this training is for • beginners with zero experience — I explain everything from scratch • those who don’t have a bot — I provide a ready one for practice • anyone who wants to learn promotion and earn from this service ⸻  Why learn from me • doing Telegram SEO since 2021 • over 1000 successful orders • my own panel SMMTG.PRO and private databases • experience working with markets of Russia, Uzbekistan, Ukraine, Israel, USA, Turkey, China, India, Vietnam, Europe, and more ⸻  For pricing — message me t.me/smmtg_link
    • Hey everyone, I was wondering if anyone knows where the client loads all the .dat files. Is there some kind of manifest or list you can specify which dat files the client loads?
    • 🔥 Welcome to Lineage 2 Haruna x3 – True Classic Interlude Experience 🔥 At Haruna x3, we’re bringing back the true essence of Interlude – slow, meaningful progression where every level matters, every item has value, and PvP is real. We’re not about fast servers, pay-to-win advantages, or fake populations. Our goal is simple: create a fair, stable, and long-term server where players can enjoy real competition, strategic clan warfare, and the thrill of open-world PvP. 💎 What Makes Haruna x3 Special? x3 Rates – Perfect for steady, rewarding progression Classic Interlude Mechanics – Relive the nostalgia of Interlude Stable & Lag-Free Gameplay – Optimized for thousands of players online Fair & Balanced – No pay-to-win, every victory is earned PvP & Clan Warfare Focused – Every battle counts 🌟 Quality of Life Features to Enhance Your Experience We keep the classic feel while adding features that make the game more convenient and enjoyable, including: Shift + Click to view monster droplists Free item mail and buy/sell via Adena Daily login rewards & Stream Rewards ALT+K Skill Panel & Alt+Click buffs removal Offline shop system Captcha for security Donate Coins currency (cannot be traded, dropped, or destroyed) Classic P110 client – no custom interface 🏰 Our Philosophy We believe Lineage 2 is about the journey, not just the destination. Haruna x3 is designed for months and years of growth, not weeks. We provide a community-driven environment where honest gameplay, fair competition, and strategic teamwork are at the forefront. 🌍 Join Our Community Whether you’re a veteran of Interlude or a returning player seeking a true classic experience, Haruna x3 offers a place to fight, trade, and grow alongside dedicated players. Step into the world of Haruna x3 – where every decision matters, every fight counts, and every victory is yours to earn. Discord: https://discord.gg/7DDC9Dsxnh Website : www.l2haruna.com
    • No, the real purpose is cheating and custom  development for games.  I'm building a custom AI moderator specially for checking illegal activity and flag current topica.
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock