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!

[RunUO 2.0] House Door Keys (Old Style Housing Rules)

Nockar

Sorceror
[RunUO 2.0] House Door Keys (Old Style Housing Rules)

[RunUO 2.0] House Door Keys (Old Style Housing Rules)

Credits:
Grodon for starting the post!
Tresdni for the ideas to get started!
Serenadethis for his 2004 post with the key code!! HAHAH


Description: Every wish you could have the old style housing rules and still keep your expansion’s & custom housing? Ever wish you could steal someone’s key and break into their house? Or just sneak into it?

This code will revert back to the old style of houses with out having to set your expansion to none! This way you can keep using all the normal stuff that you are using now and have a mostly old style housing system/rules.

What got changed:

Private: Previously while the house was private you could not ban players
- You can now Ban anyone
- The Ban buttons show up in the Gump

Private Non-friends: Previously while the house was private, a unfriended player & monsters could not enter your house. There was a magic box around it.
- Non-friends can walk into house
- Non-friends will turn gray (criminal) when in house
- Monster can walk into house

Door Key: Previsously, for both public and private, the outside door was done with security levels.
- Door security gump from right-clicking the door is now gone.
- When you make the house or transfer it, a key gets made and put in your pack or bank
- If you change house to public key stays or go away depending on what code you use
- The key is used to unlock and re-lock the front door(s)!
- The key can be stole


What does this all mean? It means just like in old times you can sneak into someone’s house or steal their key(s) and break in.


Note:
- This works fine with old housing and the new custom housing!
- This still may not work perfectly the way you want it it. But I didn’t find any bugs or problems when I tested it.
- I didn’t change anything to make items not decay inside houses. May do that later.
- HouseTeleporter will probably need to get the key code added to it. But I didn’t even know there were such things as HouseTeleporters. lol
- I have not figured out how to generate new keys. Like re-keying the doors.


How to Install:
I did not include any already edited files because there are different version of house files out there. In order to get this to work you have to go in and make a bunch of edits to a number of files. In order to do this you need to open up the attached txt file with the changes and go in and manually compare them to your current CS files then make the appropriate changes.

BaseHouse.cs
HouseDoors.cs
HouseTeleporter.cs
HouseRegion.cs
HouseGumpAOS.cs

An example of how to do this...
You will be editing BaseHouse.cs & the new code is between the //House Door Key Mod. I will make it bold so you can see it. So for this one you will be adding that bit of code to your BaseHouse.cs file.

From House Door Keys.txt
Code:
\Scripts\Multis\BaseHouse.cs
--------------------------------------------------------
	public abstract class BaseHouse : BaseMulti
	{
		public static bool NewVendorSystem{ get{ return Core.AOS; } } // Is new player vendor system enabled?
//House Door Key Mod
		[B]public uint m_keyvalue = Key.RandomValue();[/B]
//House Door Key Mod
		public const int MaxCoOwners = 15;
		public static int MaxFriends { get { return !Core.AOS ? 50 : 140; } }
		public static int MaxBans { get { return !Core.AOS ? 50 : 140; } }
--------------------------------------------------------

UPDATE:
[12/1/2010] Added new “House Door Keys.txt” with the couple of change from below.
 

Attachments

  • House Door Keys.txt
    17.1 KB · Views: 146

Tresdni

Squire
- I have not figured out how to generate new keys. Like re-keying the doors.

Take a look at the method used for the pre-aos house gump. It has to be added to the aos style house gump. Both are in the Gumps folder. Just a hint :)

*I'm at work atm, if you haven't figured out by then, I will post the code needed as soon as I get a chance.
 

Tresdni

Squire
*Takes a deep breathe*
Okay, I've finally gotten a little time off. I haven't got the time to fully test this yet, but I know it compiles.

You will have to just tweak the gump position, I haven't got to mess with it yet!

Okay first off, open Scripts\Gumps\HouseGumpAOS.cs.

Around line 349, you'll see this.

Code:
AddButtonLabeled( 210, 150, GetButtonID( 3, 13 ), 1060694, isOwner ); // Change to Public

Add this UNDER it.

