Exemplo n.º 1
0
		public void AutoHealAlly( BaseCreature bc )
		{
			Item ChivalryBook = Backpack.FindItemByType( typeof( BookOfChivalry ) ); // Added 1.9.7
			
			if ( bc != null )
			{	
				if ( bc is BaseCreature && bc.Controlled == true && bc.ControlMaster != null && bc.ControlMaster == this.ControlMaster )
				{
					if ( InRange( bc, Bandage.Range ) )
					{
						if ( bc.Hidden == false )
						{
							if ( bc.Alive == true && bc.Poisoned )
							{
								if ( bc.Body == 0x191 || bc.Body == 0x190 || bc.Body == 0x25D || bc.Body == 0x25E )
								{
									if ( m_AutoHealOther == true )
									{
										if ( m_AutoCastCleanseByFireAlly == true && ChivalryBook != null && !IsDeadPet && Mana >= 10 && TithingPoints >= 10  && DateTime.Now > m_SpellCastDelay && Hits >= ( ( HitsMax / 3 ) * 2 ) && bc.Poisoned == true ) // Added 1.9.7
										{
											new Server.Spells.Chivalry.CleanseByFireSpell( this, null ).Cast();
											
											SquireTargetCleanseByFireDelayTimer CleanseByFireTimer;
											CleanseByFireTimer = new SquireTargetCleanseByFireDelayTimer( this, bc, TimeSpan.FromSeconds( 1.0 ) );
											CleanseByFireTimer.Start();
											
											m_SpellCastDelay = DateTime.Now + TimeSpan.FromSeconds( 4.0 );
										}
										else // Added 1.9.7
										{
											Item item = Backpack.FindItemByType( typeof( Bandage ) );
													
											if ( Skills.Healing.Value >= 60.0 && Skills.Anatomy.Value >= 60.0 && null != item && null != BandageContext.BeginHeal( this, bc ) )
											{
												item.Consume( 1 );
												RevealingAction();
												if( m_SquireBeQuiet == false )
												{
													SquireDialog.DoSquireDialog( this.ControlMaster, this, SquireDialogTree.SquireCuresHumanoid, bc, null );
												}
													
												m_Delay = DateTime.Now + TimeSpan.FromSeconds( 4 );
											}
										}
									}
								}
								else
								{
									if ( m_AutoHealAnimals == true )
									{
										if ( m_AutoCastCleanseByFireAlly == true && ChivalryBook != null && !IsDeadPet && Mana >= 10 && TithingPoints >= 10  && DateTime.Now > m_SpellCastDelay && Hits >= ( ( HitsMax / 3 ) * 2 ) && bc.Poisoned == true ) // Added 1.9.7
										{
											new Server.Spells.Chivalry.CleanseByFireSpell( this, null ).Cast();
											
											SquireTargetCleanseByFireDelayTimer CleanseByFireTimer;
											CleanseByFireTimer = new SquireTargetCleanseByFireDelayTimer( this, bc, TimeSpan.FromSeconds( 1.0 ) );
											CleanseByFireTimer.Start();
											
											m_SpellCastDelay = DateTime.Now + TimeSpan.FromSeconds( 4.0 );
										}
										else // Added 1.9.7
										{
											Item item = Backpack.FindItemByType( typeof( Bandage ) );			
													
											if ( Skills.Veterinary.Value >= 60.0 && Skills.AnimalLore.Value >= 60.0 && null != item && null != BandageContext.BeginHeal( this, bc ) )
											{
												item.Consume( 1 );
												RevealingAction();
												if( m_SquireBeQuiet == false )
												{
													SquireDialog.DoSquireDialog( this.ControlMaster, this, SquireDialogTree.SquireCuresAnimal, bc, null );
												}
													
												m_Delay = DateTime.Now + TimeSpan.FromSeconds( 4 );
											}
										}
									}
								}
							}
							else if ( bc.Alive == true && bc.Hits < bc.HitsMax - 10 )
							{
								Item item = Backpack.FindItemByType( typeof( Bandage ) );
						
								if ( bc.Body == 0x191 || bc.Body == 0x190 || bc.Body == 0x25D || bc.Body == 0x25E )
								{
									if ( m_AutoHealOther == true )
									{
										if ( m_AutoCastCloseWoundsAlly == true && ChivalryBook != null && !IsDeadPet && Mana >= 10 && TithingPoints >= 10 && DateTime.Now > m_SpellCastDelay && bc.Hits <= ( ( bc.HitsMax / 3 ) * 2 ) && bc.Poisoned == false && !MortalStrike.IsWounded( bc ) ) // Added 1.9.7
										{
											new Server.Spells.Chivalry.CloseWoundsSpell( this, null ).Cast();
											
											SquireTargetCloseWoundsDelayTimer CloseWoundsTimer;
											CloseWoundsTimer = new SquireTargetCloseWoundsDelayTimer( this, bc, TimeSpan.FromSeconds( 1.5 ) );
											CloseWoundsTimer.Start();
											
											m_SpellCastDelay = DateTime.Now + TimeSpan.FromSeconds( 4.0 );
										}
										else if ( null != item && null != BandageContext.BeginHeal( this, bc ) )
										{
											item.Consume( 1 );
											RevealingAction();
											if( m_SquireBeQuiet == false )
											{
												SquireDialog.DoSquireDialog( this.ControlMaster, this, SquireDialogTree.SquireHealsWounded, bc, null );
											}
												
											m_Delay = DateTime.Now + TimeSpan.FromSeconds( 4 );
										}
									}
								}
								else
								{
									if ( m_AutoHealAnimals == true )
									{
										if ( m_AutoCastCloseWoundsAlly == true && ChivalryBook != null && !IsDeadPet && Mana >= 10 && TithingPoints >= 10 && DateTime.Now > m_SpellCastDelay && bc.Hits <= ( ( bc.HitsMax / 3 ) * 2 ) && bc.Poisoned == false && !MortalStrike.IsWounded( bc ) ) // Added 1.9.7
										{
											new Server.Spells.Chivalry.CloseWoundsSpell( this, null ).Cast();
											
											SquireTargetCloseWoundsDelayTimer CloseWoundsTimer;
											CloseWoundsTimer = new SquireTargetCloseWoundsDelayTimer( this, bc, TimeSpan.FromSeconds( 1.5 ) );
											CloseWoundsTimer.Start();
											
											m_SpellCastDelay = DateTime.Now + TimeSpan.FromSeconds( 4.0 );
										}
										else if ( null != item && null != BandageContext.BeginHeal( this, bc ) )
										{
											item.Consume( 1 );
											RevealingAction();
											if( m_SquireBeQuiet == false )
											{
												SquireDialog.DoSquireDialog( this.ControlMaster, this, SquireDialogTree.SquireHealsWounded, bc, null );
											}
												
											m_Delay = DateTime.Now + TimeSpan.FromSeconds( 4 );
										}
									}
								}
							}
							else if ( bc.Alive == false )
							{
								Item item = Backpack.FindItemByType( typeof( Bandage ) );
								
								if ( bc.Body == 0x191 || bc.Body == 0x190 || bc.Body == 0x25D || bc.Body == 0x25E )
								{
									if ( m_AutoHealOther == true )
									{
										if ( m_AutoRezAlly == true && Skills.Healing.Value >= 80.0 && Skills.Anatomy.Value >= 80.0 && null != item && null != BandageContext.BeginHeal( this, bc ) ) 
										{
											item.Consume( 1 );
											RevealingAction();
											if( m_SquireBeQuiet == false )
											{
												SquireDialog.DoSquireDialog( this.ControlMaster, this, SquireDialogTree.SquireRezsHumanoid, bc, null );
											}
															
											m_Delay = DateTime.Now + TimeSpan.FromSeconds( 9 );
										}
									}
								}
								else
								{
									if ( m_AutoHealAnimals == true )
									{
										if ( m_AutoRezAlly == true && Skills.Veterinary.Value >= 80.0 && Skills.AnimalLore.Value >= 80.0 && null != item && null != BandageContext.BeginHeal( this, bc ) ) 
										{
											item.Consume( 1 );
											RevealingAction();
											if( m_SquireBeQuiet == false )
											{
												SquireDialog.DoSquireDialog( this.ControlMaster, this, SquireDialogTree.SquireRezsAnimal, bc, null );
											}
															
											m_Delay = DateTime.Now + TimeSpan.FromSeconds( 9 );
										}
									}
								}
							}
						}
					}
				}
			}
		}
