[Release] MillionaireLee (NPC) + DBScroll/MetScroll Functionality

05/31/2009 08:52 Zeroxelli#1
Dunno if this was already released, but oh well.

EDIT: Changed two '==' to '>=' as nTL3fTy pointed out, dunno what I was thinking :p Oh and for the people whom it's only taking 1 DB, This happened to me once but I can't seem to replicate it. It only happened when the DBs all had the same UID, which shouldn't have been in the first place...

Screenshot: [Only registered and activated users can see links. Click Here To Register...]

Code A: NpcTalk.cs:
Code:
                case 5004: // MillionaireLee
                    {
                        if (LinkBack == 0)
                        {
                            Text("Hello! I can free up space in your inventory by packing 10 DragonBalls or Meteors into a DragonScroll or MeteorScroll!", CSocket);
                            Link("Make me a DragonScroll.", 1, CSocket);
                            Link("Make me a MeteorScroll.", 2, CSocket);
                            Link("No thanks!", 255, CSocket);
                            End(CSocket);
                        }
                        else if (LinkBack == 1)
                        {
                            int DBCount = 0;
                            List<int> DBList = new List<int>();

                            foreach (Struct.ItemInfo Item in CSocket.Client.Inventory.Values)
                            {
                                if (Item.ItemID == 1088000)
                                {
                                    DBCount++;
                                    DBList.Add(Item.UID);
                                }

                                if (DBCount == 10)
                                    break;
                            }


                            if (DBCount >= 10)
                            {
                                foreach (int DBUID in DBList)
                                {
                                    CSocket.Client.Inventory.Remove(DBUID);
                                    CSocket.Send(ConquerPacket.ItemUsage(DBUID, 255, Struct.ItemUsage.RemoveItem));
                                    Database.Database.DeleteItem(DBUID);
                                }

                                Struct.ItemInfo SubItem = new Struct.ItemInfo();
                                SubItem.Bless = SubItem.Enchant = SubItem.Position =
                                SubItem.Color = SubItem.Soc1 = SubItem.Soc2 = SubItem.Plus = 0;
                                SubItem.Dura = 1;
                                SubItem.ItemID = 720028;
                                SubItem.UID = Nano.Rand.Next(1, 9999999);

                                bool created = Database.Database.NewItem(SubItem, CSocket);
                                while (!created)
                                {
                                    SubItem.UID = Nano.Rand.Next(1, 9999999);
                                    created = Database.Database.NewItem(SubItem, CSocket);
                                }

                                CSocket.Client.Inventory.Add(SubItem.UID, SubItem);
                                CSocket.Send(ConquerPacket.ItemInfo(SubItem.UID, SubItem.ItemID, SubItem.Plus, SubItem.Bless, SubItem.Enchant, SubItem.Soc1, SubItem.Soc2, SubItem.Dura, SubItem.MaxDura, SubItem.Position, SubItem.Color));
                                CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "You obtained a DragonScroll!", Struct.ChatType.Top));
                            }
                            else
                            {
                                Text("Fool! How dare you try and rip me off!", CSocket);
                                Link("Sorry!", 255, CSocket);
                                End(CSocket);
                                break;
                            }
                        }
                        else if (LinkBack == 2)
                        {
                            int MetCount = 0;
                            List<int> MetList = new List<int>();

                            foreach (Struct.ItemInfo Item in CSocket.Client.Inventory.Values)
                            {
                                if (Item.ItemID == 1088001)
                                {
                                    MetCount++;
                                    MetList.Add(Item.UID);
                                }

                                if (MetCount == 10)
                                    break;
                            }

                            if (MetCount >= 10)
                            {
                                foreach (int DBUID in MetList)
                                {
                                    CSocket.Client.Inventory.Remove(DBUID);
                                    CSocket.Send(ConquerPacket.ItemUsage(DBUID, 255, Struct.ItemUsage.RemoveItem));
                                    Database.Database.DeleteItem(DBUID);
                                }

                                Struct.ItemInfo SubItem = new Struct.ItemInfo();
                                SubItem.Bless = SubItem.Enchant = SubItem.Position =
                                SubItem.Color = SubItem.Soc1 = SubItem.Soc2 = SubItem.Plus = 0;
                                SubItem.Dura = 1;
                                SubItem.ItemID = 720027;
                                SubItem.UID = Nano.Rand.Next(1, 9999999);

                                bool created = Database.Database.NewItem(SubItem, CSocket);
                                while (!created)
                                {
                                    SubItem.UID = Nano.Rand.Next(1, 9999999);
                                    created = Database.Database.NewItem(SubItem, CSocket);
                                }

                                CSocket.Client.Inventory.Add(SubItem.UID, SubItem);
                                CSocket.Send(ConquerPacket.ItemInfo(SubItem.UID, SubItem.ItemID, SubItem.Plus, SubItem.Bless, SubItem.Enchant, SubItem.Soc1, SubItem.Soc2, SubItem.Dura, SubItem.MaxDura, SubItem.Position, SubItem.Color));
                                CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "You obtained a MeteorScroll!", Struct.ChatType.Top));
                            }
                            else
                            {
                                Text("Fool! How dare you try and rip me off!", CSocket);
                                Link("Sorry!", 255, CSocket);
                                End(CSocket);
                                break;
                            }
                        }
                        break;
                    }
