scriptsdk/CSharp-ScriptSDK-Legacy

Event listeners causing packet error

Opened this issue · 5 comments

Stealth.Client.Buff_DebuffSystem += onBuff;
Stealth.Client.UnicodeSpeech += onSpeech;
Stealth.Client.PartyInvite += onInvite;
Stealth.Client.ClilocSpeech += onClilocSpeech;

Error, packet parsed incorrectly! x4

Miss you!

Bosek commented

Hello!
Could you please provide more info? Client version, Stealth version, ScriptSDK version and possibly emulator and it's version in case you are playing on free server?

Also it would be helpful if you showed us a relevant snippet of your code.

Thanks for your submission and have a great day!

Hello

I cloned and compiled the latest source of ScriptSDK. Stealth is v8.10.2 playing on OSI
Thank you! This code was working 3 years ago.

I'll just post the Buff_DebuffSystem for now, but also getting this for UnicodeSpeech, PartyInvite and ClilocSpeech.

Source: https://raw.githubusercontent.com/unisharpUO/Combot/master/Client/Routines/Combat.cs

Stealth.Client.Buff_DebuffSystem += onBuff;

static void onBuff(object sender, Buff_DebuffSystemEventArgs e)
{
	if (e.AttributeId == 1038)
	{
		Data.Job j = new Data.Job("cleanse", Controller.ID, 10, "spell");
		Client.JobResponse(j, "add");
	}
	/* * 
	 * 1069 is a buff that comes up 3 times whenever
	 * a bandage is being used.  So we're using that
	 * to determine whether we're bandaging or not.
	 * * */
	if (e.AttributeId == 1069)
	{
		if (!IsBandaging)
		{
			IsBandaging = true;
			Controller.IsBusy = true;
		}
	}
	else if (e.AttributeId == 1101) //1101 means we finished bandaging
	{
		Controller.ConsoleMessage("Caught a 1101 Debuff Event",
			ConsoleColor.DarkYellow);

		/* *
		 * We have to set the bools to false before telling
		 * the server that we completed the job so the server
		 * doesn't try giving us a job while we're still busy
		 * * */
		IsBandaging = false;
		Controller.IsBusy = false;
		Client.JobResponse(Jobs.BandageJob.ID, "complete");
		Controller.ConsoleMessage("Bandage job complete",
				ConsoleColor.Green);
	}
}
Bosek commented

It's weird that it was working a few days ago. Maybe you got a system update? If it was working, it does not indicate a bug in ScriptSDK. Can you maybe try to replicate the issue on other computer?

And maybe copy us a stack trace? That would definitelly help. Thanks!

Hello,

Sorry, not days - years. This worked years ago (2016).

Can you test and confirm the Stealth.Client.Buff_DebuffSystem is working as intended?

I added a try/catch and it's not throwing an exception so I can't stack trace. The error it's throwing is "Stealth\Script DLL packet parser, Error, Packet parsed incorrectly!"

Thanks!

This has been fixed with Merge Pull Request #29