Code:
AddButtonLabeled( [B]210, 155[/B], GetButtonID( 3, 14 ), 1011247, isOwner ); // Change the house locks

*That is the bit of code you will need to modify the first two numbers in bold to position it correctly.*

Then around line 1082, you will see case 13: , you are going to add this entire case under it. Please be sure to be careful doing this.

Code:
case 14: //Change the house locks edit
						{
							if ( m_House.Public )
							{
								from.SendLocalizedMessage( 501669 );// Public houses are always unlocked.
							}
							else
							{
								if ( isOwner )
								{
									m_House.RemoveKeys( from );
									m_House.ChangeLocks( from );

									from.SendLocalizedMessage( 501306 ); // The locks on your front door have been changed, and new master keys have been placed in your bank and your backpack.
								}
								else
								{
									from.SendLocalizedMessage( 501303 ); // Only the house owner may change the house locks.
								}
							}

							break;
						}

This should allow you to change house locks on an AOS style house gump, ONLY when the house is private already (public houses can't be locked). The button will appear when you click Security.
On a side note, I really appreciate you posting these edits, I get tired of having to do it every single time off the top of my head :) If you get the edit I posted with the gumps positioned right, please post the correct positioning for me. Thanks again!
 

Tresdni

Squire
Sorry for the extra post, but I just caught this.

- I didn’t change anything to make items not decay inside houses. May do that later.

Inside of Scripts/Regions/HouseRegion.cs...

Code:
public override bool OnDecay( Item item )
		{
			if ( (m_House.IsLockedDown( item ) || m_House.IsSecure( item )) && m_House.IsInside( item ) )
				return false;
			else
				return false; [B] //was return base.OnDecay(item );[/B]
		}

No more item decay inside of your home.
 

Nockar

Sorceror
Thanks for the info. I just had a chance to try it out.

Item Decay: If some one is killed in a house will the corps not decay? Or killing a mob in the house?
Edit: Corpses and mobs do decay & other stuff does not. So its working fine

Change Locks: If the keys are in your pack they get removed and a new key shows up. If you have a stolen key (or a key some where else) it stays and does not get removed. However, either way, KeyValue remains the same so it does not seem to work.

Any idea how to get the KeyValue to change? That way if a key does get stolen you house can’t be broken into indefinitely. Or is that the way it’s supposed to work?
 

Pure Insanity

Sorceror
Perhaps setup some new type of tool you can sell on a vendor. Allow you to "rekey" doors, so it can have a new value and you can create a new key.

Doing all of these edits still allows someone to set security on a telepad or chest, right?
 

Nockar

Sorceror
James420;868028 said:
Perhaps setup some new type of tool you can sell on a vendor. Allow you to "rekey" doors, so it can have a new value and you can create a new key.

Doing all of these edits still allows someone to set security on a telepad or chest, right?

Ya, all the rules for chests & telepad etc are unchanged. All the house rules in general are unchanged except the ones listed above.

Well, there is optional code in there to get rid of the right-click thing on the telepad. But you don’t have to do it.
 

grodon

Wanderer
Great Job! Just finished applying all of these housing changes, love it.

As for the re-keying bit... How about this, when you click "new keys" or whatever it was/is, the script removes your current DOOR, and your keys attached to the door, and it generates a new door and keys.

Im assuming the split second that your front door is off, is not enough time for anyone to possibly get inside your house. Although, if the server were to crash at the exact time your door is removed, but not replaced...that could be bad.
 

Tresdni

Squire
That's actually the same method that the pre-aos gump does it. I just copied it from that gump, and made a new gump entry for it on the aos-style gump.

That way if a key does get stolen you house can’t be broken into indefinitely. Or is that the way it’s supposed to work?

The keys are newbied, they can't be stolen.
 

Nockar

Sorceror
Tresdni;868260 said:
That's actually the same method that the pre-aos gump does it. I just copied it from that gump, and made a new gump entry for it on the aos-style gump.

The keys are newbied, they can't be stolen.

Is the default that keys can not be stolen? If they could not be stolen then that would explain why creating a new key does not actually re-key the door.

Do you know of a way to make it so the keys actually get a new KeyVaule?
 

jokik

