public CharmInfo(Unit unit) { _unit = unit; _CommandState = CommandStates.Follow; _petnumber = 0; _oldReactState = ReactStates.Passive; for (byte i = 0; i < SharedConst.MaxSpellCharm; ++i) { _charmspells[i] = new UnitActionBarEntry(); _charmspells[i].SetActionAndType(0, ActiveStates.Disabled); } for (var i = 0; i < SharedConst.ActionBarIndexMax; ++i) { PetActionBar[i] = new UnitActionBarEntry(); } Creature creature = _unit.ToCreature(); if (creature != null) { _oldReactState = creature.GetReactState(); creature.SetReactState(ReactStates.Passive); } }
public void RestoreState() { if (_unit.IsTypeId(TypeId.Unit)) { Creature creature = _unit.ToCreature(); if (creature) { creature.SetReactState(_oldReactState); } } }