zdrastvuite druza vot dobavil if (command.startsWith("_bbsbuff")) vse efecti rabotaiut no ochen tormazat sekunt 40 nada jdat chtobi drugoi buff dobavit pomogite esli mojete
package net.sf.l2j.gameserver.communitybbs.BufferManager;
import java.util.StringTokenizer;
import net.sf.l2j.Config;
import net.sf.l2j.gameserver.communitybbs.BaseBBSManager;
import net.sf.l2j.gameserver.data.SkillTable;
import net.sf.l2j.gameserver.data.cache.HtmCache;
import net.sf.l2j.gameserver.model.actor.Player;
import net.sf.l2j.gameserver.network.serverpackets.MagicSkillUse;
import net.sf.l2j.gameserver.skills.L2Skill;
/**
* @author GeNeRaLs
*
*/
public class BuffBBSManager extends BaseBBSManager
{
@Override
public void parseCmd(String command, Player player)
{
if (command.startsWith("_bbsbuff"))
{
if (!checkAllowed(player))
{
return;
}
String val = command.substring(8);
StringTokenizer st = new StringTokenizer(val, "_");
String a = st.nextToken();
int id = Integer.parseInt(a);
String b = st.nextToken();
int lvl = Integer.parseInt(b);
L2Skill skill = SkillTable.getInstance().getInfo(id, lvl);
if (skill != null)
{
skill.getEffects(player, player);
MagicSkillUse mgc = new MagicSkillUse(player, player, id, lvl, 1150, 0);
player.sendPacket(mgc);
player.broadcastPacket(mgc);
}
String filename = HtmCache.getInstance().getHtm(player.isLang() + "Communityboard/top/buffer/buffer.htm");
String content = HtmCache.getInstance().getHtm(filename);
separateAndSend(content, player);
}
if (command.startsWith("_bbsfighter"))
{
player.stopAllEffectsExceptThoseThatLastThroughDeath();
for (Integer skillid : Config.FIGHTER_BUFF_LIST)
{
L2Skill skill = SkillTable.getInstance().getInfo(skillid, SkillTable.getInstance().getMaxLevel(skillid));
if (skill != null)
skill.getEffects(player, player);
}
player.getStatus().setMaxCpHpMp();
player.sendMessage("You get a Fighter-buff complect.");
separateAndSend(command, player);
}
if (command.startsWith("_bbsmage"))
{
player.stopAllEffectsExceptThoseThatLastThroughDeath();
for (Integer skillid : Config.MAGE_BUFF_LIST)
{
L2Skill skill = SkillTable.getInstance().getInfo(skillid, SkillTable.getInstance().getMaxLevel(skillid));
if (skill != null)
skill.getEffects(player, player);
}
player.getStatus().setMaxCpHpMp();
player.sendMessage("You get a Mage-buff complect.");
separateAndSend(command, player);
}
String filename = HtmCache.getInstance().getHtm(player.isLang() + "Communityboard/top/buffer/buffer.htm");
String content = HtmCache.getInstance().getHtm(filename);
separateAndSend(content, player);
}
public boolean checkAllowed(Player activeChar)
{
String msg = null;
if (activeChar.isSitting())
{
msg = "You can't use Community Buffer when you sit!";
}
else if (activeChar.getCast().isCastingNow())
{
msg = "You can't use Community Buffer when you cast!";
}
else if (activeChar.isDead())
{
msg = "You can't use Community Buffer when you dead!";
}
else if (activeChar.isInCombat())
{
msg = "You can't use Community Buffer when you in combat!";
}
if (msg != null)
{
activeChar.sendMessage(msg);
}
return msg == null;
}
public static BuffBBSManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final BuffBBSManager INSTANCE = new BuffBBSManager();
}
}
package net.sf.l2j.gameserver.communitybbs.BufferManager;
import java.util.StringTokenizer;
import net.sf.l2j.Config;
import net.sf.l2j.gameserver.communitybbs.BaseBBSManager;
import net.sf.l2j.gameserver.data.SkillTable;
import net.sf.l2j.gameserver.data.cache.HtmCache;
import net.sf.l2j.gameserver.model.actor.Player;
import net.sf.l2j.gameserver.network.serverpackets.MagicSkillUse;
import net.sf.l2j.gameserver.skills.L2Skill;
/**
* @author GeNeRaLs
*
*/
public class BuffBBSManager extends BaseBBSManager
{
@Override
public void parseCmd(String command, Player player)
{
if (command.startsWith("_bbsbuff"))
{
if (!checkAllowed(player))
{
return;
}
String val = command.substring(8);
StringTokenizer st = new StringTokenizer(val, "_");
String a = st.nextToken();
int id = Integer.parseInt(a);
String b = st.nextToken();
int lvl = Integer.parseInt(b);
L2Skill skill = SkillTable.getInstance().getInfo(id, lvl);
if (skill != null)
{
skill.getEffects(player, player);
MagicSkillUse mgc = new MagicSkillUse(player, player, id, lvl, 1150, 0);
player.sendPacket(mgc);
player.broadcastPacket(mgc);
}
String filename = HtmCache.getInstance().getHtm(player.isLang() + "Communityboard/top/buffer/buffer.htm");
String content = HtmCache.getInstance().getHtm(filename);
separateAndSend(content, player);
}
if (command.startsWith("_bbsfighter"))
{
player.stopAllEffectsExceptThoseThatLastThroughDeath();
for (Integer skillid : Config.FIGHTER_BUFF_LIST)
{
L2Skill skill = SkillTable.getInstance().getInfo(skillid, SkillTable.getInstance().getMaxLevel(skillid));
if (skill != null)
skill.getEffects(player, player);
}
player.getStatus().setMaxCpHpMp();
player.sendMessage("You get a Fighter-buff complect.");
separateAndSend(command, player);
}
if (command.startsWith("_bbsmage"))
{
player.stopAllEffectsExceptThoseThatLastThroughDeath();
for (Integer skillid : Config.MAGE_BUFF_LIST)
{
L2Skill skill = SkillTable.getInstance().getInfo(skillid, SkillTable.getInstance().getMaxLevel(skillid));
if (skill != null)
skill.getEffects(player, player);
}
player.getStatus().setMaxCpHpMp();
player.sendMessage("You get a Mage-buff complect.");
separateAndSend(command, player);
}
String filename = HtmCache.getInstance().getHtm(player.isLang() + "Communityboard/top/buffer/buffer.htm");
String content = HtmCache.getInstance().getHtm(filename);
separateAndSend(content, player);
}
public boolean checkAllowed(Player activeChar)
{
String msg = null;
if (activeChar.isSitting())
{
msg = "You can't use Community Buffer when you sit!";
}
else if (activeChar.getCast().isCastingNow())
{
msg = "You can't use Community Buffer when you cast!";
}
else if (activeChar.isDead())
{
msg = "You can't use Community Buffer when you dead!";
}
else if (activeChar.isInCombat())
{
msg = "You can't use Community Buffer when you in combat!";
}
if (msg != null)
{
activeChar.sendMessage(msg);
}
return msg == null;
}
public static BuffBBSManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final BuffBBSManager INSTANCE = new BuffBBSManager();
}
}
Последнее редактирование: