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!

[RUO 1.0 FINAL] Region Tracker

Vorspire

Knight
[RUO 1.0 FINAL] Region Tracker

RunUO Versions: 1.0 Final

COMPATIBLE WITH RUNUO 1.0 VERSIONS ONLY

--------------------

Updates
{
  • 26th May, 2008
    {
    • Instead of saving with "(Rects)", the Tracker now MD5-Hashes the '(Rects)' string.
    }
  • 25th May, 2008
    {
    • Option to Save/Load Housing regions - This will benefit those using Town House systems.
    • No-Named regions now save as their UId ( "(UId)(Rects).bin" ).
    }
}

--------------------

I have noticed, that with Regions in RunUO 1.0, they are very hard to work with, since they are individually re-registered at run-time, losing all settings and reverting back to their base settings... How annoying!

So I came up with this simple solution...

//////////////////////////////////////////////////////////////////////////
/////
///// License: GNU/GPL
///// Free to edit and distribute as you see fit.
///// All credit notes to remain intact.
/////
///// Region Tracker By Vorspire
/////
///// Email: [email protected]
/////
///// Created: 25th May, 2008 :: 16:06
/////
///// Updated: 26th May, 2008 :: 19:07
/////
///// For: Rhovanion-PK :: Rhovanion-PK - Ultima Online Free-Shard - RunUO
/////
///// Description:
/////
///// This script will automaticlly serialize/deserialize
///// EVERY region on your server with it's own unique binary file.
///// It utilizes the basic overridable Serialize/Deserialize methods
///// located in the core Region class.
/////
///// With this, you can add custom properties as you would with any item,
///// override Serialize/Deserialize as you would with any item,
///// containing your custom variables to save/load.
/////
///// The save-file format is consistent, meaning the region saved will
///// ALWAYS be the region loaded, and vice-versa. Regions binary files are
///// saved in Saves/Regions/Tracker/(Name)(MD5Rects)*.bin --> Where '(<Name>)'
///// is the Region's Name and '(MD5Rects)*' are the exact region Rects,
///// formatted with MD5-Hash - To prevent long path errors.
///// -(Done for consistency)
/////
///// Regions without names still get saved and loaded, and are assigned
///// a special file name "(0)(MD5Rects).bin" -> Where '(0)' is the UId and
///// '(MD5Rects)' are the region co-ordinates in MD5-Hash Format.
///// -(Done for consistency)
/////
///// There is now an option to Load/Save House Regions!
/////
///// This system applies to ALL Sub-Classes of "Region", so it will even
///// Save and Load your regions created with Custom Regions In A Box!
/////
///// The script has been supplied as-is, with a simple
///// configuration. All configuration options have been annotated
///// to help the user understand better as to what each part of
///// the script does.
/////
///// Known Bugs:
/////
///// None.
/////
///// Note From The Creator:
/////
///// I hope you enjoy using, editing and reading this script
///// as much as I did writing and testing it :)
/////
///// Please leave this credit note intact!
/////
///// Best regards,
///// Vorspire :)
/////
//////////////////////////////////////////////////////////////////////////
 

Attachments

  • RegionTracker.cs
    7.9 KB · Views: 51

Mideon

Page
Really cool idea, I played around with something like this once...I was attempting to save a list of regions so that I could call them back up later...one question though have you tried this with Knives Townhouse system? I know I was going off of the region serial numbers before and was disappointed to see that knives townhouse regions actually register prior to other regions. So this threw off the serial values as for example region # 1 would no longer be region #1 if I created a new house region....

Something to look at, it may not affect you in any way but I know I was confused for a good long time as to what was going on and figured I'd at least share just in case it affects this too. Great job and great submission, cheers!
 

Vorspire

Knight
I think it was your problem that inspired this for me, but i realised i had to do this when i added a couple of new region interfaces...


Region Discovery:
Whenever a player walks into a region that they haven't been to before, they are awarded some XP based on the region's DiscoveryXP property, if the region is Dicoverable.

Boat Control:
I added another interface, IBoatControl which gives options to disallow placement of Boats in any given region using the interface.

Element Control:
IElementControl adds the functionality to any given region enabling that region to have a special item (Element Control) placed and assigned to that region, which does AOS.Damage over a few options, OnEnter, OnExit and OnTimer (Damage Over Time Options) - It also allows the user to select what types of mobs is can damage.

So for the 3 systems i've implimented, listed above, i have to serialize/deserialize every region's properties for:

(bool)Discoverable
(int)DiscoveryXP
(bool)AllowBoatPlacing
(ElementalControl)ElementalControl //base.Item


etc etc.. that is where this script comes in and accesses all regions' Serialize/Deserialize methods, enabling me to define Ser/Deser in individual region scripts.

I have had to make the new Interfaces apply to:

Guardedregion.cs
Felucca/Dungeon.cs
Malas/Dungeon.cs
Ilshenar/Dungeon.cs
Trammel/Dungeon.cs

(I have written about this in detail, as it may spark inspiration in someone who is willing to use this system or the systems described - i will not be releasing these systems though, but we will see in future...)
 

Vorspire

Knight
I would like to add that, in light of UId's being inconsistant.. I have decided to have the save files use a special name format:
Code:
(Region Name)(Rects)*.bin

(Region Name) is the region Name (duh :p)
(Rects) is the arraylist "Coords", which is unique for each region (unless you have 2 regions covering the same region)
 
Top