RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

World Spy - World file editor

Arya

Wanderer
World Spy - World file editor

Summary:
World Spy allows to view, navigate and edit the RunUO world file. Supports mobiles, items, accounts and guilds and allows the user to edit any of these objects' properties.

Description:
This script is actually somewhere in between a script and a standalone program. While it is started by running RunUO, it creates a classical windows program rather than adding functionality to the server.

Once you install the script, you can start RunUO using a -WorldSpy switch ( in other words "Server.exe -WorldSpy" ). When this switch is used, the WorldSpy script will be run and will lock down the server to prevent players from logging in. Then it will run the actual program window.

The current version (1.0 Beta) can view items, mobiles, accounts and guilds and can perform various searches for types, accounts, guilds or item/mobile/player names. Once you find an object you wish to edit, you can select it and all its properties will be displayed in a property browser. You can then edit any properties that allow editing.

Once an object is selected, you can also view a hierarchical representation of its relationships. For example, if you choose a PlayerMobile you will see a tree node with the player's name, and under this node you will see all the items the player is carrying, its bankbox, the guild, account and so on. You can then open the bankbox node to see the items inside the player's bank.

You can delete any object from the world (even accounts, players and guilds, so be careful and always backup your worldfile!). Deleting can be done by either using the small Delete button (which deletes the object currently selected and displayed in the properties viewer) or the wider 'Delete selected items" button which deletes all the objects selected in the list view in the lower portion of the screen.

The current release should be considered a beta because it hasn't been tested much. ALWAYS BACKUP YOUR WORLD FILE BEFORE USING WORLD SPY! Please don't come crying to me if you delete something you didn't want to, I warned you to backup!

Please report any bugs and suggestions either in this thread, or at http://arya.runuo.com/

Installation:
1. Copy the following files anywhere inside your RunUO\Scripts folder:

WorldSpy.cs
WorldSpyForm.cs

2. Browse to ..\RunUO\Data and open the file Assemblies.cfg in notepad. Add the following lines at the end:

System.Windows.Forms.dll
System.Drawing.dll

* There's a small chance you already might have those entries in Assemblies.cfg. If so, ignore this step.

3. Run RunUO from the command line using the following syntax:

Server.exe -WorldSpy

Updates

Version 1.0 Beta Revision 1 (March 16, 2004)
- Fixed a potential crash for items whose Map property is set to null
- Added a check for changes when closing the program using the windows X icon.
Version 1.0 Beta Revision 2 (April 9, 2004)
- Compatibility update for RunUO 1.0 RC0. Get WorlsSpyRC0.zip for RunUO 1.0, use WorldSpy.zip for Beta 36.
 

Attachments

  • WorldSpyRC0.zip
    10.8 KB · Views: 1,232

tejster24

