sm = new SystemMessage(SystemMessageId.ACQUIRED);
sm.addNumber(lotonumber);
sm.addItemName(4442);
player.sendPacket(sm);
L2ItemInstance item = new L2ItemInstance(IdFactory.getInstance().getNextId(), 4442);
item.setCount(1);
item.setCustomType1(lotonumber);
item.setEnchantLevel(enchant);
item.setCustomType2(type2);
player.getInventory().addItem("Loto", item, player, this);
InventoryUpdate iu = new InventoryUpdate();
iu.addItem(item);
L2ItemInstance adenaupdate = player.getInventory().getItemByItemId(57);
iu.addModifiedItem(adenaupdate);
player.sendPacket(iu);
filename = (getHtmlPath(npcId, 3));
html.setFile(filename);
}
else if (val == 23) //23 - current lottery jackpot
{
filename = (getHtmlPath(npcId, 3));
html.setFile(filename);
}
else if (val == 24) // 24 - Previous winning numbers/Prize claim
{
filename = (getHtmlPath(npcId, 4));
html.setFile(filename);
int lotonumber = Lottery.getInstance().getId();
String message = "";
for (L2ItemInstance item : player.getInventory().getItems())
{
if (item == null) continue;
if (item.getItemId() == 4442 && item.getCustomType1() < lotonumber)
{
message = message + "<a action=\"bypass -h npc_%objectId%_Loto "
+ item.getObjectId() + "\">" + item.getCustomType1() + " Event Number ";
int[] numbers = Lottery.getInstance().decodeNumbers(item.getEnchantLevel(),
item.getCustomType2());
for (int i = 0; i < 5; i++)
{
message += numbers[i] + " ";
}
int[] check = Lottery.getInstance().checkTicket(item);
if (check[0] > 0)
{
switch (check[0])
{
case 1:
message += "- 1st Prize";
break;
case 2:
message += "- 2nd Prize";
break;
case 3:
message += "- 3th Prize";
break;
case 4:
message += "- 4th Prize";
break;
}
message += " " + check[1] + "a.";
}
message += "</a><br>";
}
}
if (message == "")
{
message += "There is no winning lottery ticket...<br>";
}
html.replace("%result%", message);
}
else if (val > 24) // >24 - check lottery ticket by item object id
{
int lotonumber = Lottery.getInstance().getId();
L2ItemInstance item = player.getInventory().getItemByObjectId(val);
if (item == null || item.getItemId() != 4442 || item.getCustomType1() >= lotonumber) return;
int[] check = Lottery.getInstance().checkTicket(item);
sm = new SystemMessage(SystemMessageId.DISSAPEARED_ITEM);
sm.addItemName(4442);
player.sendPacket(sm);