Lottery additions and related improvements.

This commit is contained in:
MobiusDevelopment
2020-02-03 03:40:55 +00:00
parent 8c2191c7da
commit 980d99c48c
80 changed files with 1811 additions and 302 deletions

View File

@@ -498,6 +498,38 @@ AltManorSaveAllActions = False
AltManorSavePeriodRate = 2
# ---------------------------------------------------------------------------
# Lottery
# ---------------------------------------------------------------------------
# Default: True
AllowLottery = True
# Initial Lottery prize.
# Default: 50000
AltLotteryPrize = 50000
# Lottery Ticket Price
# Default: 2000
AltLotteryTicketPrice = 2000
# What part of jackpot amount should receive characters who pick 5 wining numbers
# Default: 0.6
AltLottery5NumberRate = 0.6
# What part of jackpot amount should receive characters who pick 4 wining numbers
# Default: 0.2
AltLottery4NumberRate = 0.2
# What part of jackpot amount should receive characters who pick 3 wining numbers
# Default: 0.2
AltLottery3NumberRate = 0.2
# How much Adena receive characters who pick two or less of the winning number
# Default: 200
AltLottery2and1NumberPrize = 200
# ---------------------------------------------------------------------------
# Item Auction
# ---------------------------------------------------------------------------

View File

@@ -0,0 +1,11 @@
<html><body>
Lottery Ticket Seller:<br>
Thank you for playing the lottery.<br>
One lottery Ticket costs %ticket_price% Adena.<br>
If you wish to play the lottery, press the button.<br>
<center>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Loto 21">Continue</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Loto 25">Lottery instructions</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Chat 0">Quit</Button>
</center>
</body></html>

View File

@@ -0,0 +1,14 @@
<html><body>Lottery Ticket Seller:<br>
Here is how to play the lottery:<br>
Select five numbers between 1 and 20. Your prize is determined by how many winning numbers you match.<br>
First place goes to those who pick all five winning numbers. First place prize amount is %prize5% % of the total jackpot amount, minus the fourth place prize.<br>
Second place goes to those who pick four out of the five winning numbers. Second place prize amount is %prize4% % of the total jackpot amount, minus the fourth place prize.<br>
Third place goes to those who pick three out of the five winning numbers. Third place prize amount is %prize3% % of the total jackpot amount, minus the fourth place prize.<br>
Those who pick two or less of the winning number may receive %prize2% Adena.<br>
The prize money for each category will be divided equally amongst winners. If there are no winners in any category, those winnings are transferred to the next jackpot.<br>
Lottery Tickets are sold on a weekly basis, starting at 7:10 pm every Saturday until 6:50 pm the following Saturday.<br>
The winning numbers are announced at 7:00 pm every Saturday. All times are subject to change.<br>
I wish you luck! Enjoy the lottery.<br>
<Button ALIGN=LEFT ICON="RETURN" action="bypass -h npc_%objectId%_Chat 0">Back</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Loto 0">Buy a Lottery Ticket.</Button>
</body></html>

View File

@@ -0,0 +1,8 @@
<html><body>
Lottery Ticket Seller:<br>
May I have your attention please!<br>
The total jackpot amount so far for the Round %race% Lottery is %adena% Adena.<br><br>
<center>
<Button ALIGN=LEFT ICON="RETURN" action="bypass -h npc_%objectId%_Chat 0">Return</Button>
</center>
</body></html>

View File

@@ -0,0 +1,5 @@
<html><body>
Lottery Ticket Seller:<br>
%result%
<Button ALIGN=LEFT ICON="RETURN" action="bypass -h npc_%objectId%_Chat 0">Return</Button>
</body></html>

View File

@@ -0,0 +1,54 @@
<html><body>Lottery Ticket Seller:<br>
This is Round %race% of Lottery. Choose five numbers:<br>
<center>
<table width=240 height=120 border=0 cellspacing=0 cellpadding=0>
<tr>
<td><img src="L2UI.lottotl" width=20 height=20></td>
<td><img src="L2UI.lottotc" width=200 height=25></td>
<td><img src="L2UI.lottotr" width=20 height=20></td>
</tr>
<tr>
<td><img src="L2UI.lottoml" width=20 height=80></td>
<td align=center valign=top>
<table width=200 height=80 border=0 cellspacing=0 cellpadding=0>
<tr>
<td><button value="1" action="bypass -h npc_%objectId%_Loto 1" fore="L2UI.lottoNum01" back="L2UI.lottoNum01a_check" width=40 height=20></td>
<td><button value="2" action="bypass -h npc_%objectId%_Loto 2" fore="L2UI.lottoNum02" back="L2UI.lottoNum02a_check" width=40 height=20></td>
<td><button value="3" action="bypass -h npc_%objectId%_Loto 3" fore="L2UI.lottoNum03" back="L2UI.lottoNum03a_check" width=40 height=20></td>
<td><button value="4" action="bypass -h npc_%objectId%_Loto 4" fore="L2UI.lottoNum04" back="L2UI.lottoNum04a_check" width=40 height=20></td>
<td><button value="5" action="bypass -h npc_%objectId%_Loto 5" fore="L2UI.lottoNum05" back="L2UI.lottoNum05a_check" width=40 height=20></td>
</tr>
<tr>
<td><button value="6" action="bypass -h npc_%objectId%_Loto 6" fore="L2UI.lottoNum06" back="L2UI.lottoNum06a_check" width=40 height=20></td>
<td><button value="7" action="bypass -h npc_%objectId%_Loto 7" fore="L2UI.lottoNum07" back="L2UI.lottoNum07a_check" width=40 height=20></td>
<td><button value="8" action="bypass -h npc_%objectId%_Loto 8" fore="L2UI.lottoNum08" back="L2UI.lottoNum08a_check" width=40 height=20></td>
<td><button value="9" action="bypass -h npc_%objectId%_Loto 9" fore="L2UI.lottoNum09" back="L2UI.lottoNum09a_check" width=40 height=20></td>
<td><button value="10" action="bypass -h npc_%objectId%_Loto 10" fore="L2UI.lottoNum10" back="L2UI.lottoNum10a_check" width=40 height=20></td>
</tr>
<tr>
<td><button value="11" action="bypass -h npc_%objectId%_Loto 11" fore="L2UI.lottoNum11" back="L2UI.lottoNum11a_check" width=40 height=20></td>
<td><button value="12" action="bypass -h npc_%objectId%_Loto 12" fore="L2UI.lottoNum12" back="L2UI.lottoNum12a_check" width=40 height=20></td>
<td><button value="13" action="bypass -h npc_%objectId%_Loto 13" fore="L2UI.lottoNum13" back="L2UI.lottoNum13a_check" width=40 height=20></td>
<td><button value="14" action="bypass -h npc_%objectId%_Loto 14" fore="L2UI.lottoNum14" back="L2UI.lottoNum14a_check" width=40 height=20></td>
<td><button value="15" action="bypass -h npc_%objectId%_Loto 15" fore="L2UI.lottoNum15" back="L2UI.lottoNum15a_check" width=40 height=20></td>
</tr>
<tr>
<td><button value="16" action="bypass -h npc_%objectId%_Loto 16" fore="L2UI.lottoNum16" back="L2UI.lottoNum16a_check" width=40 height=20></td>
<td><button value="17" action="bypass -h npc_%objectId%_Loto 17" fore="L2UI.lottoNum17" back="L2UI.lottoNum17a_check" width=40 height=20></td>
<td><button value="18" action="bypass -h npc_%objectId%_Loto 18" fore="L2UI.lottoNum18" back="L2UI.lottoNum18a_check" width=40 height=20></td>
<td><button value="19" action="bypass -h npc_%objectId%_Loto 19" fore="L2UI.lottoNum19" back="L2UI.lottoNum19a_check" width=40 height=20></td>
<td><button value="20" action="bypass -h npc_%objectId%_Loto 20" fore="L2UI.lottoNum20" back="L2UI.lottoNum20a_check" width=40 height=20></td>
</tr>
</table>
</td>
<td><img src="L2UI.lottomr" width=20 height=80></td>
</tr>
<tr>
<td><img src="L2UI.lottobl" width=20 height=20></td>
<td><img src="L2UI.lottobc" width=200 height=25></td>
<td><img src="L2UI.lottobr" width=20 height=20></td>
</tr>
</table>
</center><br>
<Button ALIGN=LEFT ICON="RETURN" action="bypass -h npc_%objectId%_Loto 0">Return</Button>
</body></html>