Sorceror
When I run RunUO with the -WorldSpy switch, I get: (this is copied from a dialog box, and is all the error I recieve)
Code:
See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
   at TheBox.WorldSpy.WorldSpyForm.DisplayEntities(ArrayList list)
   at TheBox.WorldSpy.WorldSpyForm.WorldSpyForm_Load(Object sender, EventArgs e)
   at System.Windows.Forms.Form.OnLoad(EventArgs e)
   at System.Windows.Forms.Form.OnCreateControl()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ContainerControl.WndProc(Message& m)
   at System.Windows.Forms.Form.WmShowWindow(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 1.0.5000.0
    Win32 Version: 1.1.4322.573
    CodeBase: file:///d:/winnt/microsoft.net/framework/v1.1.4322/mscorlib.dll
----------------------------------------
Server
    Assembly Version: 1.0.1425.4527
    Win32 Version: 1.0.1425.4527
    CodeBase: file:///D:/Program%20Files/RunUO/Server.exe
----------------------------------------
System
    Assembly Version: 1.0.5000.0
    Win32 Version: 1.1.4322.573
    CodeBase: file:///d:/winnt/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.dll
----------------------------------------
Scripts.CS
    Assembly Version: 0.0.0.0
    Win32 Version: 0.0.0.0
    CodeBase: file:///D:/Program%20Files/RunUO/Scripts/Output/Scripts.CS.dll
----------------------------------------
System.Windows.Forms
    Assembly Version: 1.0.5000.0
    Win32 Version: 1.1.4322.573
    CodeBase: file:///d:/winnt/assembly/gac/system.windows.forms/1.0.5000.0__b77a5c561934e089/system.windows.forms.dll
----------------------------------------
TemplateIntefaces
    Assembly Version: 1.0.1163.26561
    Win32 Version: 1.0.1163.26561
    CodeBase: file:///D:/Program%20Files/RunUO/TemplateIntefaces.DLL
----------------------------------------
System.Xml
    Assembly Version: 1.0.5000.0
    Win32 Version: 1.1.4322.573
    CodeBase: file:///d:/winnt/assembly/gac/system.xml/1.0.5000.0__b77a5c561934e089/system.xml.dll
----------------------------------------
System.Runtime.Remoting
    Assembly Version: 1.0.5000.0
    Win32 Version: 1.1.4322.573
    CodeBase: file:///d:/winnt/assembly/gac/system.runtime.remoting/1.0.5000.0__b77a5c561934e089/system.runtime.remoting.dll
----------------------------------------
System.Drawing
    Assembly Version: 1.0.5000.0
    Win32 Version: 1.1.4322.573
    CodeBase: file:///d:/winnt/assembly/gac/system.drawing/1.0.5000.0__b03f5f7f11d50a3a/system.drawing.dll
----------------------------------------

************** JIT Debugging **************
To enable just in time (JIT) debugging, the config file for this
application or machine (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the machine
rather than being handled by this dialog.
If I click continue, the lists are empty.
 

Arya

Wanderer
Can you run it again using Serve.exe -debug -WorldSpy please? I can't understand what in DisplayEntities could cause a NullReference exception, and that will give you the exact line.
 

tejster24

Sorceror
Code:
************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
   at TheBox.WorldSpy.WorldSpyForm.DisplayEntities(ArrayList list) in d:\Program Files\RunUO\Scripts\Custom\WorldSpy\WorldSpyForm.cs:line 871
   at TheBox.WorldSpy.WorldSpyForm.WorldSpyForm_Load(Object sender, EventArgs e) in d:\Program Files\RunUO\Scripts\Custom\WorldSpy\WorldSpyForm.cs:line 604
   at System.Windows.Forms.Form.OnLoad(EventArgs e)
   at System.Windows.Forms.Form.OnCreateControl()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ContainerControl.WndProc(Message& m)
   at System.Windows.Forms.Form.WmShowWindow(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Hope that helps - I wish I'd known that when I was writing my AdminWindow script.

Code:
			foreach( IEntity entity in list )
			{
				string[] subItems = new string[ 5 ];

				subItems[ 0 ] = entity.Serial.ToString();
				subItems[ 1 ] = entity.GetType().Name;

				Item item = entity as Item;
				Mobile m = entity as Mobile;

				if ( item != null && !item.Deleted )
				{
					if ( item.Name != null )
					{
						subItems[ 2 ] = item.Name;
					}
					else
					{
						subItems[ 2 ] = item.ItemData.Name;
					}
				}
				else if ( m != null && !m.Deleted )
				{
					subItems[ 2 ] = m.Name;
				}

				subItems[ 3 ] = entity.Location.ToString();
				subItems[ 4 ] = entity.Map.Name; // line 871

				lstMaster.Items.Add( new ListViewItem( subItems ) );
			}
It seems the problem is in this section here.
Is it that some entities do not have a map assigned?
 

Phantom

Knight
Arya

Can you run Server.exe with the -debug line or is that a line to run your application in debug mode.

Its sad I am not familar csc addiational command :confused:

I have to say. Your the first person including myself that has had runuo launch a program that references it.

Wondering how you did it actually :)

I cannot for the life of me understand how you got the form to be able to read anything from runuo. Can you pm explaining the process, I have many things I could do if I understand, plus its interesting :)
 

Phantom

Knight
I am starting to understand what you did.

Strange the simplest code explains it.

Code:
World.Save( false );

;)

