Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Private Server
You last visited: Today at 17:25

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

Advertisement



Could use help with 5165 socket glitch

Discussion on Could use help with 5165 socket glitch within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
~Templar~'s Avatar
 
elite*gold: 0
Join Date: Jul 2005
Posts: 28
Received Thanks: 8
Could use help with 5165 socket glitch

Edit- Found an easy fix for the problem. Edited code below on the off chance anyone else ever has this problem. (Second socket glitch)
I've been working on an old private server source (I believe its Impulses) mostly for my own programming experience. I've been able to work around or fix every glitch I've run into but there's one thing I haven't been able to figure out how to fix.
When you put a 2 socket item in Phoenix Castle gem socket screen and remove it the 2 slots stay on the GUI and you can replace it with a 1 sock item and make it 2 sock.
This is the code that came with the source regarding socketing. Can anyone point me in the direction of where to add a check for the socket actually being in the item or possibly how to make the item not removable from the GUI to start with?

case 1027:
{
uint MainUID = BitConverter.ToUInt32(Data, 8);
uint GemUID = BitConverter.ToUInt32(Data, 12);

Game.Item MainItem = GC.MyChar.FindInvItem(MainUID);
Game.Item Gem = GC.MyChar.FindInvItem(GemUID);

byte Mode = Data[18];
byte Slot = Data[16];

if (Mode == 0)
{
GC.MyChar.RemoveItem(MainItem);
GC.MyChar.RemoveItem(Gem);

if (Slot == 1 && MainItem.Soc1 != NewestCOServer.Game.Item.Gem.NoSocket)
MainItem.Soc1 = (Game.Item.Gem)(Gem.ID - 700000);
if (Slot == 2 && MainItem.Soc2 != NewestCOServer.Game.Item.Gem.NoSocket)
MainItem.Soc2 = (Game.Item.Gem)(Gem.ID - 700000);
GC.MyChar.AddItem(MainItem);
}
else
{
GC.MyChar.RemoveItem(MainItem);
if (Slot == 1 && MainItem.Soc1 != NewestCOServer.Game.Item.Gem.NoSocket)
MainItem.Soc1 = Game.Item.Gem.EmptySocket;
if (Slot == 2 && MainItem.Soc2 != NewestCOServer.Game.Item.Gem.NoSocket)
MainItem.Soc2 = Game.Item.Gem.EmptySocket;
GC.MyChar.AddItem(MainItem);
}

break;
}
~Templar~ is offline  
Thanks
1 User
Old 11/25/2013, 14:47   #2
 
elite*gold: 0
Join Date: Jan 2012
Posts: 52
Received Thanks: 0
This works a charm! only problem I have now is that when I tested it when I double click the 2 soc item to remove it and put the 1 socket in and it allows to put 2 gems in still and when I click socket it uses both gems but only puts 1 gem in the item and it keeps it 1 socket do you have a fix for this? it needs to know that if its 1 socket to only display 1 gem slot and not 2 :P

When I do 1 socket item then replace it with 2 socket item it corrects the gem slots but when 2 socket to 1 socket it keeps 2 gem slots
Ciarda is offline  
Old 11/25/2013, 15:47   #3
 
Super Aids's Avatar
 
elite*gold: 0
Join Date: Dec 2012
Posts: 1,761
Received Thanks: 946
Check whether the item has 2sockets? LOL.

Here is how I do it in my source.
Copy-pasting won't work, so use it as a reference.
Code:
public static void Handle(Entities.GameClient client, DataPacket packet)
		{
			if (client.Booth != null)
				return;
			using (var socket = new GemSocketingPacket(packet))
			{
				if (!client.Inventory.ContainsByUID(socket.ItemUID) &&
				    !client.Inventory.ContainsByUID(socket.GemUID))
				{
					return;
				}
				
				Data.ItemInfo SocketItem = client.Inventory.GetItemByUID(socket.ItemUID);
				if (SocketItem.CurrentDura < SocketItem.MaxDura)
					return;
				if (!socket.RemoveGem)
				{
					if (SocketItem.Gem1 != Enums.SocketGem.EmptySocket && socket.Socket == 1)
					{
						return;
					}
					else if (SocketItem.Gem2 != Enums.SocketGem.EmptySocket)
					{
						return;
					}
					
					Data.ItemInfo Gem = client.Inventory.GetItemByUID(socket.GemUID);
					if (Gem == null || SocketItem == null)
					{
						return;
					}
					if (SocketItem.IsGarment() || SocketItem.IsArrow() || SocketItem.IsBottle() ||
					    SocketItem.IsSteed() || SocketItem.IsMisc() || SocketItem.IsFan() || SocketItem.IsTower())
					{
						return;
					}
					
					Enums.SocketGem gem = (Enums.SocketGem)(Gem.ItemID % 100);
					
					if (gem != Enums.SocketGem.NormalThunderGem &&
					    gem != Enums.SocketGem.RefinedThunderGem &&
					    gem != Enums.SocketGem.SuperThunderGem &&
					    gem != Enums.SocketGem.NormalGloryGem &&
					    gem != Enums.SocketGem.RefinedGloryGem &&
					    gem != Enums.SocketGem.SuperGloryGem)
					{
						if (socket.Socket == 1)
						{
							SocketItem.Gem1 = gem;
						}
						else
						{
							SocketItem.Gem2 = gem;
						}
						
						Database.CharacterDatabase.SaveInventory(client, SocketItem, client.Inventory.GetPositionFromItemUID(SocketItem.UID));
						client.Inventory.RemoveItemByUID(Gem.UID);
						SocketItem.SendPacket(client, 3);
					}
				}
				else
				{
					if (SocketItem.Gem1 == Enums.SocketGem.EmptySocket && socket.Socket == 1
					    || SocketItem.Gem1 == Enums.SocketGem.NoSocket && socket.Socket == 1)
					{
						return;
					}
					else if (SocketItem.Gem2 == Enums.SocketGem.EmptySocket && socket.Socket != 1
					         ||SocketItem.Gem2 == Enums.SocketGem.NoSocket && socket.Socket != 1)
					{
						return;
					}
					
					if (socket.Socket == 1)
					{
						SocketItem.Gem1 = Enums.SocketGem.EmptySocket;
					}
					else
					{
						SocketItem.Gem2 = Enums.SocketGem.EmptySocket;
					}
					
					Database.CharacterDatabase.SaveInventory(client, SocketItem, client.Inventory.GetPositionFromItemUID(SocketItem.UID));
					SocketItem.SendPacket(client, 3);
				}
			}
		}
