Esempio n. 1
0
		/// <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;
		}
Esempio n. 2
0
 /// <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();
 }
Esempio n. 3
0
		/// <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;
		}
Esempio n. 4
0
        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);
            }
        }
Esempio n. 5
0
 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);
                 }
             }
         }
     }
 }
Esempio n. 6
0
        /// <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;
        }
Esempio n. 7
0
		public virtual void SetAggressionState(eAggressionState state)
		{
			AggressionState = state;
			UpdatePetWindow();
		}
Esempio n. 8
0
		/// <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();
		}
Esempio n. 9
0
 public virtual void SetAggressionState(eAggressionState state)
 {
     AggressionState = state;
     UpdatePetWindow();
 }
Esempio n. 10
0
		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);
		}
Esempio n. 11
0
        // 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);
				}
			}
		}
Esempio n. 12
0
 public void SendPetWindow(GameLiving pet, ePetWindowAction windowAction, eAggressionState aggroState, eWalkState walkState)
 {
 }
Esempio n. 13
0
		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 SendPetWindow(GameLiving pet, ePetWindowAction windowAction, eAggressionState aggroState, eWalkState walkState) { }
Esempio n. 15
0
 public void SetAggressionState(eAggressionState state)
 {
 }
Esempio n. 16
0
        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);
            }
        }
Esempio n. 17
0
 public void SetAggressionState(eAggressionState state) { }
Esempio n. 18
0
		public void SendPetWindow(GameLiving pet, ePetWindowAction windowAction, eAggressionState aggroState, eWalkState walkState)
		{
			if (SendPetWindowMethod != null) SendPetWindowMethod(this, pet, windowAction, aggroState, walkState);
		}