Jump to content
  • 0
Sign in to follow this  
johnn

Mod .gmshop

Question

Olá a todos alguém sabe me dizer por que o comando da frozen do power pack .gmshop não funciona ? tipo dou o comando .gmshop abre tudo mas ao clicar no botoes não acontece nada e não da nenhum error no gamer server abaixo o código do gmshop da frozen:

 

 

/*
* 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.
*
* http://www.gnu.org/copyleft/gpl.html
*/
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/merchant/100100" + 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;
}
}

 

 

Tambem se alguém conseguir colocar esses comando do power pack somente para carácter com acesso VIP (isVip) codigos do power pack frozen:

 

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;
}
}

 

 

 

 

 

 

Share this post


Link to post
Share on other sites

8 answers to this question

Recommended Posts


Proteja seu servidor de ataques DDoS massivos!

VPS EPIC
  • 0

Também tenho essa dúvida! Alguém?

 

 

Olá a todos alguém sabe me dizer por que o comando da frozen do power pack .gmshop não funciona ? tipo dou o comando .gmshop abre tudo mas ao clicar no botoes não acontece nada e não da nenhum error no gamer server abaixo o código do gmshop da frozen:

 

 

/*

* 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.

*

* http://www.gnu.org/copyleft/gpl.html

*/

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/merchant/100100" + 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;

}

}

 

 

 

Tambem se alguém conseguir colocar esses comando do power pack somente para carácter com acesso VIP (isVip) codigos do power pack frozen:

 

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;
}
}

 

 

 

 

 

 

vcs ja foram a este caminho e verificaram se estão la as HTML´s? data/html/merchant/100100

tem que verificar todos os caminhos e suas respectivas html´s , se mesmo assim estiver tudo ok

e nao haver modo de ativação das mesmas , ainda esta sendo implementado


Voltando ........ (Eu Acho) kkkkkkkk

Share this post


Link to post
Share on other sites
  • 0

 

 

vcs ja foram a este caminho e verificaram se estão la as HTML´s? data/html/merchant/100100

tem que verificar todos os caminhos e suas respectivas html´s , se mesmo assim estiver tudo ok

e nao haver modo de ativação das mesmas , ainda esta sendo implementado

Então mano ta tudo certo a html abre beleza toda interface botoes etc.. mas ao clicar no botão não acontece nada! a html não funciona simplesmente.

Share this post


Link to post
Share on other sites
  • 0

Então mano ta tudo certo a html abre beleza toda interface botoes etc.. mas ao clicar no botão não acontece nada! a html não funciona simplesmente.

entendi então

entao vc tera que abrir as htmls que abrem

abra elas no notepad++

e veja se os caminhos estão corretos , se não estiverem vc pode arrumar ou reportar no forum do desenvolvedor


Voltando ........ (Eu Acho) kkkkkkkk

Share this post


Link to post
Share on other sites
  • 0

bypass custom_multisell 1001

 

coloca isso na html do gmshop.htm

 

Mano a multisell ainda funciona o problema e a html não funciona a paginação so abre a pagina inicial e os botões não funciona :/

Alem desse problema os player estão reclamando que estão tomando critical quando estão em pt com um spoiler e o spoiler usa a skill todos na pt toma dc ou critical, menos o spoiler

Share this post


Link to post
Share on other sites
  • 0

Alguém poderia me ajudar? então depois de tanto trabalho descobrir onde esta o error, o comando .gmshop so funciona se você estiver no target do npc definido no power pack no caso o npc id 53 (GM SHOP) somente compra no target desse npc, então sabendo disso qual e como editar no código do .gmshop para permitir comprar sem estar no target do npc ?

 

 

/*
* 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.
*
* http://www.gnu.org/copyleft/gpl.html
*/
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;
}
}

 

Share this post


Link to post
Share on other 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.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  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.

Loading...
Sign in to follow this  



     



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • https://mega.nz/#!cJdgXa4D!fmKNVOjCc5Z4C2Qv2Xwn7SZwvCoWjOKR4KtMfE3qsZ8
    • Mil disculpas por la pregunta tonta quizás. Alguien sabe de donde descargo el parche del cliente para poder ver todas las cosas que tiene el server ? Descarge del topico L2jmega pero no me da. descarge de aqui en donde dice patch limpio y y veo iconos negros. Porfavor alquien me podria ayudar con eso ? Uso windows 10. Muchas gracias !
    • This is really helpful for people who do not comprehend the fundamentals of zone system. Nice tutorial.
    • quando coloquei os fakes pra se atacar ficou aparecendo esse erro ai alguem sabe oq é ?   como se eles nao conseguisse dar tovila e voltar
    • Vai em: gameserver\config\customs\SpecialMods.properties # Custom Spawn for news players CustomSpawn = false -> true RandomAreasSpawn = 1 # X, Y, Z custom_spawn1 = 45928, 49912, -3056 (digite /loc e pegue a localização de onde ele vai nascer) custom_spawn2 = 45928, 49912, -3056 custom_spawn3 = 45928, 49912, -3056
    • Nice men ! Amigos como puedo hacer para que mi nuevo player vaya a talking Island en vez de irse a Giran ?
    • Pequena correção para quem pretender usar essa REV e ter jóias boss nos boss... O NPC Gatekeeper of Fire Dragon (npc que abre a porta até o Heart of Volcano) não estava abrindo a porta. Então procurei sobre isso e achei um tópico relacionado a Frozen 1132 mas com a solução definitiva para isso. Caminho para correção na Source: net.sf.l2j.gameserver.scripting.scripts.teleports Procure por:   elif npcId == 31384 : #Gatekeeper of Fire Dragon DoorTable.getInstance().getDoor(24210004).openMe() return elif npcId == 31686 : #Gatekeeper of Fire Dragon DoorTable.getInstance().getDoor(24210006).openMe() return elif npcId == 31687 : #Gatekeeper of Fire Dragon DoorTable.getInstance().getDoor(24210005).openMe() return   E altere os números em vermelho para: 4 5 e 6 respectivamente.   elif npcId == 31384 : #Gatekeeper of Fire Dragon DoorTable.getInstance().getDoor(24210004).openMe() return elif npcId == 31686 : #Gatekeeper of Fire Dragon DoorTable.getInstance().getDoor(24210005).openMe() return elif npcId == 31687 : #Gatekeeper of Fire Dragon DoorTable.getInstance().getDoor(24210006).openMe() return   Correção simples mas que vai ajudar quem queira moldar seu servidor nesse estilo. Créditos pela correção: leozinhobr2    
    • Você está usando a ultima atualização postada? se não baixa e tente novamente, pode resolver seu problema e conserto de alguns bugs já relatados. Se tiver mais alguma dúvida pergunte no forum de duvidas, que responderemos da mesma forma. https://www.l2jbrasil.com/forum/18-dúvidas/
    • Você sabe como resolver esse erro? O gameserver nunca passa disso...
    • Obrigado a todos pela resposta do tvt 2x2 e 4x4 etc, eu não tenho conhecimento desse evento e coisas semelhantes. Show
×
×
  • Create New...