/// <summary> /// Constructs new controlled npc brain /// </summary> /// <param name="owner"></param> public ControlledNpcBrain(GameLiving owner) : base() { if (owner == null) throw new ArgumentNullException("owner"); m_owner = owner; m_aggressionState = eAggressionState.Defensive; m_walkState = eWalkState.Follow; m_aggroLevel = 99; m_aggroMaxRange = 1500; }
/// <summary> /// Attack the target on command /// </summary> /// <param name="target"></param> public virtual void Attack(GameObject target) { if (AggressionState == eAggressionState.Passive) { AggressionState = eAggressionState.Defensive; UpdatePetWindow(); } m_orderAttackTarget = target as GameLiving; previousIsStealthed = false; if (target is GamePlayer) { previousIsStealthed = (target as GamePlayer).IsStealthed; } AttackMostWanted(); }
/// <summary> /// Constructs new controlled npc brain /// </summary> /// <param name="owner"></param> public ControlledNpcBrain(GameLiving owner) : base() { if (owner == null) throw new ArgumentNullException("owner"); m_owner = owner; m_aggressionState = eAggressionState.Defensive; m_walkState = eWalkState.Follow; if (owner is GameNPC && (owner as GameNPC).Brain is StandardMobBrain) { m_aggroLevel = ((owner as GameNPC).Brain as StandardMobBrain).AggroLevel; } else m_aggroLevel = 99; m_aggroMaxRange = 1500; }
public override void SetAggressionState(eAggressionState state) { if (MinionsAssisting) { base.SetAggressionState(state); } else { base.SetAggressionState(eAggressionState.Passive); } // Attack immediately rather than waiting for the next Think() if (AggressionState != eAggressionState.Passive) { Attack(Owner.TargetObject); } }
public override void SetAggressionState(eAggressionState state) { base.SetAggressionState(state); if (Body.ControlledNpcList != null) { lock (Body.ControlledNpcList) { foreach (BDPetBrain icb in Body.ControlledNpcList) { if (icb != null) { icb.SetAggressionState(state); } } } } }
/// <summary> /// Constructs new controlled npc brain /// </summary> /// <param name="owner"></param> public ControlledNpcBrain(GameLiving owner) : base() { if (owner == null) { throw new ArgumentNullException("owner"); } m_owner = owner; m_aggressionState = eAggressionState.Defensive; m_walkState = eWalkState.Follow; if (owner is GameNPC && (owner as GameNPC).Brain is StandardMobBrain) { m_aggroLevel = ((owner as GameNPC).Brain as StandardMobBrain).AggroLevel; } else { m_aggroLevel = 99; } m_aggroMaxRange = 1500; }
public virtual void SetAggressionState(eAggressionState state) { AggressionState = state; UpdatePetWindow(); }
/// <summary> /// Attack the target on command /// </summary> /// <param name="target"></param> public virtual void Attack(GameObject target) { if (AggressionState == eAggressionState.Passive) { AggressionState = eAggressionState.Defensive; UpdatePetWindow(); } m_orderAttackTarget = target as GameLiving; previousIsStealthed = false; if (target is GamePlayer) previousIsStealthed = (target as GamePlayer).IsStealthed; AttackMostWanted(); }
public override void SendPetWindow(GameLiving pet, ePetWindowAction windowAction, eAggressionState aggroState, eWalkState walkState) { GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.PetWindow)); pak.WriteShort((ushort)(pet == null ? 0 : pet.ObjectID)); pak.WriteByte(0x00); //unused pak.WriteByte(0x00); //unused switch (windowAction) //0-released, 1-normal, 2-just charmed? | Roach: 0-close window, 1-update window, 2-create window { case ePetWindowAction.Open : pak.WriteByte(2); break; case ePetWindowAction.Update: pak.WriteByte(1); break; default: pak.WriteByte(0); break; } switch (aggroState) //1-aggressive, 2-defensive, 3-passive { case eAggressionState.Aggressive: pak.WriteByte(1); break; case eAggressionState.Defensive : pak.WriteByte(2); break; case eAggressionState.Passive : pak.WriteByte(3); break; default: pak.WriteByte(0); break; } switch (walkState) //1-follow, 2-stay, 3-goto, 4-here { case eWalkState.Follow : pak.WriteByte(1); break; case eWalkState.Stay : pak.WriteByte(2); break; case eWalkState.GoTarget: pak.WriteByte(3); break; case eWalkState.ComeHere: pak.WriteByte(4); break; default: pak.WriteByte(0); break; } pak.WriteByte(0x00); //unused if (pet != null) { lock (pet.EffectList) { ArrayList icons = new ArrayList(); foreach (IGameEffect effect in pet.EffectList) { if (icons.Count >= 8) break; if (effect.Icon == 0) continue; icons.Add(effect.Icon); } pak.WriteByte((byte)icons.Count); // effect count // 0x08 - null terminated - (byte) list of shorts - spell icons on pet foreach (ushort icon in icons) { pak.WriteShort(icon); } } } else pak.WriteByte((byte)0); // effect count SendTCP(pak); }
// END public override void SetAggressionState(eAggressionState state) { base.SetAggressionState(state); if (Body.ControlledNpcList != null) { lock (Body.ControlledNpcList) { foreach (BDPetBrain icb in Body.ControlledNpcList) if (icb != null) icb.SetAggressionState(state); } } }
public void SendPetWindow(GameLiving pet, ePetWindowAction windowAction, eAggressionState aggroState, eWalkState walkState) { }
public virtual void SendPetWindow(GameLiving pet, ePetWindowAction windowAction, eAggressionState aggroState, eWalkState walkState) { using (var pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.PetWindow))) { pak.WriteShort((ushort) (pet == null ? 0 : pet.ObjectID)); pak.WriteByte(0x00); //unused pak.WriteByte(0x00); //unused switch (windowAction) //0-released, 1-normal, 2-just charmed? | Roach: 0-close window, 1-update window, 2-create window { case ePetWindowAction.Open: pak.WriteByte(2); break; case ePetWindowAction.Update: pak.WriteByte(1); break; default: pak.WriteByte(0); break; } switch (aggroState) //1-aggressive, 2-defensive, 3-passive { case eAggressionState.Aggressive: pak.WriteByte(1); break; case eAggressionState.Defensive: pak.WriteByte(2); break; case eAggressionState.Passive: pak.WriteByte(3); break; default: pak.WriteByte(0); break; } switch (walkState) //1-follow, 2-stay, 3-goto, 4-here { case eWalkState.Follow: pak.WriteByte(1); break; case eWalkState.Stay: pak.WriteByte(2); break; case eWalkState.GoTarget: pak.WriteByte(3); break; case eWalkState.ComeHere: pak.WriteByte(4); break; default: pak.WriteByte(0); break; } pak.WriteByte(0x00); //unused if (pet != null) { lock (pet.EffectList) { int count = 0; foreach (IGameEffect effect in pet.EffectList) { pak.WriteShort(effect.Icon); // 0x08 - null terminated - (byte) list of shorts - spell icons on pet if (++count > 8) break; } } } pak.WriteByte(0x00); //null termination SendTCP(pak); } }
public void SetAggressionState(eAggressionState state) { }
public override void SendPetWindow(GameLiving pet, ePetWindowAction windowAction, eAggressionState aggroState, eWalkState walkState) { using (GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.PetWindow))) { pak.WriteShort((ushort)(pet == null ? 0 : pet.ObjectID)); pak.WriteByte(0x00); //unused pak.WriteByte(0x00); //unused switch (windowAction) //0-released, 1-normal, 2-just charmed? | Roach: 0-close window, 1-update window, 2-create window { case ePetWindowAction.Open: pak.WriteByte(2); break; case ePetWindowAction.Update: pak.WriteByte(1); break; default: pak.WriteByte(0); break; } switch (aggroState) //1-aggressive, 2-defensive, 3-passive { case eAggressionState.Aggressive: pak.WriteByte(1); break; case eAggressionState.Defensive: pak.WriteByte(2); break; case eAggressionState.Passive: pak.WriteByte(3); break; default: pak.WriteByte(0); break; } switch (walkState) //1-follow, 2-stay, 3-goto, 4-here { case eWalkState.Follow: pak.WriteByte(1); break; case eWalkState.Stay: pak.WriteByte(2); break; case eWalkState.GoTarget: pak.WriteByte(3); break; case eWalkState.ComeHere: pak.WriteByte(4); break; default: pak.WriteByte(0); break; } pak.WriteByte(0x00); //unused if (pet != null) { lock (pet.EffectList) { ArrayList icons = new ArrayList(); foreach (IGameEffect effect in pet.EffectList) { if (icons.Count >= 8) { break; } if (effect.Icon == 0) { continue; } icons.Add(effect.Icon); } pak.WriteByte((byte)icons.Count); // effect count // 0x08 - null terminated - (byte) list of shorts - spell icons on pet foreach (ushort icon in icons) { pak.WriteShort(icon); } } } else { pak.WriteByte((byte)0); // effect count } SendTCP(pak); } }
public void SendPetWindow(GameLiving pet, ePetWindowAction windowAction, eAggressionState aggroState, eWalkState walkState) { if (SendPetWindowMethod != null) SendPetWindowMethod(this, pet, windowAction, aggroState, walkState); }