u can adapt to classic interlude? *-*
Hello, here I adapted it to this basic code for npc simple direct buffer for Classic Interlude.
package org.l2jmobius.gameserver.model.actor.instance;
import java.util.StringTokenizer;
import org.l2jmobius.gameserver.data.xml.SkillData;
import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate;
import org.l2jmobius.gameserver.network.serverpackets.MagicSkillUse;
import org.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
/**
* @author Trance, Bluur
* @adapted for L2jmobius Reanimation
*/
public final class Buffer extends Npc
{
public Buffer(NpcTemplate template)
{
super(template);
}
@Override
public void onBypassFeedback(Player 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"))
{
SkillData.getInstance().getSkill(buffid, bufflevel).applyEffects(this, player);
broadcastPacket(new MagicSkillUse(this, player, buffid, bufflevel, 500, 0));
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
html.setFile(player, getHtmlPath(getId(), 0, player));
html.replace("%objectId%", getObjectId());
player.sendPacket(html);
}
else if (actualCommand.equalsIgnoreCase("restore"))
{
player.setCurrentHpMp(player.getMaxHp(), player.getMaxMp());
player.setCurrentCp(player.getMaxCp());
broadcastPacket(new MagicSkillUse(this, player, 1258, 4, 500, 0));
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
html.setFile(player, getHtmlPath(getId(), 0, player));
html.replace("%objectId%", getObjectId());
player.sendPacket(html);
}
else if (actualCommand.equalsIgnoreCase("cancel"))
{
player.stopAllEffects();
broadcastPacket(new MagicSkillUse(this, player, 1056, 12, 500, 0));
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
html.setFile(player, getHtmlPath(getId(), 0, player));
html.replace("%objectId%", getObjectId());
player.sendPacket(html);
}
else
{
super.onBypassFeedback(player, command);
}
}
@Override
public String getHtmlPath(int npcId, int value, Player player)
{
String filename = "";
if (value == 0)
{
filename = Integer.toString(npcId);
}
else
{
filename = npcId + "-" + value;
}
return "data/html/mods/Buffer/" + filename + ".htm";
}
}
The html do not change, they are the same as the original post, but the SQL is no longer used, you will have to create a new npc, in the folder directly in its corresponding xml:
>L2jMobius Classic Interlude\game\data\stats\npcs\custom
<npc id="50009" displayId="9000" type="Buffer" name="Rosalina" usingServerSideName="true" title="Simple Basic Buffer" usingServerSideTitle="true">
<race>HUMAN</race>
<sex>FEMALE</sex>
<stats>
<vitals hp="2444.46819" hpRegen="7.5" mp="1345.8" mpRegen="2.7" />
<attack physical="688.86373" magical="470.40463" random="30" critical="4" accuracy="95" attackSpeed="253" type="SWORD" range="40" distance="80" width="120" />
<defence physical="295.91597" magical="216.53847" />
<speed>
<walk ground="50" />
<run ground="120" />
</speed>
</stats>
<status attackable="false" />
<collision>
<radius normal="11" />
<height normal="22.25" />
</collision>
</npc>
Remember that this adaptation is only for the basic function of the NPC.
I have a new improved version, if you are interested, send me a pm.