Jump to content

Recommended Posts

Posted

Hey guys if you are doing a project from the scratch and looking for a way to connect community board with the htmls i think this is a good way to do it even though there are many ways!

 

I am just giving the idea here so please don't flame with better codes and stuff :)

 

I will do this in l2j mobious H5, i think it works mostly in all packs but let me know if it does not.

 

1) So you basically you are gonna create a new custom script that will extend Quest, in this case I named it CBnpcs.java (scripts/custom/CommunityNpcs/CBnpcs.java)

2)  Set the ids of our custom npcs

3) You have to add them on firsttalk , talk, startnpc each one separately just like bellow

4) Then the link where you have stored your htmls

5) So if you want to create more npcs connecting them to CB you can simply copy and paste the else ifs and set more ids

6) Some packs i think require the scripts to be registered on scripts.cfg so do that as well if you own such pack

 

package custom.CommunityNpcs;

import com.l2jmobius.gameserver.cache.HtmCache;
import com.l2jmobius.gameserver.handler.CommunityBoardHandler;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.quest.Quest;
import com.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;

/**
 * @author -Invoke
 */
public class CBnpcs extends Quest
{	
	private static final int Merchant = 36621;
	private static final int Gatekeeper = 36622;

public CBnpcs(int questId)
	{
		super(questId);
		addFirstTalkId(Merchant);
		addFirstTalkId(Gatekeeper);
		//
		addTalkId(Merchant);
		addTalkId(Gatekeeper);
		//
		addStartNpc(Merchant);
		addStartNpc(Gatekeeper);
	}

@Override
	public String onFirstTalk(L2Npc npc, L2PcInstance player)
	{
		
		final int npcId = npc.getId();
		String mainhtml = HtmCache.getInstance().getHtm(player, "data/html/CommunityBoard/Custom/main.html");
	
		if (npcId == Merchant)
		{
			
			String html = HtmCache.getInstance().getHtm(player, "data/html/CommunityBoard/Custom/merchant/main.html");
			CommunityBoardHandler.separateAndSend(html, player);
		}
		else if (npcId == Gatekeeper)
		{
			
			String html = HtmCache.getInstance().getHtm(player, "data/html/CommunityBoard/Custom/gatekeeper/main.html");
			CommunityBoardHandler.separateAndSend(html, player);
		}
		CommunityBoardHandler.separateAndSend(mainhtml, player);
		return "";
	}
	
	public static void main(final String[] args)
	{
		new CBnpcs(-1);
		LOGGER.info("COMMYNITY NPCS LOADED");
	}

}

 

  • Like 2
  • Thanks 2
  • Upvote 5
  • 1 month later...
Posted

Some clean/short of onFirstTalk method

public String onFirstTalk(L2Npc npc, L2PcInstance player)
{
	String path = "data/html/CommunityBoard/Custom/main.html";
	switch(npc.getId())
	{
		case Merchant:
			 path = "data/html/CommunityBoard/Custom/merchant/main.html";
			break;
		case Gatekeeper:
			 path = "data/html/CommunityBoard/Custom/gatekeeper/main.html";
			break;
	}
	CommunityBoardHandler.separateAndSend(HtmCache.getInstance().getHtm(player, path), player);
	return null;
}
  • Upvote 1
  • 2 weeks later...
Posted
On 5/27/2020 at 10:59 PM, StinkyMadness said:

Some clean/short of onFirstTalk method


public String onFirstTalk(L2Npc npc, L2PcInstance player)
{
	String path = "data/html/CommunityBoard/Custom/main.html";
	switch(npc.getId())
	{
		case Merchant:
			 path = "data/html/CommunityBoard/Custom/merchant/main.html";
			break;
		case Gatekeeper:
			 path = "data/html/CommunityBoard/Custom/gatekeeper/main.html";
			break;
	}
	CommunityBoardHandler.separateAndSend(HtmCache.getInstance().getHtm(player, path), player);
	return null;
}

yep ! good onee!

  • 5 months later...
  • 1 year later...

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
Reply to this topic...

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



  • Posts

    • Make Your Rotating Proxy Management Easier with GoProxy API A comprehensive guide with code examples to help you seamlessly integrate our APIs into your workflow. GoProxy API Version 1 is designed for rotating proxies, and will soon support static proxies as well.   A Guide to Enjoy GoProxy API Service Step 1: Generate your API Key on the Settings page. Step 2: Check the GoProxy API Documentation to explore all available features. Step 3: Start using GoProxy's rotating proxies and enhance your workflow!   Don’t Miss Out! Get up to 87% off on rotating residential proxies today!    
    • NEW SEASON 2025     GRAND OPENING 31.01.2025 Dear players, we would like present you the new season of the L2Exoplanet server. The new server will be rate x10 with alot new updates & fixes. We promise you the best High Five server with big community and balanced economy. Our project consists team of enthusiasts who love Lineage 2 and we would like invite to this iconic game.     GRAND OPENING:  31.01.2025 at 20:00 GMT+1 BETA TEST:   24.01.2025    Client: High Five Rates: x10   Website: https://l2exoplanet.net Facebook: https://www.facebook.com/L2-Exoplanet-106811564103836 Discord: https://discord.gg/4fzhW7ZSPc      
    • NEW SEASON START 31.1.2025       GRAND OPENING:  31.01.2025 at 20:00 GMT+1 BETA TEST:   24.01.2025    Client: High Five Rates: x10   Website: https://l2exoplanet.net Facebook: https://www.facebook.com/L2-Exoplanet-106811564103836 Discord: https://discord.gg/4fzhW7ZSPc       Game Rates    Experience: x10  Skill Points: x10  Adena: x8  Drop: x8  Spoil: x8  Quest: x5  Raid Boss Drop: x5  Fame: x2  Epaulette: x8  Manor: x8  MW Craft Chance: 6%  Key-Matherial-Recepie: x16    Safe Enchant: +3  Maximum Enchant: +16  Normal Scroll Chance: 60%  Blessed Scroll Chance: 63%  Attribute Stone Chance: 50%  Attribute Crystal Chance: 30%      Game Settings    Multibox - 3 game clients per HWID  Autoloot  Autolearn Skills  NPC Buffer  Buff Slots (24+4/12)  Buff Duration (2h)  Olympiad Period 7days (new heroes appear every monday)  Seven Signs Period  Class Transfer for Adena  Max Sub-Class 3  Sub-Class Max Level 85  Essence Interface  Champions System  Vote Reward System  Dayli Reward System  PC Points Reward (500PC = 1 Donate Coin)      Epic Bosses Respawn Times     Queen Ant:  24 Hours +/- 4 Hours   Beleth: 2 Days +/- 8 Hours   Baium: 2 Days +/- 8 Hours   Antharas: 3 Days +/- 8 Hours   Valakas:  3 Days +/- 8 Hours     Instance Info     Normal Freya = 6 Players   Hard Freya = 12 Players   Frintezza = 6 Players   Zaken 83 Day = 6 Players   Zaken 60 Day = 6 Players   Zaken Nightly = 6 Players   Tiat = 6 Players   Beleth = 12 Players
    • i think u need edit server files side too... bcs for interlude missing cmd for this set
  • Topics

×
×
  • Create New...