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

    • never met a programmer that doesnt know english xD and as he said his knowledge and skills are beyond our imagination xD
    • nice work, welcome back to world of lineage development @melron 😄
    • He's likely baiting you to download his source full of backdoors indeed
    • Yeah inside router i had to enable udnp services 
    • Hello cheaters, As a team of avid developers and enthusiasts of Lineage 2, we are excited to present the L2 Control Hub, a groundbreaking plugin designed by myself and my collaborator, StinkyMadness. This innovative tool equips server administrators with powerful automation capabilities directly within the game's community board. L2 Control Hub simplifies the creation and management of automations, enabling you to customize your server operations without the need to modify the source code.   Key Features of L2 Control Hub: Robust Automation Triggers: Select from a plethora of triggers currently available, with continuous additions in the works to enhance your control options. Dynamic Conditions and Actions: Tailor your server operations with an extensive range of conditions and actions, ensuring flexible and precise control over game events and player interactions. Customizable Variables: Easily integrate server-specific variables from your database to further personalize and streamline your automations. Utilize these variables across various automation scenarios to cater to your specific server requirements. JavaScript Integration: Execute custom JavaScript codes that interact seamlessly with Java classes, bringing advanced functionalities to your server's ecosystem.   Explore L2 Control Hub in Action: We've prepared a series of video tutorials to demonstrate the capabilities of L2 Control Hub: Control Hub - Create a Simple Flow with 1 Condition and 1 Action: Get started with basic automations. Control Hub - Multiple Conditions with Multiple Actions: Explore more complex automations for detailed server management. Control Hub - Using Variables: Discover how to implement and use custom variables for tailored automations. Control Hub - Using JavaScript: Experience the power of custom scripts in enhancing your server functionality.   L2 Control Hub is currently about 70% complete, and we are actively developing and refining features. We invite you to join our ➡️ Discord community ⬅️ to engage with the development process, provide feedback, and be the first to test new features. Additionally, any updates or changes to the plugin are seamlessly delivered to all customers directly from our web server, ensuring your system is always up-to-date without the need for manual downloads.   Your game, your rules, automated. Join us in redefining server management in Lineage 2 and elevate your gaming community with unmatched automation capabilities. For more details, contact us directly to get started with L2 Control Hub.   Currently, the plugin is developed using aCis sources. We will continue with these sources until we finalize all the necessary details before proceeding to integrate with the more prominent sources available.       The L2 Control Hub is designed to extend beyond mere functional additions to your server. We are in the process of implementing a suite of advanced mechanisms, such as a vote manager capable of interfacing with any Lineage 2 voting site without requiring configuration, live statistics to provide admins with real-time insights, and an event engine that can generate any desired event within seconds. All these features will be seamlessly integrated into the module, enhancing your server management experience significantly.     Please note that L2 Control Hub will be a premium tool, reflecting the extensive features and benefits it offers. While we are finalizing the pricing structure, rest assured that we aim to deliver great value for your investment. We will announce the cost details soon on our platforms to ensure everyone is well-informed and can plan accordingly. Join us to take your server management to the next level with L2 Control Hub.     
  • Topics

×
×
  • Create New...