View File

@@ -0,0 +1,7 @@
<html><body>Lottery Ticket Seller:<br>
Thank you for playing the lottery.<br>
The winners will be announced at 7:00 pm on Saturday<br>
<center>
<Button ALIGN=LEFT ICON="RETURN" action="bypass -h npc_%objectId%_Chat 0">Return</Button>
</center>
</body></html>

View File

@@ -0,0 +1,7 @@
<html><body>
Lottery Ticket Seller:<br>
Every ticket is a potential winner! Step right up!<br>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Loto 0">Purchase Lottery Ticket</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Loto 23">Current lottery jackpot</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Loto 24">Previous winning numbers/Prize claim</Button>
</body></html>

View File

@@ -0,0 +1,11 @@
<html><body>
Lottery Ticket Seller:<br>
Thank you for playing the lottery.<br>
One lottery Ticket costs %ticket_price% Adena.<br>
If you wish to play the lottery, press the button.<br>
<center>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Loto 21">Continue</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Loto 25">Lottery instructions</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Chat 0">Quit</Button>
</center>
</body></html>

View File

@@ -0,0 +1,14 @@
<html><body>Lottery Ticket Seller:<br>
Here is how to play the lottery:<br>
Select five numbers between 1 and 20. Your prize is determined by how many winning numbers you match.<br>
First place goes to those who pick all five winning numbers. First place prize amount is %prize5% % of the total jackpot amount, minus the fourth place prize.<br>
Second place goes to those who pick four out of the five winning numbers. Second place prize amount is %prize4% % of the total jackpot amount, minus the fourth place prize.<br>
Third place goes to those who pick three out of the five winning numbers. Third place prize amount is %prize3% % of the total jackpot amount, minus the fourth place prize.<br>
Those who pick two or less of the winning number may receive %prize2% Adena.<br>
The prize money for each category will be divided equally amongst winners. If there are no winners in any category, those winnings are transferred to the next jackpot.<br>
Lottery Tickets are sold on a weekly basis, starting at 7:10 pm every Saturday until 6:50 pm the following Saturday.<br>
The winning numbers are announced at 7:00 pm every Saturday. All times are subject to change.<br>
I wish you luck! Enjoy the lottery.<br>
<Button ALIGN=LEFT ICON="RETURN" action="bypass -h npc_%objectId%_Chat 0">Back</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Loto 0">Buy a Lottery Ticket.</Button>
</body></html>

View File

@@ -0,0 +1,8 @@
<html><body>
Lottery Ticket Seller:<br>
May I have your attention please!<br>
The total jackpot amount so far for the Round %race% Lottery is %adena% Adena.<br><br>
<center>
<Button ALIGN=LEFT ICON="RETURN" action="bypass -h npc_%objectId%_Chat 0">Return</Button>
</center>
</body></html>

View File

@@ -0,0 +1,5 @@
<html><body>
Lottery Ticket Seller:<br>
%result%
<Button ALIGN=LEFT ICON="RETURN" action="bypass -h npc_%objectId%_Chat 0">Return</Button>
</body></html>

View File

