Jump to content

Recommended Posts

Posted

Hello there,

i was so boring this Saturday and i started to make this hero manager. So, i am here to share it today. It is being created exclusively by me (`Heroin). It is just a simple NPC, where a player is able to make hero him self...However, he can choose to make all of his online clan members hero. NPC is calculating automatically prizes (depends number of online clan members) and replaces it on NPC html(dialog).

 

Here are some screens of my NPC:

 

http://i47.tinypic.com/161korn.jpg (html dialog preview).

http://i49.tinypic.com/2r3jdaw.jpg ("Make me hero" button).

http://img844.imageshack.us/img844/2430/shot00009v.png ("Make all over my online clan members hero" button).

 

 

How to Install:

 

1. Create a new java file on data/scripts/custom/HeroManager/HeroManager.java

 

Paste this code:

package custom.HeroManager;
import java.util.logging.Logger;
import com.l2jserver.gameserver.cache.HtmCache;
import com.l2jserver.gameserver.datatables.ItemTable;
import com.l2jserver.gameserver.model.L2Clan;
import com.l2jserver.gameserver.model.L2ClanMember;
import com.l2jserver.gameserver.model.L2World;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jserver.gameserver.util.Broadcast;

/**
* @author `Heroin
* Made For Maxcheaters.com
*/
public class HeroManager extends Quest
{
private Logger _log = Logger.getLogger(HeroManager.class.getName());
private static final int npcid = 36650; // npc id
private static final int ItemConsumeId = 57; // Item Consume id
private static final int ItemConsumeAmount = 100; // Item Consume Amount
private static String htm = "data/scripts/custom/HeroManager/1.htm"; //html location
private static boolean announce = true; //Announce which players are getting hero from npc or not.
private static String ItemName = ItemTable.getInstance().createDummyItem(ItemConsumeId).getItemName();

public HeroManager(int questId, String name, String descr)
{
	super(questId, name, descr);
	addFirstTalkId(npcid);
	addTalkId(npcid);
	addStartNpc(npcid);
}

@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
	if (event.startsWith("hero"))
	{
		Hero(event, npc, player, event);
	}
	if (event.startsWith("heroall"))
	{
		HeroAll(event, npc, player, event);
	}
	return "";
}

private void Hero(String event, L2Npc npc, L2PcInstance player, String command)
{
	try
	{
		if (player.isHero())
		{
			player.sendMessage("You are already hero!");
			return;
		}
		if (!player.isNoble())
		{
			player.sendMessage("You have to be a noblesser in order to be hero!");
			return;
		}
		else if (player.getInventory().getItemByItemId(ItemConsumeId).getCount() >= ItemConsumeAmount)
		{
			player.destroyItemByItemId("Hero Manager", ItemConsumeId, ItemConsumeAmount, player, true);
			player.sendMessage("Congratulations, you are now a temporary hero!");
			player.setHero(true);
			player.broadcastUserInfo();
			_log.info(player.getName()+" is now a temporary hero.");
			if (announce == true)
			{
				Broadcast.announceToOnlinePlayers(player.getName()+" has been hero from Hero Manager!");
			}
		}
		else if (player.getInventory().getItemByItemId(ItemConsumeId).getCount() < ItemConsumeAmount)
		{
			player.sendMessage("You don't have enough items!");
			return;
		}
		else
		{
			player.sendMessage("Something went wrong.");
			return;
		}
	}
	catch (Exception e)
	{
		player.sendMessage("Something went wrong try again.");
	}
}

@SuppressWarnings("unused")
private void HeroAll(String event, L2Npc npc, L2PcInstance player, String command)
{
	try
	{
		L2Clan clan = player.getClan();
		L2ClanMember[] mem = clan.getMembers();
		int count = clan.getOnlineMembersCount();
		if (clan == null)
		{
			player.sendMessage("You are not in a clan!");
			return;
		}
		if (player.getInventory().getItemByItemId(ItemConsumeId).getCount() < count * mem.length)
		{
			player.sendMessage("You need "+count * mem.length+" "+ItemName+" to make all your online clan members hero!");
			return;
		}
		else if (player.getInventory().getItemByItemId(ItemConsumeId).getCount() >= count * mem.length)
		{
			int c = 0;
			for (L2ClanMember member : mem)
			{
				int id = member.getObjectId();
				L2PcInstance playeru = L2World.getInstance().getPlayer(id);
				playeru.setHero(true);
				playeru.sendMessage(player.getName() + " paid to make you hero.");
				c = c+1;
				playeru.broadcastUserInfo();
			}
			player.destroyItemByItemId("Hero Manager", ItemConsumeId, ItemConsumeAmount*mem.length, player, true);
			player.sendMessage("Congratulations, all your online clan members are now hero!");
			player.setHero(true);
			player.broadcastUserInfo();
			if (announce == true)
			{
				Broadcast.announceToOnlinePlayers("All "+clan.getName()+" members are now hero!");
			}
		}
	}
	catch (Exception e)
	{
		player.sendMessage("Something went wrong try again.");
	}
}

@Override
public String onFirstTalk(L2Npc npc, L2PcInstance player)
{
	final int npcId = npc.getNpcId();
	if (player.getQuestState(getName()) == null)
	{
		newQuestState(player);
	}
	int members = player.getClan().getOnlineMembersCount();
	if (npcId == npcid)
	{
		String html = HtmCache.getInstance().getHtm(player.getHtmlPrefix(), htm);
		html = html.replaceAll("%player%", player.getName());
		html = html.replaceAll("%itemname%", ItemName);
		html = html.replaceAll("%solosize%", ""+ItemConsumeAmount+"");
		html = html.replaceAll("%clansize%", ""+members*ItemConsumeAmount+"");

		NpcHtmlMessage npcHtml = new NpcHtmlMessage(0);
		npcHtml.setHtml(html);
		player.sendPacket(npcHtml);
	}
	return "";
}

public static void main(final String[] args)
{
	new HeroManager(-1, HeroManager.class.getSimpleName(), "custom");
	System.out.println("Hero Manager By `Heroin Has been Loaded Successfully!");
}
}

 

