Koio did most of this code credits to him not me, also place this into NpcTalk.cs in CoEmu source.
Code:
case 926://Lucky Box Coded by koio and alil by Epic-Chaos
case 925:
case 927:
case 928:
case 929:
case 930:
case 931:
case 932:
case 933:
case 934:
case 935:
case 936:
case 937:
case 938:
case 939:
case 940:
case 942:
case 943:
case 944:
case 945:
{
if (LinkBack == 0)
{
Text("Hi i am the Lucky Box. Tick me in order to get a random item", CSocket);
Link("I Will do it.", 1, CSocket);
Link("Nah No thanks!!", 255, CSocket);
End(CSocket);
}
if (LinkBack == 1)
{
Teleport(1036, 206, 213, 0, CSocket);
{
bool agien = true;
int pluss = 0;
while (agien)
{
int Times = 1;
for (int i = 0; i < Times; i++)
{
int lottoitem = Nano.Rand.Next(1, 10);
if (Calculation.PercentSuccess(90))
lottoitem = Nano.Rand.Next(2, 240);
if (Calculation.PercentSuccess(70))
lottoitem = Nano.Rand.Next(60, 3000);
if (Calculation.PercentSuccess(50))
lottoitem = Nano.Rand.Next(200, 4000);
if (Calculation.PercentSuccess(30))
lottoitem = Nano.Rand.Next(1000, 30000);
if (Calculation.PercentSuccess(100))
lottoitem = Nano.Rand.Next(2000, 50000);
if (Calculation.PercentSuccess(100))
lottoitem = Nano.Rand.Next(2000, 50000);
if (lottoitem < 100000)
lottoitem = lottoitem * 11;
if (Nano.Items.ContainsKey(lottoitem))
{
#region new item
Struct.ItemInfo Item = new Struct.ItemInfo();
Item.Bless = 0;
Item.Dura = Item.MaxDura;
Item.Enchant = 0;
Item.ItemID = lottoitem;
Item.Plus = pluss;
Item.Position = 0;
Item.Soc1 = 0;
Item.Soc2 = 0;
Item.Color = 0;
Item.UID = Nano.Rand.Next(1, 9999999);
bool created = Database.Database.NewItem(Item, CSocket);
while (!created)
{
Item.UID = Nano.Rand.Next(1, 9999999);
created = Database.Database.NewItem(Item, CSocket);
}
CSocket.Client.Inventory.Add(Item.UID, Item);
CSocket.Send(ConquerPacket.ItemInfo(Item.UID, Item.ItemID, Item.Plus, Item.Bless, Item.Enchant, Item.Soc1, Item.Soc2, Item.Dura, Item.MaxDura, Item.Position, Item.Color));
{
}
#endregion
agien = false;
}
}
}
}
}
break;
}
EDITED- better coded thxs to Kinshi
This needs improveing if you can improve it please let me know. and if i improve it i will update everything.
i see no code for quality of items in there so that means prob u can get a normal item from lottery and u better put lady luck on x 212 y 188 and coord for box teleport on x 215 y 190 )
i see no code for quality of items in there so that means prob u can get a normal item from lottery and u better put lady luck on x 212 y 188 and coord for box teleport on x 215 y 190 )
[Release]Another lotto script 09/14/2010 - CO2 PServer Guides & Releases - 28 Replies NPCTalk.cs:
case 923:// Lady Luck enter
{
if (LinkBack == 0)
{
if (InventoryContains(710212, 1, CSocket))
{
Text("I see that you have a lottery ticket, do you want to do the lottery in exchange for the ticket?", CSocket);
Link("Yes", 2, CSocket);
[Release]Lotto limit (enter 10 times a day) - LAME XD 11/15/2008 - CO2 PServer Guides & Releases - 9 Replies Okay I have a free 3 minutes, so I thought that 99% of the noobs doesn`t have this so, here it is. My excuse for the others is that I`m bored
Okay, first go to the Character.cs at the variables, and add this line :
public byte LottoCount = 0;
Now go to the Lotto NPC (ID is 1846). Modify the option which teleports you to lotto. At me it looks like this
Now, change it to this