Сборка l2code такая хрень у меня
Вот байпас на прем бафф
bypass -h Quest 50000_Buffer Buff 4554
вот в бд
INSERT INTO `custom_npcbuffer` VALUES ('50000', '4554', '4', '6673', '1', '4554');
вот сам скрипт баффера
package custom.core;
import java.util.Map;
import org.apache.log4j.Logger;
import ru.catssoftware.Config;
import ru.catssoftware.gameserver.cache.HtmCache;
import ru.catssoftware.gameserver.datatables.NpcBufferTable;
import ru.catssoftware.gameserver.datatables.SkillTable;
import ru.catssoftware.gameserver.model.L2Character;
import ru.catssoftware.gameserver.model.L2ItemInstance;
import ru.catssoftware.gameserver.model.L2Skill;
import ru.catssoftware.gameserver.model.L2World;
//import ru.catssoftware.gameserver.model.actor.instance.L2MonsterInstance;
import ru.catssoftware.gameserver.model.actor.instance.L2NpcInstance;
import ru.catssoftware.gameserver.model.actor.instance.L2PcInstance;
import ru.catssoftware.gameserver.model.actor.instance.L2PcInstance.BuffProfile;
import ru.catssoftware.gameserver.model.olympiad.Olympiad;
import ru.catssoftware.gameserver.model.quest.Quest;
import ru.catssoftware.gameserver.model.quest.QuestState;
import ru.catssoftware.gameserver.model.zone.L2Zone;
import ru.catssoftware.gameserver.network.SystemMessageId;
import ru.catssoftware.gameserver.network.serverpackets.MagicSkillLaunched;
import ru.catssoftware.gameserver.network.serverpackets.MagicSkillUse;
import ru.catssoftware.gameserver.network.serverpackets.SystemMessage;
import ru.catssoftware.gameserver.util.L2Utils;
import javolution.util.FastMap;
public class Buffer extends Quest {
private static int BuffVipCard = 6673;
private static Logger _log = Logger.getLogger(Buffer.class);
public static String qn = "50000_Buffer";
private static String htmlBase = "data/html/CommunityBoard/buffer/Buffer";
//private static String htmlBaseEn = "data/html/CommunityBoard/buffer/en/Buffer";
private static String htmlBaseEn = "data/html_en/CommunityBoard/buffer/Buffer";
private Map<Integer, String> _lastPage;
private Map<Integer, Boolean> _isPetTarget = new FastMap<Integer, Boolean>();
private String _err = "";
private Map<Integer, Long> _restoreDelays = new FastMap<Integer, Long>();
public Buffer() {
super(-1, qn, "custom");
NpcBufferTable.getInstance();
_lastPage = new FastMap<Integer, String>();
}
@Override
public String onFirstTalk(L2NpcInstance npc, L2PcInstance player) {
return onTalk(npc, player);
}
@Override
public String onTalk(L2NpcInstance npc, L2PcInstance talker) {
if (talker.getQuestState(qn) == null) {
newQuestState(talker);
}
_lastPage.put(talker.getObjectId(), getMainHtml(talker.getChatLanguage()) + ".htm");
_isPetTarget.put(talker.getObjectId(), false);
return fillHtml(talker, HtmCache.getInstance().getHtm(getMainHtml(talker.getChatLanguage()) + ".htm", talker));
}
private String ShowLastPage(int playerId) {
if (_lastPage.containsKey(playerId)) {
String html = HtmCache.getInstance().getHtm(_lastPage.get(playerId), L2World.getInstance().getPlayer(playerId));
return fillHtml(L2World.getInstance().getPlayer(playerId), html);
}
return null;
}
private boolean isValidTalker(L2PcInstance player, boolean isFromBBS) {
if (Olympiad.getInstance().isRegistered(player)) {
return false;
}
if ((player.getTarget() != null && player.getTarget() instanceof L2NpcInstance)
|| (isFromBBS && L2Utils.checkMagicCondition(player))) {
return true;
}
return false;
}
@Override
public String onEvent(String event, QuestState qs) {
return onEvent(event, qs, false);
}
private boolean checkMagicCondition(L2PcInstance player) {
boolean ok = true;
if ((player._event != null && player._event.isRunning()) && Config.BUFFER_RESTRICTION.contains("EVENT")) {
ok = false;
//System.out.println("1");
}
if (player.isInJail() && Config.BUFFER_RESTRICTION.contains("JAIL")) {
ok = false;
//System.out.println("2");
}
if (player.getOlympiadGameId() >= 0 && Config.BUFFER_RESTRICTION.contains("OLY")) {
ok = false;
//System.out.println("3");
}
if (player.isInCombat() && Config.BUFFER_RESTRICTION.contains("COMBAT")) {
ok = false;
//System.out.println("4");
}
if (player.getKarma() > 0 && Config.BUFFER_RESTRICTION.contains("KARMA")) {
ok = false;
//System.out.println("5");
}
if (player.getPvpFlag() > 0 && Config.BUFFER_RESTRICTION.contains("PVP")) {
ok = false;
//System.out.println("6");
}
if (player.isInsideZone(L2Zone.FLAG_SIEGE) && Config.BUFFER_RESTRICTION.contains("SIEGE")) {
ok = false;
//System.out.println("7");
}
if (player.isInsideZone(L2Zone.FLAG_NOSUMMON) && Config.BUFFER_RESTRICTION.contains("RB")) {
ok = false;
//System.out.println("8");
}
if (player.isInsideZone(L2Zone.FLAG_PVP) && Config.BUFFER_RESTRICTION.contains("ARENA")) {
ok = false;
//System.out.println("9");
}
if(!player.isInsideZone(L2Zone.FLAG_PEACE) && Config.BBS_RESTRICTIONS.contains("NOPEACEBUFF")) {
ok = false;
}
return ok;
}
public boolean restoreCheck(L2PcInstance player) {
Long lastRestore = _restoreDelays.get(player.getObjectId());
if (Config.BUFFER_RESTORE_DELAY <= 0) {
return true;
}
if (lastRestore == null) {
_restoreDelays.put(player.getObjectId(), System.currentTimeMillis());
return true;
}
if (System.currentTimeMillis() + (Config.BUFFER_RESTORE_DELAY * 1000) < lastRestore) {
_restoreDelays.put(player.getObjectId(), System.currentTimeMillis());
return true;
}
return true;
}
@Override
public String onEvent(String event, QuestState qs, boolean isFromBBS) {
try {
L2PcInstance player = qs.getPlayer();
if (player == null) {
return null;
}
if ((player.isAlikeDead() || player.isAfraid() || player.isImmobilized()) && !event.startsWith("Chat")) {
return null;
}
if (player.isCastingNow() || player.isAttackingNow() && !event.startsWith("Chat")) {
return "Разговор запрещен во время каста.";
}
if (!checkMagicCondition(player)) {
return HtmCache.getInstance().getHtm(getMainHtml(player.getChatLanguage()) + "-not.htm", player);
}
L2NpcInstance npc = null;
if (!isFromBBS && player.getTarget() != null && player.getTarget() instanceof L2NpcInstance) {
npc = (L2NpcInstance) player.getTarget();
}
L2Character target = player;
if (_isPetTarget.get(player.getObjectId()) && player.getPet() != null) {
target = player.getPet();
}
if (event.startsWith("Chat")) {
String chatId = "";
String htm = getMainHtml(player.getChatLanguage()) + ".htm";
if (event.indexOf(" ") != -1) {
chatId = event.substring(event.indexOf(" ") + 1);
}
if (!chatId.equals("0")) {
chatId = "-" + chatId;
if (_isPetTarget.get(player.getObjectId())) {
if (HtmCache.getInstance().pathExists(getMainHtml(player.getChatLanguage()) + "-pet" + chatId + ".htm")) {
htm = getMainHtml(player.getChatLanguage()) + "-pet" + chatId + ".htm";
} else {
htm = getMainHtml(player.getChatLanguage()) + chatId + ".htm";
}
} else {
htm = getMainHtml(player.getChatLanguage()) + chatId + ".htm";
}
}
_lastPage.put(player.getObjectId(), htm);
String html = HtmCache.getInstance().getHtm(htm, player);
return fillHtml(player, html);
} else if (event.startsWith("SelectProfile")) {
String[] args = event.split(" ");
player.getCharacterData().set("BuffProfile", args[1]);
String html = HtmCache.getInstance().getHtm(getMainHtml(player.getChatLanguage()) + "-p2.htm", player);
_lastPage.put(player.getObjectId(), getMainHtml(player.getChatLanguage()) + "-p2.htm");
html = fillHtml(player, html);
return html;
} else if (event.startsWith("Profile")) {
String html = HtmCache.getInstance().getHtm(getMainHtml(player.getChatLanguage()) + "-p1.htm", player);
_lastPage.put(player.getObjectId(), getMainHtml(player.getChatLanguage()) + "-p1.htm");
return fillHtml(player, html);
} else if (event.startsWith("ClearProfile")) {
String[] args = event.split(" ");
if (args.length < 2)
{
return onEvent("Profile", qs, isFromBBS);
}
BuffProfile profile = getActiveProfile(player,args[1]);
profile._buffs.clear();
return onEvent("Profile", qs, isFromBBS);
}/* else if (event.startsWith("DeleteProfile")) {
Map<String, BuffProfile> _profiles = player.getBuffProfiles();
if (getActiveProfile(player) != null) {
_profiles.remove(getActiveProfileName(player));
}
player.getCharacterData().set("BuffProfile", (String) null);
return onEvent("Profile", qs, isFromBBS);
}*/ else if (event.startsWith("CreateProfile")) {
//Map<String, BuffProfile> _profiles = player.getBuffProfiles();
String[] args = event.split(" ");
if (args.length > 2) {
if (player.getChatLanguage() == 1) {
_err = "Имя профиля не должно содержать пробелы";
} else {
_err = "Please use: a-z, 0-9";
}
return onEvent("Profile", qs, isFromBBS);
}
/*if (_profiles.containsKey(args[1])) {
if (player.getChatLanguage() == 1) {
_err = "Профиль с таким именем уже сущевствует";
} else {
_err = "Profile name is already exists.";
}
return onEvent("Profile", qs, isFromBBS);
}*/
//player.putBuffProfile(args[1]);
player.putBuffProfileSkills(args[1]);
//player.getCharacterData().set("BuffProfile", args[1]);
//player.getCharacterData().set(args[1], args[1]);
//player.store();
return onEvent("Profile", qs, isFromBBS);
} else if (event.startsWith("UseProfile")) {
String[] args = event.split(" ");
if (args.length < 2)
{
return onEvent("Profile", qs, isFromBBS);
}
BuffProfile profile = getActiveProfile(player,args[1]);
if (profile != null) {
for (int buff : profile._buffs) {
int[] group = NpcBufferTable.getInstance().getSkillInfo(npc == null ? 50000 : npc.getNpcId(), buff);
useBuff(npc, buff, group, player, target);
}
}
} else if (event.startsWith("RemBuff")) {
if (target.isInsideZone(L2Zone.FLAG_PEACE) && isValidTalker(player, isFromBBS) && player.destroyItemByItemId("GM Buffer", Config.GMSHOP_BUFF_ITEM, Config.GMSHOP_BUFF_REMOVE, player, true)) {
target.stopAllEffects();
}
} else if (event.startsWith("RemDeBuff")) {
if (target.isInsideZone(L2Zone.FLAG_PEACE) && isValidTalker(player, isFromBBS) && player.destroyItemByItemId("GM Buffer", Config.GMSHOP_BUFF_ITEM, Config.GMSHOP_BUFF_REMOVE, player, true)) {
target.stopAllDebuffs();
}
} else if (event.startsWith("recHp")) {
if (target.isInsideZone(L2Zone.FLAG_PEACE) && restoreCheck(player) && isValidTalker(player, isFromBBS) && player.destroyItemByItemId("GM Buffer", Config.GMSHOP_BUFF_ITEM, Config.GMSHOP_BUFF_HP, player, true)) {
target.getStatus().setCurrentHp(target.getMaxHp());
target.getStatus().setCurrentMp(target.getMaxMp());
target.getStatus().setCurrentCp(target.getMaxCp());
}
} else if (event.startsWith("recCp")) {
if (target.isInsideZone(L2Zone.FLAG_PEACE) && restoreCheck(player) && isValidTalker(player, isFromBBS) && player.destroyItemByItemId("GM Buffer", Config.GMSHOP_BUFF_ITEM, Config.GMSHOP_BUFF_CP, player, true)) {
target.getStatus().setCurrentCp(target.getMaxCp());
}
} else if (event.startsWith("recMp")) {
if (target.isInsideZone(L2Zone.FLAG_PEACE) && restoreCheck(player) && isValidTalker(player, isFromBBS) && player.destroyItemByItemId("GM Buffer", Config.GMSHOP_BUFF_ITEM, Config.GMSHOP_BUFF_MP, player, true)) {
target.getStatus().setCurrentMp(target.getMaxMp());
}
} else if (event.startsWith("Target")) {
_isPetTarget.put(player.getObjectId(), !_isPetTarget.get(player.getObjectId()));
} else if (event.startsWith("Buff")) {
if (!isValidTalker(player, isFromBBS)) {
return ShowLastPage(player.getObjectId());
}
String[] buffGroupArray;
if (event.startsWith("BuffPet")) {
buffGroupArray = event.substring(8).split(" ");
} else {
buffGroupArray = event.substring(5).split(" ");
}
for (String buffGroupList : buffGroupArray) {
if (buffGroupList == null) {
_log.warn("NPC Buffer Warning: buffer has no buffGroup set in the bypass for the buff selected.");
return ShowLastPage(player.getObjectId());
}
int buffGroup = Integer.parseInt(buffGroupList);
int[] npcBuffGroupInfo = NpcBufferTable.getInstance().getSkillInfo(npc == null ? 50000 : npc.getNpcId(), buffGroup);
if (npcBuffGroupInfo == null) {
//_log.warn("NPC Buffer Warning: Player: " + player.getName() + " has tried to use skill group (" + buffGroup + ") not assigned to the NPC Buffer!");
return ShowLastPage(player.getObjectId());
}
useBuff(npc, buffGroup, npcBuffGroupInfo, player, target);
//
}
} else if (event.startsWith("lang")) {
try {
player.setChatLanguage(Integer.parseInt(event.substring(5)));
}
catch (Exception e) {
}
_lastPage.put(player.getObjectId(), getMainHtml(player.getChatLanguage()) + ".htm");
//return fillHtml(talker, HtmCache.getInstance().getHtm(getMainHtml(talker.getChatLanguage()) + ".htm", talker));
}
return ShowLastPage(player.getObjectId());
} catch (Exception e) {
return htmlBase + ".htm";
}
}
/*
private String getActiveProfileName(L2PcInstance player) {
try {
return player.getCharacterData().getString("BuffProfile");
} catch (IllegalArgumentException e) {
return "Нет";
}
}
private BuffProfile getActiveProfile(L2PcInstance player) {
String profileName = null;
try {
profileName = player.getCharacterData().getString("BuffProfile");
} catch (IllegalArgumentException e) {
return null;
}
Map<String, BuffProfile> _profiles = player.getBuffProfiles();
if (profileName != null && _profiles != null) {
return _profiles.get(profileName);
}
return null;
}
*/
/*private String getActiveProfileName(L2PcInstance player, String str) {
try {
//return player.getCharacterData().getString("BuffProfile");
//return player.getCharacterData().getString(str);
return str;
} catch (IllegalArgumentException e) {
return "Нет";
}
}*/
private BuffProfile getActiveProfile(L2PcInstance player, String str) {
String profileName = null;
try {
//profileName = player.getCharacterData().getString("BuffProfile");
//profileName = player.getCharacterData().getString(str);
profileName = str;
} catch (IllegalArgumentException e) {
return null;
}
Map<String, BuffProfile> _profiles = player.getBuffProfiles();
if (profileName != null && _profiles != null) {
return _profiles.get(profileName);
}
return null;
}
private synchronized String fillHtml(L2PcInstance player, String html) {
try {
if (player.getChatLanguage() == 1) {
html = html.replace("%target%", _isPetTarget.get(player.getObjectId()) ? "Pet" : "Player");
} else {
html = html.replace("%target%", _isPetTarget.get(player.getObjectId()) ? "Питомец" : "Персонаж");
}
if (player.getChatLanguage() == 1) {
html = html.replace("%target2%", _isPetTarget.get(player.getObjectId()) ? "Player" : "Pet");
} else {
html = html.replace("%target2%", _isPetTarget.get(player.getObjectId()) ? "Персонажа" : "Питомца");
}
if (player.getChatLanguage() == 1) {
html = html.replace("%language%", "<button value=\"Русский\" action=\"bypass -h Quest 50000_Buffer lang 0\" width=75 height=21 back=\"pw_pack.Bt_normalDisable\" fore=\"pw_pack.Bt_normalDisable\">");
} else {
html = html.replace("%language%", "<button value=\"English\" action=\"bypass -h Quest 50000_Buffer lang 1\" width=75 height=21 back=\"pw_pack.Bt_normalDisable\" fore=\"pw_pack.Bt_normalDisable\">");
}
// html = html.replace("%profile%", getActiveProfileName(player));
html = html.replace("%err%", _err);
_err = "";
String profiles = "";
try {
Map<String, BuffProfile> _profiles = player.getBuffProfiles();
if (_profiles != null) {
for (String profileName : _profiles.keySet()) {
profiles += "<tr><td><center><a action=\"bypass -h Quest 50000_Buffer SelectProfile " + profileName + "\">" + profileName + "</a></center></td></tr>";
}
}
if (profiles.length() == 0) {
if (player.getChatLanguage() == 1) {
profiles = "<tr><td><center>Empty</center></td></tr>";
} else {
profiles = "<tr><td><center>Отсутствуют</center></td></tr>";
}
}
/*
html = html.replace("%profilelist%", profiles);
BuffProfile profile = getActiveProfile(player);
if (profile != null && profile._buffs != null && profile._buffs.size() > 0) {
if (player.getChatLanguage() == 1) {
html = html.replace("%useprofile%", "<button action=\"bypass -h Quest 50000_Buffer UseProfile\" value=\"Use profile\" width=100 height=21 back=\"sek.cbui94\" fore=\"sek.cbui92\">");
} else {
html = html.replace("%useprofile%", "<button action=\"bypass -h Quest 50000_Buffer UseProfile\" value=\"Исп. профиль\" width=100 height=21 back=\"sek.cbui94\" fore=\"sek.cbui92\">");
}
String buffs = "";
int npcid = 50000;
for (Integer buff : profile._buffs) {
if (player.getTarget() != null && (player.getTarget() instanceof L2NpcInstance && !(player.getTarget() instanceof L2MonsterInstance))) {
npcid = ((L2NpcInstance) player.getTarget()).getNpcId();
}
int[] group = NpcBufferTable.getInstance().getSkillInfo(npcid, buff);
buffs += "<tr><td><center>" + SkillTable.getInstance().getSkillName(group[0]) + "</center></td></tr>";
}
html = html.replace("%buflist%", buffs);
} else {
html = html.replace("%useprofile%", "");
}
*/
} catch (Exception e) {
html = html.replace("%useprofile%", "");
player.clearBuffProfiles();
_log.error("Error getting profiles for " + player.getName() + ", cleaning");
}
return html;
} catch (Exception e) {
if (player.getChatLanguage() == 1) {
return "<html><body><br><center>Error, try later.</center></body></html>
не могу зделать чтобы баффал мне бафф который мне нада за предмет или доступ к разделу к баффу
id монеты 6673 все уже перепробывал не получаеться
меня ид что в бд так и в скрипте
Он баффает мне бесплатно той бафф