Jump to content
  • 0

[Help] Captcha Antibot system


Question

Posted

Hi guys,

 

so i tryed to add captcha antibot system the system works after blabla kills he pop up and i must enter if wrong = jail

 

work i just get a error here a picture : erroren.jpg

 

and here the code of L2Attackable :

 

private static int AntiBotKills = 0;
private static int Change = 0;
NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(0);

@Override
public boolean doDie(L2Character killer)
{
	// Kill the L2NpcInstance (the corpse disappeared after 7 seconds)
	if (!super.doDie(killer))
		return false;

	if (Config.ENABLE_ANTIBOT_SYSTEM)
		AntiBotKills++;

	Change = Rnd.get(10);
	int AntiBotKillsCheck = (Config.ANTIBOT_KILLS_CHECK);
	if (Config.ENABLE_ANTIBOT_SYSTEM && AntiBotKills >= AntiBotKillsCheck)
	{
		killer.setIsParalyzed(true);
		killer.setIsInvul(true);
		AntiBotKills = 0;
		switch(Change)
		{
			case 1:
				npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br1>You will be invulnerable until you enter<br1>the code so noone will kill you!<br1><br>Question: <font color=\"66FF00\"> 3 + 9 </font> = ?<edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 12\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"></center></body></html>");
				killer.sendPacket(npcHtmlMessage);
				break;
			case 2:
				npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br1>You will be invulnerable until you enter<br1>the code so noone will kill you!<br1><br>Question: <font color=\"66FF00\"> 21 - 7</font> = ?<edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 14\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"></center></body></html>");
				killer.sendPacket(npcHtmlMessage);
				break;
			case 3:
				npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br1>You will be invulnerable until you enter<br1>the code so noone will kill you!<br1><br>Question: <font color=\"66FF00\"> 5 + 3 </font> = ?<edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 8\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"></center></body></html>");
				killer.sendPacket(npcHtmlMessage);
				break;
			case 4:
				npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br1>You will be invulnerable until you enter<br1>the code so noone will kill you!<br1><br>Question: <font color=\"66FF00\"> 3 - 2 </font> = ?<edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 1\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"></center></body></html>");
				killer.sendPacket(npcHtmlMessage);
				break;
			case 5:
				npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br1>You will be invulnerable until you enter<br1>the code so noone will kill you!<br1><br>Question: <font color=\"66FF00\"> 19 + 4 </font> = ?<edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 23\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"></center></body></html>");
				killer.sendPacket(npcHtmlMessage);
				break;
			case 6:
				npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br1>You will be invulnerable until you enter<br1>the code so noone will kill you!<br1><br>Question: <font color=\"66FF00\"> 9 - 3 </font> = ?<edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 6\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"></center></body></html>");
				killer.sendPacket(npcHtmlMessage);
				break;
			case 7:
				npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br1>You will be invulnerable until you enter<br1>the code so noone will kill you!<br1><br>Question: <font color=\"66FF00\"> 53 - 33 </font> = ?<edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 20\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"></center></body></html>");
				killer.sendPacket(npcHtmlMessage);
				break;
			case 8:
				npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br1>You will be invulnerable until you enter<br1>the code so noone will kill you!<br1><br>Question: <font color=\"66FF00\"> 7 + 22 </font> = ?<edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 29\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"></center></body></html>");
				killer.sendPacket(npcHtmlMessage);
				break;
			case 9:
				npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br1>You will be invulnerable until you enter<br1>the code so noone will kill you!<br1><br>Question: <font color=\"66FF00\"> 4 + 31 </font> = ?<edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 35\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"></center></body></html>");
				killer.sendPacket(npcHtmlMessage);
				break;
			case 10:
				npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br1>You will be invulnerable until you enter<br1>the code so noone will kill you!<br1><br>Question: <font color=\"66FF00\"> 12 - 8 </font> = ?<edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 4\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"></center></body></html>");
				killer.sendPacket(npcHtmlMessage);
			default:
			;
		}
	}

	// Notify the Quest Engine of the L2Attackable death if necessary
	try
	{
		L2PcInstance player = null;

		if (killer != null)
			player = killer.getActingPlayer();

		if (player != null)
		{
			if (getTemplate().getEventQuests(Quest.QuestEventType.ON_KILL) != null)
				for (Quest quest: getTemplate().getEventQuests(Quest.QuestEventType.ON_KILL))
					ThreadPoolManager.getInstance().scheduleEffect(new OnKillNotifyTask(this, quest, player, killer instanceof L2Summon), _onKillDelay);
		}
	}
	catch (Exception e) { _log.log(Level.SEVERE, "", e); }
	return true;
}

 

