public uint[] BuildVehicleActionBar() { var bar = new uint[PetConstants.PetActionCount]; var i = 0; byte j = 0; if (Entry.Spells != null) { var spells = Entry.Spells.GetEnumerator(); for (; 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; } } } for (; j < PetConstants.PetActionCount; j++) { bar[i++] = new PetActionEntry { Type = PetActionType.CastSpell2 + j }.Raw; } return(bar); }
public uint[] BuildPetActionBar() { 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; if (Entry.Spells != null) { var spells = Entry.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.Key, PetActionType.DefaultSpellSetting); bar[i++] = actionEntry.Raw; } } } else { for (byte j = 0; j < PetConstants.PetSpellCount; j++) { bar[i++] = new PetActionEntry { Type = PetActionType.CastSpell2 + j }.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); }