@@ -0,0 +1,54 @@
<html><body>Lottery Ticket Seller:<br>
This is Round %race% of Lottery. Choose five numbers:<br>
<center>
<table width=240 height=120 border=0 cellspacing=0 cellpadding=0>
<tr>
<td><img src="L2UI.lottotl" width=20 height=20></td>
<td><img src="L2UI.lottotc" width=200 height=25></td>
<td><img src="L2UI.lottotr" width=20 height=20></td>
</tr>
<tr>
<td><img src="L2UI.lottoml" width=20 height=80></td>
<td align=center valign=top>
<table width=200 height=80 border=0 cellspacing=0 cellpadding=0>
<tr>
<td><button value="1" action="bypass -h npc_%objectId%_Loto 1" fore="L2UI.lottoNum01" back="L2UI.lottoNum01a_check" width=40 height=20></td>
<td><button value="2" action="bypass -h npc_%objectId%_Loto 2" fore="L2UI.lottoNum02" back="L2UI.lottoNum02a_check" width=40 height=20></td>
<td><button value="3" action="bypass -h npc_%objectId%_Loto 3" fore="L2UI.lottoNum03" back="L2UI.lottoNum03a_check" width=40 height=20></td>
<td><button value="4" action="bypass -h npc_%objectId%_Loto 4" fore="L2UI.lottoNum04" back="L2UI.lottoNum04a_check" width=40 height=20></td>
<td><button value="5" action="bypass -h npc_%objectId%_Loto 5" fore="L2UI.lottoNum05" back="L2UI.lottoNum05a_check" width=40 height=20></td>
</tr>
<tr>
<td><button value="6" action="bypass -h npc_%objectId%_Loto 6" fore="L2UI.lottoNum06" back="L2UI.lottoNum06a_check" width=40 height=20></td>
<td><button value="7" action="bypass -h npc_%objectId%_Loto 7" fore="L2UI.lottoNum07" back="L2UI.lottoNum07a_check" width=40 height=20></td>
<td><button value="8" action="bypass -h npc_%objectId%_Loto 8" fore="L2UI.lottoNum08" back="L2UI.lottoNum08a_check" width=40 height=20></td>
<td><button value="9" action="bypass -h npc_%objectId%_Loto 9" fore="L2UI.lottoNum09" back="L2UI.lottoNum09a_check" width=40 height=20></td>
<td><button value="10" action="bypass -h npc_%objectId%_Loto 10" fore="L2UI.lottoNum10" back="L2UI.lottoNum10a_check" width=40 height=20></td>
</tr>
<tr>
<td><button value="11" action="bypass -h npc_%objectId%_Loto 11" fore="L2UI.lottoNum11" back="L2UI.lottoNum11a_check" width=40 height=20></td>
<td><button value="12" action="bypass -h npc_%objectId%_Loto 12" fore="L2UI.lottoNum12" back="L2UI.lottoNum12a_check" width=40 height=20></td>
<td><button value="13" action="bypass -h npc_%objectId%_Loto 13" fore="L2UI.lottoNum13" back="L2UI.lottoNum13a_check" width=40 height=20></td>
<td><button value="14" action="bypass -h npc_%objectId%_Loto 14" fore="L2UI.lottoNum14" back="L2UI.lottoNum14a_check" width=40 height=20></td>
<td><button value="15" action="bypass -h npc_%objectId%_Loto 15" fore="L2UI.lottoNum15" back="L2UI.lottoNum15a_check" width=40 height=20></td>
</tr>
<tr>
<td><button value="16" action="bypass -h npc_%objectId%_Loto 16" fore="L2UI.lottoNum16" back="L2UI.lottoNum16a_check" width=40 height=20></td>
<td><button value="17" action="bypass -h npc_%objectId%_Loto 17" fore="L2UI.lottoNum17" back="L2UI.lottoNum17a_check" width=40 height=20></td>
<td><button value="18" action="bypass -h npc_%objectId%_Loto 18" fore="L2UI.lottoNum18" back="L2UI.lottoNum18a_check" width=40 height=20></td>
<td><button value="19" action="bypass -h npc_%objectId%_Loto 19" fore="L2UI.lottoNum19" back="L2UI.lottoNum19a_check" width=40 height=20></td>
<td><button value="20" action="bypass -h npc_%objectId%_Loto 20" fore="L2UI.lottoNum20" back="L2UI.lottoNum20a_check" width=40 height=20></td>
</tr>
</table>
</td>
<td><img src="L2UI.lottomr" width=20 height=80></td>
</tr>
<tr>
<td><img src="L2UI.lottobl" width=20 height=20></td>
<td><img src="L2UI.lottobc" width=200 height=25></td>
<td><img src="L2UI.lottobr" width=20 height=20></td>
</tr>
</table>
</center><br>
<Button ALIGN=LEFT ICON="RETURN" action="bypass -h npc_%objectId%_Loto 0">Return</Button>
</body></html>

View File

@@ -0,0 +1,8 @@
<html><body>
Lottery Ticket Seller:<br>
Thank you for playing the lottery.<br>
The winners will be announced at 7:00 pm on Saturday<br>
<center>
<Button ALIGN=LEFT ICON="RETURN" action="bypass -h npc_%objectId%_Chat 0">Return</Button>
</center>
</body></html>

View File

@@ -0,0 +1,7 @@
<html><body>
Lottery Ticket Seller:<br>
Every ticket is a potential winner! Step right up!<br>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Loto 0">Purchase Lottery Ticket</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Loto 23">Current lottery jackpot</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Loto 24">Previous winning numbers/Prize claim</Button>
</body></html>

View File

@@ -0,0 +1,11 @@
<html><body>
Lottery Ticket Seller:<br>
Thank you for playing the lottery.<br>
One lottery Ticket costs %ticket_price% Adena.<br>
If you wish to play the lottery, press the button.<br>
<center>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Loto 21">Continue</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Loto 25">Lottery instructions</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Chat 0">Quit</Button>
</center>
</body></html>

View File

@@ -0,0 +1,14 @@
<html><body>Lottery Ticket Seller:<br>
Here is how to play the lottery:<br>
Select five numbers between 1 and 20. Your prize is determined by how many winning numbers you match.<br>
First place goes to those who pick all five winning numbers. First place prize amount is %prize5% % of the total jackpot amount, minus the fourth place prize.<br>
Second place goes to those who pick four out of the five winning numbers. Second place prize amount is %prize4% % of the total jackpot amount, minus the fourth place prize.<br>
Third place goes to those who pick three out of the five winning numbers. Third place prize amount is %prize3% % of the total jackpot amount, minus the fourth place prize.<br>
Those who pick two or less of the winning number may receive %prize2% Adena.<br>
The prize money for each category will be divided equally amongst winners. If there are no winners in any category, those winnings are transferred to the next jackpot.<br>
Lottery Tickets are sold on a weekly basis, starting at 7:10 pm every Saturday until 6:50 pm the following Saturday.<br>
The winning numbers are announced at 7:00 pm every Saturday. All times are subject to change.<br>
I wish you luck! Enjoy the lottery.<br>
<Button ALIGN=LEFT ICON="RETURN" action="bypass -h npc_%objectId%_Chat 0">Back</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Loto 0">Buy a Lottery Ticket.</Button>
</body></html>

View File

@@ -0,0 +1,8 @@
<html><body>
Lottery Ticket Seller:<br>
May I have your attention please!<br>
The total jackpot amount so far for the Round %race% Lottery is %adena% Adena.<br><br>
<center>
<Button ALIGN=LEFT ICON="RETURN" action="bypass -h npc_%objectId%_Chat 0">Return</Button>
</center>
</body></html>

View File

@@ -0,0 +1,5 @@
<html><body>
Lottery Ticket Seller:<br>
%result%
<Button ALIGN=LEFT ICON="RETURN" action="bypass -h npc_%objectId%_Chat 0">Return</Button>
</body></html>

View File

