Ir para conteúdo
  • Cadastre-se
  • 0

Comando somente para vip usar ?


johnn

Pergunta

alguém pode colocar esses comando do power pack da frozen para somente players com acesso VIP (isVip) ? ja tenho o mod vip instalado no java esse aqui https://www.l2jbrasil.com/index.php?/topic/58400-l2jfrozen-vip-system/page-2&do=findComment&comment=502980 quero integrar ao powerpack ^^

 

GM SHOP:

 

 

/*

* L2jFrozen Project - www.l2jfrozen.com
*
* 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.
*
*/
package com.l2jfrozen.gameserver.powerpak.gmshop;
import com.l2jfrozen.Config;
import com.l2jfrozen.gameserver.cache.HtmCache;
import com.l2jfrozen.gameserver.handler.IBBSHandler;
import com.l2jfrozen.gameserver.handler.ICustomByPassHandler;
import com.l2jfrozen.gameserver.handler.IVoicedCommandHandler;
import com.l2jfrozen.gameserver.model.L2Character;
import com.l2jfrozen.gameserver.model.actor.instance.L2NpcInstance;
import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfrozen.gameserver.model.entity.event.CTF;
import com.l2jfrozen.gameserver.model.entity.event.DM;
import com.l2jfrozen.gameserver.model.entity.event.TvT;
import com.l2jfrozen.gameserver.model.entity.olympiad.Olympiad;
import com.l2jfrozen.gameserver.model.multisell.L2Multisell;
import com.l2jfrozen.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jfrozen.gameserver.powerpak.PowerPakConfig;
import com.l2jfrozen.gameserver.taskmanager.AttackStanceTaskManager;
/**
* @author L2JFrozen
*/
public class GMShop implements IVoicedCommandHandler, ICustomByPassHandler, IBBSHandler
{
@Override
public String[] getVoicedCommandList()
{
return new String[]
{
PowerPakConfig.GMSHOP_COMMAND
};
}
private boolean checkAllowed(final L2PcInstance activeChar)
{
String msg = null;
if (activeChar.isSitting())
msg = "GMShop is not available when you sit";
else if (PowerPakConfig.GMSHOP_EXCLUDE_ON.contains("ALL"))
msg = "GMShop is not available in this area";
else if (PowerPakConfig.GMSHOP_EXCLUDE_ON.contains("CURSED") && activeChar.isCursedWeaponEquiped())
msg = "GMShop is not available with the cursed sword";
else if (PowerPakConfig.GMSHOP_EXCLUDE_ON.contains("ATTACK") && AttackStanceTaskManager.getInstance().getAttackStanceTask(activeChar))
msg = "GMShop is not available during the battle";
else if (PowerPakConfig.GMSHOP_EXCLUDE_ON.contains("DUNGEON") && activeChar.isIn7sDungeon())
msg = "GMShop is not available in the catacombs and necropolis";
else if (PowerPakConfig.GMSHOP_EXCLUDE_ON.contains("RB") && activeChar.isInsideZone(L2Character.ZONE_NOSUMMONFRIEND))
msg = "GMShop is not available in this area";
else if (PowerPakConfig.GMSHOP_EXCLUDE_ON.contains("PVP") && activeChar.isInsideZone(L2Character.ZONE_PVP))
msg = "GMShop is not available in this area";
else if (PowerPakConfig.GMSHOP_EXCLUDE_ON.contains("PEACE") && activeChar.isInsideZone(L2Character.ZONE_PEACE))
msg = "GMShop is not available in this area";
else if (PowerPakConfig.GMSHOP_EXCLUDE_ON.contains("SIEGE") && activeChar.isInsideZone(L2Character.ZONE_SIEGE))
msg = "GMShop is not available in this area";
else if (PowerPakConfig.GMSHOP_EXCLUDE_ON.contains("OLYMPIAD") && (activeChar.isInOlympiadMode() || activeChar.isInsideZone(L2Character.ZONE_OLY) || Olympiad.getInstance().isRegistered(activeChar) || Olympiad.getInstance().isRegisteredInComp(activeChar)))
msg = "GMShop is not available at Olympiad";
else if (PowerPakConfig.GMSHOP_EXCLUDE_ON.contains("EVENT") && (activeChar._inEvent))
msg = "GMShop is not available at the opening event";
else if (PowerPakConfig.GMSHOP_EXCLUDE_ON.contains("TVT") && activeChar._inEventTvT && TvT.is_started())
msg = "GMShop is not available in TVT";
else if (PowerPakConfig.GMSHOP_EXCLUDE_ON.contains("CTF") && activeChar._inEventCTF && CTF.is_started())
msg = "GMShop is not available in CTF";
else if (PowerPakConfig.GMSHOP_EXCLUDE_ON.contains("DM") && activeChar._inEventDM && DM.is_started())
msg = "GMShop is not available in DM";
if (msg != null)
activeChar.sendMessage(msg);
return msg == null;
}
@Override
public boolean useVoicedCommand(final String command, final L2PcInstance activeChar, final String params)
{
if (activeChar == null)
return false;
if (!checkAllowed(activeChar))
return false;
if (command.compareTo(PowerPakConfig.GMSHOP_COMMAND) == 0)
{
String index = "";
if (params != null && params.length() != 0)
if (!params.equals("0"))
index = "-" + params;
final String text = HtmCache.getInstance().getHtm("data/html/gmshop/gmshop" + index + ".htm");
final NpcHtmlMessage htm = new NpcHtmlMessage(activeChar.getLastQuestNpcObject());
htm.setHtml(text);
activeChar.sendPacket(htm);
}
return false;
}
private static String[] _CMD =
{
"gmshop"
};
@Override
public String[] getByPassCommands()
{
return _CMD;
}
@Override
public void handleCommand(final String command, final L2PcInstance player, final String parameters)
{
if (player == null)
return;
if (parameters == null || parameters.length() == 0)
return;
if (!checkAllowed(player))
return;
if (!PowerPakConfig.GMSHOP_USEBBS && !PowerPakConfig.GMSHOP_USECOMMAND)
{
L2NpcInstance gmshopnpc = null;
if (player.getTarget() != null)
if (player.getTarget() instanceof L2NpcInstance)
{
gmshopnpc = (L2NpcInstance) player.getTarget();
if (gmshopnpc.getTemplate().getNpcId() != PowerPakConfig.GMSHOP_NPC)
gmshopnpc = null;
}
// Possible fix to Buffer - 1
if (gmshopnpc == null)
return;
// Possible fix to Buffer - 2
if (!player.isInsideRadius(gmshopnpc, L2NpcInstance.INTERACTION_DISTANCE, false, false))
return;
} // else (voice and bbs)
if (parameters.startsWith("multisell"))
{
try
{
L2Multisell.getInstance().SeparateAndSend(Integer.parseInt(parameters.substring(9).trim()), player, false, 0);
}
catch (final Exception e)
{
if (Config.ENABLE_ALL_EXCEPTIONS)
e.printStackTrace();
player.sendMessage("This list does not exist");
}
}
else if (parameters.startsWith("Chat"))
useVoicedCommand("", player, parameters.substring(4).trim());
}
@Override
public String[] getBBSCommands()
{
return _CMD;
}
}

 

 

 

GKGLOBAL:

 

 

package com.l2jfrozen.gameserver.powerpak.globalGK;