Sorceror
someone release some files with these edits, this is a mick take trying to winmerge them :) nice release though
 

Tresdni

Squire
Do you know of a way to make it so the keys actually get a new KeyVaule?

Shouldn't be too hard, would have to use the same method it uses when the keys are created in the first place. I don't quite have the urge in me to do so, because I like the old style myself :)
 

Tresdni

Squire
Just curious if you had a chance to check the gump positioning? Or was it right? I've been working 7 days a week - haven't really had the time to test it yet.
 

Nockar

Sorceror
Tresdni;868372 said:
Just curious if you had a chance to check the gump positioning? Or was it right? I've been working 7 days a week - haven't really had the time to test it yet.

The gump posotion is off a bit. I changeed it and checked it and updated the files up top. ;o)
thanks for the cod!
 

Ele7Ven

Sorceror
Hello I installed the system, fixed a couple of errors but I keep getting more...
Also I checked in my un edited backup of basehouse.cs and the lines are exactly the same so I only get the error after installing this system...
Error Log:
BaseHouse.cs Error Lines:
Code:
RunUO - [www.runuo.com] Version 2.0, Build 2959.20979
Core: Running on .NET Framework Version 2.0.50727
Scripts: Compiling C# scripts...failed (1 errors, 0 warnings)
Errors:
 + Multis/BaseHouse.cs:
    CS1519: Line 2919: Invalid token '(' in class, struct, or interface member d
eclaration
    CS1519: Line 2919: Invalid token ',' in class, struct, or interface member d
eclaration
    CS1519: Line 2919: Invalid token ')' in class, struct, or interface member d
eclaration
    CS1519: Line 2921: Invalid token '==' in class, struct, or interface member
declaration
    CS0270: Line 2922: Array size cannot be specified in a variable declaration
(try initializing with a 'new' expression)
    CS1519: Line 2922: Invalid token '=' in class, struct, or interface member d
eclaration
    CS1519: Line 2922: Invalid token '=' in class, struct, or interface member d
eclaration
    CS1519: Line 2922: Invalid token '(' in class, struct, or interface member d
eclaration
    CS1519: Line 2924: Invalid token '(' in class, struct, or interface member d
eclaration
    CS0116: Line 2927: A namespace does not directly contain members such as fie
lds or methods
    CS1518: Line 2943: Expected class, delegate, enum, interface, or struct
    CS0116: Line 2949: A namespace does not directly contain members such as fie
lds or methods
    CS1022: Line 2950: Type or namespace definition, or end-of-file expected
Scripts: One or more scripts failed to compile or no script files were found.
 - Press return to exit, or R to try again.
"m_Table.TryGetValue( m_Owner, out list );" = line 2919
Code:
                m_Table.TryGetValue( m_Owner, out list );

                if ( list == null )
                    m_Table[m_Owner] = list = new List<BaseHouse>();

                list.Remove( this );
            }

            if ( m_Region != null )
            {
                m_Region.Unregister();
                m_Region = null;
            }

            if ( m_Sign != null )
                m_Sign.Delete();

            if ( m_Trash != null )
                m_Trash.Delete();

            if ( m_Doors != null )
            {
                for ( int i = 0; i < m_Doors.Count; ++i )
                {
                    Item item = (Item)m_Doors[i];

                    if ( item != null )
                        item.Delete();
                }

                m_Doors.Clear();
            }

Please help me fix those, I've been looking for this system for a long time and I really want it.
 

JerrodWofford

Sorceror
Sooo yeah, rekeying the doors.. You got this fixed? Also when i place a house that is private.. (i did the distro changes and everything compiles) and go to the sign. (house gump) it doesnt have any of the buttons that ask me to change the house locks, or to make the house public. The only buttons i see there are... grant access, revoke access, ban, lift a ban, and close.... all buttons at the bottom of the gump. The buttons that sould be at the top of the gump dont exist. Take a look at my script for me? Maybe figure this out. thanks kindly.
 

Attachments

  • HouseGumpAOS.cs
    45.4 KB · Views: 8

Pure Insanity

Sorceror
Quick question...when using this system. Does it effect all doors in the house? Like even inner doors? Or doors on the 2nd floor?
 
Top