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;
}
}
StringTokenizer st = new StringTokenizer(parameters, " ");
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(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(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
{
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"))
{
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(Buff buff: buffs)
{
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(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;
}
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(Buff buff: buffs)
{
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(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"))
{
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"))
{
String targettype = st.nextToken();
showGiveBuffsWindow(player, targettype);
}
else if (currentCommand.startsWith("givebuffs"))
{
String targettype = st.nextToken();
String scheme_key = st.nextToken();
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 (L2Skill sk : CharSchemesTable.getInstance().getScheme(player.getObjectId(), scheme_key))
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);