import com.l2jfrozen.Config;
import com.l2jfrozen.gameserver.cache.HtmCache;
import com.l2jfrozen.gameserver.communitybbs.Manager.BaseBBSManager;
import com.l2jfrozen.gameserver.controllers.GameTimeController;
import com.l2jfrozen.gameserver.datatables.sql.TeleportLocationTable;
import com.l2jfrozen.gameserver.handler.IBBSHandler;
import com.l2jfrozen.gameserver.handler.ICustomByPassHandler;
import com.l2jfrozen.gameserver.handler.IVoicedCommandHandler;
import com.l2jfrozen.gameserver.model.L2Character;
import com.l2jfrozen.gameserver.model.L2TeleportLocation;
import com.l2jfrozen.gameserver.model.actor.instance.L2NpcInstance;
import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfrozen.gameserver.model.entity.event.CTF;
import com.l2jfrozen.gameserver.model.entity.event.DM;
import com.l2jfrozen.gameserver.model.entity.event.TvT;
import com.l2jfrozen.gameserver.network.serverpackets.MagicSkillUser;
import com.l2jfrozen.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jfrozen.gameserver.network.serverpackets.SetupGauge;
import com.l2jfrozen.gameserver.powerpak.PowerPakConfig;
import com.l2jfrozen.gameserver.taskmanager.AttackStanceTaskManager;
import com.l2jfrozen.gameserver.thread.ThreadPoolManager;
import com.l2jfrozen.gameserver.util.Broadcast;
public class GKHandler implements IVoicedCommandHandler, ICustomByPassHandler, IBBSHandler
{
private class EscapeFinalizer implements Runnable
{
L2PcInstance _player;
L2TeleportLocation _tp;
public EscapeFinalizer(final L2PcInstance player, final L2TeleportLocation loc)
{
_player = player;
_tp = loc;
}
@Override
public void run()
{
_player.enableAllSkills();
_player.teleToLocation(_tp.getLocX(), _tp.getLocY(), _tp.getLocZ());
}
}
@Override
public String[] getVoicedCommandList()
{
return new String[]
{
PowerPakConfig.GLOBALGK_COMMAND
};
}
private boolean checkAllowed(final L2PcInstance activeChar)
{
String msg = null;
if (activeChar.isSitting())
msg = "Can't use Gatekeeper when sitting";
else if (PowerPakConfig.GLOBALGK_EXCLUDE_ON.contains("ALL"))
msg = "Gatekeeper is not available in this area";
else if (PowerPakConfig.GLOBALGK_EXCLUDE_ON.contains("CURSED") && activeChar.isCursedWeaponEquiped())
msg = "Can't use Gatekeeper with Cursed Weapon";
else if (PowerPakConfig.GLOBALGK_EXCLUDE_ON.contains("ATTACK") && AttackStanceTaskManager.getInstance().getAttackStanceTask(activeChar))
msg = "Gatekeeper is not available during the battle";
else if (PowerPakConfig.GLOBALGK_EXCLUDE_ON.contains("DUNGEON") && activeChar.isIn7sDungeon())
msg = "Gatekeeper is not available in the catacombs and necropolis";
else if (PowerPakConfig.GLOBALGK_EXCLUDE_ON.contains("RB") && activeChar.isInsideZone(L2Character.ZONE_NOSUMMONFRIEND))
msg = "Gatekeeper is not available in this area";
else if (PowerPakConfig.GLOBALGK_EXCLUDE_ON.contains("PVP") && activeChar.isInsideZone(L2Character.ZONE_PVP))
msg = "Gatekeeper is not available in this area";
else if (PowerPakConfig.GLOBALGK_EXCLUDE_ON.contains("PEACE") && activeChar.isInsideZone(L2Character.ZONE_PEACE))
msg = "Gatekeeper is not available in this area";
else if (PowerPakConfig.GLOBALGK_EXCLUDE_ON.contains("SIEGE") && activeChar.isInsideZone(L2Character.ZONE_SIEGE))
msg = "Gatekeeper is not available in this area";
else if (PowerPakConfig.GLOBALGK_EXCLUDE_ON.contains("OLYMPIAD") && activeChar.isInOlympiadMode())
msg = "Gatekeeper is not available in Olympiad";
else if (PowerPakConfig.GLOBALGK_EXCLUDE_ON.contains("TVT") && activeChar._inEventTvT && TvT.is_started())
msg = "Gatekeeper is not available in TVT";
else if (PowerPakConfig.GLOBALGK_EXCLUDE_ON.contains("CTF") && activeChar._inEventCTF && CTF.is_started())
msg = "Gatekeeper is not available in CTF";
else if (PowerPakConfig.GLOBALGK_EXCLUDE_ON.contains("DM") && activeChar._inEventDM && DM.is_started())
msg = "Gatekeeper is not available in DM";
if (msg != null)
activeChar.sendMessage(msg);
return msg == null;
}
@Override
public boolean useVoicedCommand(final String cmd, final L2PcInstance player, final String params)
{
if (player == null)
return false;
if (!checkAllowed(player))
return false;
if (cmd.compareTo(PowerPakConfig.GLOBALGK_COMMAND) == 0)
{
final NpcHtmlMessage htm = new NpcHtmlMessage(player.getLastQuestNpcObject());
final String text = HtmCache.getInstance().getHtm("data/html/gatekeeper/70023.htm");
htm.setHtml(text);
player.sendPacket(htm);
}
return false;
}
@Override
public String[] getByPassCommands()
{
// TODO Auto-generated method stub
return new String[]
{
"dotele"
};
}
@Override
public void handleCommand(final String command, final L2PcInstance player, final String parameters)
{
if (player == null)
return;
if (!checkAllowed(player))
return;
if (!PowerPakConfig.GLOBALGK_USEBBS && !PowerPakConfig.GLOBALGK_USECOMMAND)
{
L2NpcInstance gknpc = null;
if (player.getTarget() != null)
if (player.getTarget() instanceof L2NpcInstance)
{
gknpc = (L2NpcInstance) player.getTarget();
if (gknpc.getTemplate().getNpcId() != PowerPakConfig.GLOBALGK_NPC)
gknpc = null;
}
// Possible fix to Buffer - 1
if (gknpc == null)
return;
// Possible fix to Buffer - 2
if (!player.isInsideRadius(gknpc, L2NpcInstance.INTERACTION_DISTANCE, false, false))
return;
} // else (voice and bbs)
String htm = "70023";
if (parameters.startsWith("goto"))
{
try
{
if (PowerPakConfig.GLOBALGK_PRICE > 0)
{
if (player.getAdena() < PowerPakConfig.GLOBALGK_PRICE)
{
player.sendMessage("You do not have enough adena to pay for services");
return;
}
player.reduceAdena("teleport", PowerPakConfig.GLOBALGK_PRICE, null, true);
}
final int locId = Integer.parseInt(parameters.substring(parameters.indexOf(" ") + 1).trim());
final L2TeleportLocation tpPoint = TeleportLocationTable.getInstance().getTemplate(locId);
if (tpPoint != null)
{
if (PowerPakConfig.GLOBALGK_PRICE == -1)
{
if (player.getAdena() < tpPoint.getPrice())
{
player.sendMessage("You do not have enough adena to pay for services");
return;
}
player.reduceAdena("teleport", tpPoint.getPrice(), null, true);
}
final int unstuckTimer = PowerPakConfig.GLOBALGK_TIMEOUT * 1000;
player.setTarget(player);
player.disableAllSkills();
final MagicSkillUser u = new MagicSkillUser(player, 1050, 1, unstuckTimer, 0);
Broadcast.toSelfAndKnownPlayersInRadius(player, u, 810000);
final SetupGauge sg = new SetupGauge(0, unstuckTimer);
player.sendPacket(sg);
final EscapeFinalizer e = new EscapeFinalizer(player, tpPoint);
player.setSkillCast(ThreadPoolManager.getInstance().scheduleGeneral(e, unstuckTimer));
player.setSkillCastEndTime(10 + GameTimeController.getGameTicks() + unstuckTimer / GameTimeController.MILLIS_IN_TICK);
return;
}
player.sendMessage("Teleport, with ID " + locId + " does not exist in the database");
}
catch (final Exception e)
{
if (Config.ENABLE_ALL_EXCEPTIONS)
e.printStackTrace();
player.sendMessage("Error... maybe you cheat..");
}
}
else if (parameters.startsWith("Chat"))
{
htm = htm + "-" + parameters.substring(parameters.indexOf(" ") + 1).trim();
}
if (htm.contains("-0"))
htm = "70023";
String text = HtmCache.getInstance().getHtm("data/html/gatekeeper/" + htm + ".htm");
if (command.startsWith("bbs"))
{
text = text.replace("-h custom_do", "bbs_bbs");
BaseBBSManager.separateAndSend(text, player);
}
else
player.sendPacket(new NpcHtmlMessage(5, text));
return;
}
@Override
public String[] getBBSCommands()
{
return new String[]
{
"bbstele"
};
}
}

 

 

 

BUFFER

 

 

