Implementing Guildwars Gates

07/14/2017 07:51 freefora11#1
Hey everyone,(Bare with me)
I'm having trouble figuring out how to implement the gates in guildwars. I'm using a source that has been great to use and I've implemented many things and now I feel more comfortable to learn more about the packets and meshes. In the source, the pole has been implemented as you see below:
Code:
public static void Init()
        {
            War = false;
            Scores = new Hashtable();
            LastScores = DateTime.Now;
            LastPoints = DateTime.Now;
            ThePole = new Pole();
            ThePole.EntityID = 6700;
            ThePole.Mesh = 1137;
            ThePole.CurHP = 10000000;
            ThePole.MaxHP = 10000000;
            ThePole.Loc = new Location();
            ThePole.Loc.Map = 1038;
            ThePole.Loc.X = 84;
            ThePole.Loc.Y = 99;

        }
It uses this function to spawn the pole:

Code:
 public void Spawn(Character C, bool Check)
            {
                if (C.Loc.Map == Loc.Map && MyMath.InBox(C.Loc.X, C.Loc.Y, Loc.X, Loc.Y, 16) && (!MyMath.InBox(C.Loc.PreviousX, C.Loc.PreviousY, Loc.X, Loc.Y, 16) || !Check))
                {
                    if (LastWinner == null) C.MyClient.AddSend(Packets.SpawnNPCWithHP(EntityID, (ushort)Mesh, 10, Loc, true, "Pole", CurHP, MaxHP));
                    else C.MyClient.AddSend(Packets.SpawnNPCWithHP(EntityID, (ushort)Mesh, 10, Loc, true, LastWinner.GuildName, CurHP, MaxHP));
                }
            }
I decided to look at another source, Redux, which has gates and the pole in it and I was able to find some characteristics that were the same. First is the EntityID. For the pole, The EntityID = 6700 for both sources, The MeshID for the pole on my source is: 1137. on Redux, I found the left gate had an EntityID = 6701, with a mesh ID:241. So I tried using the same "Pole Struct" but with an EntityID = 6701 and Mesh:241:
Code:
LeftGate = new Pole();
LeftGate.EntityID = 6701;
LeftGate.Mesh = 1137;
LeftGate.CurHP = 10000000;
LeftGate.MaxHP = 10000000;
LeftGate.Loc = new Location();
LeftGate.Loc.Map = 1038;
LeftGate.Loc.X = 167;
LeftGate.Loc.Y = 210;
Ofcourse it didn't work, but I was able to keep the EntityID to 6701 instead of 6700 and use the Pole Mesh and could spawn another Pole, but no gate.

How do you find the meshes and their corresponding IDs? And what should I look into to solving my problem? I just need some guidance; pointed in the right direction. Thank you!
07/24/2017 01:56 freefora11#2
No one has said anything yet so I'm going to continue with more test that I've done and learn. I still can't find out how to spawn a gate mesh instead of a pole. From 2 different sources, the mesh ID for a pole was 1137. One of those had the gate mesh ID as 241(leftgate) and 245(when left gate is opened). Again when I replace the pole mesh id with 241, there is no object.

Where can I find the mesh IDs? I've done many searches using Notepad++ to search all text files in my database and conquer client and nothing pops up.
I assume the gate uses the same packet as the pole which is an npc packet, the packet is below.

Code:
byte[] Packet = new byte[8 + 36 + Name.Length];

            COPacket P = new COPacket(Packet);
            P.WriteInt16((ushort)(Packet.Length - 8));
            P.WriteInt16((ushort)1109);
            P.WriteInt32(EntityID);
            P.WriteInt32(MaxHP);
            P.WriteInt32(CurHP);
            P.WriteInt16(Loc.X);
            P.WriteInt16(Loc.Y);
            P.WriteInt16((ushort)Type); //stores the meshID
            P.WriteInt16(Flags);
            P.WriteInt16(11);
            if (Named)
            {
                P.WriteByte(1);
                P.WriteByte((byte)Name.Length);
                P.WriteString(Name);
            }
