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

06/16/2009 06:57 Mr.Mafia#31
Hey Guys How To Add Please Explain
06/25/2009 10:32 WhaTStayLiv3#32
Where Exactly I Should But That Codes ?
07/01/2009 09:31 JustChillin#33
Ok ive been trying to fix this but im just getting frustrated:mad:. When i get a scroll and thats the only thing in my inv. i click it and it gives me 10 mets(duh) but when i get another one and click it it says You dont have enough room. Anything i try doesnt work.
Any idea??
07/02/2009 02:24 yousefzezo#34
thanks man
07/06/2009 05:19 Jay1029#35
Quote:
Originally Posted by Zeroxelli View Post
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, :)
Ahh:o! There we are, a nice, understandable release. I added that with ease and success. All releases should be as easy to understand as this. Unlike SOME out there.
07/15/2009 04:53 bazemad#36
thanks
07/15/2009 07:06 Zeroxelli#37
You're welcome. :)
09/22/2009 00:20 Illustria#38
Great code as expected. Now if i could get the whole adding npcs format down id almost be about ready to build a private server. I just cant seem to get the format down, i can place the npc, name the npc hell i can even make it look like the right npc, but when you click em... it does nothing.
09/22/2009 00:32 12tails#39
something si wrong with the code : X
10/18/2009 00:56 tamer kiopeed#40
Quote:
Originally Posted by mohammed2007 View Post
i want help please add me in u email [Only registered and activated users can see links. Click Here To Register...]


thank you man . im mohammed
10/18/2009 03:06 StarCurse#41
Very nice release.
12/29/2009 19:31 ktamer#42
As of Late I'm glad your coding works. It's doin wonders for my C# Studying.