Code B: UseItem.cs:
Code:
                #region Misc.
                case 720027: // MeteorScroll
                    {
                        if (CSocket.Client.Inventory.Count <= 30)
                        {
                            for (int i = 0; i < 10; i++)
                            {
                                Struct.ItemInfo SubItem = new Struct.ItemInfo();
                                SubItem.Bless = SubItem.Enchant = SubItem.Position =
                                SubItem.Color = SubItem.Soc1 = SubItem.Soc2 = SubItem.Plus = 0;
                                SubItem.Dura = 1;
                                SubItem.ItemID = 1088001;
                                SubItem.UID = Nano.Rand.Next(1, 9999999);
                                bool created = Database.Database.NewItem(SubItem, CSocket);
                                while (!created)
                                {
                                    SubItem.UID = Nano.Rand.Next(1, 9999999);
                                    created = Database.Database.NewItem(SubItem, CSocket);
                                }
                                CSocket.Client.Inventory.Add(SubItem.UID, SubItem);
                                CSocket.Send(ConquerPacket.ItemInfo(SubItem.UID, SubItem.ItemID, SubItem.Plus, SubItem.Bless, SubItem.Enchant, SubItem.Soc1, SubItem.Soc2, SubItem.Dura, SubItem.MaxDura, SubItem.Position, SubItem.Color));
                            }
                            CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "You used the MeteorScroll and obtained 10 Meteors.", Struct.ChatType.Top));
                        }
                        else
                        {
                            Delete = false;
                            CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "Not enough space in inventory.", Struct.ChatType.Top));
                        }
                        break;
                    }
                case 720028: // DragonScroll
                    {
                        if (CSocket.Client.Inventory.Count <= 30)
                        {
                            for (int i = 0; i < 10; i++)
                            {
                                Struct.ItemInfo SubItem = new Struct.ItemInfo();
                                SubItem.Bless = SubItem.Enchant = SubItem.Position =
                                SubItem.Color = SubItem.Soc1 = SubItem.Soc2 = SubItem.Plus = 0;
                                SubItem.Dura = 1;
                                SubItem.ItemID = 1088000;
                                SubItem.UID = Nano.Rand.Next(1, 9999999);
                                bool created = Database.Database.NewItem(SubItem, CSocket);
                                while (!created)
                                {
                                    SubItem.UID = Nano.Rand.Next(1, 9999999);
                                    created = Database.Database.NewItem(SubItem, CSocket);
                                }
                                CSocket.Client.Inventory.Add(SubItem.UID, SubItem);
                                CSocket.Send(ConquerPacket.ItemInfo(SubItem.UID, SubItem.ItemID, SubItem.Plus, SubItem.Bless, SubItem.Enchant, SubItem.Soc1, SubItem.Soc2, SubItem.Dura, SubItem.MaxDura, SubItem.Position, SubItem.Color));
                            }
                            CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "You used the DragonScroll and obtained 10 DragonBalls.", Struct.ChatType.Top));
                        }
                        else
                        {
                            Delete = false;
                            CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "Not enough space in inventory.", Struct.ChatType.Top));
                        }
                        break;
                    }
                #endregion
