Jump to content
  • 0

How To Add ; In Html For The Buffer.


Question

Posted (edited)

Hello guys .

 

 

 

I want to do this in in my Buffer npc who know how?

 

 

 

Default :

 

<a action="bypass -h npc_%objectId%_getbuff 1204 130">

 

 

To work like This :

 

<a action="bypass -h npc_%objectId%_getbuff 1204 130;1003 130;1004 130">

if (actualCommand.equalsIgnoreCase("getbuff"))
    	{
    		if (buffid != 0 && !player.isDead())
    		{
    			SkillTable.getInstance().getInfo(buffid, bufflevel).getEffects(this, player);
    			broadcastPacket(new MagicSkillUse(this, player, buffid, bufflevel, 500, 0));
    			showChatWindow(player);
    		}
    	}

I try some methods but i failed ... :|

 

Project aCis.

Edited by Styx

5 answers to this question

Recommended Posts

  • 0
Posted

I think it should be something like that:

    @Override
    public void onBypassFeedback(L2PcInstance player, String command)
    {
    	StringTokenizer st = new StringTokenizer(command, " ");
    	String actualCommand = st.nextToken();
    	
    	if (actualCommand.equalsIgnoreCase("getbuff"))
    	{
		String[] buffsArray = command.substring(actualCommand.length).trim().split(";");
		for(String buffString : buffsArray)
		{
			String[] idLevelString = buffString.split(" ");
			int buffid = Integer.parseInt(idLevelString[0]);
			int bufflevel = idLevelString.length > 1 ? Integer.parseInt(idLevelString[1]) : 1;
			
			if (buffid != 0 && !player.isDead())
			{
				SkillTable.getInstance().getInfo(buffid, bufflevel).getEffects(this, player);
				broadcastPacket(new MagicSkillUse(this, player, buffid, bufflevel, 500, 0));
			}
		}
			
		showChatWindow(player);
    	}
    	else if (actualCommand.equalsIgnoreCase("restore"))
    	{
    		if (!player.isDead())
    		{
    			player.setCurrentHp(player.getMaxHp());
    			broadcastPacket(new MagicSkillUse(this, player, 1258, 4, 500, 0));
        		showChatWindow(player);
    		}
    	}
    	else if (actualCommand.equalsIgnoreCase("cancel"))
    	{
    		if (!player.isDead())
    		{
    			player.stopAllEffects();
    			broadcastPacket(new MagicSkillUse(this, player, 1056, 12, 500, 0));
        		showChatWindow(player);
    		}
    	}
    	else
    		super.onBypassFeedback(player, command);
    }
  • 0
Posted

Hi

 

Could you show me whats before the code you have pasted? I would like to see how buffid and bufflevel is taken from String, so i can find out best changes in code without guessing :)

  • 0
Posted (edited)

Hi

 

Could you show me whats before the code you have pasted? I would like to see how buffid and bufflevel is taken from String, so i can find out best changes in code without guessing :)

 

