EnterWorld question

edited August 2010 in Photon Server
In the MMO server demo's EnterWorld operation handler, there is the following:
			var actor = new MmoActor( peer, world, interestArea );
			var avatar = new MmoItem( world, operation.Position, operation.Properties, actor, operation.Username, (byte)ItemType.Avatar );

			while( world.ItemCache.AddItem( avatar ) == false )
			{
				Item otherAvatarItem;
				if( world.ItemCache.TryGetItem( avatar.Type, avatar.Id, out otherAvatarItem ) )
				{
					((MmoItem)otherAvatarItem).Owner.ExitWorld( actor.OperationHandler );
				}
			}

Where does avatar.Id come from? How is it generated? If you're looking up a previous item in the world (in this case, the avatar), I figure you would need to keep track of the IDs yourself as you create the items, since the ItemCache requires that you specify the ID when looking for an item.

Thanks in advance.

Comments

  • the avatar is the MmoItem that is created in the second line.
    The Id is the "operation.Username".
  • Boris wrote:
    the avatar is the MmoItem that is created in the second line.
    The Id is the "operation.Username".
    Ah, thanks. I just realized it was a silly question. For some reason I thought avatar.Id was an integral value.
Sign In or Register to comment.