My only other option I can think of which I'm thinking is just use 2 poles as the gate. I can set it to when the health gets to 0, i can remove object, or move it out of the way. This would be pretty easy, but would rather have the correct mesh. Example: [Only registered and activated users can see links. Click Here To Register...]



I'm not asking anyone to code anything for me, I want to do it myself.Any help in the right direction would be very appreciated!
07/24/2017 06:01 Spirited#3
Here's an old packet dump I have for the side gates.
Hopefully they're useful to you.

Code:
Packet 0 -- From: TQClient -- Length: 38 | Receive Length: 46 -- Type: 10010
26 00 1A 27 7C 4F 3F 00 F2 00 C3 00 00 00 00 00 ;   & '|O?       
52 65 8E 17 89 00 00 00 FD 00 CB 00 0E 04 00 00 ;   Reމ       
FF FF FF FF 00 00 54 51 43 6C 69 65 6E 74       ;     TQClient

Packet 1 -- From: TQServer -- Length: 38 | Receive Length: 46 -- Type: 10010
26 00 1A 27 7C 4F 3F 00 F2 00 C3 00 00 00 00 00 ;   & '|O?       
6F 17 EB 09 89 00 00 00 FD 00 CB 00 0E 04 00 00 ;   o	‰       
00 00 00 00 00 00 54 51 53 65 72 76 65 72       ;         TQServer

Packet 2 -- From: TQServer -- Length: 40 | Receive Length: 48 -- Type: 1109
28 00 55 04 13 8F 01 00 CF 5C 5C 00 00 2D 31 01 ;   ( U \\  -1
64 00 00 00 DF 00 B1 00 1F 01 1A 00 15 00 00 00 ;   d         
CB 09 00 00 00 00 00 00 54 51 53 65 72 76 65 72 ;   	      TQServer

Packet 3 -- From: TQClient -- Length: 38 | Receive Length: 46 -- Type: 10010
26 00 1A 27 7C 4F 3F 00 E8 00 BA 00 00 00 00 00 ;   & '|O?       
29 68 8E 17 89 00 00 00 F2 00 C3 00 0E 04 00 00 ;   )hމ       
FF FF FF FF 00 00 54 51 43 6C 69 65 6E 74       ;     TQClient

Packet 4 -- From: TQServer -- Length: 38 | Receive Length: 46 -- Type: 10010
26 00 1A 27 7C 4F 3F 00 E8 00 BA 00 00 00 00 00 ;   & '|O?       
30 1A EB 09 89 00 00 00 F2 00 C3 00 0E 04 00 00 ;   0	‰       
00 00 00 00 00 00 54 51 53 65 72 76 65 72       ;         TQServer

