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

    • In my opinion, L2 is dead because the people who make servers didn’t adapt to today’s reality. People are getting older, life moves faster, there are more responsibilities, and less free time. And I’m not even talking about newcomers—how can you expect someone new to this game to learn by Googling every drop location or quest requirement? These things should’ve been integrated into the game, made accessible with just a few clicks through the interface. Instead, so much time was wasted trying to recreate retail-like features that no one asked for. Everyone hates autofarm, but why? Because admins never found a smart way to implement it. You could have made it available only in specific zones, with reduced drops, working like Adrenaline, or auto-teleporting to farm for a limited time per day—just enough to help people with limited time stay relevant in-game. There should also be zones with better drops, where active farming actually matters. Other features feel pointless—like the Life Stone system. Spamming LS to get a skill? Instead, you could create a system where you level up the skill with low chances per level, something that feels progressive and fair. Crafting should be simpler too. Right-click a recipe, and the required materials should show up right there. As for sieges, why not create daily clan war events at peak hours—one for Europeans, one for Latinos? You could spawn crystals inside or outside castles that give points and trigger PvP. Add a boss during the event that gives even more points, and let the top clan in the ranking take the castle. I could go on forever, but what’s the point? The community died because the people who had the knowledge to improve the game just took the easy way out, copying the same server formula over and over until no one could enjoy playing it anymore.
    • It's not because I'm an admin that he treated me differently. I actually gave him several clients from my side without him even knowing they came from me, and most of them had no issues. I was also waiting 3–4 weeks at times for things I bought from AvE, even when I was in a rush. He still delivered in the end. That said, I'm not defending him blindly. I'm just saying it's unlikely he’d risk scamming someone over 60–100€, especially knowing how quickly word spreads here.
    • For exact same reason - there were accusation that I scammed. When was it? 2016? But in that time, admins actually didn't listen. I got banned, then unbaned (when I prooved I've refunded) but I was trash talking to mods. When few months later same shit happened, Grisom (?) old global mod, banned me anyway. You can read somewhere on forum how I was shitting on him for doing that (from other account because original account was banned) - which was banned too. He is not here anymore I think. Back in the days I was well know for not carring that much if I was talking to mod or admin, I didn't hold my tongue. Now You know. Just like You know - if I delay, I deliver or refund. I'm not a scammer, even if my old time haterz love to repeat themselfs like mantra. I don't care.
    • Okay I respect that but why is your other account banned?   I don't think this happened just because you delayed somebodys work even in 2012
    • Do You understand the fact, I won't scam anyone? Can You grasp such idea?  Second of all, if a random restaurant on Google Maps has 599 positive reviews and few negative ones with 4,8* score, do You ask Google to block it's profile and burn the place down? No? Then why the fuck You are crying about my random delays? If someone can't get a CUSTOM DESIGN on time, I refund. I'm not 16  y.o. anymore. I don't make living out of this L2 bullshit. Never did. Since 2012 I've made shit tons of projects. How many delays did I have? 12? 15? Out of hundrets of projects. Calm Your tits please. If I would actually take 4k euro and NOT deliver and NOT refund - admins can ban me. So don't compare me to Simple. And just so You know, Celestine sent me customers, so it's not like I've worked with him on his account all the time. That's another thing You won't understand. I won't waste anymore time on You and any other cunt who never was my customer but is bitching just because he has nothing better to do in his life. You don't like my work? Hove along, I don't give a shit. 
  • Topics

×
×
  • Create New...