Aura.Channel.World.Entities.Creature.GetActualCreature C# (CSharp) Метод

GetActualCreature() публичный Метод

If this creature is an RP character, it returns the player's character behind the RP character, if not it just returns itself.
Use in cases where you want to execute an action on the actual player character, but you don't know if you're working with an RP character or not. For example, maybe you want to give a player a quest item at the end of the dungeon, but the dungeon can be played as RP or non-RP. Using just the creature would give it to the RP character, with the player never getting it.
public GetActualCreature ( ) : Creature
Результат Creature
		public Creature GetActualCreature()
		{
			if (!this.IsRpCharacter)
				return this;

			var rpCharacter = this as RpCharacter;
			return rpCharacter.Actor;
		}
	}

Usage Example

Пример #1
0
		/// <summary>
		/// Called when a creature enters the lobby region.
		/// </summary>
		/// <param name="creature"></param>
		public void OnPlayerEntersLobby(Creature creature)
		{
			var actualCreature = creature.GetActualCreature();
			var isCreator = this.Creators.Contains(actualCreature.EntityId);

			// Save location
			// This happens whenever you enter the lobby.
			creature.DungeonSaveLocation = creature.GetLocation();
			Send.Notice(creature, Localization.Get("You have memorized this location."));

			// Notify player if dungeon was created by another party.
			if (!isCreator)
				Send.MsgBox(creature, Localization.Get("This dungeon has been created by another player."));

			// Scroll message
			var msg = "";
			if (isCreator)
				msg = Localization.Get("This dungeon has been created by you or your party.\t");
			else
				msg = Localization.Get("This dungeon has been created by another player.");

			Send.Notice(creature, NoticeType.Top, ScrollMessageDuration, msg + this.GetPlayerListScrollMessage());

			// Enter events
			this.Script.OnPlayerEntered(this, creature);
			lock (_partyEnterSyncLock)
			{
				if (!_partyEnterEventFired && this.CountPlayers() == this.Creators.Count)
				{
					_partyEnterEventFired = true;
					this.Script.OnPartyEntered(this, creature);
				}
			}
		}