/*

* L2jFrozen Project - www.l2jfrozen.com
*
* 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.
*
*/
package com.l2jfrozen.gameserver.powerpak.Buffer;
import java.util.ArrayList;
import java.util.Map;
import java.util.StringTokenizer;
import com.l2jfrozen.Config;
import com.l2jfrozen.gameserver.cache.HtmCache;
import com.l2jfrozen.gameserver.communitybbs.Manager.BaseBBSManager;
import com.l2jfrozen.gameserver.datatables.BufferSkillsTable;
import com.l2jfrozen.gameserver.datatables.CharSchemesTable;
import com.l2jfrozen.gameserver.datatables.SkillTable;
import com.l2jfrozen.gameserver.handler.IBBSHandler;
import com.l2jfrozen.gameserver.handler.ICustomByPassHandler;
import com.l2jfrozen.gameserver.handler.IVoicedCommandHandler;
import com.l2jfrozen.gameserver.model.L2Character;
import com.l2jfrozen.gameserver.model.L2Effect;
import com.l2jfrozen.gameserver.model.L2Skill;
import com.l2jfrozen.gameserver.model.actor.instance.L2NpcInstance;
import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfrozen.gameserver.model.entity.event.CTF;
import com.l2jfrozen.gameserver.model.entity.event.DM;
import com.l2jfrozen.gameserver.model.entity.event.TvT;
import com.l2jfrozen.gameserver.model.entity.olympiad.Olympiad;
import com.l2jfrozen.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jfrozen.gameserver.powerpak.PowerPakConfig;
import com.l2jfrozen.gameserver.powerpak.Buffer.BuffTable.Buff;
import com.l2jfrozen.gameserver.taskmanager.AttackStanceTaskManager;
import javolution.text.TextBuilder;
import javolution.util.FastList;
import javolution.util.FastMap;
/**
* @author Nick
*/
public class BuffHandler implements IVoicedCommandHandler, ICustomByPassHandler, IBBSHandler
{
private static final String PARENT_DIR = "data/html/buffer/";
private final Map<Integer, ArrayList<Buff>> _buffs;
private final Map<Integer, String> _visitedPages;
private ArrayList<Buff> getOwnBuffs(final int objectId)
{
if (_buffs.get(objectId) == null)
synchronized (_buffs)
{
_buffs.put(objectId, new ArrayList<Buff>());
}
return _buffs.get(objectId);
}
public BuffHandler()
{
_buffs = new FastMap<>();
_visitedPages = new FastMap<>();
}
@Override
public String[] getVoicedCommandList()
{
return new String[]
{
PowerPakConfig.BUFFER_COMMAND
};
}
private boolean checkAllowed(final L2PcInstance activeChar)
{
String msg = null;
if (activeChar.isSitting())
msg = "Can't use buffer when sitting";
else if (activeChar.isCastingNow() || activeChar.isCastingPotionNow())
msg = "Can't use buffer when casting";
else if (activeChar.isAlikeDead())
msg = "Can't use buffer while dead";
else if (PowerPakConfig.BUFFER_EXCLUDE_ON.contains("ALL"))
msg = "Buffer is not available in this area";
else if (PowerPakConfig.BUFFER_EXCLUDE_ON.contains("CURSED") && activeChar.isCursedWeaponEquiped())
msg = "Can't use Buffer with Cursed Weapon";
else if (PowerPakConfig.BUFFER_EXCLUDE_ON.contains("ATTACK") && AttackStanceTaskManager.getInstance().getAttackStanceTask(activeChar))
msg = "Buffer is not available during the battle";
else if (PowerPakConfig.BUFFER_EXCLUDE_ON.contains("DUNGEON") && activeChar.isIn7sDungeon())
msg = "Buffer is not available in the catacombs and necropolis";
else if (PowerPakConfig.BUFFER_EXCLUDE_ON.contains("RB") && activeChar.isInsideZone(L2Character.ZONE_NOSUMMONFRIEND))
msg = "Buffer is not available in this area";
else if (PowerPakConfig.BUFFER_EXCLUDE_ON.contains("PVP") && activeChar.isInsideZone(L2Character.ZONE_PVP))
msg = "Buffer is not available in this area";
else if (PowerPakConfig.BUFFER_EXCLUDE_ON.contains("PEACE") && activeChar.isInsideZone(L2Character.ZONE_PEACE))
msg = "Buffer is not available in this area";
else if (PowerPakConfig.BUFFER_EXCLUDE_ON.contains("SIEGE") && activeChar.isInsideZone(L2Character.ZONE_SIEGE))
msg = "Buffer is not available in this area";
else if (PowerPakConfig.BUFFER_EXCLUDE_ON.contains("OLYMPIAD") && (activeChar.isInOlympiadMode() || activeChar.isInsideZone(L2Character.ZONE_OLY) || Olympiad.getInstance().isRegistered(activeChar) || Olympiad.getInstance().isRegisteredInComp(activeChar)))
msg = "Buffer is not available in Olympiad";
else if (PowerPakConfig.BUFFER_EXCLUDE_ON.contains("EVENT") && (activeChar.isInFunEvent()))
msg = "Buffer is not available in this event";
else if (PowerPakConfig.BUFFER_EXCLUDE_ON.contains("TVT") && activeChar._inEventTvT && TvT.is_started())
msg = "Buffer is not available in TVT";
else if (PowerPakConfig.BUFFER_EXCLUDE_ON.contains("CTF") && activeChar._inEventCTF && CTF.is_started())
msg = "Buffer is not available in CTF";
else if (PowerPakConfig.BUFFER_EXCLUDE_ON.contains("DM") && activeChar._inEventDM && DM.is_started())
msg = "Buffer is not available in DM";
if (msg != null)
activeChar.sendMessage(msg);
return msg == null;
}
@Override
public boolean useVoicedCommand(final String command, final L2PcInstance activeChar, final String target)
{
if (activeChar == null)
return false;
if (!checkAllowed(activeChar))
return false;
if (command.compareTo(PowerPakConfig.BUFFER_COMMAND) == 0)
{
final NpcHtmlMessage htm = new NpcHtmlMessage(activeChar.getLastQuestNpcObject());
final String text = HtmCache.getInstance().getHtm("data/html/default/" + PowerPakConfig.BUFFER_NPC + ".htm");
htm.setHtml(text);
activeChar.sendPacket(htm);
}
return false;
}
private static final String[] _BYPASSCMD =
{
"dobuff"
};
@Override
public String[] getByPassCommands()
{
return _BYPASSCMD;
}
@Override
public void handleCommand(final String command, final L2PcInstance player, final String parameters)
{
if (player == null)
return;
if (!checkAllowed(player))
return;
L2NpcInstance buffer = null;
if (!PowerPakConfig.BUFFER_USEBBS && !PowerPakConfig.BUFFER_USECOMMAND)
{
if (player.getTarget() != null)
if (player.getTarget() instanceof L2NpcInstance)
{
buffer = (L2NpcInstance) player.getTarget();
if (buffer.getTemplate().getNpcId() != PowerPakConfig.BUFFER_NPC)
buffer = null;
}
// Possible fix to Buffer - 1
if (buffer == null)
return;
// Possible fix to Buffer - 2
if (!player.isInsideRadius(buffer, L2NpcInstance.INTERACTION_DISTANCE, false, false))
return;
} // if buffer is null means that buffer will be applied directly (voice and bbs)
if (parameters.contains("Pet"))
{
if (player.getPet() == null)
{
return;
}
}
final StringTokenizer st = new StringTokenizer(parameters, " ");
final String currentCommand = st.nextToken();
if (parameters.compareTo("ClearBuffs") == 0)
{
getOwnBuffs(player.getObjectId()).clear();
player.sendMessage("Buff set cleared");
}
else if (parameters.compareTo("ClearPetBuffs") == 0)
{
getOwnBuffs(player.getPet().getObjectId()).clear();
player.sendMessage("Pet Buff set cleared");
}
else if (parameters.compareTo("RemoveAll") == 0)
{
final L2Effect[] effects = player.getAllEffects();
for (final L2Effect e : effects)
{
if (e.getEffectType() == L2Effect.EffectType.BUFF)
player.removeEffect(e);
}
}
else if (parameters.compareTo("RemovePetAll") == 0)
{
final L2Effect[] effects = player.getPet().getAllEffects();
for (final L2Effect e : effects)
{
if (e.getEffectType() == L2Effect.EffectType.BUFF)
player.getPet().removeEffect(e);
}
}
else if (parameters.startsWith("Chat"))
{
String chatIndex = parameters.substring(4).trim();
synchronized (_visitedPages)
{
_visitedPages.put(player.getObjectId(), chatIndex);
}
chatIndex = "-" + chatIndex;
String text = HtmCache.getInstance().getHtm("data/html/buffer/buffer" + chatIndex + ".htm");
if (command.startsWith("bbsbuff"))
{
text = text.replace("-h custom_do", "bbs_bbs");
BaseBBSManager.separateAndSend(text, player);
}
else
{
final NpcHtmlMessage htm = new NpcHtmlMessage(player.getLastQuestNpcObject());
htm.setHtml(text);
player.sendPacket(htm);
}
}
else if (parameters.startsWith("RestoreAll"))
{
if (player.getAdena() < PowerPakConfig.BUFFER_PRICE * 3)
{
player.sendMessage("You don't have enough adena");
return;
}
player.getStatus().setCurrentCp(player.getMaxCp());
player.getStatus().setCurrentMp(player.getMaxMp());
player.getStatus().setCurrentHp(player.getMaxHp());
player.reduceAdena("Buff", PowerPakConfig.BUFFER_PRICE * 3, null, true);
}
else if (parameters.startsWith("RestorePetAll"))
{
if (player.getAdena() < PowerPakConfig.BUFFER_PRICE * 3)
{
player.sendMessage("You don't have enough adena");
return;
}
player.getPet().getStatus().setCurrentMp(player.getPet().getMaxMp());
player.getPet().getStatus().setCurrentHp(player.getPet().getMaxHp());
player.reduceAdena("Buff", PowerPakConfig.BUFFER_PRICE * 3, null, true);
}
else if (parameters.startsWith("RestoreCP"))
{
if (player.getAdena() < PowerPakConfig.BUFFER_PRICE)
{
player.sendMessage("You don't have enough adena");
return;
}
player.getStatus().setCurrentCp(player.getMaxCp());
player.reduceAdena("Buff", PowerPakConfig.BUFFER_PRICE, null, true);
}
else if (parameters.startsWith("RestoreMP"))
{
if (player.getAdena() < PowerPakConfig.BUFFER_PRICE)
{
player.sendMessage("You don't have enough adena");
return;
}
player.getStatus().setCurrentMp(player.getMaxMp());
player.reduceAdena("Buff", PowerPakConfig.BUFFER_PRICE, null, true);
}
else if (parameters.startsWith("RestorePetMP"))
{
if (player.getAdena() < PowerPakConfig.BUFFER_PRICE)
{
player.sendMessage("You don't have enough adena");
return;
}
player.getPet().getStatus().setCurrentMp(player.getPet().getMaxMp());
player.reduceAdena("Buff", PowerPakConfig.BUFFER_PRICE, null, true);
}
else if (parameters.startsWith("RestoreHP"))
{
if (player.getAdena() < PowerPakConfig.BUFFER_PRICE)
{
player.sendMessage("You don't have enough adena");
return;
}
player.getStatus().setCurrentHp(player.getMaxHp());
player.reduceAdena("Buff", PowerPakConfig.BUFFER_PRICE, null, true);
}
else if (parameters.startsWith("RestorePetHP"))
{
if (player.getAdena() < PowerPakConfig.BUFFER_PRICE)
{
player.sendMessage("You don't have enough adena");
return;
}
player.getPet().getStatus().setCurrentHp(player.getPet().getMaxHp());
player.reduceAdena("Buff", PowerPakConfig.BUFFER_PRICE, null, true);
}
else if (parameters.startsWith("MakeBuffs") || parameters.startsWith("RestoreBuffs"))
{
final String buffName = parameters.substring(9).trim();
int totaladena = 0;
ArrayList<Buff> buffs = null;
if (parameters.startsWith("RestoreBuffs"))
buffs = getOwnBuffs(player.getObjectId());
else
buffs = BuffTable.getInstance().getBuffsForName(buffName);
if (buffs != null && buffs.size() == 1)
{
if (!getOwnBuffs(player.getObjectId()).contains(buffs.get(0)))
getOwnBuffs(player.getObjectId()).add(buffs.get(0));
}
if (buffs == null || buffs.size() == 0)
{
player.sendMessage("Your buff set is missing");
return;
}
for (final Buff buff : buffs)
{
final L2Skill skill = SkillTable.getInstance().getInfo(buff._skillId, buff._skillLevel);
if (skill != null)
{
if (player.getLevel() >= buff._minLevel && player.getLevel() <= buff._maxLevel)
{
if (buff._price > 0)
{
totaladena += buff._price;
if (player.getAdena() < totaladena)
{
player.sendMessage("You don't have enough adena");
break;
}
}
if (!buff._force && buffer != null)
{
buffer.setBusy(true);
buffer.setCurrentMp(buffer.getMaxMp());
buffer.setTarget(player);
// buffer.doCast(skill);
skill.getEffects(buffer, player, false, false, false);
buffer.setBusy(false);
}
else
skill.getEffects(player, player, false, false, false);
}
try
{
Thread.sleep(100); // Delay for the packet...
}
catch (final InterruptedException e)
{
if (Config.ENABLE_ALL_EXCEPTIONS)
e.printStackTrace();
}
}
}
if (totaladena > 0)
player.reduceAdena("Buff", totaladena, null, true);
if (_visitedPages.get(player.getObjectId()) != null)
handleCommand(command, player, "Chat " + _visitedPages.get(player.getObjectId()));
else
useVoicedCommand(PowerPakConfig.BUFFER_COMMAND, player, "");
}
else if (parameters.startsWith("MakePetBuffs") || parameters.startsWith("RestorePetBuffs"))
{
if (player.getPet() == null)
{
player.sendMessage("You have not a summoned pet");
return;
}
final String buffName = parameters.substring(12).trim();
int totaladena = 0;
ArrayList<Buff> buffs = null;
if (parameters.startsWith("RestorePetBuffs"))
buffs = getOwnBuffs(player.getPet().getObjectId());
else
buffs = BuffTable.getInstance().getBuffsForName(buffName);
if (buffs != null && buffs.size() == 1)
{
if (!getOwnBuffs(player.getPet().getObjectId()).contains(buffs.get(0)))
{
getOwnBuffs(player.getPet().getObjectId()).add(buffs.get(0));
}
}
if (buffs == null || buffs.size() == 0)
{
player.sendMessage("Your pet buff set is missing");
return;
}
for (final Buff buff : buffs)
{
final L2Skill skill = SkillTable.getInstance().getInfo(buff._skillId, buff._skillLevel);
if (skill != null)
{
if (player.getLevel() >= buff._minLevel && player.getLevel() <= buff._maxLevel)
{
if (buff._price > 0)
{
totaladena += buff._price;
if (player.getAdena() < totaladena)
{
player.sendMessage("You don't have enough adena");
break;
}
}
if (!buff._force && buffer != null)
{
buffer.setBusy(true);
buffer.setCurrentMp(buffer.getMaxMp());
buffer.setTarget(player.getPet());
skill.getEffects(buffer, player.getPet(), false, false, false);
// buffer.doCast(skill);
buffer.setBusy(false);
}
else
skill.getEffects(player, player.getPet(), false, false, false);
}
try
{
Thread.sleep(100); // Delay for the packet...
}
catch (final InterruptedException e)
{
if (Config.ENABLE_ALL_EXCEPTIONS)
e.printStackTrace();
}
}
}
if (totaladena > 0)
player.reduceAdena("Buff", totaladena, null, true);
if (_visitedPages.get(player.getObjectId()) != null)
handleCommand(command, player, "Chat " + _visitedPages.get(player.getObjectId()));
else
useVoicedCommand(PowerPakConfig.BUFFER_COMMAND, player, "");
// SCHEMAS
}
else if (currentCommand.startsWith("menu"))
{
final NpcHtmlMessage html = new NpcHtmlMessage(1);
html.setFile(PARENT_DIR + "menu.htm");
sendHtmlMessage(player, html);
}
// handles giving effects {support player, support pet, givebuffs}
else if (currentCommand.startsWith("support"))
{
final String targettype = st.nextToken();
showGiveBuffsWindow(player, targettype);
}
else if (currentCommand.startsWith("givebuffs"))
{
final String targettype = st.nextToken();
final String scheme_key = st.nextToken();
final int cost = Integer.parseInt(st.nextToken());
if (cost == 0 || cost <= player.getInventory().getAdena())
{
L2Character target = player;
if (targettype.equalsIgnoreCase("pet"))
target = player.getPet();
if (target != null)
{
for (final L2Skill sk : CharSchemesTable.getInstance().getScheme(player.getObjectId(), scheme_key))
{
if (sk == null)
continue;
if (buffer != null)
{
buffer.setBusy(true);
buffer.setCurrentMp(buffer.getMaxMp());
buffer.setTarget(target);
// buffer.doCast(skill);
sk.getEffects(buffer, target, false, false, false);
buffer.setBusy(false);
}
else
sk.getEffects(target, target, false, false, false);
}
// sk.getEffects(buffer, target);
player.reduceAdena("NPC Buffer", cost, null, true);
}
else
{
player.sendMessage("Incorrect Target");
// go to main menu
final NpcHtmlMessage html = new NpcHtmlMessage(1);
html.setFile(PARENT_DIR + "menu.htm");
sendHtmlMessage(player, html);
}
}
else
{
player.sendMessage("Not enough adena");
showGiveBuffsWindow(player, targettype);
}
}
// handles edit schemes {skillselect, skillunselect}
else if (currentCommand.startsWith("editscheme"))
{
final String skill_group = st.nextToken();
String scheme_key = null;
try
{
scheme_key = st.nextToken();
}
catch (final Exception e)
{
if (Config.ENABLE_ALL_EXCEPTIONS)
e.printStackTrace();
}
showEditSchemeWindow(player, skill_group, scheme_key);
}
else if (currentCommand.startsWith("skill"))
{
final String skill_group = st.nextToken();
final String scheme_key = st.nextToken();
final int skill_id = Integer.parseInt(st.nextToken());
final int level = BufferSkillsTable.getInstance().getSkillLevelById(skill_id);
if (currentCommand.startsWith("skillselect") && !scheme_key.equalsIgnoreCase("unselected"))
{
if (CharSchemesTable.getInstance() != null && CharSchemesTable.getInstance().getScheme(player.getObjectId(), scheme_key) != null && CharSchemesTable.getInstance().getScheme(player.getObjectId(), scheme_key).size() < PowerPakConfig.NPCBUFFER_MAX_SKILLS)
CharSchemesTable.getInstance().getScheme(player.getObjectId(), scheme_key).add(SkillTable.getInstance().getInfo(skill_id, level));
else
player.sendMessage("This scheme has reached maximun amount of buffs");
}
else if (currentCommand.startsWith("skillunselect") && CharSchemesTable.getInstance() != null && CharSchemesTable.getInstance().getScheme(player.getObjectId(), scheme_key) != null)
CharSchemesTable.getInstance().getScheme(player.getObjectId(), scheme_key).remove(SkillTable.getInstance().getInfo(skill_id, level));
showEditSchemeWindow(player, skill_group, scheme_key);
}
// manage schemes {create, delete, clear}
else if (currentCommand.startsWith("manageschemes"))
showManageSchemeWindow(player);
else if (currentCommand.startsWith("createscheme"))
{
if (!st.hasMoreTokens())
{
player.sendMessage("Error: Specify Schema Name!");
showManageSchemeWindow(player);
return;
}
final String name = st.nextToken();
if (name.length() > 14)
{
player.sendMessage("Error: Scheme's name must contain up to 14 chars without any spaces");
showManageSchemeWindow(player);
}
else if (CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()) != null && CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()).size() == PowerPakConfig.NPCBUFFER_MAX_SCHEMES)
{
player.sendMessage("Error: Maximun schemes amount reached, please delete one before creating a new one");
showManageSchemeWindow(player);
}
else if (CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()) != null && CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()).containsKey(name))
{
player.sendMessage("Error: duplicate entry. Please use another name");
showManageSchemeWindow(player);
}
else
{
if (CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()) == null)
CharSchemesTable.getInstance().getSchemesTable().put(player.getObjectId(), new FastMap<String, FastList<L2Skill>>(PowerPakConfig.NPCBUFFER_MAX_SCHEMES + 1));
CharSchemesTable.getInstance().setScheme(player.getObjectId(), name.trim(), new FastList<L2Skill>(PowerPakConfig.NPCBUFFER_MAX_SKILLS + 1));
showManageSchemeWindow(player);
}
}
// handles deletion
else if (currentCommand.startsWith("deletescheme"))
{
if (!st.hasMoreTokens())
{
player.sendMessage("Error: Specify Schema Name!");
showManageSchemeWindow(player);
return;
}
final String name = st.nextToken();
if (CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()) != null && CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()).containsKey(name))
{
CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()).remove(name);
showManageSchemeWindow(player);
}
}
// handles cleanning
else if (currentCommand.startsWith("clearscheme"))
{
if (!st.hasMoreTokens())
{
player.sendMessage("Error: Specify Schema Name!");
showManageSchemeWindow(player);
return;
}
final String name = st.nextToken();
if (CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()) != null && CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()).containsKey(name))
{
CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()).get(name).clear();
showManageSchemeWindow(player);
}
}
// predefined buffs
else if (currentCommand.startsWith("fighterbuff") || currentCommand.startsWith("magebuff"))
{
final ArrayList<L2Skill> skills_to_buff = new ArrayList<>();
if (currentCommand.startsWith("magebuff"))
{
for (final int skillId : PowerPakConfig.MAGE_SKILL_LIST.keySet())
{
final L2Skill skill = SkillTable.getInstance().getInfo(skillId, PowerPakConfig.MAGE_SKILL_LIST.get(skillId));
if (skill != null)
{
skills_to_buff.add(skill);
}
}
}
else
{
for (final int skillId : PowerPakConfig.FIGHTER_SKILL_LIST.keySet())
{
final L2Skill skill = SkillTable.getInstance().getInfo(skillId, PowerPakConfig.FIGHTER_SKILL_LIST.get(skillId));
if (skill != null)
{
skills_to_buff.add(skill);
}
}
}
String targettype = "";
if (st.hasMoreTokens())
targettype = st.nextToken();
int cost = 0;
if (PowerPakConfig.BUFFER_PRICE > 0)
cost = PowerPakConfig.BUFFER_PRICE * skills_to_buff.size();
if (cost == 0 || cost <= player.getInventory().getAdena())
{
L2Character target = player;
if (targettype.equalsIgnoreCase("pet"))
target = player.getPet();
if (target != null)
{
for (final L2Skill sk : skills_to_buff)
sk.getEffects(target, target, false, false, false);
player.reduceAdena("NPC Buffer", cost, null, true);
}
else
{
player.sendMessage("Incorrect Pet");
}
}
else
{
player.sendMessage("Not enough adena");
}
}
}
private static String[] _BBSCommand =
{
"bbsbuff"
};
@Override
public String[] getBBSCommands()
{
return _BBSCommand;
}
private void sendHtmlMessage(final L2PcInstance player, final NpcHtmlMessage html)
{
// html.replace("%objectId%", String.valueOf(getObjectId()));
// html.replace("%npcId%", String.valueOf(getNpcId()));
player.sendPacket(html);
}
/**
* Sends an html packet to player with Give Buffs menu info for player and pet, depending on targettype parameter {player, pet}
* @param player
* @param targettype
*/
private void showGiveBuffsWindow(final L2PcInstance player, final String targettype)
{
final TextBuilder tb = new TextBuilder();
tb.append("<html><title>Buffer - Giving buffs to " + targettype + "</title>");
tb.append("<body> Here are your defined profiles and their fee, just click on it to receive effects<br>");
final FastMap<String, FastList<L2Skill>> map = CharSchemesTable.getInstance().getAllSchemes(player.getObjectId());
if (CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()) == null || CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()).isEmpty())
tb.append("You have not defined any valid scheme, please go to Manage scheme and create at least one");
else
{
int cost;
tb.append("<table>");
for (FastMap.Entry<String, FastList<L2Skill>> e = map.head(), end = map.tail(); (e = e.getNext()) != end;)
{
cost = getFee(e.getValue());
tb.append("<tr><td width=\"90\"><a action=\"bypass -h custom_dobuff givebuffs " + targettype + " " + e.getKey() + " " + String.valueOf(cost) + "\">" + e.getKey() + "</a></td><td>Fee: " + String.valueOf(cost) + "</td></tr>");
}
tb.append("</table>");
}
tb.append("</body></html>");
final NpcHtmlMessage html = new NpcHtmlMessage(1);
html.setHtml(tb.toString());
sendHtmlMessage(player, html);
}
/**
* Sends an html packet to player with Manage scheme menu info. This allows player to create/delete/clear schemes
* @param player
*/
private void showManageSchemeWindow(final L2PcInstance player)
{
final TextBuilder tb = new TextBuilder();
tb.append("<html><title>Buffer - Manage Schemes</title>");
tb.append("<body><br>");
if (CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()) == null || CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()).isEmpty())
tb.append("<font color=\"LEVEL\">You have not created any scheme</font><br>");
else
{
tb.append("Here is a list of your schemes. To delete one just click on drop button. To create, fill name box and press create. " + "Each scheme must have different name. Name must have up to 14 chars. Spaces (\" \") are not allowed. DO NOT click on Create until you have filled quick box<br>");
tb.append("<table>");
for (FastMap.Entry<String, FastList<L2Skill>> e = CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()).head(), end = CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()).tail(); (e = e.getNext()) != end;)
{
tb.append("<tr><td width=\"140\">" + e.getKey() + " (" + String.valueOf(CharSchemesTable.getInstance().getScheme(player.getObjectId(), e.getKey()).size()) + " skill(s))</td>");
tb.append("<td width=\"60\"><button value=\"Clear\" action=\"bypass -h custom_dobuff clearscheme " + e.getKey() + "\" width=50 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");
tb.append("<td width=\"60\"><button value=\"Drop\" action=\"bypass -h custom_dobuff deletescheme " + e.getKey() + "\" width=50 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>");
}
}
tb.append("<br><table width=240>");
tb.append("<tr><td><edit var=\"name\" width=120 height=15></td><td><button value=\"create\" action=\"bypass -h custom_dobuff createscheme $name\" width=50 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>");
tb.append("</table>");
tb.append("<br><font color=\"LEVEL\">Max schemes per player: " + String.valueOf(PowerPakConfig.NPCBUFFER_MAX_SCHEMES) + "</font>");
tb.append("<br><br>");
tb.append("<a action=\"bypass -h custom_dobuff menu\">Back</a>");
tb.append("</body></html>");
final NpcHtmlMessage html = new NpcHtmlMessage(1);
html.setHtml(tb.toString());
sendHtmlMessage(player, html);
}
/**
* This sends an html packet to player with Edit Scheme Menu info. This allows player to edit each created scheme (add/delete skills)
* @param player
* @param skill_group
* @param scheme_key
*/
private void showEditSchemeWindow(final L2PcInstance player, final String skill_group, final String scheme_key)
{
final NpcHtmlMessage html = new NpcHtmlMessage(1);
html.setFile(PARENT_DIR + "schememenu.htm");
html.replace("%typesframe%", getTypesFrame(scheme_key));
if (skill_group.equalsIgnoreCase("unselected"))
{
html.replace("%schemelistframe%", getPlayerSchemeListFrame(player, skill_group, scheme_key));
html.replace("%skilllistframe%", getGroupSkillListFrame(player, null, null));
html.replace("%myschemeframe%", getPlayerSkillListFrame(player, null, null));
}
else
{
html.replace("%schemelistframe%", getPlayerSchemeListFrame(player, skill_group, scheme_key));
html.replace("%skilllistframe%", getGroupSkillListFrame(player, skill_group, scheme_key));
html.replace("%myschemeframe%", getPlayerSkillListFrame(player, skill_group, scheme_key));
}
sendHtmlMessage(player, html);
}
/**
* Returns a table with info about player's scheme list.<br>
* If player scheme list is null, it returns a warning message
* @param player
* @param skill_group
* @param scheme_key
* @return
*/
private String getPlayerSchemeListFrame(final L2PcInstance player, String skill_group, String scheme_key)
{
if (CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()) == null || CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()).isEmpty())
return "Please create at least one scheme";
if (skill_group == null)
skill_group = "def";
if (scheme_key == null)
scheme_key = "def";
final TextBuilder tb = new TextBuilder();
tb.append("<table>");
int count = 0;
for (FastMap.Entry<String, FastList<L2Skill>> e = CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()).head(), end = CharSchemesTable.getInstance().getAllSchemes(player.getObjectId()).tail(); (e = e.getNext()) != end;)
{
if (count == 0)
tb.append("<tr>");
tb.append("<td width=\"90\"><a action=\"bypass -h custom_dobuff editschemes " + skill_group + " " + e.getKey() + "\">" + e.getKey() + "</a></td>");
if (count == 3)
{
tb.append("</tr>");
count = 0;
}
count++;
}
if (!tb.toString().endsWith("</tr>"))
tb.append("</tr>");
tb.append("</table>");
return tb.toString();
}
/**
* @param player
* @param skill_group
* @param scheme_key
* @return a table with info about skills stored in each skill_group
*/
private String getGroupSkillListFrame(final L2PcInstance player, final String skill_group, final String scheme_key)
{
if (skill_group == null || skill_group == "unselected")
return "Please, select a valid group of skills";
else if (scheme_key == null || scheme_key.equalsIgnoreCase("unselected"))
return "Please, select a valid scheme";
final TextBuilder tb = new TextBuilder();
tb.append("<table>");
int count = 0;
for (final L2Skill sk : BufferSkillsTable.getInstance().getSkillsByType(skill_group))
{
if (CharSchemesTable.getInstance().getScheme(player.getObjectId(), scheme_key) != null && !CharSchemesTable.getInstance().getScheme(player.getObjectId(), scheme_key).isEmpty() && CharSchemesTable.getInstance().getSchemeContainsSkill(player.getObjectId(), scheme_key, sk.getId()))
continue;
if (count == 0)
tb.append("<tr>");
tb.append("<td width=\"100\"><a action=\"bypass -h custom_dobuff skillselect " + skill_group + " " + scheme_key + " " + String.valueOf(sk.getId()) + "\">" + sk.getName() + " (" + String.valueOf(sk.getLevel()) + ")</a></td>");
if (count == 3)
{
tb.append("</tr>");
count = -1;
}
count++;
}
if (!tb.toString().endsWith("</tr>"))
tb.append("</tr>");
tb.append("</table>");
return tb.toString();
}
/**
* @param player
* @param skill_group
* @param scheme_key
* @return a table with info about selected skills
*/
private String getPlayerSkillListFrame(final L2PcInstance player, final String skill_group, final String scheme_key)
{
if (skill_group == null || skill_group == "unselected")
return "<br>Please, select a valid group of skills";
else if (scheme_key == null || scheme_key.equalsIgnoreCase("unselected"))
return "<br>Please, select a valid scheme";
if (CharSchemesTable.getInstance().getScheme(player.getObjectId(), scheme_key) == null)
return "Please choose your Scheme";
if (CharSchemesTable.getInstance().getScheme(player.getObjectId(), scheme_key).isEmpty())
return "Empty Scheme";
final TextBuilder tb = new TextBuilder();
tb.append("Scheme: " + scheme_key + "<br>");
tb.append("<table>");
int count = 0;
for (final L2Skill sk : CharSchemesTable.getInstance().getScheme(player.getObjectId(), scheme_key))
{
if (count == 0)
tb.append("<tr>");
tb.append("<td><a action=\"bypass -h custom_dobuff skillunselect " + skill_group + " " + scheme_key + " " + String.valueOf(sk.getId()) + "\">" + sk.getName() + "</a></td>");
count++;
if (count == 3)
{
tb.append("</tr>");
count = 0;
}
}
if (!tb.toString().endsWith("<tr>"))
tb.append("<tr>");
tb.append("</table>");
return tb.toString();
}
/**
* @param scheme_key
* @return an string with skill_groups table.
*/
private String getTypesFrame(String scheme_key)
{
final TextBuilder tb = new TextBuilder();
tb.append("<table>");
int count = 0;
if (scheme_key == null)
scheme_key = "unselected";
for (final String s : BufferSkillsTable.getInstance().getSkillsTypeList())
{
if (count == 0)
tb.append("<tr>");
tb.append("<td width=\"90\"><a action=\"bypass -h custom_dobuff editscheme " + s + " " + scheme_key + "\">" + s + "</a></td>");
if (count == 2)
{
tb.append("</tr>");
count = -1;
}
count++;
}
if (!tb.toString().endsWith("</tr>"))
tb.append("</tr>");
tb.append("</table>");
return tb.toString();
}
/**
* @param list
* @return fee for all skills contained in list.
*/
private int getFee(final FastList<L2Skill> list)
{
int fee = 0;
if (PowerPakConfig.NPCBUFFER_STATIC_BUFF_COST >= 0)
return list.size() * PowerPakConfig.NPCBUFFER_STATIC_BUFF_COST;
for (final L2Skill sk : list)
fee += BufferSkillsTable.getInstance().getSkillFee(sk.getId());
return fee;
}
}

 

 

 

 

 