thanks for helping mee

Recommended Posts

  • 0
Posted

Tryskell

 

did you have better protect ideas ?i yes but i think for a java beginner very hard to code.

so i dont know captcha is one way the bot reoirt button the second.

 

if i i change it into L2Pcinstance at what bolean  and what i have o change there if you mean that will work better ?

 

thanks

  • 0
Posted

Well, it totally depends of the "idea" of your mod.

 

A captcha system have more reasons to exist on the entrance of any player (enterWorld.java) than in the DoDie method of any L2Attackable monster/summon/player.

 

Considering your captcha thing is *CURRENTLY* :

- generating correctly a random code, and make the association code/input text (well your code is primitive, but it seems to work);

- sending a window at the death of a player (killing anything other than a player show a NPE atm, from what I think);

- punishing the player if the code is wrong;

 

The only thing you have to do is to remove all the code from L2Attackable and edit it for EnterWorld. Basically your code fits for EnterWorld, as it misses all good instances checks, and enterWorld is "made" for players only.

 

------

 

Revert back your code in L2Attackable then

 

	/**
 * Kill the L2Attackable (the corpse disappeared after 7 seconds), distribute rewards (EXP, SP, Drops...) and notify Quest Engine.
 *
 * Actions:
 * Distribute Exp and SP rewards to L2PcInstance (including Summon owner) that hit the L2Attackable and to their Party members
 * Notify the Quest Engine of the L2Attackable death if necessary
 * Kill the L2NpcInstance (the corpse disappeared after 7 seconds)
 *
 * Caution: This method DOESN'T GIVE rewards to L2PetInstance
 *
 * @param killer The L2Character that has killed the L2Attackable
 */
@Override
public boolean doDie(L2Character killer)
{
	// Kill the L2NpcInstance (the corpse disappeared after 7 seconds)
	if (!super.doDie(killer))
		return false;

	// Notify the Quest Engine of the L2Attackable death if necessary
	try
	{
		L2PcInstance player = null;

		if (killer != null)
			player = killer.getActingPlayer();

		if (player != null)
		{
			if (getTemplate().getEventQuests(Quest.QuestEventType.ON_KILL) != null)
				for (Quest quest: getTemplate().getEventQuests(Quest.QuestEventType.ON_KILL))
					ThreadPoolManager.getInstance().scheduleEffect(new OnKillNotifyTask(this, quest, player, killer instanceof L2Summon), _onKillDelay);
		}
	}
	catch (Exception e) { _log.log(Level.SEVERE, "", e); }
	return true;
}

 

And in enterworld.java, find the good place to put (around the end, as enterWorld initializes many things) - I perhaps made errors, I just edited with notepad and didn't check synthax/logic :

 