@@ -0,0 +1,54 @@
<html><body>Lottery Ticket Seller:<br>
This is Round %race% of Lottery. Choose five numbers:<br>
<center>
<table width=240 height=120 border=0 cellspacing=0 cellpadding=0>
<tr>
<td><img src="L2UI.lottotl" width=20 height=20></td>
<td><img src="L2UI.lottotc" width=200 height=25></td>
<td><img src="L2UI.lottotr" width=20 height=20></td>
</tr>
<tr>
<td><img src="L2UI.lottoml" width=20 height=80></td>
<td align=center valign=top>
<table width=200 height=80 border=0 cellspacing=0 cellpadding=0>
<tr>
<td><button value="1" action="bypass -h npc_%objectId%_Loto 1" fore="L2UI.lottoNum01" back="L2UI.lottoNum01a_check" width=40 height=20></td>
<td><button value="2" action="bypass -h npc_%objectId%_Loto 2" fore="L2UI.lottoNum02" back="L2UI.lottoNum02a_check" width=40 height=20></td>
<td><button value="3" action="bypass -h npc_%objectId%_Loto 3" fore="L2UI.lottoNum03" back="L2UI.lottoNum03a_check" width=40 height=20></td>
<td><button value="4" action="bypass -h npc_%objectId%_Loto 4" fore="L2UI.lottoNum04" back="L2UI.lottoNum04a_check" width=40 height=20></td>
<td><button value="5" action="bypass -h npc_%objectId%_Loto 5" fore="L2UI.lottoNum05" back="L2UI.lottoNum05a_check" width=40 height=20></td>
</tr>
<tr>
<td><button value="6" action="bypass -h npc_%objectId%_Loto 6" fore="L2UI.lottoNum06" back="L2UI.lottoNum06a_check" width=40 height=20></td>
<td><button value="7" action="bypass -h npc_%objectId%_Loto 7" fore="L2UI.lottoNum07" back="L2UI.lottoNum07a_check" width=40 height=20></td>
<td><button value="8" action="bypass -h npc_%objectId%_Loto 8" fore="L2UI.lottoNum08" back="L2UI.lottoNum08a_check" width=40 height=20></td>
<td><button value="9" action="bypass -h npc_%objectId%_Loto 9" fore="L2UI.lottoNum09" back="L2UI.lottoNum09a_check" width=40 height=20></td>
<td><button value="10" action="bypass -h npc_%objectId%_Loto 10" fore="L2UI.lottoNum10" back="L2UI.lottoNum10a_check" width=40 height=20></td>
</tr>
<tr>
<td><button value="11" action="bypass -h npc_%objectId%_Loto 11" fore="L2UI.lottoNum11" back="L2UI.lottoNum11a_check" width=40 height=20></td>
<td><button value="12" action="bypass -h npc_%objectId%_Loto 12" fore="L2UI.lottoNum12" back="L2UI.lottoNum12a_check" width=40 height=20></td>
<td><button value="13" action="bypass -h npc_%objectId%_Loto 13" fore="L2UI.lottoNum13" back="L2UI.lottoNum13a_check" width=40 height=20></td>
<td><button value="14" action="bypass -h npc_%objectId%_Loto 14" fore="L2UI.lottoNum14" back="L2UI.lottoNum14a_check" width=40 height=20></td>
<td><button value="15" action="bypass -h npc_%objectId%_Loto 15" fore="L2UI.lottoNum15" back="L2UI.lottoNum15a_check" width=40 height=20></td>
</tr>
<tr>
<td><button value="16" action="bypass -h npc_%objectId%_Loto 16" fore="L2UI.lottoNum16" back="L2UI.lottoNum16a_check" width=40 height=20></td>
<td><button value="17" action="bypass -h npc_%objectId%_Loto 17" fore="L2UI.lottoNum17" back="L2UI.lottoNum17a_check" width=40 height=20></td>
<td><button value="18" action="bypass -h npc_%objectId%_Loto 18" fore="L2UI.lottoNum18" back="L2UI.lottoNum18a_check" width=40 height=20></td>
<td><button value="19" action="bypass -h npc_%objectId%_Loto 19" fore="L2UI.lottoNum19" back="L2UI.lottoNum19a_check" width=40 height=20></td>
<td><button value="20" action="bypass -h npc_%objectId%_Loto 20" fore="L2UI.lottoNum20" back="L2UI.lottoNum20a_check" width=40 height=20></td>
</tr>
</table>
</td>
<td><img src="L2UI.lottomr" width=20 height=80></td>
</tr>
<tr>
<td><img src="L2UI.lottobl" width=20 height=20></td>
<td><img src="L2UI.lottobc" width=200 height=25></td>
<td><img src="L2UI.lottobr" width=20 height=20></td>
</tr>
</table>
</center><br>
<Button ALIGN=LEFT ICON="RETURN" action="bypass -h npc_%objectId%_Loto 0">Return</Button>
</body></html>

View File

@@ -0,0 +1,8 @@
<html><body>
Lottery Ticket Seller:<br>
Thank you for playing the lottery.<br>
The winners will be announced at 7:00 pm on Saturday<br>
<center>
<Button ALIGN=LEFT ICON="RETURN" action="bypass -h npc_%objectId%_Chat 0">Return</Button>
</center>
</body></html>

View File

@@ -0,0 +1,7 @@
<html><body>
Lottery Ticket Seller:<br>
Every ticket is a potential winner! Step right up!<br>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Loto 0">Purchase Lottery Ticket</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Loto 23">Current lottery jackpot</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Loto 24">Previous winning numbers/Prize claim</Button>
</body></html>

View File

@@ -0,0 +1,11 @@
<html><body>
Lottery Ticket Seller:<br>
Thank you for playing the lottery.<br>
One lottery Ticket costs %ticket_price% Adena.<br>
If you wish to play the lottery, press the button.<br>
<center>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Loto 21">Continue</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Loto 25">Lottery instructions</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Chat 0">Quit</Button>
</center>
</body></html>

View File

@@ -0,0 +1,14 @@
<html><body>Lottery Ticket Seller:<br>
Here is how to play the lottery:<br>
Select five numbers between 1 and 20. Your prize is determined by how many winning numbers you match.<br>
First place goes to those who pick all five winning numbers. First place prize amount is %prize5% % of the total jackpot amount, minus the fourth place prize.<br>
Second place goes to those who pick four out of the five winning numbers. Second place prize amount is %prize4% % of the total jackpot amount, minus the fourth place prize.<br>
Third place goes to those who pick three out of the five winning numbers. Third place prize amount is %prize3% % of the total jackpot amount, minus the fourth place prize.<br>
Those who pick two or less of the winning number may receive %prize2% Adena.<br>
The prize money for each category will be divided equally amongst winners. If there are no winners in any category, those winnings are transferred to the next jackpot.<br>
Lottery Tickets are sold on a weekly basis, starting at 7:10 pm every Saturday until 6:50 pm the following Saturday.<br>
The winning numbers are announced at 7:00 pm every Saturday. All times are subject to change.<br>
I wish you luck! Enjoy the lottery.<br>
<Button ALIGN=LEFT ICON="RETURN" action="bypass -h npc_%objectId%_Chat 0">Back</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Loto 0">Buy a Lottery Ticket.</Button>
</body></html>