Clearly since RunUO launches the "form" and runuo is running, you access everything just as it was.

Ayra you just gave me a killer idea :)

You mind if I use "your method" for a program I am working on? Its much better then trying to use xml :rolleyes:
 

Arya

Wanderer
tejster24, the reason for this exception is a mobile or item on your server with the map value set to null which is something I didn't think was possible. Later on I'll post an update version, in the meantime you can workaround it at line 871:

Change:

subItems[ 4 ] = entity.Map.Name;

to:

if ( entity.Map != null )
{
subItems[ 4 ] = entity.Map.Name;
}
 

Arya

Wanderer
Phantom said:
I am starting to understand what you did.

Strange the simplest code explains it.

Code:
World.Save( false );

;)

Clearly since RunUO launches the "form" and runuo is running, you access everything just as it was.

Ayra you just gave me a killer idea :)

You mind if I use "your method" for a program I am working on? Its much better then trying to use xml :rolleyes:

Of course you can use the idea :) It's quite easy to display the form actually. The form class is written just like a normal application (except it misses a Main method), and the script that launches it just creates the form and shows it:

Code:
WorldSpyForm form = new WorldSpyForm();
form.ShowDialog();

I created the form within my scripting solution in VS, so as you noticed the form has access to all the static variables on the server. Keep in mind that using ShowDialog will prevent the server from actually running, which for my script is desirable but you might have different needs. My first version relied on the lockdown and used form.Show() which allows the server to run, but the form didn't fully load (it was created but any controls on it weren't). Maybe this could be addressed by running the form in a separate thread.

The downside of this method is that it can create the form only on the machine the server is running on, but then again is this desirable for my script.

If you still need any help with it let me know and I'll gladly try :)

PS: Don't you really know the -debug switch? It's the most useful switch ever, and I'm sure it's RunUO specific. It runs the server and compiles the scripts with debug symbols which means that crashlogs have line numbers (see above) and you also can attach a debugger and debug your scripts just like you would do with a classical program :) Priceless ;)
 

Phantom

Knight
Krrios talked about it oh 5 -6 months never said how :p

I am thinking about a spawn "system" that can use the default spawners but organize certain aspects. Spawners would have groups, would display the group, the monsters, location, map, ect.

You could export and import your spawners and submit the xml.

I was original going to try to read the xml to make the list. But this is much better :)

Locking the server would actually I believe be good for this process. Would be "spawner" program. Different to the Area Spawner orb plans, but still useful.

Would allow packages to be done, using the default, custom default spawners ( spawners with fixed creaure lists ).

You could of course convert custom spawners -> default spawners via a different export command.
 

Arya

Wanderer
That's a good idea, but if you do it like I did it can only be run on the machine hosting the server, while spawning is often delegated to gamemasters or seers. You could consider doing it through .NET remoting (using the same system UOArchitect is using).

You could also make it spawner indipendent, using a filter class that converts a shard's spawner into a format recognized by your program. This is what I'm doing for the next version of Pandora's Box: you create a spawn group in my own format, send it to the .NET remoting object that converts it to a spawner appropriate for the server (I'll be providing filters for the default spawner and the xmlspawner, but it's easy to write a custom one).

When it comes to Xml, it's very easy to use if your classes are Xml serializable and you don't have to write and read each node manually. It takes 4 lines of code to read or write an Xml file. Here are the generic methods I'm using:

Code:
public static object LoadXml( Type type, string filename )
{
	try
	{
		FileStream stream = new FileStream( filename, FileMode.Open, FileAccess.Read, FileShare.Read );
		XmlSerializer serializer = new XmlSerializer( type );
		object obj = serializer.Deserialize( stream );
		stream.Close();

		return obj;
	}
	catch
	{
		return null;
	}
}

