Register for your free account! | Forgot your password?

You last visited: Today at 11:41

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Release] Lotto

Discussion on [Release] Lotto within the CO2 PServer Guides & Releases forum part of the CO2 Private Server category.

Reply
 
Old   #1
 
Epic-Chaos's Avatar
 
elite*gold: 0
Join Date: May 2009
Posts: 113
Received Thanks: 30
[Release] Lotto

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.
Epic-Chaos is offline  
Thanks
6 Users
Old 05/29/2009, 23:21   #2
 
araXis's Avatar
 
elite*gold: 0
Join Date: Mar 2008
Posts: 418
Received Thanks: 49
EpicChaos* im a new c# user.can u send me ur NpcTalk.cs ? i cant put this code, i dont know how to know edit this.
araXis is offline  
Old 05/29/2009, 23:31   #3
 
elite*gold: 20
Join Date: Apr 2008
Posts: 2,281
Received Thanks: 912
Only make the code once, and just add
Code:
case 925:
case 926:
...
{
    // Code...
}
kinshi88 is offline  
Thanks
1 User
Old 05/29/2009, 23:32   #4
 
Epic-Chaos's Avatar
 
elite*gold: 0
Join Date: May 2009
Posts: 113
Received Thanks: 30
Quote:
Originally Posted by kinshi88 View Post
Only make the code once, and just add
Code:
case 925:
case 926:
...
{
    // Code...
}
thanks ill edit that.
Epic-Chaos is offline  
Old 05/29/2009, 23:48   #5

 
Kiyono's Avatar
 
elite*gold: 20
Join Date: Jun 2006
Posts: 3,296
Received Thanks: 924
For some reason I win a lot of normal items...
Kiyono is offline  
Old 05/30/2009, 00:02   #6
 
© Haydz's Avatar
 
elite*gold: 20
Join Date: Jan 2008
Posts: 1,042
Received Thanks: 252
Quote:
Originally Posted by kinshi88 View Post
Only make the code once, and just add
Code:
case 925:
case 926:
...
{
    // Code...
}
Actually the best option, instead of all that long code

if (NPCDIALOGNUMBEROWHATEVERHERE >= 926 && <= 945)
{
}
© Haydz is offline  
Old 05/30/2009, 02:14   #7
 
scottdavey's Avatar
 
elite*gold: 0
Join Date: Dec 2006
Posts: 684
Received Thanks: 238
Quote:
Originally Posted by © Haydz View Post
Actually the best option, instead of all that long code

if (NPCDIALOGNUMBEROWHATEVERHERE >= 926 && <= 945)
{
}
Which is slower when checking through like 1000 npcs..
scottdavey is offline  
Old 05/30/2009, 02:28   #8
 
© Haydz's Avatar
 
elite*gold: 20
Join Date: Jan 2008
Posts: 1,042
Received Thanks: 252
Quote:
Originally Posted by scottdavey View Post
Which is slower when checking through like 1000 npcs..
far from it. its one If check on an id range of about 20.
insert that before the switch block, then return if it is.

We had a discussion on IF statements vs switch blocks. you must've missed it.
© Haydz is offline  
Old 05/30/2009, 02:31   #9
 
Ultimatum's Avatar
 
elite*gold: 0
Join Date: Feb 2008
Posts: 277
Received Thanks: 52
looks ok, if a varible value check can be mowed down to one-two ifs, then go for it, otherwise use switches.
Ultimatum is offline  
Old 05/30/2009, 05:17   #10
 
xXVamXx's Avatar
 
elite*gold: 0
Join Date: Aug 2008
Posts: 91
Received Thanks: 31
Nice release koio and Epic
xXVamXx is offline  
Old 05/30/2009, 11:27   #11
 
elite*gold: 0
Join Date: Oct 2006
Posts: 75
Received Thanks: 17
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 )
gad-legion is offline  
Old 05/30/2009, 11:53   #12

 
Kiyono's Avatar
 
elite*gold: 20
Join Date: Jun 2006
Posts: 3,296
Received Thanks: 924
Quote:
Originally Posted by gad-legion View Post
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 )
Well I've also won Ref/Uni/Eli/Sup items.
Kiyono is offline  
Old 05/30/2009, 12:37   #13
 
elite*gold: 0
Join Date: Sep 2008
Posts: 132
Received Thanks: 64
with the code you will win all kind of items (Normal Super Elite ...) equipment or mets ...
koio is offline  
Old 05/30/2009, 12:44   #14

 
Kiyono's Avatar
 
elite*gold: 20
Join Date: Jun 2006
Posts: 3,296
Received Thanks: 924
Quote:
Originally Posted by koio View Post
with the code you will win all kind of items (Normal Super Elite ...) equipment or mets ...
You misspelled LOTF in your siggy.
Kiyono is offline  
Old 05/30/2009, 17:06   #15
 
scottdavey's Avatar
 
elite*gold: 0
Join Date: Dec 2006
Posts: 684
Received Thanks: 238
Quote:
Originally Posted by © Haydz View Post
far from it. its one If check on an id range of about 20.
insert that before the switch block, then return if it is.

We had a discussion on IF statements vs switch blocks. you must've missed it.
Perhaps, i go out with friends. Unlike alot of people on this forum.
scottdavey is offline  
Reply


Similar Threads Similar Threads
[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



All times are GMT +2. The time now is 11:41.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.