Пример #1
0
		protected internal override void CheckInitialize(SpellCast creatingCast, ObjectReference casterReference, Unit target, ref SpellFailedReason failReason)
		{
			Caster = casterReference.Object as Unit;
			if (Caster == null || Caster is Vehicle)
			{
				log.Warn("Invalid SpellCaster \"{0}\" for Spell: {1}", Caster, SpellEffect.Spell);
				failReason = SpellFailedReason.Error;
				return;
			}

			Vehicle = target as Vehicle;
			if (Vehicle == null)
			{
				failReason = SpellFailedReason.BadTargets;
			}
			else
			{
				Seat = Vehicle.GetSeatFor(Caster);
				if (Seat == null)
				{
					// must never happen since Vehicle is unclickable when full
					failReason = SpellFailedReason.BadTargets;
				}
			}
		}
Пример #2
0
		private void SetupSeats()
		{
			var entries = m_entry.VehicleEntry.Seats;
			m_Seats = new VehicleSeat[entries.Length];

			var driver = true;
			for (var i = 0; i < entries.Length; i++)
			{
				var entry = entries[i];
				if (entry != null)
				{
					m_Seats[i] = new VehicleSeat(this, entry, (byte)i, driver);
					driver = false;
				}
			}
		}
Пример #3
0
		private void SetupSeats()
		{
			var entries = m_entry.VehicleEntry.Seats;
			_seats = new VehicleSeat[entries.Length];

			for (var i = 0; i < entries.Length; i++)
			{
				var entry = entries[i];
				if (entry == null) continue;

				_seats[i] = new VehicleSeat(this, entry, (byte)i);
				if (_seats[i].Entry.PassengerNPCId == 0) continue;
				HasUnitAttachment = true;
				_seats[i].CharacterCanEnterOrExit = false;

				//copy locally (access to modified closure)
				var seat = i;
				AddMessage(() =>
				           	{
				           		var npcEntry = NPCMgr.GetEntry(entry.PassengerNPCId);
				           		if (npcEntry == null)
				           			return;

				           		var newNpc = npcEntry.SpawnAt(this);
				           		newNpc.Brain.EnterDefaultState();
				           		_seats[seat].Enter(newNpc);
				           	});
			}
		}