public static bool SaveXml( object obj, string filename )
{
	try
	{
		FileStream stream = new FileStream( filename, FileMode.Create, FileAccess.Write, FileShare.Read );
		XmlSerializer serializer = new XmlSerializer( obj.GetType() );
		serializer.Serialize( stream, obj );
		stream.Close();

		return true;
	}
	catch
	{
		return false;
	}
}

That will serialize all public variables and properties of an object, you can see an example of a file produced by these methods by looking at the Pandora's Box options.

Also if you only deal with spawners you won't probably need to lockdown, you can add code to check if a spawn is used by testing if any players are fighting the spawn creatures.

Well I'm just throwing ideas ;) Good luck with your project! :)
 

Ceday

Page
Well, i am using a windows form just like this to edit account information. Just a reminder for people who want to use this, if you are using some custom scripts (Cats Jail as an example, i guess most people use this one), you will have problem unless you do the necessasy changes for the those scripts as well..

i havent looked the script but overall it sounds very nice :)
 

Arya

Wanderer
Ceday said:
Well, i am using a windows form just like this to edit account information. Just a reminder for people who want to use this, if you are using some custom scripts (Cats Jail as an example, i guess most people use this one), you will have problem unless you do the necessasy changes for the those scripts as well..

i havent looked the script but overall it sounds very nice :)

I have tried using world spy with Cat's jail system and had no trouble. The jail system handles the WorldSave event and performs its own save whenever the world is saved. I have tried jailing a character, saving, restarting and deleting the character using world spy, and after restarting the jail system was behaving correctly (the account was jailed).

If you know of specific issues that can occur, can you let me know so I can try and address them in my code? Thanks! :)
 

Dracarys

Wanderer
Although my knowledge isn't enough to fully understand this script, I can tell it's great :)

I have only used it for deleting a few items i couldn't get to with the client so far but it works without any flaws.

Thank you very much!
 

Phantom

Knight
Well

The tool I want to make is sort of an "Admin" tool. Would be used to load up a donated xml spawner file. Then the admin could change the spawner(s).

I would have to look into how to doing something like UOArchitect if I wanted to make the remote version of the tool.

I am not sure what I want to do :) Outkast wants to do a similar program, I might work with him perhaps we can make something really good that way.

I hate making a program that is already done in another program. Problem with map making today, so many programs that never get updated. Orb is solving that though with their tools.

Either tool I speak of would be different then Area Spawner program, that they are working on.

I am not sure :p
 

Kamron

Knight
I havent tested the power of this program yet, although I was wondering if -
1) would it be possible to add batch commands that you could do on items/mobiles
2) would it be possible to change the derived class that an object comes from? In essence changing the parent class Item to BaseItem (and using batch commands to do it to every item)?
 

Arya

Wanderer
XxSP1DERxX said:
I havent tested the power of this program yet, although I was wondering if -
1) would it be possible to add batch commands that you could do on items/mobiles
2) would it be possible to change the derived class that an object comes from? In essence changing the parent class Item to BaseItem (and using batch commands to do it to every item)?

1. Yes I plan on doing that. Probably first write a better searching, and then allow the possibility to mass change a property on the results (or perhaps add items on mobiles or to their backpack/bank).

2. This is somewhat complicated, and really out of scope for world spy. Changing the parent class must be done in the script, so say you have a MyItem derived from Item. You would need to create a second class MyItem2 derived from BaseItem and then perform the conversion from MyItem to MyItem2 ad hoc, specifying which properties are converted and how. As far as I know there's no way to change the base type of a class dynamically. Or maybe I didn't fully understand what you want to do :)
 

k0t

Wanderer
Great work! :D
But would it be possible to sort the list of items/mobs? So I can easily remove items/mobs from a facet for example or of a certain type.
 
Top