2.Create a new htm file on data/scripts/custom/HeroManager/1.htm

Paste this code on it.

 

<html>
<title>%player%</title>
<body><center>
<img src="L2UI_CH3.herotower_deco" width=256 height=32></center><br>
Hello there, i could make you hero easily. Only thing i need is some <font color=LEVEL>%itemname%</font>
and tell me exactly what you want from me.<br>
In order to make <font color=FF0000>only yourself hero,</font> you need: <font color=LEVEL>%solosize% %itemname%</font><br>
In order to make <font color=FF0000>all over your online clan members hero,</font> you need:
<font color=LEVEL>%clansize% %itemname%</font><br><br>


<a action="bypass -h Quest HeroManager hero">Make Me Hero.</a><br>
<a action="bypass -h Quest HeroManager heroall">Make All Over My Online Clan Members Hero.</a><br>


<br><br><br><br><br><br>
<center>
<img src="L2UI_CH3.herotower_deco" width=256 height=32></center>
</body></html>

 

3.Add script on scripts.cfg file:

custom/HeroManager/HeroManager.java

 

How to Modify:

 

Check Variables on code:

private Logger _log = Logger.getLogger(HeroManager.class.getName());
private static final int npcid = 36650; // npc id
private static final int ItemConsumeId = 57; // Item Consume id
private static final int ItemConsumeAmount = 100; // Item Consume Amount
private static String htm = "data/scripts/custom/HeroManager/1.htm"; //html location
private static boolean announce = true; //Announce which players are getting hero from npc or not.
private static String ItemName = ItemTable.getInstance().createDummyItem(ItemConsumeId).getItemName();

 

 

Credits:  `Heroin

Idea:  `Heroin

Posted

Good share!

is a nice share but really don't thing is ok for karma.. keep on!

