Go Back   RunUO - Ultima Online Emulation > RunUO > RunUO Post Archive

RunUO Post Archive The Archvie

Reply
 
Thread Tools Display Modes
Old 03-15-2004, 06:35 PM   #1 (permalink)
 
Join Date: Mar 2003
Location: Near a lava pool
Age: 8
Posts: 1,012
Default 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.
Attached Files
File Type: zip WorldSpyRC0.zip (10.8 KB, 1195 views)
__________________
Oxygen should be regarded as a drug.
Arya is offline   Reply With Quote
Old 03-15-2004, 06:46 PM   #2 (permalink)
Connection Reset by Peer
 
Join Date: Jan 2003
Posts: 676
Default

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.
tejster24 is offline   Reply With Quote
Old 03-15-2004, 06:52 PM   #3 (permalink)
 
Join Date: Mar 2003
Location: Near a lava pool
Age: 8
Posts: 1,012
Default

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.
Arya is offline   Reply With Quote
Old 03-15-2004, 07:45 PM   #4 (permalink)
Connection Reset by Peer
 
Join Date: Jan 2003
Posts: 676
Default

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?
tejster24 is offline   Reply With Quote
Old 03-15-2004, 09:04 PM   #5 (permalink)
Account Terminated
 
Join Date: Sep 2002
Age: 26
Posts: 3,846
Send a message via ICQ to Phantom Send a message via AIM to Phantom Send a message via MSN to Phantom
Default

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

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 is offline   Reply With Quote
Old 03-15-2004, 09:32 PM   #6 (permalink)
Account Terminated
 
Join Date: Sep 2002
Age: 26
Posts: 3,846
Send a message via ICQ to Phantom Send a message via AIM to Phantom Send a message via MSN to Phantom
Default

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
Phantom is offline   Reply With Quote
Old 03-15-2004, 11:32 PM   #7 (permalink)
 
Join Date: Mar 2003
Location: Near a lava pool
Age: 8
Posts: 1,012
Default

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;
}
__________________
Oxygen should be regarded as a drug.
Arya is offline   Reply With Quote
Old 03-15-2004, 11:44 PM   #8 (permalink)
 
Join Date: Mar 2003
Location: Near a lava pool
Age: 8
Posts: 1,012
Default

Quote:
Originally Posted by Phantom
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
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
__________________
Oxygen should be regarded as a drug.
Arya is offline   Reply With Quote
Old 03-15-2004, 11:55 PM   #9 (permalink)
Account Terminated
 
Join Date: Sep 2002
Age: 26
Posts: 3,846
Send a message via ICQ to Phantom Send a message via AIM to Phantom Send a message via MSN to Phantom
Default

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

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.
Phantom is offline   Reply With Quote
Old 03-16-2004, 04:27 AM   #10 (permalink)
 
Join Date: Mar 2003
Location: Near a lava pool
Age: 8
Posts: 1,012
Default

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!
__________________
Oxygen should be regarded as a drug.
Arya is offline   Reply With Quote
Old 03-16-2004, 04:40 AM   #11 (permalink)
 
Join Date: Nov 2002
Posts: 636
Default

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 :)
Ceday is offline   Reply With Quote
Old 03-16-2004, 04:56 AM   #12 (permalink)
 
Join Date: Mar 2003
Location: Near a lava pool
Age: 8
Posts: 1,012
Default

Quote:
Originally Posted by Ceday
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!
__________________
Oxygen should be regarded as a drug.
Arya is offline   Reply With Quote
Old 03-16-2004, 09:02 AM   #13 (permalink)
Forum Expert
 
Join Date: Jan 2004
Posts: 1,377
Default

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!
__________________
Dracarys
retired - consider me dead to these boards
Dracarys is offline   Reply With Quote
Old 03-16-2004, 04:58 PM   #14 (permalink)
Account Terminated
 
Join Date: Sep 2002
Age: 26
Posts: 3,846
Send a message via ICQ to Phantom Send a message via AIM to Phantom Send a message via MSN to Phantom
Default

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
Phantom is offline   Reply With Quote
Old 03-17-2004, 01:56 PM   #15 (permalink)
bow before me.. or perish
 
Daegon's Avatar
 
Join Date: Dec 2003
Location: WI
Age: 24
Posts: 271
Send a message via ICQ to Daegon Send a message via AIM to Daegon Send a message via MSN to Daegon
Default