Hope it helps, :)
05/31/2009 08:58 mohammed2007#2
Quote:
Originally Posted by Zeroxelli View Post
Dunno if this was already released, but oh well.

Screenshot: [Only registered and activated users can see links. Click Here To Register...]

Code A: NpcTalk.cs:
Code:
                case 5004: // MillionaireLee
                    {
                        if (LinkBack == 0)
                        {
                            Text("Hello! I can free up space in your inventory by packing 10 DragonBalls or Meteors into a DragonScroll or MeteorScroll!", CSocket);
                            Link("Make me a DragonScroll.", 1, CSocket);
                            Link("Make me a MeteorScroll.", 2, CSocket);
                            Link("No thanks!", 255, CSocket);
                            End(CSocket);
                        }
                        else if (LinkBack == 1)
                        {
                            int DBCount = 0;
                            List<int> DBList = new List<int>();

                            foreach (Struct.ItemInfo Item in CSocket.Client.Inventory.Values)
                            {
                                if (Item.ItemID == 1088000)
                                {
                                    DBCount++;
                                    DBList.Add(Item.UID);
                                }
                            }


                            if (DBCount == 10)
                            {
                                foreach (int DBUID in DBList)
                                {
                                    CSocket.Client.Inventory.Remove(DBUID);
                                    CSocket.Send(ConquerPacket.ItemUsage(DBUID, 255, Struct.ItemUsage.RemoveItem));
                                    Database.Database.DeleteItem(DBUID);
                                }

                                Struct.ItemInfo SubItem = new Struct.ItemInfo();
                                SubItem.Bless = SubItem.Enchant = SubItem.Position =
                                SubItem.Color = SubItem.Soc1 = SubItem.Soc2 = SubItem.Plus = 0;
                                SubItem.Dura = 1;
                                SubItem.ItemID = 720028;
                                SubItem.UID = Nano.Rand.Next(1, 9999999);

                                bool created = Database.Database.NewItem(SubItem, CSocket);
                                while (!created)
                                {
                                    SubItem.UID = Nano.Rand.Next(1, 9999999);
                                    created = Database.Database.NewItem(SubItem, CSocket);
                                }

                                CSocket.Client.Inventory.Add(SubItem.UID, SubItem);
                                CSocket.Send(ConquerPacket.ItemInfo(SubItem.UID, SubItem.ItemID, SubItem.Plus, SubItem.Bless, SubItem.Enchant, SubItem.Soc1, SubItem.Soc2, SubItem.Dura, SubItem.MaxDura, SubItem.Position, SubItem.Color));
                                CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "You obtained a DragonScroll!", Struct.ChatType.Top));
                            }
                            else
                            {
                                Text("Fool! How dare you try and rip me off!", CSocket);
                                Link("Sorry!", 255, CSocket);
                                End(CSocket);
                                break;
                            }
                        }
                        else if (LinkBack == 2)
                        {
                            int MetCount = 0;
                            List<int> MetList = new List<int>();

                            foreach (Struct.ItemInfo Item in CSocket.Client.Inventory.Values)
                            {
                                if (Item.ItemID == 1088001)
                                {
                                    MetCount++;
                                    MetList.Add(Item.UID);
                                }
                            }

                            if (MetCount == 10)
                            {
                                foreach (int DBUID in MetList)
                                {
                                    CSocket.Client.Inventory.Remove(DBUID);
                                    CSocket.Send(ConquerPacket.ItemUsage(DBUID, 255, Struct.ItemUsage.RemoveItem));
                                    Database.Database.DeleteItem(DBUID);
                                }

                                Struct.ItemInfo SubItem = new Struct.ItemInfo();
                                SubItem.Bless = SubItem.Enchant = SubItem.Position =
                                SubItem.Color = SubItem.Soc1 = SubItem.Soc2 = SubItem.Plus = 0;
                                SubItem.Dura = 1;
                                SubItem.ItemID = 720027;
                                SubItem.UID = Nano.Rand.Next(1, 9999999);

                                bool created = Database.Database.NewItem(SubItem, CSocket);
                                while (!created)
                                {
                                    SubItem.UID = Nano.Rand.Next(1, 9999999);
                                    created = Database.Database.NewItem(SubItem, CSocket);
                                }

                                CSocket.Client.Inventory.Add(SubItem.UID, SubItem);
                                CSocket.Send(ConquerPacket.ItemInfo(SubItem.UID, SubItem.ItemID, SubItem.Plus, SubItem.Bless, SubItem.Enchant, SubItem.Soc1, SubItem.Soc2, SubItem.Dura, SubItem.MaxDura, SubItem.Position, SubItem.Color));
                                CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "You obtained a MeteorScroll!", Struct.ChatType.Top));
                            }
                            else
                            {
                                Text("Fool! How dare you try and rip me off!", CSocket);
                                Link("Sorry!", 255, CSocket);
                                End(CSocket);
                                break;
                            }
                        }
                        break;
                    }
