Jump to content
  • 0

Command .openatod


charcters

Question

Hi, I want put on my server the command .openatod is for open book Ancient of the demon of hellbound, for example if u want to open 1000 books u need write ".openatod 1000"

if any1 can give me info about this command please

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

I'll only write the useVoicedCommand method assuming you know how to register a new voiced handler.

public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params)
{
if (command.equalsIgnoreCase("openatod"))
	{
		if (params == null)
			activeChar.sendMessage("Usage: .openatod [num]");
		else
		{
			int num = 0;
			try {num = Integer.parseInt(params);}
			catch (NumberFormatException nfe) 
			{
				activeChar.sendMessage("You must enter a number. Usage: .openatod [num]");
				return false;
			}

			if (num == 0)
				return false;
			else if (activeChar.getInventory().getInventoryItemCount(9599, 0) >= num)
			{
				int a=0, b=0, c=0, d=0, rnd;
				for (int i=0; i<num;i++)
				{
					rnd = Rnd.get(100);
					// 25% Chance for hidden first page
					if (rnd <= 47 && rnd > 22)
						a++;
					// 15% chance for hidden second page
					else if (rnd <= 22 && rnd > 7)
						b++;
					else if (rnd <= 7)
						c++;
					else d++;
				}
				if (activeChar.destroyItemByItemId("ATOD", 9599, a+b+c+d, null, true))
				{
					if (a>0)
						activeChar.addItem("ATOD", 9600, a, null, true);
					if (b>0)
						activeChar.addItem("ATOD", 9601, b, null, true);
					if (c>0)
						activeChar.addItem("ATOD", 9602, c, null, true);
					activeChar.sendMessage(d+" Ancient Tomes of the Demon failed to open.");
				}
				else activeChar.sendMessage("You do not have enough tomes.");
			}
			else activeChar.sendMessage("You do not have enough tomes.");
		}
	}
}

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.


×
×
  • Create New...