Forging interface

08/26/2019 10:45 denominator#1
I reborned my noob just to see if it retained the riding skill and it did, I was also hoping to see a mana backsword and I also gained that. Things were looking not bad and then I went to add a socket on the mana backsword and it failed which p*ssed me off completely, seems the source is using a chance based thing on it so where would I look to change it? It should be 100% success rate, thankfully I don't lose the DB when it fails though.

So I tried on a refined backsword and it worked, perhaps I should have left the mana backsword as unique before trying to socket it smdfh


Code:
static void SocketItem(ItemUsage usage, Client.GameClient client)
        {
            ConquerItem item = null;
            ConquerItem[] Minors = null;
            if (client.Inventory.TryGetItem(usage.UID, out item))
            {
                ushort pos = ItemPosition(item.ID);
                if (pos == ConquerItem.Bottle || pos == ConquerItem.Fan || pos == ConquerItem.Garment || pos == ConquerItem.LeftWeaponAccessory || pos == ConquerItem.RightWeaponAccessory || pos == ConquerItem.Steed || pos == ConquerItem.SteedArmor || pos == ConquerItem.SteedCrop || pos == ConquerItem.Tower || pos == ConquerItem.Wings)
                {
                    client.Send(new Message("Sorry can't make socket in this item !", System.Drawing.Color.Red, Message.Talk));
                    return;
                }

                Minors = new ConquerItem[usage.Batch.Length];
                for (int i = 0; i < usage.Batch.Length; i++)
                {
                    if (!client.Inventory.TryGetItem(usage.Batch[i], out Minors[i]))
                        return;
                    else
                        if (Minors[i].UID == item.UID)
                            return;
                }
                if (Minors.Length == 0)
                    return;
                if (item.SocketOne == LordsRoad.Game.Enums.Gem.NoSocket)
                {
                    ushort cost = 1;
                    if (pos != ConquerItem.RightWeapon && pos != ConquerItem.LeftWeapon)
                        cost = 12;

                    if (client.Inventory.Contains(1088000, cost))
                    {
                        item.SocketOne = LordsRoad.Game.Enums.Gem.EmptySocket;
                        item.Mode = LordsRoad.Game.Enums.ItemMode.Update;
                        item.Send(client);
                        usage.dwParam = 1;
                        client.LoadItemStats();
                        Database.ConquerItemTable.UpdateSockets(item);
                        foreach (var xitem in Minors)
                        {
                            client.Inventory.Remove(xitem.UID, LordsRoad.Game.Enums.ItemUse.Remove, true);
                        }
                    }
                }
                else if (item.SocketTwo == LordsRoad.Game.Enums.Gem.NoSocket)
                {
                    ushort cost = 5;
                    if (pos != ConquerItem.RightWeapon && pos != ConquerItem.LeftWeapon)
                    {
                        cost = 1;
                        var minor = Minors.FirstOrDefault();
                        if (minor.ID == 1200005)
                        {
                            if (client.Inventory.Contains(1200005, cost))
                            {
                                if (Kernel.Rate((double)30))
                                {
                                    item.SocketTwo = LordsRoad.Game.Enums.Gem.EmptySocket;
                                    item.Mode = LordsRoad.Game.Enums.ItemMode.Update;
                                    item.Send(client);
                                    usage.dwParam = 1;
                                    client.LoadItemStats();
                                    Database.ConquerItemTable.UpdateSockets(item);
                                }
                                else
                                {
                                    usage.dwParam = 0;
                                    client.Inventory.Add(1200006, 0, 1);
                                }
                                foreach (var xitem in Minors)
                                {
                                    client.Inventory.Remove(xitem.UID, LordsRoad.Game.Enums.ItemUse.Remove, true);
                                }
                            }
                        }
                        else if (minor.ID == 1200006)
                        {
                            cost = 7;
                            if (client.Inventory.Contains(1200006, cost))
                            {
                                item.SocketTwo = LordsRoad.Game.Enums.Gem.EmptySocket;
                                item.Mode = LordsRoad.Game.Enums.ItemMode.Update;
                                item.Send(client);
                                usage.dwParam = 1;
                                client.LoadItemStats();
                                Database.ConquerItemTable.UpdateSockets(item);
                                foreach (var xitem in Minors)
                                {
                                    client.Inventory.Remove(xitem.UID, LordsRoad.Game.Enums.ItemUse.Remove, true);
                                }
                            }
                        }
                    }
                    else
                    {
                        if (client.Inventory.Contains(1088000, cost))
                        {
                            item.SocketTwo = LordsRoad.Game.Enums.Gem.EmptySocket;
                            item.Mode = LordsRoad.Game.Enums.ItemMode.Update;
                            item.Send(client);
                            usage.dwParam = 1;
                            client.LoadItemStats();
                            Database.ConquerItemTable.UpdateSockets(item);
                            foreach (var xitem in Minors)
                            {
                                client.Inventory.Remove(xitem.UID, LordsRoad.Game.Enums.ItemUse.Remove, true);
                            }
                        }
                    }
                }
            }
        }
I'm going to assume it's in here somewhere, I downgraded the level and socketed it. Would still like to know how I go about changing the success rate though
08/26/2019 22:37 pintinho12#2
Are you using a Classic based source? Tho, there are two places where you can forge your equipment level. I don't know when it changed to the new one, so I can't say if you should change the code, but maybe that code is the one from the TwinCity NPC. Sooo, you'll need to rewrite it.
08/26/2019 22:52 denominator#3
I've found if I use normal gears then it's 100% socket success so I can actually get around it, it could be TC code but I am unsure tbh
08/27/2019 08:21 Spirited#4
I don't see any rate stuff for the first socket, but the second socket has some type of call to a rate check of maybe 30%? Not sure, I've never looked deeply into these sources, but it sounds suspicious.
08/27/2019 10:55 pintinho12#5
Quote:
Originally Posted by denominator View Post
I've found if I use normal gears then it's 100% socket success so I can actually get around it, it could be TC code but I am unsure tbh
I'm sorry, I misunderstood the question. Tho, looks like there's nothing wrong in your code...

But there's the probability thing...

Code:
if (minor.ID == 1200005)
                        {
                            if (client.Inventory.Contains(1200005, cost))
                            {
                                if (Kernel.Rate((double)30))
Second socket does have it, but I think the rate is lower. It's 12,5% probably.