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

05/31/2009 19:34 yuko#16
this is working for me with the shoppingmall.
just replace it
Code:
public static void ItemBuy(byte[] Data, ClientSocket CSocket)
        {
            int ID = PacketProcessor.ReadLong(Data, 8);
            int Amount = PacketProcessor.ReadLong(Data, 20);
            
                if (CSocket.Client.Inventory.Count == 40)
                {
                    CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "[ERROR] Your inventory is full.", Struct.ChatType.Top));
                    return;
                }
                    string Shop = System.IO.File.ReadAllText("Shop.dat");
                    if (itemexist(Convert.ToString(ID), Shop))
                    {
                        [COLOR="Red"]//Struct.ItemInfo Item = new Struct.ItemInfo();[/COLOR]
                        if (Nano.Items.ContainsKey(ID))
                        {
                            Struct.ItemData NewItem = Nano.Items[ID];
                            if (NewItem.CPCost > 0)
                            {
                                for (int i = 0; i < Amount; i++)
                                {
                                    if (CSocket.Client.CPs >= NewItem.CPCost)
                                    {
                                        [COLOR="Lime"]Struct.ItemInfo Item = new Struct.ItemInfo();[/COLOR]
                                        Handler.CPs(NewItem.CPCost * -1, CSocket);
                                        Item.ItemID = NewItem.ID;
                                        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, 0, 0, 0, 0, 0, 0, 0, 0, 0));
                                    }
                                    else
                                    {
                                        CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "[ERROR] You do not have enough CPs.", Struct.ChatType.Top));
                                    }
                                }
                            }
                            else if (NewItem.Cost > 0)
                            {
                                if (CSocket.Client.Money >= NewItem.Cost)
                                {
                                    [COLOR="lime"]Struct.ItemInfo Item = new Struct.ItemInfo();[/COLOR]                                    Handler.Money(NewItem.Cost * -1, CSocket);
                                    Item.ItemID = NewItem.ID;
                                    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, 0, 0, 0, 0, 0, 0, 0, 0, 0));
                                }
                                else
                                {
                                    CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "[ERROR] You do not have enough money.", Struct.ChatType.Top));
                                }
                            }
                            else
                            {
                                [COLOR="lime"]Struct.ItemInfo Item = new Struct.ItemInfo();[/COLOR]
                                Item.ItemID = NewItem.ID;
                                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, 0, 0, 0, 0, 0, 0, 0, 0, 0));
                            }
                        }
                    }
                    else
                    {
                        CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "[ERROR] Item does not exist in Shop.dat", Struct.ChatType.Top));
                    }
        }
the npc will eat all dbs
why?

Code:
[COLOR="Red"]foreach (int DBUID in DBList)[/COLOR]
                                {
                                    CSocket.Client.Inventory.Remove(DBUID);
                                    CSocket.Send(ConquerPacket.ItemUsage(DBUID, 255, Struct.ItemUsage.RemoveItem));
                                    Database.Database.DeleteItem(DBUID);
                                }
think a bit and you'll be able to change that ;)
good luck
05/31/2009 19:40 Kiyono#17
It just takes away all DBs now not just 10...
05/31/2009 23:02 ~*Dutchess*~#18
I did some further testing. When you buy the dbs as a bulk. it only takes one. same goes for th mets. but if you buy one at a time. it will take all the dbs/mets and packs them.
05/31/2009 23:08 yuko#19
#edite

zerocelli updated his post
05/31/2009 23:28 Zeroxelli#20
Reason why is; I updated the code in my server but forgot to update the code in my post. Sorry guys.

And, it's because the Shopping Mall Fix you guys use that it won't work if you buy 10 dbs at once, I fixed my mall myself so it doesn't give you 10 DB's with the same UID, thus you actually delete them all..
06/01/2009 17:20 almoshax.#21
the only problem for me that it take all db or all mets is there any ideas?
06/01/2009 18:10 yuko#22
yes you need the new npc he updated it after i send mine so i deleted that :D. just recopy the new one

what he added is a break after the list has 10 dbs

good luck
06/01/2009 19:34 reborn666#23
thx good work dude!
06/05/2009 20:22 PurePwnage23#24
Hmm i got a error can some 1 help me? It says The Name Delete Doesnt Exist in the current contest :/
06/05/2009 21:14 Zeroxelli#25
@PurePwnage23;

In compile? You might wanna check your 'using' includes at the top, though mouse-over n it will fix it for you in most cases.
06/06/2009 07:46 Rulzan#26
this works on tq binarys 5065?
06/06/2009 09:00 Zeroxelli#27
Erm, It's for the CoEmu V2 source.
06/06/2009 21:30 Rulzan#28
damn
Ok thanks
06/16/2009 02:01 ELB@Sh@BeCkh@M#29
Quote:
Originally Posted by Zeroxelli View Post
Erm, It's for the CoEmu V2 source.

but someone use your codes and edit them to work on TQ binary v5065 can u help us to make it work on TQ binary ??please :confused:
06/16/2009 05:32 Zeroxelli#30
Fuck no, I'll never support the use of the binaries.