Kamras

Member
I've found a bug or glitch in ServUO crafting system when being used with Vita Nex Core.

When using a smith hammer, In the crafting menu it only shows pre AOS items, now I checked my Expansion list and it does show TOL, also the gold feature from TOL works, just the crafting system is out the window..

What's interesting is I used the same client on JustUO and it worked with no issue, however i did a fresh installation of servuo and the problem went away as opposed to my original servuo installation.

So I started to wonder, what I did was different. I went through each of my custom scripts one at a time to figure out which one was causing this.. I never would have guessed.. Its Vita Nex Core..

So If you install a fresh copy of servuo, use the newest patched client (which i did), start it like normal, verify the crafting system is great. Save, restart, verify again, crafting system is great.

Then Drop in the vita nex core scripts in customs, start the shard, then restart the shard (as vita nex as to make its data files) , log into your shard, and check crafting system again and it's bugged by only showing you pre AOS stuff, nothing after that expansion for crafting.

Now additionally, you can remove the vita nex core script files out of the custom folder and delete the data files it makes, restart the shard and the crafting system is happy again with a fully functioning crafting system to the current expansion

Anyone have any idea on how to fix this?
 
Either debug through it from moment you boot with Visual Studio and a proper debugger or wait until Voxpire may have a chance to look at it.
 
I've actually never used visual studio, guess I will see what I can dig up. Hopefully Voxpire has time to check into this.
 
I went through all of the VNc code (including the up-coming 3.0 release) to see what would possibly cause this to happen and I've turned up nothing.

VNc doesn't modify the Core Expansion and it doesn't do anything with CraftSystems beyond adding new ones.
I also checked to see whether any related NetState properties are modified by VNc, but there were none.
I checked the SuperGumps framework to see if it was possibly messing with the craft gump, it isn't.

I have a feeling that something has changed in ServUO, given that the expansion checks are done in NetState.SupportsExpansion(...)
Also worth noting that in the time VNc has been out there, this is the first time I've heard of this issue, which is another reason I believe it's ServUO related.

The searching was done with the help of Visual Studio and ReSharper, so nothing should have been overlooked.
The only things left to check are reflection-accessed properties.
If anyone can reproduce this and help me track down the issue, it would be extremely helpful.
 
I kinda doubted it was related to VNC as we use VNC directly in JustUO and it inherited its crafting system from ServUO. This would have to be either a recent change to ServUO or something related to the packet changes in TOL. JustUO also has TOL support and I'm not seeing the issue there either. Unless there is some packet hooking in VNC, I really doubt it is the culprit.

My thought is it could be related to this post, which seems to be a very intermittent issue:
https://www.servuo.com/threads/7-0-47-0-patch-craft-issue.3592/#post-23098

By the way, really looking forward to VNC 3!!!
 
In regards to that post, when I initially found that I saw that I also used knives chat, which is also what prompted me to do a fresh installation of everything, fresh UO client updated as well as an untouched downloaded copy of servuo. Then I put one script in after another and recompiled, turned out knives chat had no negative effects on servuo that I could identify. I also tried it again last night using Visual Studio and didn't find anything weird.

Yeah VNC3 has me on the edge of my seat, can't wait to see the improvements.
 
I'm not a developer but I know enough to get around, if there is any additional info you guys need from me, please let me know.
 
I figured a temporary work around, which isn't to terrible, I just modified the file ' DefBlacksmithy.cs ' and commented out all the references to core checks and manually enabled the crafting options enhance and alter. My whole system is manually merged anyways so it isn't a huge issue for me (never a fan of drag and dropping). I tried posting the code for the defblacksmithy.cs however my browser doesn't like it, probably just to big, if you want it though PM me and I will send it to you that way.
 
Joshua, were you getting this same warning at world loading? I only got it the first time I ran the server after compile and until I saved. Just curios if you got the same?

World: Loading...[Persistence]: System.IO.EndOfStreamException: Unable to read b
eyond the end of the stream.
at System.IO.BinaryReader.FillBuffer(Int32 numBytes)
at System.IO.BinaryReader.ReadInt32()
at Server.Engines.Craft.CraftContext.<OnLoad>b__5(GenericReader reader)
at Server.Persistence.Deserialize(FileInfo file, Action`1 deserializer, Boole
an ensure) in k:\Projects\ServUO\Server\Persistence\Persistence.cs:line 95
[Persistence]: System.IO.EndOfStreamException: Unable to read beyond the end of
the stream.
at System.IO.BinaryReader.FillBuffer(Int32 numBytes)
at System.IO.BinaryReader.ReadInt32()
at Server.Items.DisguisePersistence.<OnLoad>b__2(GenericReader reader)
at Server.Persistence.Deserialize(FileInfo file, Action`1 deserializer, Boole
an ensure) in k:\Projects\ServUO\Server\Persistence\Persistence.cs:line 95
 