Code B: UseItem.cs:
Code:
                #region Misc.
                case 720027: // MeteorScroll
                    {
                        if (CSocket.Client.Inventory.Count <= 30)
                        {
                            for (int i = 0; i < 10; i++)
                            {
                                Struct.ItemInfo SubItem = new Struct.ItemInfo();
                                SubItem.Bless = SubItem.Enchant = SubItem.Position =
                                SubItem.Color = SubItem.Soc1 = SubItem.Soc2 = SubItem.Plus = 0;
                                SubItem.Dura = 1;
                                SubItem.ItemID = 1088001;
                                SubItem.UID = Nano.Rand.Next(1, 9999999);
                                bool created = Database.Database.NewItem(SubItem, CSocket);
                                while (!created)
                                {
                                    SubItem.UID = Nano.Rand.Next(1, 9999999);
                                    created = Database.Database.NewItem(SubItem, CSocket);
                                }
                                CSocket.Client.Inventory.Add(SubItem.UID, SubItem);
                                CSocket.Send(ConquerPacket.ItemInfo(SubItem.UID, SubItem.ItemID, SubItem.Plus, SubItem.Bless, SubItem.Enchant, SubItem.Soc1, SubItem.Soc2, SubItem.Dura, SubItem.MaxDura, SubItem.Position, SubItem.Color));
                            }
                            CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "You used the MeteorScroll and obtained 10 Meteors.", Struct.ChatType.Top));
                        }
                        else
                        {
                            Delete = false;
                            CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "Not enough space in inventory.", Struct.ChatType.Top));
                        }
                        break;
                    }
                case 720028: // DragonScroll
                    {
                        if (CSocket.Client.Inventory.Count <= 30)
                        {
                            for (int i = 0; i < 10; i++)
                            {
                                Struct.ItemInfo SubItem = new Struct.ItemInfo();
                                SubItem.Bless = SubItem.Enchant = SubItem.Position =
                                SubItem.Color = SubItem.Soc1 = SubItem.Soc2 = SubItem.Plus = 0;
                                SubItem.Dura = 1;
                                SubItem.ItemID = 1088000;
                                SubItem.UID = Nano.Rand.Next(1, 9999999);
                                bool created = Database.Database.NewItem(SubItem, CSocket);
                                while (!created)
                                {
                                    SubItem.UID = Nano.Rand.Next(1, 9999999);
                                    created = Database.Database.NewItem(SubItem, CSocket);
                                }
                                CSocket.Client.Inventory.Add(SubItem.UID, SubItem);
                                CSocket.Send(ConquerPacket.ItemInfo(SubItem.UID, SubItem.ItemID, SubItem.Plus, SubItem.Bless, SubItem.Enchant, SubItem.Soc1, SubItem.Soc2, SubItem.Dura, SubItem.MaxDura, SubItem.Position, SubItem.Color));
                            }
                            CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "You used the DragonScroll and obtained 10 DragonBalls.", Struct.ChatType.Top));
                        }
                        else
                        {
                            Delete = false;
                            CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "Not enough space in inventory.", Struct.ChatType.Top));
                        }
                        break;
                    }
                #endregion