View File

@@ -0,0 +1,8 @@
<html><body>
Lottery Ticket Seller:<br>
May I have your attention please!<br>
The total jackpot amount so far for the Round %race% Lottery is %adena% Adena.<br><br>
<center>
<Button ALIGN=LEFT ICON="RETURN" action="bypass -h npc_%objectId%_Chat 0">Return</Button>
</center>
</body></html>

View File

@@ -0,0 +1,5 @@
<html><body>
Lottery Ticket Seller:<br>
%result%
<Button ALIGN=LEFT ICON="RETURN" action="bypass -h npc_%objectId%_Chat 0">Return</Button>
</body></html>

View File

@@ -0,0 +1,54 @@
<html><body>Lottery Ticket Seller:<br>
This is Round %race% of Lottery. Choose five numbers:<br>
<center>
<table width=240 height=120 border=0 cellspacing=0 cellpadding=0>
<tr>
<td><img src="L2UI.lottotl" width=20 height=20></td>
<td><img src="L2UI.lottotc" width=200 height=25></td>
<td><img src="L2UI.lottotr" width=20 height=20></td>
</tr>
<tr>
<td><img src="L2UI.lottoml" width=20 height=80></td>
<td align=center valign=top>
<table width=200 height=80 border=0 cellspacing=0 cellpadding=0>
<tr>
<td><button value="1" action="bypass -h npc_%objectId%_Loto 1" fore="L2UI.lottoNum01" back="L2UI.lottoNum01a_check" width=40 height=20></td>
<td><button value="2" action="bypass -h npc_%objectId%_Loto 2" fore="L2UI.lottoNum02" back="L2UI.lottoNum02a_check" width=40 height=20></td>
<td><button value="3" action="bypass -h npc_%objectId%_Loto 3" fore="L2UI.lottoNum03" back="L2UI.lottoNum03a_check" width=40 height=20></td>
<td><button value="4" action="bypass -h npc_%objectId%_Loto 4" fore="L2UI.lottoNum04" back="L2UI.lottoNum04a_check" width=40 height=20></td>
<td><button value="5" action="bypass -h npc_%objectId%_Loto 5" fore="L2UI.lottoNum05" back="L2UI.lottoNum05a_check" width=40 height=20></td>
</tr>
<tr>
<td><button value="6" action="bypass -h npc_%objectId%_Loto 6" fore="L2UI.lottoNum06" back="L2UI.lottoNum06a_check" width=40 height=20></td>
<td><button value="7" action="bypass -h npc_%objectId%_Loto 7" fore="L2UI.lottoNum07" back="L2UI.lottoNum07a_check" width=40 height=20></td>
<td><button value="8" action="bypass -h npc_%objectId%_Loto 8" fore="L2UI.lottoNum08" back="L2UI.lottoNum08a_check" width=40 height=20></td>
<td><button value="9" action="bypass -h npc_%objectId%_Loto 9" fore="L2UI.lottoNum09" back="L2UI.lottoNum09a_check" width=40 height=20></td>
<td><button value="10" action="bypass -h npc_%objectId%_Loto 10" fore="L2UI.lottoNum10" back="L2UI.lottoNum10a_check" width=40 height=20></td>
</tr>
<tr>
<td><button value="11" action="bypass -h npc_%objectId%_Loto 11" fore="L2UI.lottoNum11" back="L2UI.lottoNum11a_check" width=40 height=20></td>
<td><button value="12" action="bypass -h npc_%objectId%_Loto 12" fore="L2UI.lottoNum12" back="L2UI.lottoNum12a_check" width=40 height=20></td>
<td><button value="13" action="bypass -h npc_%objectId%_Loto 13" fore="L2UI.lottoNum13" back="L2UI.lottoNum13a_check" width=40 height=20></td>
<td><button value="14" action="bypass -h npc_%objectId%_Loto 14" fore="L2UI.lottoNum14" back="L2UI.lottoNum14a_check" width=40 height=20></td>
<td><button value="15" action="bypass -h npc_%objectId%_Loto 15" fore="L2UI.lottoNum15" back="L2UI.lottoNum15a_check" width=40 height=20></td>
</tr>
<tr>
<td><button value="16" action="bypass -h npc_%objectId%_Loto 16" fore="L2UI.lottoNum16" back="L2UI.lottoNum16a_check" width=40 height=20></td>
<td><button value="17" action="bypass -h npc_%objectId%_Loto 17" fore="L2UI.lottoNum17" back="L2UI.lottoNum17a_check" width=40 height=20></td>
<td><button value="18" action="bypass -h npc_%objectId%_Loto 18" fore="L2UI.lottoNum18" back="L2UI.lottoNum18a_check" width=40 height=20></td>
<td><button value="19" action="bypass -h npc_%objectId%_Loto 19" fore="L2UI.lottoNum19" back="L2UI.lottoNum19a_check" width=40 height=20></td>
<td><button value="20" action="bypass -h npc_%objectId%_Loto 20" fore="L2UI.lottoNum20" back="L2UI.lottoNum20a_check" width=40 height=20></td>
</tr>
</table>
</td>
<td><img src="L2UI.lottomr" width=20 height=80></td>
</tr>
<tr>
<td><img src="L2UI.lottobl" width=20 height=20></td>
<td><img src="L2UI.lottobc" width=200 height=25></td>
<td><img src="L2UI.lottobr" width=20 height=20></td>
</tr>
</table>
</center><br>
<Button ALIGN=LEFT ICON="RETURN" action="bypass -h npc_%objectId%_Loto 0">Return</Button>
</body></html>

View File

@@ -0,0 +1,8 @@
<html><body>
Lottery Ticket Seller:<br>
Thank you for playing the lottery.<br>
The winners will be announced at 7:00 pm on Saturday<br>
<center>
<Button ALIGN=LEFT ICON="RETURN" action="bypass -h npc_%objectId%_Chat 0">Return</Button>
</center>
</body></html>

View File

@@ -0,0 +1,7 @@
<html><body>
Lottery Ticket Seller:<br>
Every ticket is a potential winner! Step right up!<br>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Loto 0">Purchase Lottery Ticket</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Loto 23">Current lottery jackpot</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Loto 24">Previous winning numbers/Prize claim</Button>
</body></html>