if (Config.ENABLE_ANTIBOT_SYSTEM)
{
private static int AntiBotKills = 0;
private static int Change = 0;
int AntiBotKillsCheck = (Config.ANTIBOT_KILLS_CHECK);
NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(0);

Change = Rnd.get(8);
AntiBotKills++;

if (AntiBotKills >= AntiBotKillsCheck)
{
	killer.setIsParalyzed(true);
	AntiBotKills = 0;
	switch(Change)
	{
		case 0:
			npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br><br>Question: <font color=\"66FF00\"> 3 + 9 </font> = ?<br><edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 12\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"><font color=\"FFFFFF\"> If your Type is Incorrect you will be Punished !</font></center></body></html>");
			killer.sendPacket(npcHtmlMessage);
			break;
		case 1:
			npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br><br>Question: <font color=\"66FF00\"> 21 - 7 </font> = ?<br><edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 14\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"><font color=\"FFFFFF\"> If your Type is Incorrect you will be Punished !</font></center></body></html>");
			killer.sendPacket(npcHtmlMessage);
			break;
		case 2:
			npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br><br>Question: <font color=\"66FF00\"> 9 + 7 </font> = ?<br><edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 16\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"><font color=\"FFFFFF\"> If your Type is Incorrect you will be Punished !</font></center></body></html>");
			killer.sendPacket(npcHtmlMessage);
			break;
		case 3:
			npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br><br>Question: <font color=\"66FF00\"> 36 - 18 </font> = ?<br><edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 18\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"><font color=\"FFFFFF\"> If your Type is Incorrect you will be Punished !</font></center></body></html>");
			killer.sendPacket(npcHtmlMessage);
			break;
		case 4:
			npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br><br>Question: <font color=\"66FF00\"> 10 + 0 </font> = ?<br><edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 10\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"><font color=\"FFFFFF\"> If your Type is Incorrect you will be Punished !</font></center></body></html>");
			killer.sendPacket(npcHtmlMessage);
			break;
		case 5:
			npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br><br>Question: <font color=\"66FF00\"> 7 + 6 </font> = ?<br><edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 13\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"><font color=\"FFFFFF\"> If your Type is Incorrect you will be Punished !</font></center></body></html>");
			killer.sendPacket(npcHtmlMessage);
			break;
		case 6:
			npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br><br>Question: <font color=\"66FF00\"> 7 + 6 </font> = ?<br><edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 13\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"><font color=\"FFFFFF\"> If your Type is Incorrect you will be Punished !</font></center></body></html>");
			killer.sendPacket(npcHtmlMessage);
			break;
		case 7:
			npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br><br>Question: <font color=\"66FF00\"> 7 + 6 </font> = ?<br><edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 13\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"><font color=\"FFFFFF\"> If your Type is Incorrect you will be Punished !</font></center></body></html>");
			killer.sendPacket(npcHtmlMessage);
			break;
		case 8:
			npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br><br>Question: <font color=\"66FF00\"> 7 + 6 </font> = ?<br><edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 13\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"><font color=\"FFFFFF\"> If your Type is Incorrect you will be Punished !</font></center></body></html>");
			killer.sendPacket(npcHtmlMessage);
			break;
		default:
			npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br><br>Question: <font color=\"66FF00\"> 1 + 8 </font> = ?<br><edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 9\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"><font color=\"FFFFFF\"> If your Type is Incorrect you will be Punished !</font></center></body></html>");
			killer.sendPacket(npcHtmlMessage);
	}
}
}

 

I didn't test your mechanism, so don't tell it doesn't works (this is your system if I didn't fock the c/p :D), and I don't know how the player isn't supposed to be de-paralized, I guess the voiced command got it.

 

killer have to be replaced to activeChar, imports have surely to be corrected, and such.

  • 0
Posted

Well, it totally depends of the "idea" of your mod.

 

A captcha system have more reasons to exist on the entrance of any player (enterWorld.java) than in the DoDie method of any L2Attackable monster/summon/player.

 

Considering your captcha thing is *CURRENTLY* :

- generating correctly a random code, and make the association code/input text (well your code is primitive, but it seems to work);

- sending a window at the death of a player (killing anything other than a player show a NPE atm, from what I think);

- punishing the player if the code is wrong;

 

The only thing you have to do is to remove all the code from L2Attackable and edit it for EnterWorld. Basically your code fits for EnterWorld, as it misses all good instances checks, and enterWorld is "made" for players only.

 

------

 

Revert back your code in L2Attackable then

 

	/**
 * Kill the L2Attackable (the corpse disappeared after 7 seconds), distribute rewards (EXP, SP, Drops...) and notify Quest Engine.
 *
 * Actions:
 * Distribute Exp and SP rewards to L2PcInstance (including Summon owner) that hit the L2Attackable and to their Party members
 * Notify the Quest Engine of the L2Attackable death if necessary
 * Kill the L2NpcInstance (the corpse disappeared after 7 seconds)
 *
 * Caution: This method DOESN'T GIVE rewards to L2PetInstance
 *
 * @param killer The L2Character that has killed the L2Attackable
 */