Thanks for help.

 /*
 * 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.model.actor.L2Npc;
import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
import net.sf.l2j.gameserver.network.serverpackets.MoveToPawn;
import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
import net.sf.l2j.gameserver.network.serverpackets.MagicSkillUse;
import net.sf.l2j.gameserver.templates.chars.L2NpcTemplate;


public final class L2BufferInstance extends L2NpcInstance
{
    public L2BufferInstance(int objectId, L2NpcTemplate template)
    {
        super(objectId, template);
    }
    
    @Override
	public void onAction(L2PcInstance player)
	{
		// Set the target of the L2PcInstance player
		if (player.getTarget() != this)
			player.setTarget(this);
		else
		{
			// Check if the player is attackable (without a forced attack) and isn't dead
			if (isAutoAttackable(player) && !isAlikeDead())
			{
				// Check the height difference, this max heigth difference might need some tweaking
				if (Math.abs(player.getZ() - getZ()) < 400)
				{
					// Set the L2PcInstance Intention to ATTACK
					player.getAI().setIntention(CtrlIntention.ATTACK, this);
				}
				else
				{
					// Send ActionFailed (target is out of attack range) to the L2PcInstance player
					player.sendPacket(ActionFailed.STATIC_PACKET);
				}
			}
			else if (!isAutoAttackable(player))
			{
				// Calculate the distance between the L2PcInstance and the L2NpcInstance
				if (!canInteract(player))
				{
					// Notify the L2PcInstance AI with INTERACT
					player.getAI().setIntention(CtrlIntention.INTERACT, this);
				}
				else
				{
					// Rotate the player to face the instance
					player.sendPacket(new MoveToPawn(player, this, L2Npc.INTERACTION_DISTANCE));
					
					// Send ActionFailed to the player in order to avoid he stucks
					player.sendPacket(ActionFailed.STATIC_PACKET);
					
					// Send the freaking chat window
					showChatWindow(player);
				}
			}
			// Send a Server->Client ActionFailed to the L2PcInstance in order to avoid that the client wait another packet
			player.sendPacket(ActionFailed.STATIC_PACKET);
		}
	}
    
    @Override
    public void onBypassFeedback(L2PcInstance player, String command)
    {
    	StringTokenizer st = new StringTokenizer(command, " ");
    	String actualCommand = st.nextToken();
    	
    	int buffid = 0, bufflevel = 1;
    	if (st.countTokens() == 2)
    	{
    		buffid = Integer.valueOf(st.nextToken());
    		bufflevel = Integer.valueOf(st.nextToken());
    	}
    	else if (st.countTokens() == 1)
    		buffid = Integer.valueOf(st.nextToken());
    	
    	if (actualCommand.equalsIgnoreCase("getbuff"))
    	{
    		if (buffid != 0 && !player.isDead())
    		{
    			SkillTable.getInstance().getInfo(buffid, bufflevel).getEffects(this, player);
    			broadcastPacket(new MagicSkillUse(this, player, buffid, bufflevel, 500, 0));
    			showChatWindow(player);
    		}
    	}
    	else if (actualCommand.equalsIgnoreCase("restore"))
    	{
    		if (!player.isDead())
    		{
    			player.setCurrentHp(player.getMaxHp());
    			broadcastPacket(new MagicSkillUse(this, player, 1258, 4, 500, 0));
        		showChatWindow(player);
    		}
    	}
    	else if (actualCommand.equalsIgnoreCase("cancel"))
    	{
    		if (!player.isDead())
    		{
    			player.stopAllEffects();
    			broadcastPacket(new MagicSkillUse(this, player, 1056, 12, 500, 0));
        		showChatWindow(player);
    		}
    	}
    	else
    		super.onBypassFeedback(player, command);
    }
    
    @Override
    public void showChatWindow(L2PcInstance player)
    {
    	// Send a Server->Client NpcHtmlMessage containing the text of the L2Npc to the L2PcInstance
    	NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
		html.setFile("data/html/gold/buffer.htm");
		html.replace("%objectId%", getObjectId());
		player.sendPacket(html);
		
		// Send a Server->Client ActionFailed to the L2PcInstance in order to avoid that the client wait another packet
		player.sendPacket(ActionFailed.STATIC_PACKET);
    }
}
Edited by Styx
  • 0
Posted

 

I think it should be something like that:

    @Override
    public void onBypassFeedback(L2PcInstance player, String command)
    {
    	StringTokenizer st = new StringTokenizer(command, " ");
    	String actualCommand = st.nextToken();
    	
    	if (actualCommand.equalsIgnoreCase("getbuff"))
    	{
		String[] buffsArray = command.substring(actualCommand.length).trim().split(";");
		for(String buffString : buffsArray)
		{
			String[] idLevelString = buffString.split(" ");
			int buffid = Integer.parseInt(idLevelString[0]);
			int bufflevel = idLevelString.length > 1 ? Integer.parseInt(idLevelString[1]) : 1;
			
			if (buffid != 0 && !player.isDead())
			{
				SkillTable.getInstance().getInfo(buffid, bufflevel).getEffects(this, player);
				broadcastPacket(new MagicSkillUse(this, player, buffid, bufflevel, 500, 0));
			}
		}
			
		showChatWindow(player);
    	}
    	else if (actualCommand.equalsIgnoreCase("restore"))
    	{
    		if (!player.isDead())
    		{
    			player.setCurrentHp(player.getMaxHp());
    			broadcastPacket(new MagicSkillUse(this, player, 1258, 4, 500, 0));
        		showChatWindow(player);
    		}
    	}
    	else if (actualCommand.equalsIgnoreCase("cancel"))
    	{
    		if (!player.isDead())
    		{
    			player.stopAllEffects();
    			broadcastPacket(new MagicSkillUse(this, player, 1056, 12, 500, 0));
        		showChatWindow(player);
    		}
    	}
    	else
    		super.onBypassFeedback(player, command);
    }

 

I will check it now thanks for your time..

Guest
This topic is now closed to further replies.


  • Posts

    • It's also the players' fault, because there have been decent servers implementing some of the things you said plus some other 'innovations', plus many QOL things for newbies (ingame bestiary, with drops searchers, etc). In the end, it's the players who decide to feed into that shit and play the most garbage servers simply because the owners of the servers gave their clan leaders 100 euros, or they insta quit the server because they didn't win the first QA, etc, etc, etc.   In the end, if a server is garbage or great it doesn't really matter if the players don't wanna stay in there.   Players are no better than the devs themselves, in the end it seems there are abusive devs who will milk the shit out of their willingly milkable players, or there are none, goes both ways.
    • In my opinion, L2 is dead because the people who make servers didn’t adapt to today’s reality. People are getting older, life moves faster, there are more responsibilities, and less free time. And I’m not even talking about newcomers—how can you expect someone new to this game to learn by Googling every drop location or quest requirement? These things should’ve been integrated into the game, made accessible with just a few clicks through the interface. Instead, so much time was wasted trying to recreate retail-like features that no one asked for. Everyone hates autofarm, but why? Because admins never found a smart way to implement it. You could have made it available only in specific zones, with reduced drops, working like Adrenaline, or auto-teleporting to farm for a limited time per day—just enough to help people with limited time stay relevant in-game. There should also be zones with better drops, where active farming actually matters. Other features feel pointless—like the Life Stone system. Spamming LS to get a skill? Instead, you could create a system where you level up the skill with low chances per level, something that feels progressive and fair. Crafting should be simpler too. Right-click a recipe, and the required materials should show up right there. As for sieges, why not create daily clan war events at peak hours—one for Europeans, one for Latinos? You could spawn crystals inside or outside castles that give points and trigger PvP. Add a boss during the event that gives even more points, and let the top clan in the ranking take the castle. I could go on forever, but what’s the point? The community died because the people who had the knowledge to improve the game just took the easy way out, copying the same server formula over and over until no one could enjoy playing it anymore.
    • It's not because I'm an admin that he treated me differently. I actually gave him several clients from my side without him even knowing they came from me, and most of them had no issues. I was also waiting 3–4 weeks at times for things I bought from AvE, even when I was in a rush. He still delivered in the end. That said, I'm not defending him blindly. I'm just saying it's unlikely he’d risk scamming someone over 60–100€, especially knowing how quickly word spreads here.
    • For exact same reason - there were accusation that I scammed. When was it? 2016? But in that time, admins actually didn't listen. I got banned, then unbaned (when I prooved I've refunded) but I was trash talking to mods. When few months later same shit happened, Grisom (?) old global mod, banned me anyway. You can read somewhere on forum how I was shitting on him for doing that (from other account because original account was banned) - which was banned too. He is not here anymore I think. Back in the days I was well know for not carring that much if I was talking to mod or admin, I didn't hold my tongue. Now You know. Just like You know - if I delay, I deliver or refund. I'm not a scammer, even if my old time haterz love to repeat themselfs like mantra. I don't care.
    • Okay I respect that but why is your other account banned?   I don't think this happened just because you delayed somebodys work even in 2012
  • Topics

×
×
  • Create New...