Link para o comentário
Compartilhar em outros sites

5 respostass a esta questão

Posts recomendados

  • 0

Mano, voce quer que apenas VIPs utilizem esses serviços?

voce precisa realizar a verificação:

if (!activeChar.isVip()){
msg = "Adicione sua mensagem";
}

depois dessa linha:

private boolean checkAllowed(final L2PcInstance activeChar)
{
String msg = null;

se eu entendi errado, explica que eu tento ajudar

Link para o comentário
Compartilhar em outros sites


  • 0

Mano, voce quer que apenas VIPs utilizem esses serviços?

voce precisa realizar a verificação:

if (!activeChar.isVip()){
msg = "Adicione sua mensagem";
}

depois dessa linha:

private boolean checkAllowed(final L2PcInstance activeChar)
{
String msg = null;

se eu entendi errado, explica que eu tento ajudar

na frozen tem o powerpack certo ? entao no power pack voce pode definir comandos para usar gmshop gkglobal e npc buff de onde quiser certo ? eu quero bloquear isso para player normais e apenas vip consguir usar os comandos entendeu ^^ dessa forma que voce me falou se a pessoa for vip ela nao usa o comando ali sao as restricoes se caso a pessoa for vip, ou estiver emmodo de atck etc.. ainda nao resolveu mais obrigado pela tentantiva ^^ se ainda tiver outra idea estou disponivel maow vlw EDIT mano me desculpa deu tudo certinho ^^ e por causa que ja tinha tentado dessejeito sera que e por que eu colocarva sem isso no active Char " ! "

Editado por johnn
Link para o comentário
Compartilhar em outros sites

  • 0

na frozen tem o powerpack certo ? entao no power pack voce pode definir comandos para usar gmshop gkglobal e npc buff de onde quiser certo ? eu quero bloquear isso para player normais e apenas vip consguir usar os comandos entendeu ^^ dessa forma que voce me falou se a pessoa for vip ela nao usa o comando ali sao as restricoes se caso a pessoa for vip, ou estiver emmodo de atck etc.. ainda nao resolveu mais obrigado pela tentantiva ^^ se ainda tiver outra idea estou disponivel maow vlw

 

Nao mano,

a verificação é justamente o oposto, a exclamação (!) no começo da validação tem o significado de negação, ou seja.

 

 

Se o char for vip.... (sem a !)

if (activeChar.isVip()){

Se o char não for vip...(Com a !)

if (!activeChar.isVip()){

O Que irá acontecer é que se o player nao for vip, vai retornar a mensagem que você predeterminar abaixo..

Link para o comentário
Compartilhar em outros sites

  • 0

 

Nao mano,

a verificação é justamente o oposto, a exclamação (!) no começo da validação tem o significado de negação, ou seja.

 

 

Se o char for vip.... (sem a !)

if (activeChar.isVip()){

Se o char não for vip...(Com a !)

if (!activeChar.isVip()){

O Que irá acontecer é que se o player nao for vip, vai retornar a mensagem que você predeterminar abaixo..

te amo cara eu tinha tentado esse metodo ai sem o " ! " ai fioquei louco kkk atras de ajuda muito obrigado mesmo voce me salvou muitos aqui recusaram me ajudar ate chegaram a fala em $$ mas voce e pessoa de bem agradeco a vc e que Deus te abencoe.

Link para o comentário
Compartilhar em outros sites

  • 0

te amo cara eu tinha tentado esse metodo ai sem o " ! " ai fioquei louco kkk atras de ajuda muito obrigado mesmo voce me salvou muitos aqui recusaram me ajudar ate chegaram a fala em $$ mas voce e pessoa de bem agradeco a vc e que Deus te abencoe.

 

disponha mano ;)

Link para o comentário
Compartilhar em outros sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Processando...
  • Registre-se

    Faça parte da maior e  mais antigas comunidades sobre Lineage2 da América Latina.





  • Patrocinadores

  • Quem Está Navegando

    • Nenhum usuário registrado visualizando esta página.
  • Posts

    • Teria como fazer do dusk shield e do zombie shield dessa maneira?     Teria como fazer do dusk shield e do zombie shield dessa maneira?     Teria como fazer do dusk shield e do zombie shield dessa maneira?     Teria como fazer do dusk shield e do zombie shield dessa maneira?     Teria como fazer do dusk shield e do zombie shield dessa maneira?     Teria como fazer do dusk shield e do zombie shield dessa maneira?    
    • muchas gracias muy lindos NPC 🙂
    • relaxa jovem gafanhoto, testa as quests. e posTa os erros indesejaveis.  
    • Se alguém pudesse me ensinar como codificar as missões, eu ficaria feliz em fazer isso sozinho ou pelo menos ajudar. Eu realmente quero jogar em um servidor onde todas as quests funcionem bem e melhor ainda se você puder fazer quests customizadas!
    • mas no interlude, nem todas as quests de class,  vai mostrar onde tem que ir, ate o reborn nao mostrava quando era interlude, só mostrou depois que eles colocaram client classic pra rodar, e ficou melhor ainda quando virou hellbound em diante, mas ha sim alguma chance de modificar isso direto no script para fazer igualmente, só basta te um pouco de paciencia e persistencia exato
    • 408_PathToElvenwizard dá Orion eu tive que mexer tbm, até modifiquei e consegui deixar ela igual do Classic, com a seta e a marcação no mapa. (não retail IL) Dá pra importar py de várias revs, o foda é que não da regular as quest py através do debug em tempo real, pelo menos eu não consegui rsrs
    • Hasta el momento todas las QUESTS son completables si te guias con un tutorial de youtube. El problema es que tienen bugs de locacion y de subquests que no avanzan o no te marcan correctamente a donde ir en el mapa, cosa que en Retail si se ve como corresponde.
    • estranho, mas pelo menos a galera nunca reclamo das quests quando tinha aberto 5x, geral fez class primeira e segunda job, poucos que compraram a class
    • en RUSaCis-3.5 data pack, las Quests estan en formato .java y son diferentes a como estan redactadas en jOrion y jFrozen 1.5 (ProyectX) package net.sf.l2j.gameserver.scripting.quest; import net.sf.l2j.commons.random.Rnd; import net.sf.l2j.gameserver.enums.Paperdoll; import net.sf.l2j.gameserver.enums.QuestStatus; import net.sf.l2j.gameserver.enums.actors.ClassId; import net.sf.l2j.gameserver.model.actor.Creature; import net.sf.l2j.gameserver.model.actor.Npc; import net.sf.l2j.gameserver.model.actor.Player; import net.sf.l2j.gameserver.network.serverpackets.SocialAction; import net.sf.l2j.gameserver.scripting.QuestState; public class Q224_TestOfSagittarius extends SecondClassQuest { private static final String QUEST_NAME = "Q224_TestOfSagittarius"; // Items private static final int BERNARD_INTRODUCTION = 3294; private static final int HAMIL_LETTER_1 = 3295; private static final int HAMIL_LETTER_2 = 3296; private static final int HAMIL_LETTER_3 = 3297; private static final int HUNTER_RUNE_1 = 3298; private static final int HUNTER_RUNE_2 = 3299; private static final int TALISMAN_OF_KADESH = 3300; private static final int TALISMAN_OF_SNAKE = 3301; private static final int MITHRIL_CLIP = 3302; private static final int STAKATO_CHITIN = 3303; private static final int REINFORCED_BOWSTRING = 3304; private static final int MANASHEN_HORN = 3305; private static final int BLOOD_OF_LIZARDMAN = 3306; private static final int CRESCENT_MOON_BOW = 3028; private static final int WOODEN_ARROW = 17; // Rewards private static final int MARK_OF_SAGITTARIUS = 3293; // NPCs private static final int BERNARD = 30702; private static final int HAMIL = 30626; private static final int SIR_ARON_TANFORD = 30653; private static final int VOKIAN = 30514; private static final int GAUEN = 30717; // Monsters private static final int ANT = 20079; private static final int ANT_CAPTAIN = 20080; private static final int ANT_OVERSEER = 20081; private static final int ANT_RECRUIT = 20082; private static final int ANT_PATROL = 20084; private static final int ANT_GUARD = 20086; private static final int NOBLE_ANT = 20089; private static final int NOBLE_ANT_LEADER = 20090; private static final int BREKA_ORC_SHAMAN = 20269; private static final int BREKA_ORC_OVERLORD = 20270; private static final int MARSH_STAKATO_WORKER = 20230; private static final int MARSH_STAKATO_SOLDIER = 20232; private static final int MARSH_STAKATO_DRONE = 20234; private static final int MARSH_SPIDER = 20233; private static final int ROAD_SCAVENGER = 20551; private static final int MANASHEN_GARGOYLE = 20563; private static final int LETO_LIZARDMAN = 20577; private static final int LETO_LIZARDMAN_ARCHER = 20578; private static final int LETO_LIZARDMAN_SOLDIER = 20579; private static final int LETO_LIZARDMAN_WARRIOR = 20580; private static final int LETO_LIZARDMAN_SHAMAN = 20581; private static final int LETO_LIZARDMAN_OVERLORD = 20582; private static final int SERPENT_DEMON_KADESH = 27090; public Q224_TestOfSagittarius() { super(224, "Test Of Sagittarius"); setItemsIds(BERNARD_INTRODUCTION, HAMIL_LETTER_1, HAMIL_LETTER_2, HAMIL_LETTER_3, HUNTER_RUNE_1, HUNTER_RUNE_2, TALISMAN_OF_KADESH, TALISMAN_OF_SNAKE, MITHRIL_CLIP, STAKATO_CHITIN, REINFORCED_BOWSTRING, MANASHEN_HORN, BLOOD_OF_LIZARDMAN, CRESCENT_MOON_BOW); addQuestStart(BERNARD); addTalkId(BERNARD, HAMIL, SIR_ARON_TANFORD, VOKIAN, GAUEN); addMyDying(ANT, ANT_CAPTAIN, ANT_OVERSEER, ANT_RECRUIT, ANT_PATROL, ANT_GUARD, NOBLE_ANT, NOBLE_ANT_LEADER, BREKA_ORC_SHAMAN, BREKA_ORC_OVERLORD, MARSH_STAKATO_WORKER, MARSH_STAKATO_SOLDIER, MARSH_STAKATO_DRONE, MARSH_SPIDER, ROAD_SCAVENGER, MANASHEN_GARGOYLE, LETO_LIZARDMAN, LETO_LIZARDMAN_ARCHER, LETO_LIZARDMAN_SOLDIER, LETO_LIZARDMAN_WARRIOR, LETO_LIZARDMAN_SHAMAN, LETO_LIZARDMAN_OVERLORD, SERPENT_DEMON_KADESH); } @Override public String onAdvEvent(String event, Npc npc, Player player) { String htmltext = event; QuestState st = player.getQuestList().getQuestState(QUEST_NAME); if (st == null) return htmltext; // BERNARD if (event.equalsIgnoreCase("30702-04.htm")) { st.setState(QuestStatus.STARTED); st.setCond(1); playSound(player, SOUND_ACCEPT); giveItems(player, BERNARD_INTRODUCTION, 1); if (giveDimensionalDiamonds39(player)) htmltext = "30702-04a.htm"; } // HAMIL else if (event.equalsIgnoreCase("30626-03.htm")) { st.setCond(2); playSound(player, SOUND_MIDDLE); takeItems(player, BERNARD_INTRODUCTION, 1); giveItems(player, HAMIL_LETTER_1, 1); } else if (event.equalsIgnoreCase("30626-07.htm")) { st.setCond(5); playSound(player, SOUND_MIDDLE); takeItems(player, HUNTER_RUNE_1, 10); giveItems(player, HAMIL_LETTER_2, 1); } // SIR_ARON_TANFORD else if (event.equalsIgnoreCase("30653-02.htm")) { st.setCond(3); playSound(player, SOUND_MIDDLE); takeItems(player, HAMIL_LETTER_1, 1); } // VOKIAN else if (event.equalsIgnoreCase("30514-02.htm")) { st.setCond(6); playSound(player, SOUND_MIDDLE); takeItems(player, HAMIL_LETTER_2, 1); } return htmltext; } @Override public String onTalk(Npc npc, Player player) { String htmltext = getNoQuestMsg(); QuestState st = player.getQuestList().getQuestState(QUEST_NAME); if (st == null) return htmltext; switch (st.getState()) { case CREATED: if (player.getClassId() != ClassId.ROGUE && player.getClassId() != ClassId.ELVEN_SCOUT && player.getClassId() != ClassId.ASSASSIN) htmltext = "30702-02.htm"; else if (player.getStatus().getLevel() < 39) htmltext = "30702-01.htm"; else htmltext = "30702-03.htm"; break; case STARTED: int cond = st.getCond(); switch (npc.getNpcId()) { case BERNARD: htmltext = "30702-05.htm"; break; case HAMIL: if (cond == 1) htmltext = "30626-01.htm"; else if (cond == 2 || cond == 3) htmltext = "30626-04.htm"; else if (cond == 4) htmltext = "30626-05.htm"; else if (cond > 4 && cond < 8) htmltext = "30626-08.htm"; else if (cond == 8) { htmltext = "30626-09.htm"; st.setCond(9); playSound(player, SOUND_MIDDLE); takeItems(player, HUNTER_RUNE_2, 10); giveItems(player, HAMIL_LETTER_3, 1); } else if (cond > 8 && cond < 12) htmltext = "30626-10.htm"; else if (cond == 12) { htmltext = "30626-11.htm"; st.setCond(13); playSound(player, SOUND_MIDDLE); } else if (cond == 13) htmltext = "30626-12.htm"; else if (cond == 14) { htmltext = "30626-13.htm"; takeItems(player, BLOOD_OF_LIZARDMAN, -1); takeItems(player, CRESCENT_MOON_BOW, 1); takeItems(player, TALISMAN_OF_KADESH, 1); giveItems(player, MARK_OF_SAGITTARIUS, 1); rewardExpAndSp(player, 54726, 20250); player.broadcastPacket(new SocialAction(player, 3)); playSound(player, SOUND_FINISH); st.exitQuest(false); } break; case SIR_ARON_TANFORD: if (cond == 2) htmltext = "30653-01.htm"; else if (cond > 2) htmltext = "30653-03.htm"; break; case VOKIAN: if (cond == 5) htmltext = "30514-01.htm"; else if (cond == 6) htmltext = "30514-03.htm"; else if (cond == 7) { htmltext = "30514-04.htm"; st.setCond(8); playSound(player, SOUND_MIDDLE); takeItems(player, TALISMAN_OF_SNAKE, 1); } else if (cond > 7) htmltext = "30514-05.htm"; break; case GAUEN: if (cond == 9) { htmltext = "30717-01.htm"; st.setCond(10); playSound(player, SOUND_MIDDLE); takeItems(player, HAMIL_LETTER_3, 1); } else if (cond == 10) htmltext = "30717-03.htm"; else if (cond == 11) { htmltext = "30717-02.htm"; st.setCond(12); playSound(player, SOUND_MIDDLE); takeItems(player, MANASHEN_HORN, 1); takeItems(player, MITHRIL_CLIP, 1); takeItems(player, REINFORCED_BOWSTRING, 1); takeItems(player, STAKATO_CHITIN, 1); giveItems(player, CRESCENT_MOON_BOW, 1); giveItems(player, WOODEN_ARROW, 10); } else if (cond > 11) htmltext = "30717-04.htm"; break; } break; case COMPLETED: htmltext = getAlreadyCompletedMsg(); break; } return htmltext; } @Override public void onMyDying(Npc npc, Creature killer) { final Player player = killer.getActingPlayer(); final QuestState st = checkPlayerState(player, npc, QuestStatus.STARTED); if (st == null) return; switch (npc.getNpcId()) { case ANT: case ANT_CAPTAIN: case ANT_OVERSEER: case ANT_RECRUIT: case ANT_PATROL: case ANT_GUARD: case NOBLE_ANT: case NOBLE_ANT_LEADER: if (st.getCond() == 3 && dropItems(player, HUNTER_RUNE_1, 1, 10, 500000)) st.setCond(4); break; case BREKA_ORC_SHAMAN: case BREKA_ORC_OVERLORD: if (st.getCond() == 6 && dropItems(player, HUNTER_RUNE_2, 1, 10, 500000)) { st.setCond(7); giveItems(player, TALISMAN_OF_SNAKE, 1); } break; case MARSH_STAKATO_WORKER: case MARSH_STAKATO_SOLDIER: case MARSH_STAKATO_DRONE: if (st.getCond() == 10 && dropItems(player, STAKATO_CHITIN, 1, 1, 100000) && player.getInventory().hasItems(MANASHEN_HORN, MITHRIL_CLIP, REINFORCED_BOWSTRING)) st.setCond(11); break; case MARSH_SPIDER: if (st.getCond() == 10 && dropItems(player, REINFORCED_BOWSTRING, 1, 1, 100000) && player.getInventory().hasItems(MANASHEN_HORN, MITHRIL_CLIP, STAKATO_CHITIN)) st.setCond(11); break; case ROAD_SCAVENGER: if (st.getCond() == 10 && dropItems(player, MITHRIL_CLIP, 1, 1, 100000) && player.getInventory().hasItems(MANASHEN_HORN, REINFORCED_BOWSTRING, STAKATO_CHITIN)) st.setCond(11); break; case MANASHEN_GARGOYLE: if (st.getCond() == 10 && dropItems(player, MANASHEN_HORN, 1, 1, 100000) && player.getInventory().hasItems(REINFORCED_BOWSTRING, MITHRIL_CLIP, STAKATO_CHITIN)) st.setCond(11); break; case LETO_LIZARDMAN: case LETO_LIZARDMAN_ARCHER: case LETO_LIZARDMAN_SOLDIER: case LETO_LIZARDMAN_WARRIOR: case LETO_LIZARDMAN_SHAMAN: case LETO_LIZARDMAN_OVERLORD: if (st.getCond() == 13) { if (((player.getInventory().getItemCount(BLOOD_OF_LIZARDMAN) - 120) * 5) > Rnd.get(100)) { playSound(player, SOUND_BEFORE_BATTLE); takeItems(player, BLOOD_OF_LIZARDMAN, -1); addSpawn(SERPENT_DEMON_KADESH, player, false, 300000, true); } else dropItemsAlways(player, BLOOD_OF_LIZARDMAN, 1, 0); } break; case SERPENT_DEMON_KADESH: if (st.getCond() == 13) { if (player.getInventory().getItemIdFrom(Paperdoll.RHAND) == CRESCENT_MOON_BOW) { st.setCond(14); playSound(player, SOUND_MIDDLE); giveItems(player, TALISMAN_OF_KADESH, 1); } else addSpawn(SERPENT_DEMON_KADESH, player, false, 300000, true); } break; } } }  
×
×
  • Criar Novo...

Important Information

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.