@Override
public boolean doDie(L2Character killer)
{
	// Kill the L2NpcInstance (the corpse disappeared after 7 seconds)
	if (!super.doDie(killer))
		return false;

	// Notify the Quest Engine of the L2Attackable death if necessary
	try
	{
		L2PcInstance player = null;

		if (killer != null)
			player = killer.getActingPlayer();

		if (player != null)
		{
			if (getTemplate().getEventQuests(Quest.QuestEventType.ON_KILL) != null)
				for (Quest quest: getTemplate().getEventQuests(Quest.QuestEventType.ON_KILL))
					ThreadPoolManager.getInstance().scheduleEffect(new OnKillNotifyTask(this, quest, player, killer instanceof L2Summon), _onKillDelay);
		}
	}
	catch (Exception e) { _log.log(Level.SEVERE, "", e); }
	return true;
}

 

And in enterworld.java, find the good place to put (around the end, as enterWorld initializes many things) - I perhaps made errors, I just edited with notepad and didn't check synthax/logic :

 

if (Config.ENABLE_ANTIBOT_SYSTEM)
{
private static int AntiBotKills = 0;
private static int Change = 0;
int AntiBotKillsCheck = (Config.ANTIBOT_KILLS_CHECK);
NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(0);

Change = Rnd.get(8);
AntiBotKills++;

if (AntiBotKills >= AntiBotKillsCheck)
{
	killer.setIsParalyzed(true);
	AntiBotKills = 0;
	switch(Change)
	{
		case 0:
			npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br><br>Question: <font color=\"66FF00\"> 3 + 9 </font> = ?<br><edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 12\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"><font color=\"FFFFFF\"> If your Type is Incorrect you will be Punished !</font></center></body></html>");
			killer.sendPacket(npcHtmlMessage);
			break;
		case 1:
			npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br><br>Question: <font color=\"66FF00\"> 21 - 7 </font> = ?<br><edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 14\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"><font color=\"FFFFFF\"> If your Type is Incorrect you will be Punished !</font></center></body></html>");
			killer.sendPacket(npcHtmlMessage);
			break;
		case 2:
			npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br><br>Question: <font color=\"66FF00\"> 9 + 7 </font> = ?<br><edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 16\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"><font color=\"FFFFFF\"> If your Type is Incorrect you will be Punished !</font></center></body></html>");
			killer.sendPacket(npcHtmlMessage);
			break;
		case 3:
			npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br><br>Question: <font color=\"66FF00\"> 36 - 18 </font> = ?<br><edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 18\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"><font color=\"FFFFFF\"> If your Type is Incorrect you will be Punished !</font></center></body></html>");
			killer.sendPacket(npcHtmlMessage);
			break;
		case 4:
			npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br><br>Question: <font color=\"66FF00\"> 10 + 0 </font> = ?<br><edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 10\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"><font color=\"FFFFFF\"> If your Type is Incorrect you will be Punished !</font></center></body></html>");
			killer.sendPacket(npcHtmlMessage);
			break;
		case 5:
			npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br><br>Question: <font color=\"66FF00\"> 7 + 6 </font> = ?<br><edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 13\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"><font color=\"FFFFFF\"> If your Type is Incorrect you will be Punished !</font></center></body></html>");
			killer.sendPacket(npcHtmlMessage);
			break;
		case 6:
			npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br><br>Question: <font color=\"66FF00\"> 7 + 6 </font> = ?<br><edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 13\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"><font color=\"FFFFFF\"> If your Type is Incorrect you will be Punished !</font></center></body></html>");
			killer.sendPacket(npcHtmlMessage);
			break;
		case 7:
			npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br><br>Question: <font color=\"66FF00\"> 7 + 6 </font> = ?<br><edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 13\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"><font color=\"FFFFFF\"> If your Type is Incorrect you will be Punished !</font></center></body></html>");
			killer.sendPacket(npcHtmlMessage);
			break;
		case 8:
			npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br><br>Question: <font color=\"66FF00\"> 7 + 6 </font> = ?<br><edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 13\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"><font color=\"FFFFFF\"> If your Type is Incorrect you will be Punished !</font></center></body></html>");
			killer.sendPacket(npcHtmlMessage);
			break;
		default:
			npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br><br>Question: <font color=\"66FF00\"> 1 + 8 </font> = ?<br><edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 9\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"><font color=\"FFFFFF\"> If your Type is Incorrect you will be Punished !</font></center></body></html>");
			killer.sendPacket(npcHtmlMessage);
	}
}
}

 