View File

@@ -0,0 +1,11 @@
<html><body>
Lottery Ticket Seller:<br>
Thank you for playing the lottery.<br>
One lottery Ticket costs %ticket_price% Adena.<br>
If you wish to play the lottery, press the button.<br>
<center>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Loto 21">Continue</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Loto 25">Lottery instructions</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Chat 0">Quit</Button>
</center>
</body></html>

View File

@@ -0,0 +1,14 @@
<html><body>Lottery Ticket Seller:<br>
Here is how to play the lottery:<br>
Select five numbers between 1 and 20. Your prize is determined by how many winning numbers you match.<br>
First place goes to those who pick all five winning numbers. First place prize amount is %prize5% % of the total jackpot amount, minus the fourth place prize.<br>
Second place goes to those who pick four out of the five winning numbers. Second place prize amount is %prize4% % of the total jackpot amount, minus the fourth place prize.<br>
Third place goes to those who pick three out of the five winning numbers. Third place prize amount is %prize3% % of the total jackpot amount, minus the fourth place prize.<br>
Those who pick two or less of the winning number may receive %prize2% Adena.<br>
The prize money for each category will be divided equally amongst winners. If there are no winners in any category, those winnings are transferred to the next jackpot.<br>
Lottery Tickets are sold on a weekly basis, starting at 7:10 pm every Saturday until 6:50 pm the following Saturday.<br>
The winning numbers are announced at 7:00 pm every Saturday. All times are subject to change.<br>
I wish you luck! Enjoy the lottery.<br>
<Button ALIGN=LEFT ICON="RETURN" action="bypass -h npc_%objectId%_Chat 0">Back</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Loto 0">Buy a Lottery Ticket.</Button>
</body></html>

View File

@@ -0,0 +1,8 @@
<html><body>
Lottery Ticket Seller:<br>
May I have your attention please!<br>
The total jackpot amount so far for the Round %race% Lottery is %adena% Adena.<br><br>
<center>
<Button ALIGN=LEFT ICON="RETURN" action="bypass -h npc_%objectId%_Chat 0">Return</Button>
</center>
</body></html>

View File

@@ -0,0 +1,5 @@
<html><body>
Lottery Ticket Seller:<br>
%result%
<Button ALIGN=LEFT ICON="RETURN" action="bypass -h npc_%objectId%_Chat 0">Return</Button>
</body></html>

View File

@@ -0,0 +1,54 @@
<html><body>Lottery Ticket Seller:<br>
This is Round %race% of Lottery. Choose five numbers:<br>
<center>
<table width=240 height=120 border=0 cellspacing=0 cellpadding=0>
<tr>
<td><img src="L2UI.lottotl" width=20 height=20></td>
<td><img src="L2UI.lottotc" width=200 height=25></td>
<td><img src="L2UI.lottotr" width=20 height=20></td>
</tr>
<tr>
<td><img src="L2UI.lottoml" width=20 height=80></td>
<td align=center valign=top>
<table width=200 height=80 border=0 cellspacing=0 cellpadding=0>
<tr>
<td><button value=" " action="bypass -h npc_%objectId%_Loto 1" fore="L2UI.lottoNum01" back="L2UI.lottoNum01a_check" width=40 height=20></td>
<td><button value=" " action="bypass -h npc_%objectId%_Loto 2" fore="L2UI.lottoNum02" back="L2UI.lottoNum02a_check" width=40 height=20></td>
<td><button value=" " action="bypass -h npc_%objectId%_Loto 3" fore="L2UI.lottoNum03" back="L2UI.lottoNum03a_check" width=40 height=20></td>
<td><button value=" " action="bypass -h npc_%objectId%_Loto 4" fore="L2UI.lottoNum04" back="L2UI.lottoNum04a_check" width=40 height=20></td>
<td><button value=" " action="bypass -h npc_%objectId%_Loto 5" fore="L2UI.lottoNum05" back="L2UI.lottoNum05a_check" width=40 height=20></td>
</tr>
<tr>
<td><button value=" " action="bypass -h npc_%objectId%_Loto 6" fore="L2UI.lottoNum06" back="L2UI.lottoNum06a_check" width=40 height=20></td>
<td><button value=" " action="bypass -h npc_%objectId%_Loto 7" fore="L2UI.lottoNum07" back="L2UI.lottoNum07a_check" width=40 height=20></td>
<td><button value=" " action="bypass -h npc_%objectId%_Loto 8" fore="L2UI.lottoNum08" back="L2UI.lottoNum08a_check" width=40 height=20></td>
<td><button value=" " action="bypass -h npc_%objectId%_Loto 9" fore="L2UI.lottoNum09" back="L2UI.lottoNum09a_check" width=40 height=20></td>
<td><button value=" " action="bypass -h npc_%objectId%_Loto 10" fore="L2UI.lottoNum10" back="L2UI.lottoNum10a_check" width=40 height=20></td>
</tr>
<tr>
<td><button value=" " action="bypass -h npc_%objectId%_Loto 11" fore="L2UI.lottoNum11" back="L2UI.lottoNum11a_check" width=40 height=20></td>
<td><button value=" " action="bypass -h npc_%objectId%_Loto 12" fore="L2UI.lottoNum12" back="L2UI.lottoNum12a_check" width=40 height=20></td>
<td><button value=" " action="bypass -h npc_%objectId%_Loto 13" fore="L2UI.lottoNum13" back="L2UI.lottoNum13a_check" width=40 height=20></td>
<td><button value=" " action="bypass -h npc_%objectId%_Loto 14" fore="L2UI.lottoNum14" back="L2UI.lottoNum14a_check" width=40 height=20></td>
<td><button value=" " action="bypass -h npc_%objectId%_Loto 15" fore="L2UI.lottoNum15" back="L2UI.lottoNum15a_check" width=40 height=20></td>
</tr>
<tr>
<td><button value=" " action="bypass -h npc_%objectId%_Loto 16" fore="L2UI.lottoNum16" back="L2UI.lottoNum16a_check" width=40 height=20></td>
<td><button value=" " action="bypass -h npc_%objectId%_Loto 17" fore="L2UI.lottoNum17" back="L2UI.lottoNum17a_check" width=40 height=20></td>
<td><button value=" " action="bypass -h npc_%objectId%_Loto 18" fore="L2UI.lottoNum18" back="L2UI.lottoNum18a_check" width=40 height=20></td>
<td><button value=" " action="bypass -h npc_%objectId%_Loto 19" fore="L2UI.lottoNum19" back="L2UI.lottoNum19a_check" width=40 height=20></td>
<td><button value=" " action="bypass -h npc_%objectId%_Loto 20" fore="L2UI.lottoNum20" back="L2UI.lottoNum20a_check" width=40 height=20></td>
</tr>
</table>
</td>
<td><img src="L2UI.lottomr" width=20 height=80></td>
</tr>
<tr>
<td><img src="L2UI.lottobl" width=20 height=20></td>
<td><img src="L2UI.lottobc" width=200 height=25></td>
<td><img src="L2UI.lottobr" width=20 height=20></td>
</tr>
</table>
</center><br>
<Button ALIGN=LEFT ICON="RETURN" action="bypass -h npc_%objectId%_Loto 0">Return</Button>
</body></html>

