Example #1
0
File: NPC.Pet.cs Project: NVN/WCell
		public uint[] BuidPetActionBar()
		{
			var bar = new uint[PetConstants.PetActionCount];

			var i = 0;

			bar[i++] = new PetActionEntry
			{
				Action = PetAction.Attack,
				Type = PetActionType.SetAction
			}.Raw;

			bar[i++] = new PetActionEntry
			{
				Action = PetAction.Follow,
				Type = PetActionType.SetAction
			}.Raw;

			bar[i++] = new PetActionEntry
			{
				Action = PetAction.Stay,
				Type = PetActionType.SetAction
			}.Raw;

			var spells = m_spells.GetEnumerator();
			for (byte j = 0; j < PetConstants.PetSpellCount; j++)
			{
				if (!spells.MoveNext())
				{
					bar[i++] = new PetActionEntry
					{
						Type = PetActionType.CastSpell2 + j
					}.Raw;
				}
				else
				{
					var spell = spells.Current;
					var actionEntry = new PetActionEntry();
					actionEntry.SetSpell(spell.SpellId, PetActionType.DefaultSpellSetting);
					bar[i++] = actionEntry.Raw;
				}
			}

			bar[i++] = new PetActionEntry
			{
				AttackMode = PetAttackMode.Aggressive,
				Type = PetActionType.SetMode
			}.Raw;

			bar[i++] = new PetActionEntry
			{
				AttackMode = PetAttackMode.Defensive,
				Type = PetActionType.SetMode
			}.Raw;

			bar[i++] = new PetActionEntry
			{
				AttackMode = PetAttackMode.Passive,
				Type = PetActionType.SetMode
			}.Raw;

			return bar;
		}
Example #2
0
		public uint[] BuildVehicleActionBar()
		{
			var bar = new uint[PetConstants.PetActionCount];
			var i = 0;

			byte j;
			if (Entry.Spells != null)
			{
				var spells = Entry.Spells.GetEnumerator();

				for (j = 0; j < PetConstants.PetSpellCount; j++)
				{
					if (!spells.MoveNext())
					{
						bar[i++] = new PetActionEntry
						           	{
						           		Type = PetActionType.CastSpell2 + j
						           	}.Raw;
					}
					else
					{
						var spell = spells.Current;
						var actionEntry = new PetActionEntry();
						if (spell.Value.IsPassive)
						{
							var cast = SpellCast;
							if (cast != null)
								cast.TriggerSelf(spell.Value);

							actionEntry.Type = PetActionType.CastSpell2 + j;
						}
						else
						{
							actionEntry.SetSpell(spell.Key, PetActionType.CastSpell2 + j);

						}
						bar[i++] = actionEntry.Raw;
					}
				}
			}
			else
			{
				for (j = 0; j < PetConstants.PetSpellCount; j++)
				{
					bar[i++] = new PetActionEntry
					           	{
					           		Type = PetActionType.CastSpell2 + j
					           	}.Raw;
				}
			}

			for (; j < PetConstants.PetActionCount; j++)
			{
				bar[i++] = new PetActionEntry
				           	{
				           		Type = PetActionType.CastSpell2 + j
				           	}.Raw;
			}

			return bar;
		}