I didn't test your mechanism, so don't tell it doesn't works (this is your system if I didn't fock the c/p :D), and I don't know how the player isn't supposed to be de-paralized, I guess the voiced command got it.

 

killer have to be replaced to activeChar, imports have surely to be corrected, and such.

  • 0
Posted

Well, it totally depends of the "idea" of your mod.

 

A captcha system have more reasons to exist on the entrance of any player (enterWorld.java) than in the DoDie method of any L2Attackable monster/summon/player.

 

Considering your captcha thing is *CURRENTLY* :

- generating correctly a random code, and make the association code/input text (well your code is primitive, but it seems to work);

- sending a window at the death of a player (killing anything other than a player show a NPE atm, from what I think);

- punishing the player if the code is wrong;

 

The only thing you have to do is to remove all the code from L2Attackable and edit it for EnterWorld. Basically your code fits for EnterWorld, as it misses all good instances checks, and enterWorld is "made" for players only.

 

------

 

Revert back your code in L2Attackable then

 

	/**
 * Kill the L2Attackable (the corpse disappeared after 7 seconds), distribute rewards (EXP, SP, Drops...) and notify Quest Engine.
 *
 * Actions:
 * Distribute Exp and SP rewards to L2PcInstance (including Summon owner) that hit the L2Attackable and to their Party members
 * Notify the Quest Engine of the L2Attackable death if necessary
 * Kill the L2NpcInstance (the corpse disappeared after 7 seconds)
 *
 * Caution: This method DOESN'T GIVE rewards to L2PetInstance
 *
 * @param killer The L2Character that has killed the L2Attackable
 */
@Override
public boolean doDie(L2Character killer)
{
	// Kill the L2NpcInstance (the corpse disappeared after 7 seconds)
	if (!super.doDie(killer))
		return false;

	// Notify the Quest Engine of the L2Attackable death if necessary
	try
	{
		L2PcInstance player = null;

		if (killer != null)
			player = killer.getActingPlayer();

		if (player != null)
		{
			if (getTemplate().getEventQuests(Quest.QuestEventType.ON_KILL) != null)
				for (Quest quest: getTemplate().getEventQuests(Quest.QuestEventType.ON_KILL))
					ThreadPoolManager.getInstance().scheduleEffect(new OnKillNotifyTask(this, quest, player, killer instanceof L2Summon), _onKillDelay);
		}
	}
	catch (Exception e) { _log.log(Level.SEVERE, "", e); }
	return true;
}

 

And in enterworld.java, find the good place to put (around the end, as enterWorld initializes many things) - I perhaps made errors, I just edited with notepad and didn't check synthax/logic :

 