Great share, rewarded :)

Thank you all and ty for +1 pixel Dεbian.

Posted

read the new rulles kiddo, no double karma on same post

 

kid is your father okay? chek here next time idiot http://maxcheaters.com/forum/index.php?topic=269053.msg2505070#msg2505070 why double  karma here?

 

if u dont know dont talk so much trash.

Posted

kid is your father okay? chek here next time idiot http://maxcheaters.com/forum/index.php?topic=269053.msg2505070#msg2505070 why double  karma here?

 

if u dont know dont talk so much trash.

 

calm trashtalker, they will loose it soon as soon a gmod notices it, about you now, you give 2nd karma? why? Its such a GREAT share to deserve 2 Karma with: More restricted Karma rules?

 

He already got 1 karma for his try but the code has nothing special to deserve more.

Posted

calm trashtalker, they will loose it soon as soon a gmod notices it, about you now, you give 2nd karma? why? Its such a GREAT share to deserve 2 Karma with: More restricted Karma rules?

 

He already got 1 karma for his try but the code has nothing special to deserve more.

 

dude stop trashtalking. i didnt see the new rules so next time tell it firist after flame

Posted

Read new rules

We give +1 ONLY for a good share and only once. If someone else already gave +1 for this share dont give second.

 

Nice share btw keep going ;)

Karma fixed

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

    • Discord         :  utchiha_market Telegram        : https://t.me/utchiha_market Auto Buy Store  : https://utchiha-market.mysellauth.com/ Not sure if we’re legit? Check Our server — real reviews, real buyers https://discord.gg/uthciha-servicess  | https://campsite.bio/utchihaamkt
    • how can i write you the exact price if the price is constantly changing? you are fucking weird people HELLO EVERYONE. WE ARE SELLING A LOT OF ADENA ON L2 REBORN DISCORD - GODDARDSHOP   HURRY TO BUY OR YOU MAY NOT MAKE IT!!!
    • Marketing without structured promotion is like playing blind. Whether you're building a product, managing a brand, running a blog, developing a service, or launching a startup — visibility is one of the key success factors. No matter how good your project is, without traffic, reach, and engaged audiences, it simply won't reach the right people. ➡ In 2025, marketing is more than just advertising. It's about maintaining a consistent presence in the information space, working smartly with social media, content platforms, and audience feedback. And this process should be automated. Want more attention, reach, and traffic for your project? ➡ SocNet is a powerful and easy-to-use platform for promotion across top platforms. Who is it for? – Website, e-commerce store, and blog owners – Admins of Telegram channels, Discord servers, and communities – Content creators, streamers, and musicians – Marketers, agencies, and SMM professionals – Anyone building projects online Use our SMM Panel to boost Facebook, Instagram, Telegram, Spotify, SoundCloud, YouTube, Reddit, Threads, Kick, Discord, LinkedIn, Likee, VK, Twitch, Kwai, TikTok, Trustpilot, Apple Music, Tripadvisor, Snapchat, and more. Subscribers, likes, views, reposts, listens, live viewers, reactions, comments — everything you need. Get a $1 bonus for your first test run: Just submit a support ticket with the subject “Get Trial Bonus” on our website. ➡ Go to SMM Panel (clickable) or contact our bot support How to order: ➡ SMM Panel: Click ➡ Telegram bot version: Click (Menu ➡ SMM Panel) Our digital goods store: ➡ Online Store: Click ➡ Telegram Bot: Click Regular customers receive extra discounts and promo codes! Support: ➡ Telegram: https://t.me/solomon_bog ➡ Discord: https://discord.gg/y9AStFFsrh ➡ WhatsApp: https://wa.me/79051904467 ➡ Email: solomonbog@socnet.store ➡ Telegram Channel: https://t.me/accsforyou_shop You can also use these contacts to: — Inquire about wholesale pricing — Propose a partnership (Current partners: https://socnet.bgng.io/partners ) — Become our supplier SocNet — your store for digital goods and premium subscriptions.
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock