Page 1 of 1

Resource tiles and ltargetkind

Posted: Tue Mar 18, 2008 8:52 am
by j4bber
Ok, was working with a mining script today and noticed that the #ltargetkind is 3 for the ground instead of 2 like on OSI. Is this a runuo thing or a bug? Putting here in case it is a bug...

Archived topic from AOV, old topic ID:2506, old post ID:15901

Resource tiles and ltargetkind

Posted: Tue Mar 18, 2008 4:09 pm
by Death
j4bber wrote:Ok, was working with a mining script today and noticed that the #ltargetkind is 3 for the ground instead of 2 like on OSI. Is this a runuo thing or a bug? Putting here in case it is a bug...
It might possibly have something to do with the OSI map changes. They've been shifting tiles and putting in new ones in the clients because of UOKR which might have had an effect during client patching. Either that or like you said, it might be a runuo thing and it may be how they are differentiated. Squirrel can likely give more insight on this but thanks for the heads up in case something turns out to be funny.

Archived topic from AOV, old topic ID:2506, old post ID:15907

Resource tiles and ltargetkind

Posted: Tue Mar 18, 2008 6:31 pm
by Red Squirrel
Hmm that's interesting actually, as thats client side as far as I know. I'll take a look at the targetting code and see if it does actually send an interger with the target, maybe there is a server side part to it.

Archived topic from AOV, old topic ID:2506, old post ID:15930

Resource tiles and ltargetkind

Posted: Tue Mar 18, 2008 8:18 pm
by Red Squirrel
lol looks like runuo only cares about type 1. But guess checking for mobile/item sort of works to check for other type, then else is for anything else. Still not the best handling, I could probably improve that.

Code: Select all

		public static void TargetResponse( NetState state, PacketReader pvSrc )
		{
			int type = pvSrc.ReadByte();
			int targetID = pvSrc.ReadInt32();
			int flags = pvSrc.ReadByte();
			Serial serial = pvSrc.ReadInt32();
			int x = pvSrc.ReadInt16(), y = pvSrc.ReadInt16(), z = pvSrc.ReadInt16();
			int graphic = pvSrc.ReadInt16();

			if ( targetID == unchecked( (int) 0xDEADBEEF ) )
				return;

			Mobile from = state.Mobile;

			Target t = from.Target;

			if ( t != null )
			{
				if ( x == -1 && y == -1 && !serial.IsValid )
				{
					// User pressed escape
					t.Cancel( from, TargetCancelType.Canceled );
				}
				else
				{
					object toTarget;

					if ( type == 1 )
					{
						if ( graphic == 0 )
						{
							toTarget = new LandTarget( new Point3D( x, y, z ), from.Map );
						}
						else
						{
							Map map = from.Map;

							if ( map == null || map == Map.Internal )
							{
								t.Cancel( from, TargetCancelType.Canceled );
								return;
							}
							else
							{
								Tile[] tiles = map.Tiles.GetStaticTiles( x, y, !t.DisallowMultis );

								bool valid = false;

								for ( int i = 0; !valid && i < tiles.Length; ++i )
								{
									if ( tiles[i].Z == z && (tiles[i].ID & 0x3FFF) == (graphic & 0x3FFF) )
										valid = true;
								}

								if ( !valid )
								{
									t.Cancel( from, TargetCancelType.Canceled );
									return;
								}
								else
								{
									toTarget = new StaticTarget( new Point3D( x, y, z ), graphic );
								}
							}
						}
					}
					else if ( serial.IsMobile )
					{
						toTarget = World.FindMobile( serial );
					}
					else if ( serial.IsItem )
					{
						toTarget = World.FindItem( serial );
					}
					else
					{
						t.Cancel( from, TargetCancelType.Canceled );
						return;
					}

					t.Invoke( from, toTarget );
				}
			}
		}
a landtarget would also be a resource pool in most cases, unless its trees then its a statictarget and not a landtarget

Archived topic from AOV, old topic ID:2506, old post ID:15946

Resource tiles and ltargetkind

Posted: Tue Mar 18, 2008 9:35 pm
by Red Squirrel
hmm just tested this and I know what you mean. Does 3 work on OSI? I'm wondering if OSI might just ignore the type altogether.

Since land targets go by x/y while item/mobile go by serial so that alone is enough to know what type of target it is (until someone clover decides to send both! )

Archived topic from AOV, old topic ID:2506, old post ID:15949

Resource tiles and ltargetkind

Posted: Tue Mar 18, 2008 10:12 pm
by j4bber
I can defiantly say OSI doesn't ignore type since if it is set to 1 instead of 2 you can't mine or chop... I have never used 3 on OSI so not sure (and I no longer have an OSI account to test on ;) )

since it seems runuo only cares about 1, I may try that instead and see what happens.

Archived topic from AOV, old topic ID:2506, old post ID:15954