Exemplo n.º 2
0
		public override void OnThink()
		{
			base.OnThink();
			Mobile m = this.ControlMaster;
			BaseCreature bc = null;
			foreach ( Mobile search in this.GetMobilesInRange( 16 ) )
			{
				if ( search is BaseCreature && search != this && this.CanSee( search ) )
				{
					bc = ((BaseCreature)search);
					break;
				}
			}
			

			if ( DateTime.Now > m_Delay )
            {
				Item healthPotion = Backpack.FindItemByType( typeof( BaseHealPotion ) );
				Item curePotion = Backpack.FindItemByType( typeof( BaseCurePotion ) );
				Item ChivalryBook = Backpack.FindItemByType( typeof( BookOfChivalry ) );
				
				if ( m_AutoUseHealthPotion == true && healthPotion != null && DateTime.Now > m_HealthDelay && Hits <= ( HitsMax / 2 ) && this.Poisoned == false && !MortalStrike.IsWounded( this ) )
				{
					((BasePotion)healthPotion).Drink( this );
					m_HealthDelay = DateTime.Now + TimeSpan.FromSeconds( 10 );
					if( m_SquireBeQuiet == false )
					{
						SquireDialog.DoSquireDialog( m, this, SquireDialogTree.HealthPotion, null, null );
					}
				}
				else if ( m_AutoCastCloseWounds == true && ChivalryBook != null && !IsDeadPet && Mana >= 10 && TithingPoints >= 10 && DateTime.Now > m_SpellCastDelay && Hits <= ( ( HitsMax / 3 ) * 2 ) && this.Poisoned == false && !MortalStrike.IsWounded( this ) ) // Added 1.9.6
				{
					new Server.Spells.Chivalry.CloseWoundsSpell( this, null ).Cast();
					
					SquireSelfCloseWoundsDelayTimer CloseWoundsTimer;
					CloseWoundsTimer = new SquireSelfCloseWoundsDelayTimer( this, TimeSpan.FromSeconds( 1.5 ) );
					CloseWoundsTimer.Start();
					
					m_SpellCastDelay = DateTime.Now + TimeSpan.FromSeconds( 4.0 );
				}
				else if ( m_AutoUseCurePotion == true && curePotion != null && this.Poisoned && DateTime.Now > m_CureDelay )
				{
					((BasePotion)curePotion).Drink( this );
					m_CureDelay = DateTime.Now + TimeSpan.FromSeconds( 4 ); // So they don't spam when drinking.
					if( m_SquireBeQuiet == false )
					{
						SquireDialog.DoSquireDialog( m, this, SquireDialogTree.CurePotion, null, null );
					}
				}
				else if ( m_AutoCastCleanseByFire == true && ChivalryBook != null && !IsDeadPet && Mana >= 10 && TithingPoints >= 10  && DateTime.Now > m_SpellCastDelay && Hits >= ( ( HitsMax / 3 ) * 2 ) && this.Poisoned == true ) // Added 1.9.6
				{
					new Server.Spells.Chivalry.CleanseByFireSpell( this, null ).Cast();
					
					SquireSelfCleanseByFireDelayTimer CleanseByFireTimer;
					CleanseByFireTimer = new SquireSelfCleanseByFireDelayTimer( this, TimeSpan.FromSeconds( 1.0 ) );
					CleanseByFireTimer.Start();
					
					m_SpellCastDelay = DateTime.Now + TimeSpan.FromSeconds( 4.0 );
				}
				else if ( m_AutoHealSelf == true && Hits < HitsMax - 10 && null == BandageContext.GetContext( this ))
				{
					Item item = Backpack.FindItemByType( typeof(Bandage) );

					if ( null != item && null != BandageContext.BeginHeal( this , this ))
					{
						item.Consume( 1 );
						RevealingAction();
						
                        m_Delay = DateTime.Now + TimeSpan.FromSeconds( 11 );
					}
				}
				else if ( Controlled == true && ControlMaster != null && Hits >= HitsMax - 10 )
				{
					if ( InRange( ControlMaster, Bandage.Range ) )
					{
						if ( m_AutoHealMaster == true && m.Hidden == false )
						{
							if ( m.Alive == true && m.Poisoned )
							{
								Item item = Backpack.FindItemByType( typeof( Bandage ) );
						
								if ( m_AutoCastCleanseByFireMaster == true && ChivalryBook != null && !IsDeadPet && Mana >= 10 && TithingPoints >= 10  && DateTime.Now > m_SpellCastDelay && Hits >= ( ( HitsMax / 3 ) * 2 ) && m.Poisoned == true ) // Added 1.9.7
								{
									new Server.Spells.Chivalry.CleanseByFireSpell( this, null ).Cast();
									
									SquireTargetCleanseByFireDelayTimer CleanseByFireTimer;
									CleanseByFireTimer = new SquireTargetCleanseByFireDelayTimer( this, m, TimeSpan.FromSeconds( 1.0 ) );
									CleanseByFireTimer.Start();
									
									m_SpellCastDelay = DateTime.Now + TimeSpan.FromSeconds( 4.0 );
								}
								else if ( Skills.Healing.Value >= 60.0 && Skills.Anatomy.Value >= 60.0 && null != item && null != BandageContext.BeginHeal( this, m ) ) // Sent behind an Else 1.9.7
								{
									item.Consume( 1 );
									RevealingAction();
									if( m_SquireBeQuiet == false )
									{
										SquireDialog.DoSquireDialog( m, this, SquireDialogTree.SquireCuresMaster, null, null );
									}
								
									m_Delay = DateTime.Now + TimeSpan.FromSeconds( 4 );
								}
							}
							else if ( m_AutoCastCloseWoundsMaster == true && ChivalryBook != null && !IsDeadPet && Mana >= 10 && TithingPoints >= 10 && DateTime.Now > m_SpellCastDelay && m.Hits <= ( ( m.HitsMax / 3 ) * 2 ) && m.Poisoned == false && !MortalStrike.IsWounded( m ) ) // Added 1.9.7
							{
								new Server.Spells.Chivalry.CloseWoundsSpell( this, null ).Cast();
								
								SquireTargetCloseWoundsDelayTimer CloseWoundsTimer;
								CloseWoundsTimer = new SquireTargetCloseWoundsDelayTimer( this, m, TimeSpan.FromSeconds( 1.5 ) );
								CloseWoundsTimer.Start();
								
								m_SpellCastDelay = DateTime.Now + TimeSpan.FromSeconds( 4.0 );
							}
							else if ( m.Alive == true && m.Hits < m.HitsMax - 10 )
							{
								Item item = Backpack.FindItemByType( typeof( Bandage ) );
						
								if ( null != item && null != BandageContext.BeginHeal( this, m ) )
								{
									item.Consume( 1 );
									RevealingAction();
									if( m_SquireBeQuiet == false )
									{
										SquireDialog.DoSquireDialog( m, this, SquireDialogTree.SquireHealsMaster, null, null );
									}
								
									m_Delay = DateTime.Now + TimeSpan.FromSeconds( 4 );
								}
							}
							else if ( m.Alive == false )
							{
								Item item = Backpack.FindItemByType( typeof( Bandage ) );
						
								if ( m_AutoUseSpiritSpeak == true && DateTime.Now > m_SpiritDelay ) 
								{
									SquireSpeaksWithSpirits();
								}
								
								if ( m_AutoRezMaster == true && Skills.Healing.Value >= 80.0 && Skills.Anatomy.Value >= 80.0 && null != item && null != BandageContext.BeginHeal( this, m ) ) 
								{
									item.Consume( 1 );
									RevealingAction();
									if( m_SquireBeQuiet == false )
									{
										SquireDialog.DoSquireDialog( m, this, SquireDialogTree.SquireRezsMaster, null, null );
									}
								
									m_Delay = DateTime.Now + TimeSpan.FromSeconds( 9 );
								}
							}
						}
					}
					else if ( m_AutoHealMaster == true && m.Hidden == true && Controlled == true && ControlMaster != null && Hits >= HitsMax - 10 && m.Alive == true && m.Hits < m.HitsMax - 10 )
					{
						if ( DateTime.Now > m_AnnoyanceDelay )
						{
							if( m_SquireBeQuiet == false )
							{
								SquireDialog.DoSquireDialog( m, this, SquireDialogTree.ASquiresConcern, null, null );
							}
							m_AnnoyanceDelay = DateTime.Now + TimeSpan.FromSeconds( 30 );
						}
					}
					else if ( m_DesperateMasterRun == true && !(this.InRange( ControlMaster, Bandage.Range ) ) && Controlled == true && ControlMaster != null && m.Alive == true && m.Hits < m.HitsMax / 2 )
					{
						if( this.ControlOrder == OrderType.Stay && DateTime.Now > m_AnnoyanceDelay )
						{
							if( m_SquireBeQuiet == false )
							{
								SquireDialog.DoSquireDialog( m, this, SquireDialogTree.ASquiresStay, null, null );
							}
							m_AnnoyanceDelay = DateTime.Now + TimeSpan.FromSeconds( 30 );
						}
						else if ( this.ControlOrder != OrderType.Stay && m.Hits < m.HitsMax / 2 )
						{
							this.AIObject.MoveTo( m, true, 1 );
						}
					}
					else if ( Controlled == false || ControlMaster == null )
					{
						if( m_SquireBeQuiet == false )
						{
							Say( "I lack a " + m_MasterNickname + ", admin?" );
						}
						m_AnnoyanceDelay = DateTime.Now + TimeSpan.FromSeconds( 30 );
					}
					
					if ( m.Hits > m.HitsMax - 10 && m.Poisoned == false && m.Alive == true )
					{
						foreach ( Mobile search in this.GetMobilesInRange( Bandage.Range ) ) 
						{
							if ( search is BaseCreature && m_AutoHealAnimals == false && (search.Body == 0x191 || search.Body == 0x190 || search.Body == 0x25D || search.Body == 0x25E) && ((BaseCreature)search).ControlMaster == this.ControlMaster && ((BaseCreature)search).Controlled == true && search != this && this.CanSee( search ) && search.Hits < search.HitsMax - 10 )
							{
								AutoHealAlly( ( ( BaseCreature )search ) );
								break;
							}
							else if ( search is BaseCreature && m_AutoHealAnimals == true && ((BaseCreature)search).ControlMaster == this.ControlMaster && ((BaseCreature)search).Controlled == true && search != this && this.CanSee( search ) && search.Hits < search.HitsMax - 10 )
							{
								AutoHealAlly( ( ( BaseCreature )search ) );
								break;
							}
						}
					}
				}
			}
			
			if ( Hunger < 10 || Loyalty <= BaseCreature.MaxLoyalty / 10 )
			{
				CheckFeedSelf();
			}
			
			Item RangedWeaponCheck = FindItemOnLayer( Layer.TwoHanded );
			Item RangedWeaponCheck2 = FindItemOnLayer( Layer.OneHanded );
			
			if ( m_AutoPickupAmmo == true && ( RangedWeaponCheck is BaseRanged || RangedWeaponCheck2 is BaseRanged ) )
			{
				GrabAmmo( false );
			}
			
			if( DateTime.Now > m_HungerDecay )
			{
				if( this != null && Hunger >= 1 )
				{
					Hunger -= 1;
					m_HungerDecay = DateTime.Now + TimeSpan.FromMinutes( 5 );
				}
				else if( DateTime.Now > m_AnnoyanceDelay )
				{
					Emote( "Stomach Growls Audibly" );
					m_AnnoyanceDelay = DateTime.Now + TimeSpan.FromSeconds( 30 );
					if( Female )
					{
						PlaySound( 0x313 );
					}
					else
					{
						PlaySound( 0x42B );
					}
				}
			}
			
			if( DateTime.Now > m_WeaponAbilityDelay && m_AutoUseWeaponAbility == true ) // Added 1.9.7
			{
				switch( Utility.Random( 2 ) )
				{
					case 0: WeaponAbility.SetCurrentAbility( this, ((BaseWeapon)Weapon).PrimaryAbility ); break;
					case 1: WeaponAbility.SetCurrentAbility( this, ((BaseWeapon)Weapon).SecondaryAbility ); break;
				}
				
				m_WeaponAbilityDelay = DateTime.Now + TimeSpan.FromSeconds( 30 );
			}
		}