I am very impressed, Arya. I love it! Loaded my test world file fine. Very nice.
__________________
http://www.dominusexuro.com/
Daegon is offline   Reply With Quote
Old 03-17-2004, 07:09 PM   #16 (permalink)
 
Join Date: Oct 2002
Age: 23
Posts: 4,689
Default

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)?
XxSP1DERxX is offline   Reply With Quote
Old 03-18-2004, 07:37 AM   #17 (permalink)
 
Join Date: Mar 2003
Location: Near a lava pool
Age: 8
Posts: 1,012
Default

Quote:
Originally Posted by XxSP1DERxX
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
__________________
Oxygen should be regarded as a drug.
Arya is offline   Reply With Quote
Old 03-20-2004, 06:19 AM   #18 (permalink)
k0t
Forum Novice
 
Join Date: Jun 2003
Location: Berlin, Germany
Age: 23
Posts: 212
Send a message via ICQ to k0t Send a message via AIM to k0t Send a message via MSN to k0t
Default

Great work!
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.
k0t is offline   Reply With Quote
Old 03-20-2004, 08:06 AM   #19 (permalink)
 
Join Date: Feb 2004
Location: U.K
Age: 18
Posts: 5
Send a message via MSN to 02moorem
Question



i dont understand wat the program dose

dose it to map editing or ... ?????..
02moorem is offline   Reply With Quote
Old 03-20-2004, 09:36 AM   #20 (permalink)
 
Join Date: Feb 2004
Location: U.K
Age: 18
Posts: 5
Send a message via MSN to 02moorem
Default

undefined
WAT IS A COMMAND LINE AND HOW DO I MAKE ON ????[COLOR=Blue]undefined[/color]
02moorem is offline   Reply With Quote
Old 03-20-2004, 10:20 AM   #21 (permalink)
Account Terminated
 
Join Date: Sep 2002
Age: 26
Posts: 3,846
Send a message via ICQ to Phantom Send a message via AIM to Phantom Send a message via MSN to Phantom
Default

Guys lose the god damn color words, its so anyoing.

This program allows you to edit the world and delete/edit items in the world.

Read the first post and follow the directions.

If you want help you will have to explain your question in more detail and do not use color, if you do, I won't help you.
Phantom is offline   Reply With Quote
Old 03-21-2004, 08:34 AM   #22 (permalink)
 
Join Date: Mar 2003
Location: Near a lava pool
Age: 8
Posts: 1,012
Default

Quote:
Originally Posted by k0t
Great work!
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.
Yes, I'll add that as well. Still not sure when though as I'm out of town for a few days.

If you can't understand what the script does from the description, you probably shouldn't use it or you just risk loosking your shard.
__________________
Oxygen should be regarded as a drug.
Arya is offline   Reply With Quote
Old 03-21-2004, 01:01 PM   #23 (permalink)
k0t
Forum Novice
 
Join Date: Jun 2003
Location: Berlin, Germany
Age: 23
Posts: 212
Send a message via ICQ to k0t Send a message via AIM to k0t Send a message via MSN to k0t
Default

Thanks Arya!
k0t is offline   Reply With Quote
Old 03-22-2004, 06:59 PM   #24 (permalink)
 
Join Date: Oct 2002
Age: 23
Posts: 4,689
Default

Arya, I meant this.. You have lets say BaseArmor which derives from Item. If you change it IN SCRIPT to BaseArmor derives from BaseItem which derives from Item. Would it be possible, to prevent RunUO from loading the world (so you dont ruin the world trying to load it) with your script, and actually change the derivation of all items which use BaseArmor.

So instead of like PlateHelm -> BaseArmor -> Item
you change it (in the world) to PlateHelm -> BaseArmor -> BaseItem -> Item
granted these changes were already made in the code?

Also, I do know that if BaseItem was a blank class, you could do that, but that does not help 90% of the people, becuase you cannot change it without corrupting the world regardless.

If this is definately outside of the scope of your script, then I apologize, it was just a false hope then
XxSP1DERxX is offline   Reply With Quote
Old 03-23-2004, 03:18 AM   #25 (permalink)
 
Join Date: Mar 2003
Location: Near a lava pool
Age: 8
Posts: 1,012
Default

Well World Spy doesn't load the world file itself, it uses World.Items, World.Mobi