Added support for CB teleports and buffs.
This commit is contained in:
		
							
								
								
									
										12
									
								
								trunk/dist/game/config/Custom.properties
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										12
									
								
								trunk/dist/game/config/Custom.properties
									
									
									
									
										vendored
									
									
								
							| @@ -587,3 +587,15 @@ FreeJumpsForAll = False | ||||
| # Enable Custom Community Board | ||||
| # Default: False | ||||
| CustomCommunityBoard = True | ||||
|  | ||||
| # Currency used by the Community Board (itemId) | ||||
| # Default: 57 (Adena) | ||||
| CommunityCurrencyId = 57 | ||||
|  | ||||
| # Price for Teleports | ||||
| # Default: 0 (free) | ||||
| CommunityTeleportPrice = 0 | ||||
|  | ||||
| # Price for Buffs | ||||
| # Default: 0 (free) | ||||
| CommunityBuffPrice = 0 | ||||
|   | ||||
| @@ -5,7 +5,6 @@ | ||||
| 			<br> | ||||
| 			<br1> <!-- add code after this comment --> | ||||
| 			<img src="l2ui.bbs_lineage2" width="128" height="16" ><br> | ||||
| 			<button action="bypass _bbsmultisell;2010" value="Shop Test" width=200 height=31 back="L2UI_CT1.OlympiadWnd_DF_Reward_Down" fore="L2UI_CT1.OlympiadWnd_DF_Reward"><br> | ||||
| 			<button action="bypass _bbstop;test.html" value="Page Test" width=200 height=31 back="L2UI_CT1.OlympiadWnd_DF_Watch_Down" fore="L2UI_CT1.OlympiadWnd_DF_Watch"><br> | ||||
| 		</center> | ||||
| 	</body> | ||||
|   | ||||
| @@ -6,6 +6,8 @@ | ||||
| 			<br1> <!-- add code after this comment --> | ||||
| 			<img src="l2ui.bbs_lineage2" width="128" height="16" ><br> | ||||
| 			<button action="bypass _bbsmultisell;2010" value="Shop Test" width=200 height=31 back="L2UI_CT1.OlympiadWnd_DF_Reward_Down" fore="L2UI_CT1.OlympiadWnd_DF_Reward"><br> | ||||
| 			<button action="bypass _bbsteleport;83421:148008:-3408" value="Teleport Test" width=200 height=31 back="L2UI_CT1.OlympiadWnd_DF_Reward_Down" fore="L2UI_CT1.OlympiadWnd_DF_Reward"><br> | ||||
| 			<button action="bypass _bbsbuff;1323:1" value="Buff Test" width=200 height=31 back="L2UI_CT1.OlympiadWnd_DF_Reward_Down" fore="L2UI_CT1.OlympiadWnd_DF_Reward"><br> | ||||
| 		</center> | ||||
| 	</body> | ||||
| </html> | ||||
| @@ -27,6 +27,7 @@ import com.l2jserver.L2DatabaseFactory; | ||||
| import com.l2jserver.gameserver.cache.HtmCache; | ||||
| import com.l2jserver.gameserver.datatables.ClanTable; | ||||
| import com.l2jserver.gameserver.datatables.MultisellData; | ||||
| import com.l2jserver.gameserver.datatables.SkillData; | ||||
| import com.l2jserver.gameserver.handler.CommunityBoardHandler; | ||||
| import com.l2jserver.gameserver.handler.IParseBoardHandler; | ||||
| import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; | ||||
| @@ -44,7 +45,9 @@ public final class HomeBoard implements IParseBoardHandler | ||||
| 	{ | ||||
| 		"_bbshome", | ||||
| 		"_bbstop", | ||||
| 		"_bbsmultisell" | ||||
| 		"_bbsmultisell", | ||||
| 		"_bbsteleport", | ||||
| 		"_bbsbuff" | ||||
| 	}; | ||||
| 	 | ||||
| 	@Override | ||||
| @@ -56,9 +59,9 @@ public final class HomeBoard implements IParseBoardHandler | ||||
| 	@Override | ||||
| 	public boolean parseCommunityBoardCommand(String command, L2PcInstance activeChar) | ||||
| 	{ | ||||
| 		final String customPath = Config.CUSTOM_CB_ENABLED ? "Custom/" : ""; | ||||
| 		if (command.equals("_bbshome") || command.equals("_bbstop")) | ||||
| 		{ | ||||
| 			final String customPath = Config.CUSTOM_CB_ENABLED ? "Custom/" : ""; | ||||
| 			CommunityBoardHandler.getInstance().addBypass(activeChar, "Home", command); | ||||
| 			 | ||||
| 			String html = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/" + customPath + "home.html"); | ||||
| @@ -69,6 +72,7 @@ public final class HomeBoard implements IParseBoardHandler | ||||
| 		} | ||||
| 		else if (command.startsWith("_bbstop;")) | ||||
| 		{ | ||||
| 			final String customPath = Config.CUSTOM_CB_ENABLED ? "Custom/" : ""; | ||||
| 			final String path = command.replace("_bbstop;", ""); | ||||
| 			if ((path.length() > 0) && path.endsWith(".html")) | ||||
| 			{ | ||||
| @@ -76,11 +80,39 @@ public final class HomeBoard implements IParseBoardHandler | ||||
| 				CommunityBoardHandler.separateAndSend(html, activeChar); | ||||
| 			} | ||||
| 		} | ||||
| 		else if (command.startsWith("_bbsmultisell") && Config.CUSTOM_CB_ENABLED) | ||||
| 		else if (Config.CUSTOM_CB_ENABLED && command.startsWith("_bbsmultisell")) | ||||
| 		{ | ||||
| 			final int multisell = Integer.valueOf(command.replace("_bbsmultisell;", "")); | ||||
| 			MultisellData.getInstance().separateAndSend(multisell, activeChar, null, false); | ||||
| 			return false; | ||||
| 		} | ||||
| 		else if (Config.CUSTOM_CB_ENABLED && command.startsWith("_bbsteleport")) | ||||
| 		{ | ||||
| 			final String fullBypass = command.replace("_bbsteleport;", ""); | ||||
| 			final String[] teleportBypass = fullBypass.split(":"); | ||||
| 			final int x = Integer.parseInt(teleportBypass[0]); | ||||
| 			final int y = Integer.parseInt(teleportBypass[1]); | ||||
| 			final int z = Integer.parseInt(teleportBypass[2]); | ||||
| 			if (activeChar.getInventory().getInventoryItemCount(Config.COMMUNITYBOARD_CURRENCY, -1) < Config.COMMUNITYBOARD_TELEPORT_PRICE) | ||||
| 			{ | ||||
| 				activeChar.sendMessage("Not enough currency!"); | ||||
| 				return false; | ||||
| 			} | ||||
| 			activeChar.getInventory().destroyItemByItemId("CB_Teleport", Config.COMMUNITYBOARD_CURRENCY, Config.COMMUNITYBOARD_TELEPORT_PRICE, activeChar, activeChar); | ||||
| 			activeChar.teleToLocation(x, y, z, 0); | ||||
| 		} | ||||
| 		else if (Config.CUSTOM_CB_ENABLED && command.startsWith("_bbsbuff")) | ||||
| 		{ | ||||
| 			final String fullBypass = command.replace("_bbsbuff;", ""); | ||||
| 			final String[] buffBypass = fullBypass.split(":"); | ||||
| 			final int buffId = Integer.parseInt(buffBypass[0]); | ||||
| 			final int buffLevel = Integer.parseInt(buffBypass[1]); | ||||
| 			if (activeChar.getInventory().getInventoryItemCount(Config.COMMUNITYBOARD_CURRENCY, -1) < Config.COMMUNITYBOARD_BUFF_PRICE) | ||||
| 			{ | ||||
| 				activeChar.sendMessage("Not enough currency!"); | ||||
| 				return false; | ||||
| 			} | ||||
| 			activeChar.getInventory().destroyItemByItemId("CB_Buff", Config.COMMUNITYBOARD_CURRENCY, Config.COMMUNITYBOARD_BUFF_PRICE, activeChar, activeChar); | ||||
| 			SkillData.getInstance().getSkill(buffId, buffLevel).applyEffects(activeChar, activeChar); | ||||
| 		} | ||||
| 		return true; | ||||
| 	} | ||||
|   | ||||
| @@ -818,6 +818,9 @@ public final class Config | ||||
| 	public static int SHOP_MIN_RANGE_FROM_PLAYER; | ||||
| 	public static boolean FREE_JUMPS_FOR_ALL; | ||||
| 	public static boolean CUSTOM_CB_ENABLED; | ||||
| 	public static int COMMUNITYBOARD_CURRENCY; | ||||
| 	public static int COMMUNITYBOARD_TELEPORT_PRICE; | ||||
| 	public static int COMMUNITYBOARD_BUFF_PRICE; | ||||
| 	 | ||||
| 	// -------------------------------------------------- | ||||
| 	// NPC Settings | ||||
| @@ -2608,6 +2611,9 @@ public final class Config | ||||
| 			FREE_JUMPS_FOR_ALL = CustomSettings.getBoolean("FreeJumpsForAll", false); | ||||
| 			 | ||||
| 			CUSTOM_CB_ENABLED = CustomSettings.getBoolean("CustomCommunityBoard", false); | ||||
| 			COMMUNITYBOARD_CURRENCY = CustomSettings.getInt("CommunityCurrencyId", 57); | ||||
| 			COMMUNITYBOARD_TELEPORT_PRICE = CustomSettings.getInt("CommunityTeleportPrice", 0); | ||||
| 			COMMUNITYBOARD_BUFF_PRICE = CustomSettings.getInt("CommunityBuffPrice", 0); | ||||
| 			 | ||||
| 			// Load PvP L2Properties file (if exists) | ||||
| 			final PropertiesParser PVPSettings = new PropertiesParser(PVP_CONFIG_FILE); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 mobius
					mobius