Sending Packets

11/18/2010 08:04 Interest07#121
Quote:
Originally Posted by SunB View Post
I can do self cast but I can not do it with target and after do 4-5 self cast spells, the game client become not responding. Maybe my code do something stupid with the game client. Anyway, thank for your respond ^ ^:D

P/s: Is there any problem if I open and close the process many time, for example, update game info, perform send package, scan for mob, items, npc?
Maybe... why don't you just open the process once?

Do you play on the russian server?
11/18/2010 08:21 SunB#122
I am playing on Vietname server :D I am refactoring my code to only open the process once. How to let the character move to a specified location by sending package?
11/18/2010 09:32 Interest07#123
In the first post of this thread I linked to a post explaining movement by packets.

Ahh, there is a chance packets aren't all the same on Vietnamese server I suppose.
11/18/2010 15:59 BuBucekTop#124
>>>>> I can do self cast but I can not do it with target

Have you set proper target before using skill on it ???
______________________________
Captiain Obvious is at your service.
11/18/2010 16:00 Interest07#125
Quote:
Originally Posted by BuBucekTop View Post
>>>>> I can do self cast but I can not do it with target

Have you set proper target before using skill on it ???
______________________________
Captiain Obvious is at your service.
oh yeah, good question, did you select target before trying to use a skill on it :o
11/18/2010 17:13 SunB#126
Quote:
Originally Posted by BuBucekTop View Post
>>>>> I can do self cast but I can not do it with target

Have you set proper target before using skill on it ???
______________________________
Captiain Obvious is at your service.
Of course, I do target the proper mob. Does that exactly mean "set proper target" :D
Update:
A little try after work, I can do regular attack. I call SelectTarget before casting, am I missing anything?
12/04/2010 04:08 SunB#127
I call function "Set Target" first, then I use "Cast Skill" but it fail. I try to target manually and call function "Cast Skill" and it works :confused: Am I missing anything before call "Use Skill" ?
12/04/2010 09:19 Interest07#128
has there been enough time between the set target and cast skill?
If you send the two packets (almost) simultaneously, they might arrive in the wrong order at the server.
12/04/2010 11:32 SunB#129
Hi Interest, I tried to some the package after 5s but it did not work. After call "Set Target", I call "Regular Attack" and it works. However I can do self cast (buffs...).
Here is the cast skill function:
Code:
 public void DoCastSpell(uint skillID, uint targetID)
        {
            var stream = new MemoryStream();
            stream.Write(BitConverter.GetBytes(0x29), 0, 2);
            stream.Write(BitConverter.GetBytes(skillID), 0, 4);
            stream.Write(BitConverter.GetBytes(0x100), 0, 2);
            stream.Write(BitConverter.GetBytes(targetID), 0, 4);
            byte[] data = stream.ToArray();
            SendPackage(data);
        }
Is the package correct?
12/04/2010 18:17 Interest07#130
do you reverse the byte order ? I've never used MemoryStream before, but i don't think it reverses byte order for you. BUt when you for example want to use skill (skillId 0x1234, playerId 0x12345678) you send packet:

290034120000000178563412
12/04/2010 19:27 vuduy#131
You don't need to reverse the bye array when writing bytes directly using BitConverter. His UseSkill works when he selects the target before hand so it's not the function problem.

The problem is his SetTarget function. He needs to lock target first by using "Select" opcode (0200) before he can execute skills on the target. He's probably setting target by just writing the targetId to the Target offset without locking.
12/04/2010 21:45 Interest07#132
Hehe thanks vuduy, I'm never good at figuring out what goes wrong for people.
12/05/2010 01:52 SunB#133
I used the "SetTarget" get function for "targeting". After call this function, I do check the target ID at TargetOffset and it matches. Is that the correct way to target and lock target?
12/05/2010 02:44 vuduy#134
What do you do in your SetTarget function?
12/05/2010 02:48 SunB#135
Here it is:
Code:
 public void DoSetTarget(uint targetID)
        {
            var stream = new MemoryStream();
            stream.Write(BitConverter.GetBytes(0x2), 0, 2);
            stream.Write(BitConverter.GetBytes(targetID), 0, 4);
            byte[] data = stream.ToArray();
            SendPackage(data);
        }
Thank you, Vuduy