Hope it helps, :)

i want help please add me in u email [Only registered and activated users can see links. Click Here To Register...]
05/31/2009 09:08 ~*Dutchess*~#3
Works like a Charm. Thanks mate
05/31/2009 09:12 Zeroxelli#4
Quote:
Originally Posted by ~*Dutchess*~ View Post
Works like a Charm. Thanks mate
Np, glad it works :)
05/31/2009 09:22 john_ko1234#5
Quote:
Originally Posted by Zeroxelli View Post
Np, glad it works :)
ummm does it work in CO from TQ..?:confused:
05/31/2009 09:23 mohammed2007#6
Quote:
Originally Posted by Zeroxelli View Post
Np, glad it works :)
why u no`t want help me
05/31/2009 09:31 Nirion#7
Thanks Man, I tried coding this last night...I failed :p On the other hand this will give me some reference for some other npcs I have in mind.
05/31/2009 10:02 ~*Dutchess*~#8
okay, after testing this. it dont work so well :P. firstly it wont pack DBs. secondly. when you pack mets it checks for 10 but only takes one and makes the scroll.
05/31/2009 10:27 Zeroxelli#9
Quote:
Originally Posted by mohammed2007 View Post
why u no`t want help me
Cause you no speaky english :p

Quote:
Originally Posted by john_ko1234 View Post
ummm does it work in CO from TQ..?:confused:
What o.0

Quote:
Originally Posted by ~*Dutchess*~ View Post
okay, after testing this. it dont work so well :P. firstly it wont pack DBs. secondly. when you pack mets it checks for 10 but only takes one and makes the scroll.
Can't seem to replicate that.. You sure it's a normal DB?

Quote:
Originally Posted by Nirion View Post
Thanks Man, I tried coding this last night...I failed :p On the other hand this will give me some reference for some other npcs I have in mind.
Woot, post em when done :)
05/31/2009 15:30 ~*Dutchess*~#10
[QUOTE=Zeroxelli;2295119]
Can't seem to replicate that.. You sure it's a normal DB?QUOTE]

Well, I used the dragon balls and mets from the shopping mall to test. so it should be a normal one right? :P. Unless. i put the wrong codes in. but im 99.9% sure i did it right.
05/31/2009 15:39 Kiyono#11
Little bug, it checks for 10 DBs and takes like 5 gives me a DBScroll I open that end up with 15 DBs and then he doesn't accept them at all.
05/31/2009 17:32 nTL3fTy#12
Quote:
Originally Posted by Kiyono View Post
Little bug, it checks for 10 DBs and takes like 5 gives me a DBScroll I open that end up with 15 DBs and then he doesn't accept them at all.
Code:
if (DBCount == 10)
to
Code:
if (DBCount >= 10)
05/31/2009 17:39 Zeroxelli#13
Quote:
Originally Posted by ~*Dutchess*~ View Post
Quote:
Originally Posted by Zeroxelli View Post
Can't seem to replicate that.. You sure it's a normal DB
Well, I used the dragon balls and mets from the shopping mall to test. so it should be a normal one right? :P. Unless. i put the wrong codes in. but im 99.9% sure i did it right.
Still can't see to replicate it o.0

Scrolls work just fine packing & unpacking with mets/DBs from mall, as in the screenshot.
05/31/2009 17:42 Kiyono#14
Quote:
Originally Posted by nTL3fTy View Post
Code:
if (DBCount == 10)
to
Code:
if (DBCount >= 10)

Ok now it does this:

If I have 10 DBs he takes 1 and gives me a scroll.
Then if I open the scroll and re-scroll them he will take 10 DBs.
But if I have 29 DBs he'll take 20 and give me 1 scroll.
If I had 20 DBs he'd take none and give me free scrolls.
05/31/2009 18:06 royboy01#15
hehe me and Zeroxelli are workin on a project togther :) hehe. :P i love that kid