• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

[Share] LadyLuck NPC Code work now

Junior Spellweaver
Joined
Apr 18, 2006
Messages
121
Reaction score
1
add this in your DB in NPC_Spawns

NPC ID:923
X:212
Y:188
TYPE:9230
DIR:2
FLAG:0
MAP:1036


1:
you will also need to add these to your packetbuilder.cs

Code:
		public static byte[] UpdateCPoints(Character Char)
        {
            byte[] PacketData = new byte[28];
            PacketData[0] = 0x1C;
            PacketData[2] = 0xF9;
            PacketData[3] = 0x03;
            PacketData[4] = (byte)(Char.CharID & 0xff);
            PacketData[5] = (byte)((Char.CharID & 0xff00) >> 8);
            PacketData[6] = (byte)((Char.CharID & 0xff0000) >> 16);
            PacketData[7] = (byte)((Char.CharID & 0xff000000) >> 24);
            PacketData[8] = 0x01;
            PacketData[12] = 0x1e;
            PacketData[16] = (byte)(Char.Points & 0xff);
            PacketData[17] = (byte)((Char.Points & 0xff00) >> 8);
            PacketData[18] = (byte)((Char.Points & 0xff0000) >> 16);
            PacketData[19] = (byte)((Char.Points & 0xff000000) >> 24);
            return PacketData;
        }

        public static byte[] UpdateMoney(Character Char)
        {
            byte[] PacketData = new byte[28];
            PacketData[0] = 0x1C;
            PacketData[2] = 0xF9;
            PacketData[3] = 0x03;
            PacketData[4] = (byte)(Char.CharID & 0xff);
            PacketData[5] = (byte)((Char.CharID & 0xff00) >> 8);
            PacketData[6] = (byte)((Char.CharID & 0xff0000) >> 16);
            PacketData[7] = (byte)((Char.CharID & 0xff000000) >> 24);
            PacketData[8] = 0x01;
            PacketData[12] = 0x04;
            PacketData[16] = (byte)(Char.Money & 0xff);
            PacketData[17] = (byte)((Char.Money & 0xff00) >> 8);
            PacketData[18] = (byte)((Char.Money & 0xff0000) >> 16);
            PacketData[19] = (byte)((Char.Money & 0xff000000) >> 24);
            return PacketData;
        }

2:
you will also need to add these to your Character.cs
after Line 118 add this
Code:
        private long m_Points;

3:
you will also need to add these to yoour Character.cs
and also add this
Code:
        public long Points
        {
            set
            {
                m_Points = value;
            }
            get
            {
                return m_Points;
            }
        }

4:
to give yourself a command to give yourself some points add this to the parsecommand section

Code:
                if (Splitter[0].ToLower() == "/points")
                {
                    int Points_I = Convert.ToInt32(Splitter[1]);
                    Client.Char.Points = Points_I;
                    Client.SendData(PacketBuilder.UpdateCPonts(Client.Char));
                }

5:
if you wish to create the database field then you need to add something like this to the "public static Character GetFullChar(uint CharID)" within BackEndDB.cs
Code:
                Char.Points = (Int64)DR["Points"];

6:
within the brackets add the name of the field you created, and now the server will load your points when u login,

to make the server save your points when you log off, add this anywhere after
Code:
", \"Equipment\" = " + save_equip +

in your "public static void SynchronizeCharacter(Character Char)" and it should be fine
Code:
", \"Points\" = " + Char.Points +

7:
you will also need to add these to your NPCdialog.cs

Code:
                            if (CLNPC == 923)  //CPs
                    {
                        if (_NPCcontrol == 0)
                        {
                            CmdNPC.Face(15);
                            CmdNPC.Say("Welcome to the Lottery Center! There are many LuckyBoxes which have innumerable treasure such as super");
                            CmdNPC.Say("gems Tow-socket gears,up to 500,000,000 silvers etc.in them If you are Level 70 or above, you are");
                            CmdNPC.Say("allowed to enter the Lottery Center and try your luck at most ten times a day. And I charge you only 27 CPs for each admission Come on,try your luck right now!");
                            CmdNPC.Link("Wow,good deal!", 1);
                            CmdNPC.Link("May I know the rule first?", 2);
                            CmdNPC.Link("Just passing by.", 255);
                            CmdNPC.Finish();
                        }
                        if (_client.Char.Level <= 70)
                        if (_NPCcontrol == 1)
                        {
                            CmdNPC.Face(02);
                            CmdNPC.Say("Must you are Level 70 or above First");
                            CmdNPC.Link("ok, I see.", 255);
                            CmdNPC.Finish();
                        }
                        if (_NPCcontrol == 2)
                        { 
                            CmdNPC.Face(02);
                            CmdNPC.Say("You will be teleported to Lottery Center Where are many LuckyBoxes");
                            CmdNPC.Say("after you pay me 27 CPs You may choose one box to try you luck at your");
                            CmdNPC.Say("will Remember you have only one chance to open a LuckyBox every time.If you wand to open another box,you have to leave the room to re-enrol in Market");   
                            CmdNPC.Link("ok, I see.", 255);
                                CmdNPC.Finish();
                            }
                            
                        if (_NPCcontrol == 1)
                        {
                            if (_client.Char.Level >= 69)
                            if (_client.Char.Points > Convert.ToInt32(26))
                            {
                                int Teleport_Points = Convert.ToInt32(_client.Char.Points - 27);
                                _client.Char.Points = Teleport_Points;

                                _client.SendData(PacketBuilder.CharacterInfo(_client.Char));
                                byte[] SpawnData = PacketBuilder.SpawnEntity(_char);
                                int x = 042; int y = 052; // Cordinates x & y
                                _char.CurrentLoc = new Location(x, y);
                                uint Teleport_Map = 700; // Map
                                _char.Map = (World.Maps)Teleport_Map;
                                World.SpawnCharacter(_client);
                            }
                            else if (_client.Char.Points < Convert.ToInt32(27))
                            {
                                CmdNPC.Say("You do not have enough CPS .");
                                CmdNPC.Link("Er...sorry.", 255);
                                CmdNPC.Finish();
                            }
                        }
                    }
 