if (Config.ENABLE_ANTIBOT_SYSTEM)
{
private static int AntiBotKills = 0;
private static int Change = 0;
int AntiBotKillsCheck = (Config.ANTIBOT_KILLS_CHECK);
NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(0);

Change = Rnd.get(8);
AntiBotKills++;

if (AntiBotKills >= AntiBotKillsCheck)
{
	killer.setIsParalyzed(true);
	AntiBotKills = 0;
	switch(Change)
	{
		case 0:
			npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br><br>Question: <font color=\"66FF00\"> 3 + 9 </font> = ?<br><edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 12\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"><font color=\"FFFFFF\"> If your Type is Incorrect you will be Punished !</font></center></body></html>");
			killer.sendPacket(npcHtmlMessage);
			break;
		case 1:
			npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br><br>Question: <font color=\"66FF00\"> 21 - 7 </font> = ?<br><edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 14\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"><font color=\"FFFFFF\"> If your Type is Incorrect you will be Punished !</font></center></body></html>");
			killer.sendPacket(npcHtmlMessage);
			break;
		case 2:
			npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br><br>Question: <font color=\"66FF00\"> 9 + 7 </font> = ?<br><edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 16\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"><font color=\"FFFFFF\"> If your Type is Incorrect you will be Punished !</font></center></body></html>");
			killer.sendPacket(npcHtmlMessage);
			break;
		case 3:
			npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br><br>Question: <font color=\"66FF00\"> 36 - 18 </font> = ?<br><edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 18\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"><font color=\"FFFFFF\"> If your Type is Incorrect you will be Punished !</font></center></body></html>");
			killer.sendPacket(npcHtmlMessage);
			break;
		case 4:
			npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br><br>Question: <font color=\"66FF00\"> 10 + 0 </font> = ?<br><edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 10\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"><font color=\"FFFFFF\"> If your Type is Incorrect you will be Punished !</font></center></body></html>");
			killer.sendPacket(npcHtmlMessage);
			break;
		case 5:
			npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br><br>Question: <font color=\"66FF00\"> 7 + 6 </font> = ?<br><edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 13\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"><font color=\"FFFFFF\"> If your Type is Incorrect you will be Punished !</font></center></body></html>");
			killer.sendPacket(npcHtmlMessage);
			break;
		case 6:
			npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br><br>Question: <font color=\"66FF00\"> 7 + 6 </font> = ?<br><edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 13\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"><font color=\"FFFFFF\"> If your Type is Incorrect you will be Punished !</font></center></body></html>");
			killer.sendPacket(npcHtmlMessage);
			break;
		case 7:
			npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br><br>Question: <font color=\"66FF00\"> 7 + 6 </font> = ?<br><edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 13\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"><font color=\"FFFFFF\"> If your Type is Incorrect you will be Punished !</font></center></body></html>");
			killer.sendPacket(npcHtmlMessage);
			break;
		case 8:
			npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br><br>Question: <font color=\"66FF00\"> 7 + 6 </font> = ?<br><edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 13\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"><font color=\"FFFFFF\"> If your Type is Incorrect you will be Punished !</font></center></body></html>");
			killer.sendPacket(npcHtmlMessage);
			break;
		default:
			npcHtmlMessage.setHtml("<html><title>Antibot System</title><body><center>Enter a code below and click CONFIRM<br><br>Question: <font color=\"66FF00\"> 1 + 8 </font> = ?<br><edit var=\"antibot\" width=110><br><br><button value=\"Confirm\" action=\"bypass -h voice .antibot $antibot 9\" width=80 height=26 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"><font color=\"FFFFFF\"> If your Type is Incorrect you will be Punished !</font></center></body></html>");
			killer.sendPacket(npcHtmlMessage);
	}
}
}

 

I didn't test your mechanism, so don't tell it doesn't works (this is your system if I didn't fock the c/p :D), and I don't know how the player isn't supposed to be de-paralized, I guess the voiced command got it.

 

killer have to be replaced to activeChar, imports have surely to be corrected, and such.

 

If you have ever botted before with programs like L2Net you know that when your bot loggs in you can just sit there for a few minutes and watch it for the capatcha to load up.

 

What you could do on enterworld.java is add a random int for the loading of the capatcha and have the integer be a large number.

 

So player enters - the code assigns random time before load capatcha - when time runs out loads capatcha... not that hard to edit form your current code.

  • 0
Posted

A generated number / suit of letters/number will show the asked code on the html ("To play enter following code : blablabla"), so it's exploitable as the answer is shown.

 

The only real way would be to call an image. The other solution is as the topic owner made, but once the guy got all possible questions/answers, it's bypassed.

 

----

 

I gave all codes and what you had to do, so now go work and come if you got issues compiling/ingame :P.

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
Answer this question...

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




×
×
  • Create New...