Super Aids is offline  
Thanks
1 User
Old 11/25/2013, 17:21   #4
 
elite*gold: 0
Join Date: Jan 2012
Posts: 52
Received Thanks: 0
Thanks didnt even think about that done and working now ty
Ciarda is offline  
Old 01/09/2014, 10:57   #5
 
~Templar~'s Avatar
 
elite*gold: 0
Join Date: Jul 2005
Posts: 28
Received Thanks: 8
I'm working on another problem now that I just recently discovered... Could use some help with it.

If a player logs on to the same character that's already online it usually has a code to deal with it and kick one- BUT if the player opens 2 clients and clicks login at the EXACT same time both clients are able to login to the same character.

This leaves huge room for exploitation/duplication and I need a fix.

I've tried thread sleeps, delaying connections, tried to figure out a way to check for character logged in twice... not having much luck in my endeavor.

Thanks in advance for any assistance or guidance.
~Templar~ is offline  
Old 01/09/2014, 21:52   #6
 
Super Aids's Avatar
 
elite*gold: 0
Join Date: Dec 2012
Posts: 1,761
Received Thanks: 946
Packet 1052.
Super Aids is offline  
Old 01/10/2014, 14:54   #7
 
~Templar~'s Avatar
 
elite*gold: 0
Join Date: Jul 2005
Posts: 28
Received Thanks: 8
So what does packet 1052 need added to it to stop this from happening?
It already has:

Code:
                                    while (Game.World.H_Chars.Contains(GC.MyChar.EntityID))
                                    {
                                        GC.MyChar = Database.LoadCharacter(GC.AuthInfo.Character, ref Acc);
                                        Game.Character Old = (Game.Character)Game.World.H_Chars[GC.MyChar.EntityID];
                                        Old.MyClient.Disconnect();
                                        Program.WriteLine("   " + GC.MyChar.Name + " was kicked off a different client.");
                                        new System.Threading.Thread(new ThreadStart(
                                        delegate()
                                        {
                                            System.Threading.Thread.Sleep(200);
                                            Game.World.H_Chars.Remove(Old.EntityID);
                                            System.Threading.Thread.Sleep(200);
                                            GC.LocalMessage(2000, "This account has been logged in from different client! You are advised to change you password immediately!");
                                        }
                                        )).Start();

                                    }
                                    GC.MyChar.MyClient = GC;
                                    GC.MyChar.AccountName = Acc;
                                    GC.AddSend(Packets.SystemMessage(GC.MessageID, "ANSWER_OK"));
                                    GC.AddSend(Packets.CharacterInfo(GC.MyChar));
                                    GC.AddSend(Packets.Status(GC.MyChar.EntityID, Game.Status.VIPLevel, GC.MyChar.VipLevel));
                                    GC.AddSend(Packets.Time());
                                    GC.AddSend(Packets.Donators(GC.MyChar));
                                    GC.AddSend(Packets.Status(GC.MyChar.EntityID, Game.Status.Effect, 0));
                                    Program.WriteLine("      " + GC.MyChar.Name + " has logged on.");

                                }
                                GC.EndSend();
But that only prevents logging onto a character twice if its already on, not if you login to it at the same time.
Is there some kind of
if (GC.MyClient > 1)
GC.MyChar.Disconnect();
Code I can use?
~Templar~ is offline  
Reply


Similar Threads Similar Threads
tc socket glitch
01/01/2006 - Conquer Online 2 - 26 Replies
wat lvl and wat quality items r we talkin here? can i wait until i can upgrade my coat lvl 87 and wait for SM and do that and it'll work? wat did u guys try out? boots? wat lvl r the items that worked...?



All times are GMT +1. The time now is 17:25.


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.