View File

@@ -0,0 +1,8 @@
<html><body>
Lottery Ticket Seller:<br>
Thank you for playing the lottery.<br>
The winners will be announced at 7:00 pm on Saturday<br>
<center>
<Button ALIGN=LEFT ICON="RETURN" action="bypass -h npc_%objectId%_Chat 0">Return</Button>
</center>
</body></html>

View File

@@ -0,0 +1,7 @@
<html><body>
Lottery Ticket Seller:<br>
Every ticket is a potential winner! Step right up!<br>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Loto 0">Purchase Lottery Ticket</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Loto 23">Current lottery jackpot</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Loto 24">Previous winning numbers/Prize claim</Button>
</body></html>

View File

@@ -149,6 +149,7 @@ import handlers.bypasshandlers.FindPvP;
import handlers.bypasshandlers.Freight;
import handlers.bypasshandlers.ItemAuctionLink;
import handlers.bypasshandlers.Link;
import handlers.bypasshandlers.Loto;
import handlers.bypasshandlers.Multisell;
import handlers.bypasshandlers.NpcViewMod;
import handlers.bypasshandlers.Observation;
@@ -488,6 +489,7 @@ public class MasterHandler
Freight.class,
ItemAuctionLink.class,
Link.class,
Loto.class,
Multisell.class,
NpcViewMod.class,
Observation.class,

View File

