Support for community buffer multi buffs.

This commit is contained in:
MobiusDev
2016-12-30 12:15:16 +00:00
parent 8440c8cfee
commit a55076fc8a

View File

@@ -159,18 +159,19 @@ public final class HomeBoard implements IParseBoardHandler
else if (Config.CUSTOM_CB_ENABLED && Config.COMMUNITYBOARD_ENABLE_BUFFS && command.startsWith("_bbsbuff")) else if (Config.CUSTOM_CB_ENABLED && Config.COMMUNITYBOARD_ENABLE_BUFFS && command.startsWith("_bbsbuff"))
{ {
final String fullBypass = command.replace("_bbsbuff;", ""); final String fullBypass = command.replace("_bbsbuff;", "");
final String[] buypassOptions = fullBypass.split(","); final String[] buypassOptions = fullBypass.split(";");
final int buffId = Integer.parseInt(buypassOptions[0]); final int buffCount = buypassOptions.length - 1;
final int buffLevel = Integer.parseInt(buypassOptions[1]); final String page = buypassOptions[buffCount];
final String page = buypassOptions[2]; if (activeChar.getInventory().getInventoryItemCount(Config.COMMUNITYBOARD_CURRENCY, -1) < (Config.COMMUNITYBOARD_BUFF_PRICE * buffCount))
if (activeChar.getInventory().getInventoryItemCount(Config.COMMUNITYBOARD_CURRENCY, -1) < Config.COMMUNITYBOARD_BUFF_PRICE)
{ {
activeChar.sendMessage("Not enough currency!"); activeChar.sendMessage("Not enough currency!");
} }
else else
{ {
activeChar.getInventory().destroyItemByItemId("CB_Buff", Config.COMMUNITYBOARD_CURRENCY, Config.COMMUNITYBOARD_BUFF_PRICE, activeChar, activeChar); activeChar.getInventory().destroyItemByItemId("CB_Buff", Config.COMMUNITYBOARD_CURRENCY, Config.COMMUNITYBOARD_BUFF_PRICE * buffCount, activeChar, activeChar);
final Skill skill = SkillData.getInstance().getSkill(buffId, buffLevel); for (int i = 0; i < buffCount; i++)
{
final Skill skill = SkillData.getInstance().getSkill(Integer.parseInt(buypassOptions[i].split(",")[0]), Integer.parseInt(buypassOptions[i].split(",")[1]));
if (Config.COMMUNITYBOARD_CAST_ANIMATIONS) if (Config.COMMUNITYBOARD_CAST_ANIMATIONS)
{ {
SkillCaster.triggerCast(activeChar, activeChar, skill); SkillCaster.triggerCast(activeChar, activeChar, skill);
@@ -202,6 +203,7 @@ public final class HomeBoard implements IParseBoardHandler
} }
} }
} }
}
CommunityBoardHandler.separateAndSend(HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/Custom/" + page + ".html"), activeChar); CommunityBoardHandler.separateAndSend(HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/Custom/" + page + ".html"), activeChar);
} }
return false; return false;