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

    • Lol good joke.   If I'd be the one contacting yo then I'd say at least 50% in advance because you can basically just fuck off when things doesn't go your way, and then you as a developer just wasted days or even weeks of time with development.
    • "Just make your own game!" sounds simple until you’ve tried it. I did, with Epic Dragon World and learned the hard way that "open source" often means "free labor for resellers." The MIT license became a buffet for people to grab code, rebrand it and ghost the project. Even basic collaboration collapsed because everyone wanted their vision, not *a* vision. NCSoft’s lawyers aren’t theoretical. They’re a sword of Damocles. Even if you rebuild a client from scratch, if it feels like Lineage 2, they’ll come knocking. Ask the Chrono Trigger fangame corpses how that goes. MMOs are hospice care. The genre’s on life support, kept alive by whales and nostalgia. Look at Throne and Liberty, NCSoft’s own "successor" to L2, flopping harder than a 2004 PKer in ToI. Classic reboots (WoW, L2) are bandaids, not resurrections. This is the hobby. Optimizing old systems, reverse-engineering spaghetti code and preserving janky mechanics is the fun part. Monetizing it turns it into customer service hell. No thanks. Community? What community? The L2 scene is 90% resellers, 10% players who’ll quit the second they don’t get +16 on day one. Both asking how to install Java and why running the uncompiled server does not work.
    • Dear players, Open beta test for C3 begins today at 19:00 server time (GMT +2). 💰 All participants who find bugs during OBT will be rewarded with Coin of Luck (CoL): - 1 CoL for each staticmesh issue found — e.g., walking through textures, etc., - 2 CoL or more for server-side issues, depending on their severity., We strongly recommend reviewing the quest list - when switching to Chronicle 3, the total number of quests should match the number shown in the upper right corner of the window and correspond to the quest count from Chronicle 2. To log into the game, use the same data you use to access the Airin server. 📌 Download client: Google Drive
    • 🔥 Sale Alert! 🔥 Twitter Accounts with 50 Followers — now on SALE! Looking to launch a project or warm up your account base fast? We’ve got starter Twitter accounts with ~50 followers at a sweet price. 💰 Limited-time offer – while stock lasts! ✅ Organic-Looking ✅ Clean & Safe ✅ Perfect for boosting credibility 📦 Instant delivery
  • 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