Experienced Elementalist
Joined
Apr 25, 2006
Messages
273
Reaction score
1
Re: LadyLuck NPC Code work now

nice work :)

thanks host3rbe
 
Junior Spellweaver
Joined
Jan 19, 2006
Messages
102
Reaction score
0
Re: LadyLuck NPC Code work now

:p It was so simple and by the way nice ripping :p
 
Junior Spellweaver
Joined
Apr 18, 2006
Messages
121
Reaction score
1
Re: LadyLuck NPC Code work now

thx all i will make MOonBox NPc but i have some problem

How do I enter the Land by Luck Example
if i enter the land send me in The first land
The second time enter send me in 3 land
Third time enter send me in 5 land
Not arrangement

but enter by lucky
 
Initiate Mage
Joined
Jul 9, 2007
Messages
4
Reaction score
0
Re: LadyLuck NPC Code work now

lol nice code, did you get it from CoEmu? 0.o
 
Junior Spellweaver
Joined
Apr 18, 2006
Messages
121
Reaction score
1
Re: LadyLuck NPC Code work now

this code run in co full server C#
 
Junior Spellweaver
Joined
Apr 18, 2006
Messages
121
Reaction score
1
see this
you will also need to add these to your NPCdialog.cs

Code:
                            if (CLNPC == 923)  //CPs
                    {
                        if (_NPCcontrol == 0)
                        {
                            CmdNPC.Face(15);
                            CmdNPC.Say("Welcome to the Lottery Center! There are many LuckyBoxes which have innumerable treasure such as super");
                            CmdNPC.Say("gems Tow-socket gears,up to 500,000,000 silvers etc.in them If you are Level 70 or above, you are");
                            CmdNPC.Say("allowed to enter the Lottery Center and try your luck at most ten times a day. And I charge you only 27 CPs for each admission Come on,try your luck right now!");
                            CmdNPC.Link("Wow,good deal!", 1);
                            CmdNPC.Link("May I know the rule first?", 2);
                            CmdNPC.Link("Just passing by.", 255);
                            CmdNPC.Finish();
                        }
                        if (_client.Char.Level <= 70)
                        if (_NPCcontrol == 1)
                        {
                            CmdNPC.Face(02);
                            CmdNPC.Say("Must you are Level 70 or above First");
                            CmdNPC.Link("ok, I see.", 255);
                            CmdNPC.Finish();
                        }
                        if (_NPCcontrol == 2)
                        { 
                            CmdNPC.Face(02);
                            CmdNPC.Say("You will be teleported to Lottery Center Where are many LuckyBoxes");
                            CmdNPC.Say("after you pay me 27 CPs You may choose one box to try you luck at your");
                            CmdNPC.Say("will Remember you have only one chance to open a LuckyBox every time.If you wand to open another box,you have to leave the room to re-enrol in Market");   
                            CmdNPC.Link("ok, I see.", 255);
                                CmdNPC.Finish();
                            }
                            
                        if (_NPCcontrol == 1)
                        {
                            if (_client.Char.Level >= 69)
                            if (_client.Char.Points > Convert.ToInt32(26))
                            {
                                int Teleport_Points = Convert.ToInt32(_client.Char.Points - 27);
                                _client.Char.Points = Teleport_Points;

                                _client.SendData(PacketBuilder.CharacterInfo(_client.Char));
                                byte[] SpawnData = PacketBuilder.SpawnEntity(_char);
                                int x = 042; int y = 052; // Cordinates x & y
                                _char.CurrentLoc = new Location(x, y);
                                uint Teleport_Map = 700; // Map
                                _char.Map = (World.Maps)Teleport_Map;
                                World.SpawnCharacter(_client);
                            }
                            else if (_client.Char.Points < Convert.ToInt32(27))
                            {
                                CmdNPC.Say("You do not have enough CPS .");
                                CmdNPC.Link("Er...sorry.", 255);
                                CmdNPC.Finish();
                            }
                        }
                    }[/QUOTE]
 
Back
Top