Overwrite
Complete Overwrite of the Folder with the free shard. ServUO 57.3 has been added.
This commit is contained in:
@@ -0,0 +1,258 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
using System.Collections.Generic;
|
||||
using Server.Network;
|
||||
using Server.Misc;
|
||||
using Server.Engines.LotterySystem;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class ScratcherGump : Gump
|
||||
{
|
||||
private const int labelColor = 88;
|
||||
|
||||
private BaseLottoTicket m_Ticket;
|
||||
private Mobile m_From;
|
||||
|
||||
public ScratcherGump(BaseLottoTicket ticket, Mobile from)
|
||||
: base(50, 50)
|
||||
{
|
||||
m_Ticket = ticket;
|
||||
m_From = from;
|
||||
int bg = GetBackGround();
|
||||
|
||||
AddBackground(50, 0, 400, 200, bg);
|
||||
|
||||
AddImage(125, 12, 0xFC4);
|
||||
AddImage(325, 12, 0xFC4);
|
||||
|
||||
AddHtml(50, 20, 400, 30, String.Format("<Center><BASEFONT SIZE=9>{0}</Center>", ScratcherLotto.GetGameType(m_Ticket.Type)), false, false);
|
||||
|
||||
if (m_Ticket.Checked && m_Ticket.Payout > 0)
|
||||
AddHtml(75, 150, 200, 20, String.Format("<Basefont Color=#FFFF00>Winnings: {0}</Basefont>", m_Ticket.Payout), false, false);
|
||||
|
||||
switch (m_Ticket.Type)
|
||||
{
|
||||
case TicketType.GoldenTicket: GoldTicket(); break;
|
||||
case TicketType.CrazedCrafting: CrazedCrafting(); break;
|
||||
case TicketType.SkiesTheLimit: SkiesTheLimit(); break;
|
||||
}
|
||||
|
||||
AddHtml(75, 170, 350, 20, String.Format("<Basefont Size=2>Lotto Association of {0}, All Rights Reserved</Basefont>", ServerList.ServerName), false, false);
|
||||
}
|
||||
|
||||
private void GoldTicket()
|
||||
{
|
||||
int yStart = 90;
|
||||
|
||||
if (m_Ticket.Scratch1 == 0)
|
||||
AddButton(80, yStart, 0x98B, 0x98B, 1, GumpButtonType.Reply, 0);
|
||||
else if (m_Ticket.Scratch1 == 2)
|
||||
AddHtml(60, yStart, 100, 60, String.Format("<Basefont Size=8 COLOR=#FFFF00><Center>Free</Center></Basefont>"), false, false);
|
||||
else
|
||||
{
|
||||
string num = String.Format("{0:##,###,###}", m_Ticket.Scratch1);
|
||||
AddHtml(60, yStart, 100, 60, String.Format("<Basefont Size=8 COLOR=#FFFF00><Center>{0}</Center></Basefont>", num), false, false);
|
||||
}
|
||||
|
||||
if (m_Ticket.Scratch2 == 0)
|
||||
AddButton(220, yStart, 0x98B, 0x98B, 2, GumpButtonType.Reply, 0);
|
||||
else if (m_Ticket.Scratch2 == 2)
|
||||
AddHtml(200, yStart, 100, 60, String.Format("<Basefont Size=8 COLOR=#FFFF00><Center>Free</Center></Basefont>"), false, false);
|
||||
else
|
||||
{
|
||||
string num = String.Format("{0:##,###,###}", m_Ticket.Scratch2);
|
||||
AddHtml(200, yStart, 100, 60, String.Format("<Basefont Size=8 COLOR=#FFFF00><Center>{0}</Center></Basefont>", num), false, false);
|
||||
}
|
||||
|
||||
if (m_Ticket.Scratch3 == 0)
|
||||
AddButton(360, yStart, 0x98B, 0x98B, 3, GumpButtonType.Reply, 0);
|
||||
else if (m_Ticket.Scratch3 == 2)
|
||||
AddHtml(340, yStart, 100, 60, String.Format("<Basefont Size=8 COLOR=#FFFF00><Center>Free</Center></Basefont>"), false, false);
|
||||
else
|
||||
{
|
||||
string num = String.Format("{0:##,###,###}", m_Ticket.Scratch3);
|
||||
AddHtml(340, yStart, 100, 60, String.Format("<Basefont Size=8 COLOR=#FFFF00><Center>{0}</Center></Basefont>", num), false, false);
|
||||
}
|
||||
}
|
||||
|
||||
private void CrazedCrafting()
|
||||
{
|
||||
int yStart = 75;
|
||||
|
||||
AddImage(70, yStart - 10, 0x589);
|
||||
AddImage(210, yStart - 10, 0x589);
|
||||
AddImage(350, yStart - 10, 0x589);
|
||||
|
||||
CrazedCrafting ticket = null;
|
||||
|
||||
if (m_Ticket is CrazedCrafting)
|
||||
ticket = (CrazedCrafting)m_Ticket;
|
||||
|
||||
if (ticket != null)
|
||||
{
|
||||
if (m_Ticket.Scratch1 == 0)
|
||||
AddButton(79, yStart, 0x15C3, 0x15C4, 1, GumpButtonType.Reply, 0);
|
||||
else if (m_Ticket.Scratch1 == 2)
|
||||
AddHtml(71, yStart + 20, 80, 20, String.Format("<Basefont Size=6 Color=#FFFF00><Center>Free</Center></Basefont>"), false, false);
|
||||
else
|
||||
{
|
||||
bool wildCard = false;
|
||||
foreach (int num in ticket.WildCards)
|
||||
{
|
||||
if (m_Ticket.Scratch1 == num)
|
||||
{
|
||||
AddImage(80, yStart, num, 2);
|
||||
wildCard = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!wildCard)
|
||||
{
|
||||
string value = String.Format("{0:##,###,###}", ticket.Scratch1);
|
||||
AddHtml(71, yStart + 20, 80, 20, String.Format("<Basefont Size=6 Color=#FFFF00><Center>{0}</Center></Basefont>", value), false, false);
|
||||
AddImage(80, yStart, 0x15AA, 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_Ticket.Scratch2 == 0)
|
||||
AddButton(219, yStart, 0x15C3, 0x15C4, 2, GumpButtonType.Reply, 0);
|
||||
else if (m_Ticket.Scratch2 == 2)
|
||||
AddHtml(211, yStart + 20, 80, 20, String.Format("<Basefont Size=6 Color=#FFFF00><Center>Free</Center></Basefont>"), false, false);
|
||||
else
|
||||
{
|
||||
bool wildCard = false;
|
||||
foreach (int num in ticket.WildCards)
|
||||
{
|
||||
if (m_Ticket.Scratch2 == num)
|
||||
{
|
||||
AddImage(220, yStart, num, 2);
|
||||
wildCard = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!wildCard)
|
||||
{
|
||||
string value = String.Format("{0:##,###,###}", ticket.Scratch2);
|
||||
AddHtml(211, yStart + 20, 80, 20, String.Format("<Basefont Size=6 Color=#FFFF00><Center>{0}</Center></Basefont>", value), false, false);
|
||||
AddImage(220, yStart, 0x15AA, 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_Ticket.Scratch3 == 0)
|
||||
AddButton(359, yStart, 0x15C3, 0x15C4, 3, GumpButtonType.Reply, 0);
|
||||
else if (m_Ticket.Scratch3 == 2)
|
||||
AddHtml(351, yStart + 20, 80, 20, String.Format("<Basefont Size=6 Color=#FFFF00><Center>Free</Center></Basefont>"), false, false);
|
||||
else
|
||||
{
|
||||
bool wildCard = false;
|
||||
foreach (int num in ticket.WildCards)
|
||||
{
|
||||
if (m_Ticket.Scratch3 == num)
|
||||
{
|
||||
AddImage(360, yStart, num, 2);
|
||||
wildCard = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!wildCard)
|
||||
{
|
||||
string value = String.Format("{0:##,###,###}", ticket.Scratch3);
|
||||
AddHtml(351, yStart + 20, 80, 20, String.Format("<Basefont Size=6 Color=#FFFF00><Center>{0}</Center></Basefont>", value), false, false);
|
||||
AddImage(360, yStart, 0x15AA, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AddHtml(110, yStart, 80, 20, "<Basefont Size=6 Color=#FFFF00><Center>Void</Center></Basefont>", false, false);
|
||||
AddHtml(250, yStart, 80, 20, "<Basefont Size=6 Color=#FFFF00><Center>Void</Center></Basefont>", false, false);
|
||||
AddHtml(250, yStart, 80, 20, "<Basefont Size=6 Color=#FFFF00><Center>Void</Center></Basefont>", false, false);
|
||||
}
|
||||
}
|
||||
|
||||
private void SkiesTheLimit()
|
||||
{
|
||||
int yStart = 90;
|
||||
|
||||
if (m_Ticket.Scratch1 == 0)
|
||||
AddButton(80, yStart, 0x98B, 0x98B, 1, GumpButtonType.Reply, 0);
|
||||
else if (m_Ticket.Scratch1 == 2)
|
||||
AddHtml(60, yStart, 100, 60, String.Format("<Basefont Size=8 COLOR=#0000FF><Center>Free</Center></Basefont>"), false, false);
|
||||
else if (m_Ticket.Scratch1 == 1)
|
||||
{
|
||||
AddImage(100, yStart - 5, 0x265A);
|
||||
AddItem(98, yStart, 0xEEF);
|
||||
AddItem(108, yStart, 0xEEF);
|
||||
}
|
||||
else
|
||||
{
|
||||
string value = String.Format("{0:##,###,###}", m_Ticket.Scratch1);
|
||||
AddHtml(60, yStart, 100, 60, String.Format("<Basefont Size=8 COLOR=#0000FF><Center>{0}</Center></Basefont>", value), false, false);
|
||||
}
|
||||
|
||||
if (m_Ticket.Scratch2 == 0)
|
||||
AddButton(220, yStart, 0x98B, 0x98B, 2, GumpButtonType.Reply, 0);
|
||||
else if (m_Ticket.Scratch2 == 2)
|
||||
AddHtml(200, yStart, 100, 60, String.Format("<Basefont Size=8 COLOR=#0000FF><Center>Free</Center></Basefont>"), false, false);
|
||||
else if (m_Ticket.Scratch2 == 1)
|
||||
{
|
||||
AddImage(240, yStart - 5, 0x265A);
|
||||
AddItem(238, yStart, 0xEEF);
|
||||
AddItem(248, yStart, 0xEEF);
|
||||
}
|
||||
else
|
||||
{
|
||||
string value = String.Format("{0:##,###,###}", m_Ticket.Scratch2);
|
||||
AddHtml(200, yStart, 100, 60, String.Format("<Basefont Size=8 COLOR=#0000FF><Center>{0}</Center></Basefont>", value), false, false);
|
||||
}
|
||||
|
||||
if (m_Ticket.Scratch3 == 0)
|
||||
AddButton(360, yStart, 0x98B, 0x98B, 3, GumpButtonType.Reply, 0);
|
||||
else if (m_Ticket.Scratch3 == 2)
|
||||
AddHtml(340, yStart, 100, 60, String.Format("<Basefont Size=8 COLOR=#0000FF><Center>Free</Center></Basefont>"), false, false);
|
||||
else if (m_Ticket.Scratch3 == 1)
|
||||
{
|
||||
AddImage(380, yStart - 5, 0x265A);
|
||||
AddItem(378, yStart, 0xEEF);
|
||||
AddItem(388, yStart, 0xEEF);
|
||||
}
|
||||
else
|
||||
{
|
||||
string value = String.Format("{0:##,###,###}", m_Ticket.Scratch3);
|
||||
AddHtml(340, yStart, 100, 60, String.Format("<Basefont Size=8 COLOR=#0000FF><Center>{0}</Center></Basefont>", value), false, false);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
{
|
||||
int res = info.ButtonID;
|
||||
|
||||
if (res < 4 && res > 0)
|
||||
{
|
||||
if (!m_Ticket.DoScratch(res, m_From))
|
||||
m_From.SendMessage("Put some elbow greese in it next time!");
|
||||
|
||||
m_From.PlaySound(0x249);
|
||||
m_From.SendGump(new ScratcherGump(m_Ticket, m_From));
|
||||
}
|
||||
}
|
||||
|
||||
private int GetBackGround()
|
||||
{
|
||||
if (m_Ticket != null)
|
||||
{
|
||||
switch (m_Ticket.Type)
|
||||
{
|
||||
case TicketType.CrazedCrafting: return 0x2454;
|
||||
case TicketType.SkiesTheLimit: return 0x2486;
|
||||
case TicketType.GoldenTicket: return 0xDAC;
|
||||
}
|
||||
}
|
||||
|
||||
return 9270;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,416 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
using System.Collections.Generic;
|
||||
using Server.Misc;
|
||||
using Server.Network;
|
||||
using Server.Engines.LotterySystem;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class ScratcherStoneGump : Gump
|
||||
{
|
||||
private const int labelColor = 2106;
|
||||
private const int GMColor = 33;
|
||||
|
||||
private ScratcherLotto m_Stone;
|
||||
private Mobile m_From;
|
||||
|
||||
public ScratcherStoneGump(ScratcherLotto stone, Mobile from) : this( stone, from, true)
|
||||
{
|
||||
}
|
||||
|
||||
public ScratcherStoneGump(ScratcherLotto stone, Mobile from, bool quickScratch)
|
||||
: base(50, 50)
|
||||
{
|
||||
m_Stone = stone;
|
||||
m_From = from;
|
||||
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(50, 0, 350, 350, 9250);
|
||||
|
||||
AddPage(1);
|
||||
|
||||
if (m_From.AccessLevel > AccessLevel.Player)
|
||||
{
|
||||
AddLabel(70, 265, GMColor, String.Format("Gold Sink: {0}", m_Stone.GoldSink));
|
||||
|
||||
if (ScratcherLotto.Stone != null)
|
||||
{
|
||||
AddLabel(230, 265, GMColor, "Next Stats Reset:");
|
||||
AddLabel(230, 295, GMColor, String.Format("{0}", ScratcherLotto.Stone.StatStart + ScratcherLotto.Stone.WipeStats));
|
||||
}
|
||||
|
||||
AddLabel(105, 295, GMColor, m_Stone.IsActive ? "Set Game Inactive" : "Set Active");
|
||||
AddButton(70, 295, 0xFBD, 0xFBF, 6, GumpButtonType.Reply, 0);
|
||||
}
|
||||
|
||||
AddHtml(70, 20, 300, 16, String.Format("<Center>{0} Lottery Scratchers</Center>", ServerList.ServerName), false, false);
|
||||
|
||||
#region Quick/Normal Scratch Radio
|
||||
AddLabel(110, 40, labelColor, "Quick Scratch");
|
||||
AddLabel(110, 73, labelColor, "Normal Scratch");
|
||||
|
||||
AddRadio(70, 40, 0x25F8, 0x25FB, quickScratch, 0);
|
||||
AddRadio(70, 70, 0x25F8, 0x25FB, !quickScratch, 1);
|
||||
#endregion
|
||||
|
||||
#region Ticket Info
|
||||
AddLabel(60, 117, labelColor, "Buy Ticket");
|
||||
AddLabel(230, 117, labelColor, "Cost");
|
||||
AddLabel(350, 117, labelColor, "Stats");
|
||||
|
||||
AddLabel(110, 140, 0, "Golden Ticket");
|
||||
if (ScratcherLotto.Stone != null && ScratcherLotto.Stone.IsActive)
|
||||
{
|
||||
AddButton(70, 140, 0xFBD, 0xFBF, (int)TicketType.GoldenTicket, GumpButtonType.Reply, 0);
|
||||
AddLabel(230, 140, 0, GoldenTicket.TicketCost.ToString());
|
||||
AddButton(350, 140, 0xFA5, 0xFA7, 0, GumpButtonType.Page, (int)TicketType.GoldenTicket + 1);
|
||||
}
|
||||
else
|
||||
AddLabel(230, 140, GMColor, "Offline");
|
||||
|
||||
AddLabel(110, 170, 0, "Crazed Crafting");
|
||||
if (ScratcherLotto.Stone != null && ScratcherLotto.Stone.IsActive)
|
||||
{
|
||||
AddButton(70, 170, 0xFBD, 0xFBF, (int)TicketType.CrazedCrafting, GumpButtonType.Reply, 0);
|
||||
AddLabel(230, 170, 0, CrazedCrafting.TicketCost.ToString());
|
||||
AddButton(350, 170, 0xFA5, 0xFA7, 0, GumpButtonType.Page, (int)TicketType.CrazedCrafting + 1);
|
||||
}
|
||||
else
|
||||
AddLabel(230, 170, GMColor, "Offline");
|
||||
|
||||
AddLabel(110, 200, 0, "Skies the Limit");
|
||||
if (ScratcherLotto.Stone != null && ScratcherLotto.Stone.IsActive)
|
||||
{
|
||||
AddButton(70, 200, 0xFBD, 0xFBF, (int)TicketType.SkiesTheLimit, GumpButtonType.Reply, 0);
|
||||
AddLabel(230, 200, 0, SkiesTheLimit.TicketCost.ToString());
|
||||
AddButton(350, 200, 0xFA5, 0xFA7, 0, GumpButtonType.Page, (int)TicketType.SkiesTheLimit + 1);
|
||||
}
|
||||
else
|
||||
AddLabel(230, 200, GMColor, "Offline");
|
||||
|
||||
AddLabel(110, 230, 0, "Powerball");
|
||||
if (PowerBall.Instance != null && PowerBall.Game != null && !PowerBall.Game.Deleted && PowerBall.Instance.CanBuyTickets)
|
||||
{
|
||||
AddLabel(230, 230, 0, PowerBall.Game != null ? PowerBall.Game.TicketCost.ToString() : "");
|
||||
AddButton(70, 230, 0xFBD, 0xFBF, (int)TicketType.Powerball, GumpButtonType.Reply, 0);
|
||||
}
|
||||
else
|
||||
AddLabel(230, 230, GMColor, "Offline");
|
||||
|
||||
#endregion
|
||||
|
||||
AddPage(2); //Golden Ticket Stats
|
||||
|
||||
AddLabel(70, 20, labelColor, "Golden Ticket Top 10 Winners");
|
||||
|
||||
int index = 0;
|
||||
for(int i = ScratcherStats.Stats.Count - 1; i >= 0; --i)
|
||||
{
|
||||
if (ScratcherStats.Stats[i].Type == TicketType.GoldenTicket)
|
||||
{
|
||||
string num = String.Format("{0:##,###,###}", ScratcherStats.Stats[i].Payout);
|
||||
string name = "unknown player";
|
||||
|
||||
if (ScratcherStats.Stats[i].Winner != null)
|
||||
name = ScratcherStats.Stats[i].Winner.Name;
|
||||
|
||||
AddHtml(70, 50 + (index * 25), 100, 16, String.Format("<Basefont Color=#FFFFFF>{0}</Basefont>", name), false, false);
|
||||
AddHtml(150, 50 + (index * 25), 100, 16, String.Format("<Basefont Color=#FFFFFF>{0}</Basefont>", num), false, false);
|
||||
AddHtml(270, 50 + (index * 25), 100, 16, String.Format("<Basefont Color=#FFFFFF>{0}</Basefont>", ScratcherStats.Stats[i].WinTime), false, false);
|
||||
index++;
|
||||
}
|
||||
|
||||
if (index >= 9)
|
||||
break;
|
||||
}
|
||||
|
||||
AddButton(350, 300, 0xFAE, 0xFB0, 0, GumpButtonType.Page, 1);
|
||||
|
||||
AddPage(3); //Crazed Crafting Stats
|
||||
|
||||
|
||||
AddLabel(70, 20, labelColor, "Crazed Crafting Highest Winners");
|
||||
|
||||
index = 0;
|
||||
for (int i = ScratcherStats.Stats.Count - 1; i >= 0; --i)
|
||||
{
|
||||
if (ScratcherStats.Stats[i].Type == TicketType.CrazedCrafting)
|
||||
{
|
||||
string num = String.Format("{0:##,###,###}", ScratcherStats.Stats[i].Payout);
|
||||
string name = "unknown player";
|
||||
|
||||
if (ScratcherStats.Stats[i].Winner != null)
|
||||
name = ScratcherStats.Stats[i].Winner.Name;
|
||||
|
||||
AddHtml(70, 50 + (index * 25), 100, 16, String.Format("<Basefont Color=#FFFFFF>{0}</Basefont>", name), false, false);
|
||||
AddHtml(150, 50 + (index * 25), 100, 16, String.Format("<Basefont Color=#FFFFFF>{0}</Basefont>", num), false, false);
|
||||
AddHtml(270, 50 + (index * 25), 100, 16, String.Format("<Basefont Color=#FFFFFF>{0}</Basefont>", ScratcherStats.Stats[i].WinTime), false, false);
|
||||
index++;
|
||||
}
|
||||
|
||||
if (index >= 9)
|
||||
break;
|
||||
}
|
||||
|
||||
AddButton(350, 300, 0xFAE, 0xFB0, 0, GumpButtonType.Page, 1);
|
||||
|
||||
AddPage(4); //Skies the Limit Stats
|
||||
|
||||
AddLabel(70, 20, labelColor, "Skies the Limit");
|
||||
AddLabel(70, 300, labelColor, String.Format("Progressive Jackpot: {0}", m_Stone.SkiesProgressive));
|
||||
|
||||
index = 0;
|
||||
for (int i = ScratcherStats.Stats.Count - 1; i >= 0; --i)
|
||||
{
|
||||
if (ScratcherStats.Stats[i].Type == TicketType.SkiesTheLimit)
|
||||
{
|
||||
string num = String.Format("{0:##,###,###}", ScratcherStats.Stats[i].Payout);
|
||||
string name = "unknown player";
|
||||
|
||||
if (ScratcherStats.Stats[i].Winner != null)
|
||||
name = ScratcherStats.Stats[i].Winner.Name;
|
||||
|
||||
AddHtml(70, 50 + (index * 25), 100, 16, String.Format("<Basefont Color=#FFFFFF>{0}</Basefont>", name), false, false);
|
||||
AddHtml(150, 50 + (index * 25), 100, 16, String.Format("<Basefont Color=#FFFFFF>{0}</Basefont>", num), false, false);
|
||||
AddHtml(270, 50 + (index * 25), 100, 16, String.Format("<Basefont Color=#FFFFFF>{0}</Basefont>", ScratcherStats.Stats[i].WinTime), false, false);
|
||||
index++;
|
||||
}
|
||||
|
||||
if (index >= 9)
|
||||
break;
|
||||
}
|
||||
|
||||
AddButton(350, 300, 0xFAE, 0xFB0, 0, GumpButtonType.Page, 1);
|
||||
}
|
||||
|
||||
private BaseLottoTicket FindFreeTicket(Container pack, Type type)
|
||||
{
|
||||
if (pack == null)
|
||||
return null;
|
||||
|
||||
Item[] items = pack.FindItemsByType(typeof(BaseLottoTicket));
|
||||
|
||||
foreach (Item item in items)
|
||||
{
|
||||
if (item is BaseLottoTicket && item.GetType() == type && ((BaseLottoTicket)item).FreeTicket)
|
||||
return (BaseLottoTicket)item;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
{
|
||||
if (m_From == null)
|
||||
return;
|
||||
|
||||
Container pack = m_From.Backpack;
|
||||
bool quickScratch = info.IsSwitched(0);
|
||||
|
||||
switch (info.ButtonID)
|
||||
{
|
||||
default:
|
||||
case 0: break;
|
||||
case 1: //Golden Ticket
|
||||
{
|
||||
int cost = GoldenTicket.TicketCost;
|
||||
|
||||
if (ScratcherLotto.Stone != null && ScratcherLotto.Stone.IsActive)
|
||||
{
|
||||
BaseLottoTicket free = FindFreeTicket(pack, typeof(GoldenTicket));
|
||||
|
||||
if (free != null && free is GoldenTicket)
|
||||
{
|
||||
free.Delete();
|
||||
m_From.SendMessage("You purchase a lottery ticket with your free ticket.", cost);
|
||||
|
||||
DropItem(new GoldenTicket(m_From, quickScratch));
|
||||
}
|
||||
else if (pack != null && pack.GetAmount(typeof(Gold)) >= cost)
|
||||
{
|
||||
pack.ConsumeTotal(typeof(Gold), cost);
|
||||
m_From.SendMessage("You purchase a lottery ticket with {0} gold from your backpack.", cost);
|
||||
|
||||
DropItem(new GoldenTicket(m_From, quickScratch));
|
||||
|
||||
if (m_Stone != null)
|
||||
m_Stone.GoldSink += cost;
|
||||
}
|
||||
else if (Banker.Withdraw(m_From, cost, true))
|
||||
{
|
||||
m_From.SendMessage("You purchase a lottery ticket with {0} gold from your bankbox.", cost);
|
||||
|
||||
DropItem(new GoldenTicket(m_From, quickScratch));
|
||||
|
||||
if (m_Stone != null)
|
||||
m_Stone.GoldSink += cost;
|
||||
}
|
||||
else
|
||||
m_From.SendLocalizedMessage(500191); //Begging thy pardon, but thy bank account lacks these funds.
|
||||
}
|
||||
m_From.SendGump(new ScratcherStoneGump(m_Stone, m_From, quickScratch));
|
||||
break;
|
||||
}
|
||||
case 2: //Crazed Crafting
|
||||
{
|
||||
int cost = CrazedCrafting.TicketCost;
|
||||
|
||||
if (ScratcherLotto.Stone != null && ScratcherLotto.Stone.IsActive)
|
||||
{
|
||||
BaseLottoTicket free = FindFreeTicket(pack, typeof(CrazedCrafting));
|
||||
if (free != null && free is CrazedCrafting)
|
||||
{
|
||||
free.Delete();
|
||||
m_From.SendMessage("You purchase a lottery ticket with your free ticket.", cost);
|
||||
|
||||
DropItem(new CrazedCrafting(m_From, quickScratch));
|
||||
}
|
||||
else if (pack != null && pack.GetAmount(typeof(Gold)) >= cost)
|
||||
{
|
||||
pack.ConsumeTotal(typeof(Gold), cost);
|
||||
m_From.SendMessage("You purchase a lottery ticket with {0} gold from your backpack.", cost);
|
||||
|
||||
DropItem(new CrazedCrafting(m_From, quickScratch));
|
||||
|
||||
if (m_Stone != null)
|
||||
m_Stone.GoldSink += cost;
|
||||
}
|
||||
else if (Banker.Withdraw(m_From, cost, true))
|
||||
{
|
||||
m_From.SendMessage("You purchase a lottery ticket with {0} gold from your bankbox.", cost);
|
||||
|
||||
DropItem(new CrazedCrafting(m_From, quickScratch));
|
||||
|
||||
if (m_Stone != null)
|
||||
m_Stone.GoldSink += cost;
|
||||
}
|
||||
else
|
||||
m_From.SendLocalizedMessage(500191); //Begging thy pardon, but thy bank account lacks these funds.
|
||||
}
|
||||
m_From.SendGump(new ScratcherStoneGump(m_Stone, m_From, quickScratch));
|
||||
break;
|
||||
}
|
||||
case 3: //Skies the Limit
|
||||
{
|
||||
int cost = SkiesTheLimit.TicketCost;
|
||||
|
||||
if (ScratcherLotto.Stone != null && ScratcherLotto.Stone.IsActive)
|
||||
{
|
||||
BaseLottoTicket free = FindFreeTicket(pack, typeof(SkiesTheLimit));
|
||||
if (free != null && free is SkiesTheLimit)
|
||||
{
|
||||
free.Delete();
|
||||
m_From.SendMessage("You purchase a lottery ticket with your free ticket.", cost);
|
||||
|
||||
DropItem(new SkiesTheLimit(m_From, quickScratch));
|
||||
}
|
||||
else if (pack != null && pack.GetAmount(typeof(Gold)) >= cost)
|
||||
{
|
||||
pack.ConsumeTotal(typeof(Gold), cost);
|
||||
m_From.SendMessage("You purchase a lottery ticket with {0} gold from your backpack.", cost);
|
||||
|
||||
DropItem(new SkiesTheLimit(m_From, quickScratch));
|
||||
|
||||
if (m_Stone != null)
|
||||
m_Stone.GoldSink += cost;
|
||||
|
||||
m_Stone.SkiesProgressive += cost / 10;
|
||||
}
|
||||
else if (Banker.Withdraw(m_From, cost, true))
|
||||
{
|
||||
m_From.SendMessage("You purchase a lottery ticket with {0} gold from your bankbox.", cost);
|
||||
|
||||
DropItem(new SkiesTheLimit(m_From, quickScratch));
|
||||
|
||||
if (m_Stone != null)
|
||||
m_Stone.GoldSink += cost;
|
||||
|
||||
m_Stone.SkiesProgressive += cost / 10;
|
||||
}
|
||||
else
|
||||
m_From.SendLocalizedMessage(500191); //Begging thy pardon, but thy bank account lacks these funds.
|
||||
}
|
||||
m_From.SendGump(new ScratcherStoneGump(m_Stone, m_From, quickScratch));
|
||||
break;
|
||||
}
|
||||
case 4: //PowerBall Ticket
|
||||
{
|
||||
if (PowerBall.Instance != null && PowerBall.Game != null && !PowerBall.Game.Deleted && PowerBall.Instance.CanBuyTickets)
|
||||
{
|
||||
int cost = PowerBall.Game.TicketCost;
|
||||
|
||||
if (pack != null && pack.GetAmount(typeof(Gold)) >= cost)
|
||||
{
|
||||
pack.ConsumeTotal(typeof(Gold), cost);
|
||||
m_From.SendMessage("You purchase a Powerball ticket with {0} gold from your backpack.", cost);
|
||||
|
||||
DropItem(new PowerBallTicket(m_From, PowerBall.Game));
|
||||
|
||||
if (PowerBall.Instance != null)
|
||||
PowerBall.Instance.Profit += cost;
|
||||
}
|
||||
else if (Banker.Withdraw(m_From, cost, true))
|
||||
{
|
||||
m_From.SendMessage("You purchase a Powerball ticket with {0} gold from your bankbox.", cost);
|
||||
|
||||
DropItem(new PowerBallTicket(m_From, PowerBall.Game));
|
||||
|
||||
if (PowerBall.Instance != null)
|
||||
PowerBall.Instance.Profit += cost;
|
||||
}
|
||||
else
|
||||
m_From.SendLocalizedMessage(500191); //Begging thy pardon, but thy bank account lacks these funds.
|
||||
}
|
||||
|
||||
m_From.SendGump(new ScratcherStoneGump(m_Stone, m_From, quickScratch));
|
||||
break;
|
||||
}
|
||||
|
||||
case 5:
|
||||
{
|
||||
if (PowerBall.Game != null)
|
||||
m_From.SendGump(new PowerBallStatsGump(PowerBall.Game, m_From));
|
||||
|
||||
break;
|
||||
}
|
||||
case 6:
|
||||
{
|
||||
if (m_From.AccessLevel == AccessLevel.Player)
|
||||
break;
|
||||
|
||||
if (m_Stone != null)
|
||||
{
|
||||
if (m_Stone.IsActive)
|
||||
{
|
||||
m_From.SendMessage("set to inactive.");
|
||||
m_Stone.IsActive = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_From.SendMessage("set to active.");
|
||||
m_Stone.IsActive = true;
|
||||
}
|
||||
}
|
||||
|
||||
m_From.SendGump(new ScratcherStoneGump(m_Stone, m_From, quickScratch));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DropItem(Item item)
|
||||
{
|
||||
Container pack = m_From.Backpack;
|
||||
|
||||
if (pack == null || !pack.TryDropItem(m_From, item, false))
|
||||
{
|
||||
m_From.SendMessage("Your pack is full, so the ticket has been placed in your bank box!");
|
||||
m_From.BankBox.DropItem(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user