Can't be Vita-Nex. I used a fresh install of JustUO and the exact same copy of Vita-Nex and the issue is not there, so has to be a fairly recent change to ServUO.
 
yeah, it seems like something in ServUO caused this. If only there were monthly builds to reference.. lol. Unfortunately I was not able to get the same error you reported. I deleted all the save files for ServUO and Vitanex, and it compiled just fine without the above error.
 
I'm slowing walking thru, reverting as I go, will keep you posted.

I'm thinking its something with the TOL packets.
 
Ok, I'm not going any further tonight. But I can tell you that I reverted back to October 4th, 2015 before the changes to the crafting system were made by Dexter and that solved the problem. It must be something related to the new Persistance that was added into the CraftContext at that time that is conflicting with something in VNC. I'm too tired to dig further but hopefully this will help @Voxpire see what may be conflicting.
 
Wow, that is time for sure. When you get a moment tomorrow, if you could please hot link a zip file to the build from Oct 4th
 
You should use git, in which case you can rollback to any previous commit that you want, but I'm gonna assume that you don't.

Here is the one I used from Oct. 4 with VNC already added.

You might wanna wait tho, I would bet that Voxpire will find the conflict pretty quick, he is 100 times better at this than me :)

There was probably a good reason for the changes to CraftContext and I'm sure its just a matter of a small adjustment to VNC.
 

Attachments

  • ServUO.zip
    23.4 MB · Views: 4
You should use git, in which case you can rollback to any previous commit that you want, but I'm gonna assume that you don't.

Here is the one I used from Oct. 4 with VNC already added.

You might wanna wait tho, I would bet that Voxpire will find the conflict pretty quick, he is 100 times better at this than me :)

There was probably a good reason for the changes to CraftContext and I'm sure its just a matter of a small adjustment to VNC.

Oh I know he is amazing,I wanted to play with that build to see if i can learn myself :) To be honest, I've always been a little intimidated by git, though I will for sure try to get used to it.
 
I have spent quite a bit of time looking into this today. I have figured out what the problem is and how to solve it

Particularly the problem is here, in Attributes.cs:
Code:
	public class CallPriorityComparer : IComparer<MethodInfo>
	{
		public int Compare(MethodInfo x, MethodInfo y)
		{
			if (x == null && y == null)
			{
				return 0;
			}

			if (x == null)
			{
				return 1;
			}

			if (y == null)
			{
				return -1;
			}

			return GetPriority(x) - GetPriority(y);
		}

This code is being called by ScriptCompiler to determine in which order Configuration methods should be called (and this is awesome, because I never even knew you could do that).

Because the call priority of CurrentExpansion is Int32.MinValue, this means we can't subtract anything from it, or else it will become positive again. This causes things to start jumbling in the sort algorithm because we start getting instructions like "-2147483648 is bigger than 10, but smaller than 0, and 10 is bigger than 0", which are conflicting statements (and nonsense of course).

These kind of issues would have started appearing around October 2015 when there was an update to CraftContext which required CraftSystems to be configured prior to the world loading. It really has nothing to do with VNC, or Knives Chat, this could have happened randomly whenever a new script was added to ServUO that had a Configure() method. They are just the custom scripts which exposed the issue by causing the call priority comparer to fail.

The fix is a very small change which I wrote below which eliminates any arithmetic from the equation. This is in Attributes.cs in the core (so must be recompiled after making the change).
Code:
	public class CallPriorityComparer : IComparer<MethodInfo>
	{
		public int Compare(MethodInfo x, MethodInfo y)
		{
			if (x == null && y == null)
			{
				return 0;
			}

			if (x == null)
			{
				return 1;
			}

			if (y == null)
			{
				return -1;
			}

			var xPriority = GetPriority(x);
			var yPriority = GetPriority(y);
			
			if( xPriority > yPriority )
				return 1;
			
			if( xPriority < yPriority )
				return -1;

			return 0;
		}

I have tested it and it works, but don't have anything set up to commit this to the ServUO repo. I'd think this is high priority!
 
Last edited:
I reverted my work around, made the changed in the core per your suggestion and compiled the core. Tested good, crafting system is working again with all custom scripts including the initial reported one Vita Nex Core. Good Eye Jack :)
 
I have submitted PR #316 for this patch. I'll have to wait until I get home to test it before I merge. I know you all have tested this change, our working agreement is that we only merge changes that we have personally tested.
 
Thanks for looking in to this and resolving it everyone! Just goes to show what this community can do :D

I will include the fix in the stock RunUO repository in the next update too.
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back