Packet 5 -- From: TQServer -- Length: 40 | Receive Length: 48 -- Type: 1109
28 00 55 04 13 8F 01 00 CF 5C 5C 00 00 2D 31 01 ;   ( U \\  -1
64 00 00 00 DF 00 B1 00 1F 01 1A 00 15 00 00 00 ;   d         
CB 09 00 00 00 00 00 00 54 51 53 65 72 76 65 72 ;   	      TQServer

Packet 6 -- From: TQClient -- Length: 88 | Receive Length: 96 -- Type: 1009
58 00 F1 03 7C 4F 3F 00 00 00 00 00 1B 00 00 00 ;   X |O?        
36 6A 8E 17 00 00 00 00 00 00 00 00 00 00 00 00 ;   6jŽ            
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ;                   
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ;                   
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ;                   
00 00 00 00 00 00 00 00 54 51 43 6C 69 65 6E 74 ;           TQClient

Packet 7 -- From: TQServer -- Length: 88 | Receive Length: 96 -- Type: 1009
58 00 F1 03 7C 4F 3F 00 00 00 00 00 1B 00 00 00 ;   X |O?        
36 6A 8E 17 00 00 00 00 00 00 00 00 00 00 00 00 ;   6jŽ            
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ;                   
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ;                   
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ;                   
00 00 00 00 00 00 00 00 54 51 53 65 72 76 65 72 ;           TQServer

Packet 8 -- From: TQServer -- Length: 84 | Receive Length: 92 -- Type: 10017
54 00 21 27 7C 4F 3F 00 02 00 00 00 FF FF FF FF ;   T !'|O?    
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ;                   
00 00 00 00 08 00 00 00 12 00 00 00 00 00 00 00 ;                 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ;                   
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ;                   
00 00 00 00 54 51 53 65 72 76 65 72             ;       TQServer
07/24/2017 06:08 freefora11#4
Quote:
Originally Posted by Spirited View Post
Here's an old packet dump I have for the side gates.
Hopefully they're useful to you.

Code:
Packet 0 -- From: TQClient -- Length: 38 | Receive Length: 46 -- Type: 10010
26 00 1A 27 7C 4F 3F 00 F2 00 C3 00 00 00 00 00 ;   & '|O?       
52 65 8E 17 89 00 00 00 FD 00 CB 00 0E 04 00 00 ;   Re       
FF FF FF FF 00 00 54 51 43 6C 69 65 6E 74       ;     TQClient

Packet 1 -- From: TQServer -- Length: 38 | Receive Length: 46 -- Type: 10010
26 00 1A 27 7C 4F 3F 00 F2 00 C3 00 00 00 00 00 ;   & '|O?       
6F 17 EB 09 89 00 00 00 FD 00 CB 00 0E 04 00 00 ;   o	       
00 00 00 00 00 00 54 51 53 65 72 76 65 72       ;         TQServer

Packet 2 -- From: TQServer -- Length: 40 | Receive Length: 48 -- Type: 1109
28 00 55 04 13 8F 01 00 CF 5C 5C 00 00 2D 31 01 ;   ( U \\  -1
64 00 00 00 DF 00 B1 00 1F 01 1A 00 15 00 00 00 ;   d         
CB 09 00 00 00 00 00 00 54 51 53 65 72 76 65 72 ;   	      TQServer

Packet 3 -- From: TQClient -- Length: 38 | Receive Length: 46 -- Type: 10010
26 00 1A 27 7C 4F 3F 00 E8 00 BA 00 00 00 00 00 ;   & '|O?       
29 68 8E 17 89 00 00 00 F2 00 C3 00 0E 04 00 00 ;   )h       
FF FF FF FF 00 00 54 51 43 6C 69 65 6E 74       ;     TQClient

Packet 4 -- From: TQServer -- Length: 38 | Receive Length: 46 -- Type: 10010
26 00 1A 27 7C 4F 3F 00 E8 00 BA 00 00 00 00 00 ;   & '|O?       
30 1A EB 09 89 00 00 00 F2 00 C3 00 0E 04 00 00 ;   0	       
00 00 00 00 00 00 54 51 53 65 72 76 65 72       ;         TQServer

Packet 5 -- From: TQServer -- Length: 40 | Receive Length: 48 -- Type: 1109
28 00 55 04 13 8F 01 00 CF 5C 5C 00 00 2D 31 01 ;   ( U \\  -1
64 00 00 00 DF 00 B1 00 1F 01 1A 00 15 00 00 00 ;   d         
CB 09 00 00 00 00 00 00 54 51 53 65 72 76 65 72 ;   	      TQServer

Packet 6 -- From: TQClient -- Length: 88 | Receive Length: 96 -- Type: 1009
58 00 F1 03 7C 4F 3F 00 00 00 00 00 1B 00 00 00 ;   X |O?        
36 6A 8E 17 00 00 00 00 00 00 00 00 00 00 00 00 ;   6j            
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ;                   
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ;                   
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ;                   
00 00 00 00 00 00 00 00 54 51 43 6C 69 65 6E 74 ;           TQClient

Packet 7 -- From: TQServer -- Length: 88 | Receive Length: 96 -- Type: 1009
58 00 F1 03 7C 4F 3F 00 00 00 00 00 1B 00 00 00 ;   X |O?        
36 6A 8E 17 00 00 00 00 00 00 00 00 00 00 00 00 ;   6j            
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ;                   
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ;                   
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ;                   
00 00 00 00 00 00 00 00 54 51 53 65 72 76 65 72 ;           TQServer

Packet 8 -- From: TQServer -- Length: 84 | Receive Length: 92 -- Type: 10017
54 00 21 27 7C 4F 3F 00 02 00 00 00 FF FF FF FF ;   T !'|O?    
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ;                   
00 00 00 00 08 00 00 00 12 00 00 00 00 00 00 00 ;                 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ;                   
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ;                   
00 00 00 00 54 51 53 65 72 76 65 72             ;       TQServer
Thank you very much, I will take a look into these and see what I find.
07/26/2017 04:40 freefora11#5
I was finally able to spawn it! The problem was the flag variable. It was sending 10(which is for pole) and I switched it to 26 and that did it! After 14 hours of learning about packets in 3 different sources, I was able to. Thanks again Spirit, the packet type 1109 was the key in all of this.

Btw, can anyone point me in the right direction with the actual file of the gate? The client that I got with the source apparently removed it. I used a different client to get it to appear. Below are links to the 2 different clients. Thanks!

[Only registered and activated users can see links. Click Here To Register...] //my client, doens't show gate, but it is there

[Only registered and activated users can see links. Click Here To Register...] // other client
07/26/2017 08:16 Spirited#6
Quote:
Originally Posted by freefora11 View Post
I was finally able to spawn it! The problem was the flag variable. It was sending 10(which is for pole) and I switched it to 26 and that did it! After 14 hours of learning about packets in 3 different sources, I was able to. Thanks again Spirit, the packet type 1109 was the key in all of this.

Btw, can anyone point me in the right direction with the actual file of the gate? The client that I got with the source apparently removed it. I used a different client to get it to appear. Below are links to the 2 different clients. Thanks!

[Only registered and activated users can see links. Click Here To Register...] //my client, doens't show gate, but it is there

[Only registered and activated users can see links. Click Here To Register...] // other client
Likely compressed in data.wdf and c3.wdf
07/26/2017 09:20 freefora11#7
Quote:
Originally Posted by Spirited View Post
Likely compressed in data.wdf and c3.wdf
After messing around with exchanging files around, I found out it was the data.wdf. If you don't mind answering one more question. I'm trying to use CptSky's Package manager to extract the data.wdf. I'm a little confuse of what I'm doing wrong.

In the extractor part, I enter the source(which is the data.WDF), the input should be the same as the source and the output should be a different location. Is there something I did wrong? Should the output location have something in it before? Or is it that I just can't read his instructions haha. Thanks

[Only registered and activated users can see links. Click Here To Register...]
07/27/2017 04:03 Spirited#8
Quote:
Originally Posted by freefora11 View Post
After messing around with exchanging files around, I found out it was the data.wdf. If you don't mind answering one more question. I'm trying to use CptSky's Package manager to extract the data.wdf. I'm a little confuse of what I'm doing wrong.

In the extractor part, I enter the source(which is the data.WDF), the input should be the same as the source and the output should be a different location. Is there something I did wrong? Should the output location have something in it before? Or is it that I just can't read his instructions haha. Thanks

[Only registered and activated users can see links. Click Here To Register...]
WPF is a compressed file system. You need to know the key filename/path to get its data from the archive. Korvacs has a tool that iterates through all keys and dumps the archive to a directory. That's probably what you're looking for.
07/27/2017 04:21 freefora11#9
Quote:
Originally Posted by Spirited View Post
WPF is a compressed file system. You need to know the key filename/path to get its data from the archive. Korvacs has a tool that iterates through all keys and dumps the archive to a directory. That's probably what you're looking for.
I used his before and it didn't work at first, but now I understand what you/them meant where it had to know the file path to the original. I was making a copy of the data.wdf and placed it in another directory. I was able to set up the gate and got them to work like it does in normal conquer. Thanks again for time :)