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!

Finding ItemID of front stairs

goodmojo

Wanderer
Finding ItemID of front stairs

Im trying to use the following code to make sure that a player is on the front steps of a home before they can place a guildstone. For some reason i dont understand, the stairs are not being recognized for their ItemID. Im assuming it has something to do with "Flag" attribute proscribed by it being part of the House Foundation. Anyone know how I can get this getitemtype to recognize a stair tile on the front oh a home?

Code:
public override void OnDoubleClick( Mobile from )
		{
// ***** BEGIN MODS FOR GUILDSTONE

			double stairs = 0;
			Map map = from.Map;

			if ( map == null )
				return;

			IPooledEnumerable eable = map.GetItemsInRange( from.Location, 0 );

			foreach ( Item item in eable )
			{
				Type type = item.GetType();

				if ( item.ItemID == 1007 || item.ItemID == 1802 || item.ItemID == 1823 || item.ItemID == 

1826 || item.ItemID == 1849 || item.ItemID == 1873 || item.ItemID == 1878 || item.ItemID == 1901 || item.ItemID == 1929 || 

item.ItemID == 1956 || item.ItemID == 1979 )
					++stairs;
			}

			if ( stairs < 1 )
			{
				from.SendMessage( "You may only place a Guildstone on the front stairs." );
				return;
			}

			eable.Free();
 

Seanchen.net

Wanderer
The stairs are not a seperate Item to the client, they are virtualy static.

RunUO sends the entire house as a packet...I believe
 

goodmojo

Wanderer
Can you think of any other way to accomplish what im looking to do? Have players only drop a guildstone on fron stairs? Maybe point me in another direction?
 

Seanchen.net

Wanderer
goodmojo said:
Can you think of any other way to accomplish what im looking to do? Have players only drop a guildstone on fron stairs? Maybe point me in another direction?

My answer was very clear...
 

goodmojo

Wanderer
I'm sure it was. I just don't understand. I imagine i'm not educated in C# enough. I assumed you meant that all the elements of "house" were viewed as one entity to the client. However, I CAN get this code to work in recognizing the door(Item ID 1802 for example) of the house. So there went my presumption out the window. So again, im not really sure what you mean and im hoping someone can explain this further to me.
 

Seanchen.net

Wanderer
goodmojo said:
I'm sure it was. I just don't understand. I imagine i'm not educated in C# enough. I assumed you meant that all the elements of "house" were viewed as one entity to the client. However, I CAN get this code to work in recognizing the door(Item ID 1802 for example) of the house. So there went my presumption out the window. So again, im not really sure what you mean and im hoping someone can explain this further to me.

The door is added by itself, through other code, its not part of the house. I have explained it, the house if I am correct is one object. Even with a Custom House, its one object, its basicly static UNLESS your in a special "mode" but only the one client can go into that mode.

I could be wrong, If I am, then you should be able to do it. Its just a a matter of trying different things. I can tell you the stairs are not a RunUO class, they are not even of type Item, so you CANNOT reference to them as an Item. That most likely what its not working to be honest.
 

goodmojo

Wanderer
hmm ok. so the stairs are part of the static item house.

is there somethig exclusive to the stairs that the rest of the house foundation doesnt have that i can reference in a check? what i want to accomplish is to have a guildstone only be placeable outside a home, but still on (stairs) or right next to it.
 

ArteGordon

Wanderer
the house will be identified as a BaseMulti. You will need to go through the multi components list to find the stairs. Something like

Code:
// go through all of the multi components
			MultiComponentList mcl = ((BaseMulti)item).Components;
			if (mcl != null && mcl.List != null)
			{
				for (int i = 0; i < mcl.List.Length; i++)
				{
					MultiTileEntry t = mcl.List[i];

					// check the t.m_Flags or the t.m_ItemID for stairs
				}

			}

I'm not sure exactly what the flags are for the stairs, but I'm sure with a little testing you could figure it out.

(edit)

oh, and you can figure out the location of the stairs by using the m_OffsetX and m_OffsetY values for the MultiTileEntry.
 

goodmojo

Wanderer
Thanks Arte. This multitile is all new to me but i have a direction to go now. I'll start picking it apart and see what i can figure out.
 

Jeff

Lord
goodmojo said:
Thanks Arte. This multitile is all new to me but i have a direction to go now. I'll start picking it apart and see what i can figure out.
Or im just throwing this out there, how about finding the size of the house and since all houses are facing the same way, just use the S edge as a reference to a location, for example if the house is 5x5 and and the center of the house is at 1654 454 0 then we know that 1654-2 454 0 is where the steps would be and thus maybe be able to put the stone at the same spot on each house or something. 1654-2 454-2 0. just a thought.
 

goodmojo

Wanderer
Code:
public static void AddStairsTo( ref MultiComponentList mcl )
		{
			// copy the original..
			mcl = new MultiComponentList( mcl );

			mcl.Resize( mcl.Width, mcl.Height + 1 );

			int xCenter = mcl.Center.X;
			int yCenter = mcl.Center.Y;
			int y = mcl.Height - 1;

			for ( int x = 0; x < mcl.Width; ++x )
				mcl.Add( 0x63, x - xCenter, y - yCenter, 0 );
		}

Im a little lost on all of this still. I found this code but dont know what to do with it.
 
Top