Register for your free account! | Forgot your password?

You last visited: Today at 13:32

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

Advertisement



[4267] Vending Bug.

Discussion on [4267] Vending Bug. within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
killersub's Avatar
 
elite*gold: 0
Join Date: May 2009
Posts: 884
Received Thanks: 211
[4267] Vending Bug.

Okay so, I've been working on this 4267 base I picked up on, BUT, I seem to find a small bug to it.

Once you click "Ok" on the vending dialog nothing happens. I'm fairly sure(101%) that vending is fully coded inside the source just cant seem to find the problem.

here is my StartVending() method:
Code:
public bool StartVending(uint lParam)
        {
            if (m_IsVending)
                return false;
            Dictionary<uint, INpc> npcs;

            if (Kernel.Npcs.TryGetValue(Owner.Entity.MapID, out npcs))
            {
                ushort vendx = (ushort)(Owner.Entity.X - 2);
                ushort vendy = Owner.Entity.Y;
                foreach (INpc npc in npcs.Values)
                {
                    if (npc.X == vendx && npc.Y == vendy && !npc.IsVendor)
                    {
                        m_VendorNpc = npc;
                        m_VendorNpc.ConvertToVendor(Owner.Entity.Name);
                        m_VendorNpc.UID = lParam;
                        PacketKernel.SendRangedPacket(1036, vendx, vendy, ((NpcSpawnPacket)m_VendorNpc).Packet);
                        VendingItems = new Dictionary<uint, VendingItem>();
                        m_IsVending = true;
                        break;
                    }
                }
            }
            return m_IsVending;
        }
Any help would be greatly appreciated.
killersub is offline  
Old 02/23/2012, 07:37   #2
 
-Shunsui-'s Avatar
 
elite*gold: 0
Join Date: Apr 2008
Posts: 1,152
Received Thanks: 321
Add some break points see were it reaches to.
-Shunsui- is offline  
Old 02/23/2012, 11:48   #3
 
JobvdH's Avatar
 
elite*gold: 0
Join Date: Nov 2010
Posts: 371
Received Thanks: 120
Check your packet?
Perhaps your packets are wrong.
JobvdH is offline  
Old 02/24/2012, 23:26   #4
 
killersub's Avatar
 
elite*gold: 0
Join Date: May 2009
Posts: 884
Received Thanks: 211
Quote:
Originally Posted by JobvdH View Post
Check your packet?
Perhaps your packets are wrong.
What that does is send a ranged packet to the server with the NpcSpawnPacket to act as the visible "flag" npc.
Code:
public bool StartVending(uint lParam)
        {
            if (m_IsVending)
                return false;
            Dictionary<uint, INpc> npcs;

            if (Kernel.Npcs.TryGetValue(Owner.Entity.MapID, out npcs))
            {
                ushort vendx = (ushort)(Owner.Entity.X - 2);
                ushort vendy = Owner.Entity.Y;
                foreach (INpc npc in npcs.Values)
                {
                    if (npc.X == vendx && npc.Y == vendy && !npc.IsVendor)
                    {
                        m_VendorNpc = npc;
                        m_VendorNpc.ConvertToVendor(Owner.Entity.Name);
                        m_VendorNpc.UID = lParam;
                        [COLOR="Red"]PacketKernel.SendRangedPacket(1036, vendx, vendy, ((NpcSpawnPacket)m_VendorNpc).Packet);[/COLOR]
                        VendingItems = new Dictionary<uint, VendingItem>();
                        m_IsVending = true;
                        break;
                    }
                }
            }
            return m_IsVending;
        }
THIS, is the SendRangedPacket method it uses for sending the Npc reply to the appointed map, 1036, as said above, with INPC acting as the "flag".
Code:
public static void SendRangedPacket(ushort MapID, ushort X, ushort Y, byte[] Packet)
        {
            foreach (GameClient DE in Kernel.Clients)
                if (DE.Entity.MapID.ID == MapID)
                    if (Kernel.GetDistance(X, Y, DE.Entity.X, DE.Entity.Y) < DataStructures.ViewDistance)
                        DE.Send(Packet);
        }
this seems fairly fine to me, don't know why it wouldn't work.
killersub is offline  
Old 02/25/2012, 00:39   #5
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,376
Someone had this issue trying to add it to an earlier patch. Turns out they weren't sending map flags. You can apparently only finish setting up show (show the leave shop icon) if the map has the market flag active and you send map flag properly.

Look at albetros or other sources for examples of how to impliment the cq_map table from binaries. Mine also contains an enum of map flags so it's easier to check.
pro4never is offline  
Reply


Similar Threads Similar Threads
[Help]Vending-5375
06/10/2011 - CO2 Private Server - 0 Replies
what all data changes between patch 5165 and patch 5375 for vending? what would make a client dc when you try to start vending?
[HELP]Market Vending
11/04/2009 - CO2 Private Server - 40 Replies
Ok... So I've been making some good progress with my source, thanks to many people for guiding me through it. But now I'm stuck on getting my market vending working. Of course I have the stalls all over, but when a character clicks to open shop, and says yes, it states shop cannot be opened there. I was hoping perhaps someone could give me an idea on what it is I need to add/change to get somewhere with this. Thanks in advance to anyone willing to help.
Vending /omg
12/20/2005 - Ragnarok Online - 1 Replies
Hallo, Ich habe jetzt schon mehrmals die scheiss shop.txt bearbeitet, aber immer wieder kommt die Fehlermeldung in deinen Shop fehlt ein Titel /omg. Bin ich jetzt gagga im Kopf? In der shop.txt soll in der ersten Zeile der Shopname stehen, oder liegt es wielleicht an den falschen Editor? Hat jemand davon Ahnuung? Gruß SiSa
Vending?
10/29/2004 - Ragnarok Online - 3 Replies
hi, i have revemu (0.95) i was wondering how i use my bot to vend (because when i try to vend regulary my bros a diff game and my rag crashes) ANY help appreciated ;) Iam new to vending with a bot ty all
Vending Bot?
09/23/2004 - Ragnarok Online - 2 Replies
Hallo mal wieder Wollte mal nachfragen, ob we nen guten Vending Bot kennt. Der soll nix anderes machen, als einloggen, zeugs aus ner txt datei in den Wagen tun und bei nem DC reconnecten. Kennt wer einen? Greets und Thanks



All times are GMT +2. The time now is 13:32.


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.