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

    • Inventory restock: Premium business accounts are now available.   ✔ Wallester Business EU 🇪🇺|💳 Unlimited virtual cards, physical cards, 🏦 multi-currency IBAN, ₿ crypto & stablecoin deposits. ✔ Stripe Business UK 🇬🇧|💳 Instant virtual cards (Visa/Mastercard), high-conversion checkout, multi-currency payouts, ₿ crypto payments, no-code payment links. ✔ Mercury Business US 🇺🇸|🏦 US checking & savings, 💳 unlimited virtual cards, domestic & International wires, native stablecoin settlement. ✔ Payset Business EU 🇪🇺|🏦 Multiple IBANs, UK sort code, SEPA Instant, 💳 unlimited virtual cards, multi-currency accounts. ✔ Novo Business US 🇺🇸|🏦 Business checking account, ACH payments & invoicing, 💳 virtual & physical cards, novo boost.
    • Let me see if I understand correctly, older gentlemen, when a newcomer shows up to create modern things with the help of AI, doing what you charge them to do, you point the finger and laugh. I believe that's why everything is stagnant. The product isn't for programming experts, it's for newcomers. Don't buy from you if they can do it themselves using this base. You're going to deliver a similar product, maybe even worse than this one, so why are you complaining? PowerShell, as you well know, started with it, then came new platforms and new apps, new creation models, all with different languages; I chose the simplest one for my taste. This is about being organized and knowing how to choose the right words for each situation. It's not 100%, but it already gives a good impression. Nothing is 100%, so a topic written by AI, and all the code that you charge an absurd amount for to prohibit and sell hacks, could be open source so that everyone can create new practices, new models, new information for passing packets, prohibiting the use of cheats that cause server owners to break so much. Let's remember that the Admin doesn't always shut down the server; it's the players who find problems and take advantage by buying and reselling items, and they say that the GM shuts down the server every week, but that's a lie. What they do is duplicate items with packages and sell them, but perhaps this could give some future developers a starting point to create their own protection following the model in the initial documentation. Because none of you answer a question from a newbie, you think you're superior because you have knowledge, but with AI, people like that can have the same knowledge as you, but with less practice. And if they practice a lot, 10,000 hours, they can be as good as all of you older developers in the L2J field.
    • ✨ Exclusive Offer for Marketplace Growth 🔥 Elevate your performance with a premium bonus. 💲 Top up your balance with $100 or more and receive an additional $5 credit — seamlessly added to your account. ⭐️ Designed for those who value efficiency, scale, and results. ⚡️ Effortless. Refined. Effective. 💥 Enhance your strategy today 💥
  • 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..