|
You last visited: Today at 01:17
Advertisement
Proxy Help: Dropping an Item
Discussion on Proxy Help: Dropping an Item within the CO2 Programming forum part of the Conquer Online 2 category.
08/14/2010, 03:57
|
#1
|
elite*gold: 80
Join Date: Sep 2007
Posts: 642
Received Thanks: 168
|
Proxy Help: Dropping an Item
Alright, so i have decided to mess around with a proxy and try to make myself an autominer. I have gotten as far as to dropping the items. I am not sure what the problem with it is, weather its the packet structure or the Item ids itself.
EDIT: Totally forgot to mention its for a 5065 binary server.
This is in my PacketHandler, everytime i pick something up, or mine an ore i Add the item to a dictionary, then i check to see if There are more than 19 items, if their are i call my drop method(Obviously).
PHP Code:
C.MyChar.Inventory.Add(I.UID, I); if (C.MyChar.BotOn == true) { if (C.MyChar.Inventory.Count >= 20) C.MyChar.Drop(I, C.MyChar); } break; }
I created an arraylist containing all the ID that i would like to drop.
PHP Code:
public static ArrayList OresToDrop = new ArrayList() { (uint)1072010, (uint)1072011, (uint)1072012, (uint)1072013, (uint)1072014, (uint)1072015, (uint)1072016, (uint)1072017, (uint)1072018, (uint)1072019, (uint)1072020, (uint)1072021, (uint)1072022, (uint)1072023, (uint)1072024, (uint)1072025, (uint)1072026, (uint)1072027, (uint)1072028, (uint)1072029, (uint)1072040, (uint)1072041, (uint)1072042, (uint)1072043, (uint)1072044, (uint)1072045, (uint)1072046, (uint)1072047, (uint)1072048, (uint)1072049 };
Then i loop through every value in the dictionary. If any of them are contained in the list, it sends the drop packet.
PHP Code:
public void Drop(Struct.ItemInfo D, MyCharacter C) { foreach (KeyValuePair<uint, Struct.ItemInfo> Item in C.Inventory) { if (OresToDrop.Contains(Item.Value)) { MyClient.SendToServer(Packets.DropItem(D, C).Get); Thread.Sleep(1000); } } }
And this is my packet, its a lil sketchy, i have NO idea if it correct.
PHP Code:
public static COPacket DropItem(Struct.ItemInfo I, MyCharacter Char) { Random Rand = new Random(); byte[] Packet = new byte[28]; COPacket P = new COPacket(Packet); P.WriteInt16((ushort)(Packet.Length -8)); P.WriteInt16((ushort)(1009)); P.WriteInt32(I.UID); P.WriteInt16((ushort)(Char.Loc.X - Rand.Next(4) + Rand.Next(4))); P.WriteInt16((ushort)(Char.Loc.Y - Rand.Next(4) + Rand.Next(4))); P.WriteInt32(3); P.WriteInt32((uint)Environment.TickCount); P.WriteString("TQServer"); return P; }
Any help would be appreciated, i have been going at this all day.
|
|
|
08/14/2010, 05:15
|
#2
|
elite*gold: 0
Join Date: Dec 2006
Posts: 1,039
Received Thanks: 1,335
|
I'm on my phone now so I have no access to the correct packet structure right now; however, I noticed a couple of stuff.
OresToDrop.Contains(Item.Value)
Item.Value is the ItemInfo struct instance however you should be checking for item IDs so it should be something like OresToDrop.Contains(Item.Value.ID)
I'm not sure if it's called ID but it's NOT UID.
Second, DropItem(D, C) should be DropItem(Item.Value, C)
Third, in the packet struct replace TQServer with TQClient.
Also you should remove the "- R a n d . N e x t ( 4 ) + R a n d . N e x t ( 4 )" part.
I also noticed the packet structure you have is off a private server because of the random part, probably it's wrong anyway. I'll send the correct struct tomorrow.
|
|
|
08/14/2010, 05:22
|
#3
|
elite*gold: 80
Join Date: Sep 2007
Posts: 642
Received Thanks: 168
|
Quote:
Originally Posted by gabrola
I'm on my phone now so I have no access to the correct packet structure right now; however, I noticed a couple of stuff.
OresToDrop.Contains(Item.Value)
Item.Value is the ItemInfo struct instance however you should be checking for item IDs so it should be something like OresToDrop.Contains(Item.Value.ID)
I'm not sure if it's called ID but it's NOT UID.
Second, DropItem(D, C) should be DropItem(Item.Value, C)
Third, in the packet struct replace TQServer with TQClient.
Also you should remove the "- R a n d . N e x t ( 4 ) + R a n d . N e x t ( 4 )" part.
I also noticed the packet structure you have is off a private server because of the random part, probably it's wrong anyway. I'll send the correct struct tomorrow.
|
Thanks so much. Yes that would be great if you could help me when you get access to your PC. I will try some of the things you mentioned, thanks.
Edit- Still not having any luck.
|
|
|
08/14/2010, 08:26
|
#4
|
elite*gold: 106
Join Date: Oct 2006
Posts: 6,047
Received Thanks: 1,165
|
#Moved
|
|
|
08/15/2010, 03:20
|
#5
|
elite*gold: 80
Join Date: Sep 2007
Posts: 642
Received Thanks: 168
|
I have been recording the id of the same item that i am dropping and picking up and i noticed that sometimes it will be WAY different like its 18072342 and after, say 4 times, it will be like 342765.
This is the way I'm reading the values
PHP Code:
PacketReader PR = new PacketReader(Data, 4);
I.UID = PR.ReadUInt32();
I.ItemID = PR.ReadUInt32();
I realized that i had the length wrong on my packet so i added the 4 bytes, but it didn't make a difference. So i decided to dump the packet being sent from my command and also the packet(on the same item) being sent from the client seconds later. I noticed that the timestamp was WAYY different (unless i did this wrong).
Could this be why my packet isn't working?
Here is both of the packets without the Auth stamp on the end.
Sent via Cmd
PHP Code:
18 00 f1 03 e1 61 29 0b 71 00 A0 00 03 00 00 00 8f 93 83 01 00 00 00 00 Timestamp->25400207
Sent via client
PHP Code:
18 00 f1 03 e1 61 29 0b 71 00 A0 00 03 00 00 00 40 b5 cd 01 00 00 00 00 Timestamp->1946944
|
|
|
08/15/2010, 04:23
|
#6
|
elite*gold: 20
Join Date: Jan 2008
Posts: 1,042
Received Thanks: 252
|
They don't actually send the Item ID, just the Unique ID.
The ID field is used as a union for the coordinates.
I can't explain how your timestamps are madly different, I think I discovered the same thing, soon as I added coordinates though, dropping started to work.
|
|
|
08/15/2010, 04:53
|
#7
|
elite*gold: 80
Join Date: Sep 2007
Posts: 642
Received Thanks: 168
|
Quote:
Originally Posted by © Haydz
They don't actually send the Item ID, just the Unique ID.
The ID field is used as a union for the coordinates.
I can't explain how your timestamps are madly different, I think I discovered the same thing, soon as I added coordinates though, dropping started to work.
|
They do send the Item ID, unless its just a VERY weird coincidence where it just so happens to be the same as the ItemID every time.
I'm assuming the server would reject the packet if since the time stamps are soo different? Could that be why its not working? Any way to fix how the problem? I'm trying the jump packet to see if the time stamps are corrected on there.
EDIT:
Here are the results of my Jump packet stamp test.
Sent via Command
PHP Code:
18 00 f2 03 7e 48 f8 01 e2 28 4e 00 a3 00 71 00 a3 00 72 00 00 00 85 00 Timestamp ->33048702
Sent via Client
PHP Code:
18 00 f2 03 f8 34 00 00 e2 28 4e 00 a3 00 71 00 a3 00 72 00 00 00 85 00 TimeStamp ->13560
I'm going to restart my PC and see what happens.
Here are the results after i restarted my PC.
Sent via Command
PHP Code:
18 00 f2 03 ca a1 02 00 e2 28 4e 00 a3 00 71 00 a3 00 72 00 00 00 85 00 Timestamp ->172490
Sent via Client
PHP Code:
18 00 f2 03 6a 04 00 00 e2 28 4e 00 a3 00 71 00 a3 00 72 00 00 00 85 00 Timestamp ->1130
|
|
|
08/15/2010, 05:37
|
#8
|
elite*gold: 20
Join Date: Jan 2008
Posts: 1,042
Received Thanks: 252
|
Quote:
Originally Posted by StarBucks
They do send the Item ID, unless its just a VERY weird coincidence where it just so happens to be the same as the ItemID every time.
|
Quote:
|
Originally Posted by StarBucks
I have been recording the id of the same item that i am dropping and picking up and i noticed that sometimes it will be WAY different like its 18072342 and after, say 4 times, it will be like 342765.
|
Why say that then? It's just a VERY weird coincidence that I can drop item's yet you can't?
They don't check timestamps on an item drop either.
Jeez, you try to help someone here, you get it thrown back in your face.
|
|
|
08/15/2010, 06:01
|
#9
|
elite*gold: 0
Join Date: Dec 2006
Posts: 1,039
Received Thanks: 1,335
|
The UID stays the same cause it's the same item. You should also try using the native timeGetTime instead of TickCount.
|
|
|
08/15/2010, 06:35
|
#10
|
elite*gold: 80
Join Date: Sep 2007
Posts: 642
Received Thanks: 168
|
Quote:
Originally Posted by gabrola
The UID stays the same cause it's the same item. You should also try using the native timeGetTime instead of TickCount.
|
I know that the UID stay the same, it must be the packet im receiving must be messed up.
I tried native timeGettime and still no luck. Same outcome.
This is making me mad, i pretty much can't do anything because of this problem.
|
|
|
08/15/2010, 06:39
|
#11
|
elite*gold: 0
Join Date: Nov 2006
Posts: 805
Received Thanks: 464
|
well looks like you just have the wrong type to be honest. In the logged packets you have it's 0x3F2, in your structure (1009) is 0x3F1.
Also timestamps are checked (now anyways) haydz, not sure if they have to be accurate but if ya dont send one earned yourself a free trip to botjail.
so try type 1010, (not what it is right now but yeah.) currently Item info is 3f0 3f1 is drop.
May have been 3f2 back when your pserver was made.
Edit: sorry i thought your second post with packets logged was a drop packet lol.
Ill look again and see if i find anything
|
|
|
08/15/2010, 06:45
|
#12
|
elite*gold: 80
Join Date: Sep 2007
Posts: 642
Received Thanks: 168
|
Quote:
Originally Posted by Ian*
well looks like you just have the wrong type to be honest. In the logged packets you have it's 0x3F2, in your structure (1009) is 0x3F1.
Also timestamps are checked (now anyways) haydz, not sure if they have to be accurate but if ya dont send one earned yourself a free trip to botjail.
so try type 1010, (not what it is right now but yeah.) currently Item info is 3f0 3f1 is drop.
May have been 3f2 back when your pserver was made.
|
I have the correct packet type, I decided to try messing with the General packet for jump just to see if the timestamp was actually the reason, it was.
Do you have anyway that i could fix the problem with my timestamp?
|
|
|
08/15/2010, 11:27
|
#13
|
elite*gold: 20
Join Date: Aug 2005
Posts: 1,734
Received Thanks: 1,001
|
PHP Code:
[StructLayout(LayoutKind.Explicit)] public struct DwordUnion { [FieldOffset(0)] public uint Value; [FieldOffset(0)] public ushort Low; [FieldOffset(2)] public ushort High; } [StructLayout(LayoutKind.Sequential)] public unsafe struct ItemUsagePacket {
public Header Header; public uint UID; public DwordUnion dwParam; public ItemPacketSub ID; public uint TimeStamp; public uint dwExtraInfo; public fixed sbyte TQPadding[8]; public static ItemUsagePacket Create() { ItemUsagePacket Packet = new ItemUsagePacket { Header = new Header { Size = 24, Type = 1009 }, TimeStamp = (uint)Environment.TickCount }; PacketBuilder.EncodePadding(Packet.TQPadding, "TQClient"); return Packet; } public static ItemUsagePacket Drop(uint UID) { ItemUsagePacket Packet = Create(); Packet.UID = UID; Packet.ID = ItemPacketSub.DropItem;
return Packet; } }
if (IsOre(Item.ID)) { if (!IsGold(Item.ID)) { ItemUsagePacket Drop = ItemUsagePacket.Drop(Item.UID); for (int j = 0; j <= 8; j++) { if (Client.Inventory.ContainsKey(Item.UID) == false) break; int[] _DELTA_X = { 0, -1, -1, -1, 0, 1, 1, 1, 0 }; int[] _DELTA_Y = { 1, 1, 0, -1, -1, -1, 0, 1, 0 }; Drop.dwParam.Low = (ushort)(Client.Entity.Y + _DELTA_Y[j]); Drop.dwParam.High = (ushort)(Client.Entity.X + _DELTA_X[j]); Client.Send(&Drop, Drop.Header.Size, SendMode.Server); Thread.Sleep(400); } }
Seems to work just peachy for me. I'm not sure what is the problem in your code.
EDIT: I noticed the first post, you're writing "TQServer" at the end when it should be "TQClient" because you're sending it to server, perhaps this is the reason it's not working?
|
|
|
08/15/2010, 19:18
|
#14
|
elite*gold: 80
Join Date: Sep 2007
Posts: 642
Received Thanks: 168
|
Ok, these packets are IDENTICAL except the timestamp(of course). Yet the one im sending from the proxy doesn't work. Can anyone explain to me why this doesn't work? Do i need to send something to the client?
PHP Code:
FROM CLIENT: 18 00 f1 03 a4 19 2f 0b 72 00 a2 00 03 00 00 00 63 c6 69 00 00 00 00 00 54 51 43 6c 69 65 6e 74
FROM COMMAND:
18 00 f1 03 a4 19 2f 0b 72 00 a2 00 03 00 00 00 83 63 33 00 00 00 00 00 54 51 43 6c 69 65 6e 74
And This packet gave me those results
PHP Code:
public static COPacket DropItem(Struct.ItemInfo I, uint X, uint Y) { Random Rand = new Random(); byte[] Packet = new byte[0x20]; COPacket P = new COPacket(Packet); P.WriteInt16((ushort)(Packet.Length - 8)); P.WriteInt16((ushort)(0x3F1)); P.WriteInt32(I.UID); P.WriteInt16((ushort)X); P.WriteInt16((ushort)Y); P.WriteInt32(0x03); P.WriteInt32((uint)Environment.TickCount); P.Move(4); P.WriteString("TQClient"); return P; }
EDIT: So, apparently my X and Y cords were backwards so it freakin works now. Now I gotta see if i can get the jump packet to work. I'm freakin stupid.
|
|
|
08/15/2010, 21:37
|
#15
|
elite*gold: 20
Join Date: Aug 2007
Posts: 1,749
Received Thanks: 2,199
|
Since when does the "DropItem" packet contain coordinates?
|
|
|
 |
|
Similar Threads
|
[Release] Item dropping (for events/gm command)
01/16/2010 - CO2 PServer Guides & Releases - 10 Replies
So I was bored and figured I might finish my random event code for 1.0 and in the process realized just how much better alot of what I had could be written so I'm in the process of re-writing it all to use voids, switch and all that good stuff.
During that, for my random drop event I decided to write a little command/void to handle dropping items. This can be used however you wish. Maybe you want a gm command to drop x number of db's in twin city, a random event or anything else you want...
|
[SEARCH]GM Command for item dropping
08/16/2009 - Dekaron Private Server - 11 Replies
I have an own Dekaron private Server(Only4Fun) and a few questions
What is the GM Command to drop an item i chosed?
If i type /GM callmonster 101 (Spider larva) the there is no monster spawning. Why?
Pls help me
Greets Ghosthunter
PS: I have a List with the commands but the most one are not working. I type them and then nothing happens
|
editing item file for msg at dropping items
07/12/2006 - Conquer Online 2 - 7 Replies
Hi, i read about a programm that edits the item dat which changes their priority so it gives you a message , if you wanna drop it (just like meteors have).
i tried to search for that thread but wanst able to find it :/
|
All times are GMT +1. The time now is 01:18.
|
|