@@ -0,0 +1,348 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.bypasshandlers;
import java.text.DateFormat;
import org.l2jmobius.Config;
import org.l2jmobius.gameserver.handler.IBypassHandler;
import org.l2jmobius.gameserver.idfactory.IdFactory;
import org.l2jmobius.gameserver.instancemanager.games.Lottery;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
import org.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
public class Loto implements IBypassHandler
{
private static final String[] COMMANDS =
{
"Loto"
};
@Override
public boolean useBypass(String command, PlayerInstance player, Creature target)
{
if (!target.isNpc())
{
return false;
}
int val = 0;
try
{
val = Integer.parseInt(command.substring(5));
}
catch (Exception e)
{
// Handled above.
}
if (val == 0)
{
// new loto ticket
for (int i = 0; i < 5; i++)
{
player.setLoto(i, 0);
}
}
showLotoWindow(player, (Npc) target, val);
return false;
}
/**
* Open a Loto window on client with the text of the NpcInstance.<BR>
* <BR>
* <B><U> Actions</U> :</B><BR>
* <BR>
* <li>Get the text of the selected HTML file in function of the npcId and of the page number</li>
* <li>Send a Server->Client NpcHtmlMessage containing the text of the NpcInstance to the PlayerInstance</li>
* <li>Send a Server->Client ActionFailed to the PlayerInstance in order to avoid that the client wait another packet</li><BR>
* @param player The PlayerInstance that talk with the NpcInstance
* @param npc Npc loto instance
* @param value The number of the page of the NpcInstance to display
*/
// 0 - first buy lottery ticket window
// 1-20 - buttons
// 21 - second buy lottery ticket window
// 22 - selected ticket with 5 numbers
// 23 - current lottery jackpot
// 24 - Previous winning numbers/Prize claim
// >24 - check lottery ticket by item object id
public static void showLotoWindow(PlayerInstance player, Npc npc, int value)
{
final int npcId = npc.getTemplate().getId();
String filename;
SystemMessage sm;
final NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
if (value == 0) // 0 - first buy lottery ticket window
{
filename = (npc.getHtmlPath(npcId, 1, player));
html.setFile(player, filename);
}
else if ((value >= 1) && (value <= 21)) // 1-20 - buttons, 21 - second buy lottery ticket window
{
if (!Lottery.getInstance().isStarted())
{
// tickets can't be sold
player.sendPacket(SystemMessageId.LOTTERY_TICKETS_ARE_NOT_CURRENTLY_BEING_SOLD);
return;
}
if (!Lottery.getInstance().isSellableTickets())
{
// tickets can't be sold
player.sendPacket(SystemMessageId.TICKETS_FOR_THE_CURRENT_LOTTERY_ARE_NO_LONGER_AVAILABLE);
return;
}
filename = (npc.getHtmlPath(npcId, 5, player));
html.setFile(player, filename);
int count = 0;
int found = 0;
// counting buttons and unsetting button if found
for (int i = 0; i < 5; i++)
{
if (player.getLoto(i) == value)
{
// unsetting button
player.setLoto(i, 0);
found = 1;
}
else if (player.getLoto(i) > 0)
{
count++;
}
}
// if not rearched limit 5 and not unseted value
if ((count < 5) && (found == 0) && (value <= 20))
{
for (int i = 0; i < 5; i++)
{
if (player.getLoto(i) == 0)
{
player.setLoto(i, value);
break;
}
}
}
// setting pusshed buttons
count = 0;
for (int i = 0; i < 5; i++)
{
if (player.getLoto(i) > 0)
{
count++;
String button = String.valueOf(player.getLoto(i));
if (player.getLoto(i) < 10)
{
button = "0" + button;
}
final String search = "fore=\"L2UI.lottoNum" + button + "\" back=\"L2UI.lottoNum" + button + "a_check\"";
final String replace = "fore=\"L2UI.lottoNum" + button + "a_check\" back=\"L2UI.lottoNum" + button + "\"";
html.replace(search, replace);
}
}
if (count == 5)
{
final String search = "0\">Return";
final String replace = "22\">Your lucky numbers have been selected above.";
html.replace(search, replace);
}
}
else if (value == 22) // 22 - selected ticket with 5 numbers
{
if (!Lottery.getInstance().isStarted())
{
// tickets can't be sold
player.sendPacket(SystemMessageId.LOTTERY_TICKETS_ARE_NOT_CURRENTLY_BEING_SOLD);
return;
}
if (!Lottery.getInstance().isSellableTickets())
{
// tickets can't be sold
player.sendPacket(SystemMessageId.TICKETS_FOR_THE_CURRENT_LOTTERY_ARE_NO_LONGER_AVAILABLE);
return;
}
final long price = Config.ALT_LOTTERY_TICKET_PRICE;
final int lotonumber = Lottery.getInstance().getId();
int enchant = 0;
int type2 = 0;
for (int i = 0; i < 5; i++)
{
if (player.getLoto(i) == 0)
{
return;
}
if (player.getLoto(i) < 17)
{
enchant += Math.pow(2, player.getLoto(i) - 1);
}
else
{
type2 += Math.pow(2, player.getLoto(i) - 17);
}
}
if (player.getAdena() < price)
{
sm = new SystemMessage(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_ADENA);
player.sendPacket(sm);
return;
}
if (!player.reduceAdena("Loto", price, npc, true))
{
return;
}
Lottery.getInstance().increasePrize(price);
sm = new SystemMessage(SystemMessageId.YOU_HAVE_EARNED_S1);
sm.addItemName(4442);
player.sendPacket(sm);
final ItemInstance item = new ItemInstance(IdFactory.getInstance().getNextId(), 4442);
item.setCount(1);
item.setCustomType1(lotonumber);
item.setEnchantLevel(enchant);
item.setCustomType2(type2);
player.getInventory().addItem("Loto", item, player, npc);
filename = (npc.getHtmlPath(npcId, 6, player));
html.setFile(player, filename);
}
else if (value == 23) // 23 - current lottery jackpot
{
filename = (npc.getHtmlPath(npcId, 3, player));
html.setFile(player, filename);
}
else if (value == 24) // 24 - Previous winning numbers/Prize claim
{
filename = (npc.getHtmlPath(npcId, 4, player));
html.setFile(player, filename);
final int lotonumber = Lottery.getInstance().getId();
String message = "";
for (ItemInstance item : player.getInventory().getItems())
{
if (item == null)
{
continue;
}
if ((item.getId() == 4442) && (item.getCustomType1() < lotonumber))
{
message = message + "<a action=\"bypass -h npc_%objectId%_Loto " + item.getObjectId() + "\">" + item.getCustomType1() + " Event Number ";
final int[] numbers = Lottery.getInstance().decodeNumbers(item.getEnchantLevel(), item.getCustomType2());
for (int i = 0; i < 5; i++)
{
message += numbers[i] + " ";
}
final long[] check = Lottery.getInstance().checkTicket(item);
if (check[0] > 0)
{
switch ((int) 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.isEmpty())
{
message += "There has been no winning lottery ticket.<br>";
}
html.replace("%result%", message);
}
else if (value == 25) // 25 - lottery instructions
{
filename = (npc.getHtmlPath(npcId, 2, player));
html.setFile(player, filename);
}
else if (value > 25) // >25 - check lottery ticket by item object id
{
final int lotonumber = Lottery.getInstance().getId();
final ItemInstance item = player.getInventory().getItemByObjectId(value);
if ((item == null) || (item.getId() != 4442) || (item.getCustomType1() >= lotonumber))
{
return;
}
final long[] check = Lottery.getInstance().checkTicket(item);
sm = new SystemMessage(SystemMessageId.S1_HAS_DISAPPEARED);
sm.addItemName(4442);
player.sendPacket(sm);
final long adena = check[1];
if (adena > 0)
{
player.addAdena("Loto", adena, npc, true);
}
player.destroyItem("Loto", item, npc, false);
return;
}
html.replace("%objectId%", String.valueOf(npc.getObjectId()));
html.replace("%race%", Integer.toString(Lottery.getInstance().getId()));
html.replace("%adena%", Long.toString(Lottery.getInstance().getPrize()));
html.replace("%ticket_price%", Long.toString(Config.ALT_LOTTERY_TICKET_PRICE));
html.replace("%prize5%", Float.toString(Config.ALT_LOTTERY_5_NUMBER_RATE * 100));
html.replace("%prize4%", Float.toString(Config.ALT_LOTTERY_4_NUMBER_RATE * 100));
html.replace("%prize3%", Float.toString(Config.ALT_LOTTERY_3_NUMBER_RATE * 100));
html.replace("%prize2%", Long.toString(Config.ALT_LOTTERY_2_AND_1_NUMBER_PRIZE));
html.replace("%enddate%", "" + DateFormat.getDateInstance().format(Lottery.getInstance().getEndDate()));
player.sendPacket(html);
// Send a Server->Client ActionFailed to the PlayerInstance in order to avoid that the client wait another packet
player.sendPacket(ActionFailed.STATIC_PACKET);
}
@Override
public String[] getBypassList()
{
return COMMANDS;
}
}

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../xsd/spawns.xsd">
<spawn name="LotteryTicketSellers">
<group>
<npc id="30990" x="-84143" y="244637" z="-3728" heading="41000" respawnTime="60sec" />
<npc id="30990" x="-80785" y="149735" z="-3040" heading="23000" respawnTime="60sec" />
<npc id="30990" x="-14634" y="124028" z="-3131" heading="49412" respawnTime="60sec" />
<npc id="30990" x="13015" y="181610" z="-3560" heading="16000" respawnTime="60sec" />
<npc id="30990" x="15693" y="142886" z="-2696" heading="16000" respawnTime="60sec" />
<npc id="20266" x="30990" y="130725" z="-3228" heading="7858" respawnTime="60sec" />
<npc id="30990" x="83001" y="53224" z="-1488" heading="31000" respawnTime="60sec" />
<npc id="30990" x="83331" y="147905" z="-3400" heading="16700" respawnTime="60sec" />
<npc id="30990" x="111417" y="219422" z="-3544" heading="48000" respawnTime="60sec" />
<npc id="30990" x="117148" y="76865" z="-2688" heading="34000" respawnTime="60sec" />
<npc id="30990" x="146738" y="25756" z="-2008" heading="0" respawnTime="60sec" />
<npc id="30991" x="46960" y="51506" z="-2976" heading="47000" respawnTime="60sec" />
<npc id="30992" x="9656" y="15578" z="-4568" heading="6000" respawnTime="60sec" />
<npc id="30993" x="115075" y="-178133" z="-880" heading="1000" respawnTime="60sec" />
<npc id="30994" x="-45266" y="-112468" z="-240" heading="500" respawnTime="60sec" />
<npc id="30994" x="87091" y="-143443" z="-1293" heading="13029" respawnTime="60sec" />
</group>
</spawn>
</list>