PageRenderTime 57ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 1ms

/Scripts/Engines/AI/Creature/BaseCreature.cs

https://bitbucket.org/Kel/crepuscule
C# | 4750 lines | 3594 code | 997 blank | 159 comment | 913 complexity | 1afd62a65d5182fc73a5cee6e9e74830 MD5 | raw file

Large files files are truncated, but you can click here to view the full file

  1. using System;
  2. using System.Collections;
  3. using Server;
  4. using Server.Regions;
  5. using Server.Targeting;
  6. using Server.Network;
  7. using Server.Spells;
  8. using Server.Misc;
  9. using Server.Items;
  10. using Server.Mobiles;
  11. using Server.ContextMenus;
  12. using Server.Engines.Quests;
  13. using Server.Engines;
  14. using System.Collections.Generic;
  15. namespace Server.Mobiles
  16. {
  17. /// <summary>
  18. /// Summary description for MobileAI.
  19. /// </summary>
  20. ///
  21. public enum FightMode
  22. {
  23. None, // Never focus on others
  24. Agressor, // Only attack agressors
  25. Strongest, // Attack the strongest
  26. Weakest, // Attack the weakest
  27. Closest, // Attack the closest
  28. Evil // Only attack aggressor -or- negative karma
  29. }
  30. public enum OrderType
  31. {
  32. None, //When no order, let's roam
  33. Come, //"(All/Name) come" Summons all or one pet to your location.
  34. Drop, //"(Name) drop" Drops its loot to the ground (if it carries any).
  35. Follow, //"(Name) follow" Follows targeted being.
  36. //"(All/Name) follow me" Makes all or one pet follow you.
  37. Friend, //"(Name) friend" Allows targeted player to confirm resurrection.
  38. Guard, //"(Name) guard" Makes the specified pet guard you. Pets can only guard their owner.
  39. //"(All/Name) guard me" Makes all or one pet guard you.
  40. Attack, //"(All/Name) kill",
  41. //"(All/Name) attack" All or the specified pet(s) currently under your control attack the target.
  42. Patrol, //"(Name) patrol" Roves between two or more guarded targets.
  43. Release, //"(Name) release" Releases pet back into the wild (removes "tame" status).
  44. Stay, //"(All/Name) stay" All or the specified pet(s) will stop and stay in current spot.
  45. Stop, //"(All/Name) stop Cancels any current orders to attack, guard or follow.
  46. Transfert //"(Name) transfer" Transfers complete ownership to targeted player.
  47. }
  48. [Flags]
  49. public enum FoodType
  50. {
  51. Meat = 0x0001,
  52. FruitsAndVegies = 0x0002,
  53. GrainsAndHay = 0x0004,
  54. Fish = 0x0008,
  55. Eggs = 0x0010,
  56. Gold = 0x0020
  57. }
  58. [Flags]
  59. public enum PackInstinct
  60. {
  61. None = 0x0000,
  62. Canine = 0x0001,
  63. Ostard = 0x0002,
  64. Feline = 0x0004,
  65. Arachnid = 0x0008,
  66. Daemon = 0x0010,
  67. Bear = 0x0020,
  68. Equine = 0x0040,
  69. Bull = 0x0080
  70. }
  71. public enum ScaleType
  72. {
  73. Red,
  74. Yellow,
  75. Black,
  76. Green,
  77. White,
  78. Blue,
  79. All
  80. }
  81. public enum MeatType
  82. {
  83. Ribs,
  84. Bird,
  85. LambLeg,
  86. Chicken
  87. }
  88. public enum HideType
  89. {
  90. Regular,
  91. Spined,
  92. Horned,
  93. Barbed
  94. }
  95. public enum PetLoyalty
  96. {
  97. None,
  98. Confused,
  99. ExtremelyUnhappy,
  100. RatherUnhappy,
  101. Unhappy,
  102. SomewhatContent,
  103. Content,
  104. Happy,
  105. RatherHappy,
  106. VeryHappy,
  107. ExtremelyHappy,
  108. WonderfullyHappy
  109. }
  110. public class DamageStore : IComparable
  111. {
  112. public Mobile m_Mobile;
  113. public int m_Damage;
  114. public bool m_HasRight;
  115. public DamageStore(Mobile m, int damage)
  116. {
  117. m_Mobile = m;
  118. m_Damage = damage;
  119. }
  120. public int CompareTo(object obj)
  121. {
  122. DamageStore ds = (DamageStore)obj;
  123. return ds.m_Damage - m_Damage;
  124. }
  125. }
  126. [Description("PNJ")]
  127. public class BaseCreature : Mobile
  128. {
  129. private BaseAI m_AI; // THE AI
  130. private AIType m_CurrentAI; // The current AI
  131. private AIType m_DefaultAI; // The default AI
  132. private Mobile m_FocusMob; // Use focus mob instead of combatant, maybe we don't whan to fight
  133. private FightMode m_FightMode; // The style the mob uses
  134. private LootPackLevel m_LootLevel; // The loot pack level of the mob
  135. private int m_iRangePerception; // The view area
  136. private int m_iRangeFight; // The fight distance
  137. private bool m_bDebugAI; // Show debug AI messages
  138. private int m_iTeam; // Monster Team
  139. private double m_dActiveSpeed; // Timer speed when active
  140. private double m_dPassiveSpeed; // Timer speed when not active
  141. private double m_dCurrentSpeed; // The current speed, lets say it could be changed by something;
  142. private Point3D m_pHome; // The home position of the creature, used by some AI
  143. private int m_iRangeHome = 10; // The home range of the creature
  144. ArrayList m_arSpellAttack; // List of attack spell/power
  145. ArrayList m_arSpellDefense; // Liste of defensive spell/power
  146. private bool m_bControled; // Is controled
  147. private Mobile m_ControlMaster; // My master
  148. private Mobile m_ControlTarget; // My target mobile
  149. private Point3D m_ControlDest; // My target destination (patrol)
  150. private OrderType m_ControlOrder; // My order
  151. private PetLoyalty m_Loyalty;
  152. private double m_dMinTameSkill;
  153. private bool m_bTamable;
  154. private bool m_bSummoned = false;
  155. private DateTime m_SummonEnd;
  156. private int m_iControlSlots = 1;
  157. private bool m_bBardProvoked = false;
  158. private bool m_bBardPacified = false;
  159. private Mobile m_bBardMaster = null;
  160. private Mobile m_bBardTarget = null;
  161. private DateTime m_timeBardEnd;
  162. private WayPoint m_CurrentWayPoint = null;
  163. private Point2D m_TargetLocation = Point2D.Zero;
  164. private Mobile m_SummonMaster;
  165. private int m_HitsMax = -1;
  166. private int m_StamMax = -1;
  167. private int m_ManaMax = -1;
  168. private int m_DamageMin = -1;
  169. private int m_DamageMax = -1;
  170. private int m_PhysicalResistance, m_PhysicalDamage = 100;
  171. private int m_FireResistance, m_FireDamage;
  172. private int m_ColdResistance, m_ColdDamage;
  173. private int m_PoisonResistance, m_PoisonDamage;
  174. private int m_EnergyResistance, m_EnergyDamage;
  175. private ArrayList m_Owners;
  176. private Hashtable m_FearLove;
  177. private Hashtable m_Hate;
  178. private bool m_IsSystemInitialized = false;
  179. protected TimeSpan m_SayingsDelay = TimeSpan.FromSeconds(30);
  180. protected DateTime m_NextSaying;
  181. protected bool m_SayingsEnabled = false;
  182. protected int m_SayingsSecondsDelay = 30;
  183. protected string m_Saying1 = "";
  184. protected string m_Saying2 = "";
  185. protected string m_Saying3 = "";
  186. protected string m_Saying4 = "";
  187. protected string m_Saying5 = "";
  188. private bool m_ShowNameTag = true;
  189. private bool m_IsStabled;
  190. private bool m_HasGeneratedLoot; // have we generated our loot yet?
  191. public virtual InhumanSpeech SpeechType { get { return null; } }
  192. public bool IsStabled
  193. {
  194. get { return m_IsStabled; }
  195. set { m_IsStabled = value; }
  196. }
  197. #region Bonding
  198. public const bool BondingEnabled = true;
  199. public virtual bool IsBondable { get { return (BondingEnabled && !Summoned); } }
  200. public virtual TimeSpan BondingDelay { get { return TimeSpan.FromDays(7.0); } }
  201. public virtual TimeSpan BondingAbandonDelay { get { return TimeSpan.FromDays(1.0); } }
  202. public override bool CanRegenHits { get { return !m_IsDeadPet && base.CanRegenHits; } }
  203. public override bool CanRegenStam { get { return !m_IsDeadPet && base.CanRegenStam; } }
  204. public override bool CanRegenMana { get { return !m_IsDeadPet && base.CanRegenMana; } }
  205. public override bool IsDeadBondedPet { get { return m_IsDeadPet; } }
  206. private bool m_IsBonded;
  207. private bool m_IsDeadPet;
  208. private DateTime m_BondingBegin;
  209. private DateTime m_OwnerAbandonTime;
  210. [CommandProperty(AccessLevel.GameMaster)]
  211. public bool IsBonded
  212. {
  213. get { return m_IsBonded; }
  214. set { m_IsBonded = value; InvalidateProperties(); }
  215. }
  216. public bool IsDeadPet
  217. {
  218. get { return m_IsDeadPet; }
  219. set { m_IsDeadPet = value; }
  220. }
  221. [CommandProperty(AccessLevel.GameMaster)]
  222. public DateTime BondingBegin
  223. {
  224. get { return m_BondingBegin; }
  225. set { m_BondingBegin = value; }
  226. }
  227. [CommandProperty(AccessLevel.GameMaster)]
  228. public DateTime OwnerAbandonTime
  229. {
  230. get { return m_OwnerAbandonTime; }
  231. set { m_OwnerAbandonTime = value; }
  232. }
  233. #endregion
  234. public virtual double WeaponAbilityChance { get { return 0.4; } }
  235. public virtual WeaponAbility GetWeaponAbility()
  236. {
  237. return null;
  238. }
  239. public override int BasePhysicalResistance { get { return m_PhysicalResistance; } }
  240. public override int BaseFireResistance { get { return m_FireResistance; } }
  241. public override int BaseColdResistance { get { return m_ColdResistance; } }
  242. public override int BasePoisonResistance { get { return m_PoisonResistance; } }
  243. public override int BaseEnergyResistance { get { return m_EnergyResistance; } }
  244. [CommandProperty(AccessLevel.GameMaster)]
  245. public bool ShowNameTag { get { return m_ShowNameTag; } set { m_ShowNameTag = value; } }
  246. [CommandProperty(AccessLevel.GameMaster)]
  247. public bool SayingsEnabled { get { return m_SayingsEnabled; } set { m_SayingsEnabled = value; } }
  248. [CommandProperty(AccessLevel.GameMaster)]
  249. public int SayingsSecondsDelay { get { return m_SayingsSecondsDelay; } set { m_SayingsSecondsDelay = value; m_SayingsDelay = TimeSpan.FromSeconds(value); } }
  250. [CommandProperty(AccessLevel.GameMaster)]
  251. public string Saying1 { get { return m_Saying1; } set { m_Saying1 = value; } }
  252. [CommandProperty(AccessLevel.GameMaster)]
  253. public string Saying2 { get { return m_Saying2; } set { m_Saying2 = value; } }
  254. [CommandProperty(AccessLevel.GameMaster)]
  255. public string Saying3 { get { return m_Saying3; } set { m_Saying3 = value; } }
  256. [CommandProperty(AccessLevel.GameMaster)]
  257. public string Saying4 { get { return m_Saying4; } set { m_Saying4 = value; } }
  258. [CommandProperty(AccessLevel.GameMaster)]
  259. public string Saying5 { get { return m_Saying5; } set { m_Saying5 = value; } }
  260. [CommandProperty(AccessLevel.GameMaster)]
  261. public int PhysicalResistanceSeed { get { return m_PhysicalResistance; } set { m_PhysicalResistance = value; UpdateResistances(); } }
  262. [CommandProperty(AccessLevel.GameMaster)]
  263. public int FireResistSeed { get { return m_FireResistance; } set { m_FireResistance = value; UpdateResistances(); } }
  264. [CommandProperty(AccessLevel.GameMaster)]
  265. public int ColdResistSeed { get { return m_ColdResistance; } set { m_ColdResistance = value; UpdateResistances(); } }
  266. [CommandProperty(AccessLevel.GameMaster)]
  267. public int PoisonResistSeed { get { return m_PoisonResistance; } set { m_PoisonResistance = value; UpdateResistances(); } }
  268. [CommandProperty(AccessLevel.GameMaster)]
  269. public int EnergyResistSeed { get { return m_EnergyResistance; } set { m_EnergyResistance = value; UpdateResistances(); } }
  270. [CommandProperty(AccessLevel.GameMaster)]
  271. public int PhysicalDamage { get { return m_PhysicalDamage; } set { m_PhysicalDamage = value; } }
  272. [CommandProperty(AccessLevel.GameMaster)]
  273. public int FireDamage { get { return m_FireDamage; } set { m_FireDamage = value; } }
  274. [CommandProperty(AccessLevel.GameMaster)]
  275. public int ColdDamage { get { return m_ColdDamage; } set { m_ColdDamage = value; } }
  276. [CommandProperty(AccessLevel.GameMaster)]
  277. public int PoisonDamage { get { return m_PoisonDamage; } set { m_PoisonDamage = value; } }
  278. [CommandProperty(AccessLevel.GameMaster)]
  279. public int EnergyDamage { get { return m_EnergyDamage; } set { m_EnergyDamage = value; } }
  280. [CommandProperty(AccessLevel.GameMaster)]
  281. public LootPackLevel LootLevel { get { return m_LootLevel; } set { m_LootLevel = value; } }
  282. public virtual FoodType FavoriteFood { get { return FoodType.Meat; } }
  283. public virtual PackInstinct PackInstinct { get { return PackInstinct.None; } }
  284. public ArrayList Owners { get { return m_Owners; } }
  285. public virtual bool AllowMaleTamer { get { return true; } }
  286. public virtual bool AllowFemaleTamer { get { return true; } }
  287. public virtual bool SubdueBeforeTame { get { return false; } }
  288. public virtual bool Commandable { get { return true; } }
  289. public virtual Poison HitPoison { get { return null; } }
  290. public virtual double HitPoisonChance { get { return 0.5; } }
  291. public virtual Poison PoisonImmune { get { return null; } }
  292. public virtual bool BardImmune { get { return false; } }
  293. public virtual bool Unprovokable { get { return BardImmune || m_IsDeadPet; } }
  294. public virtual bool Uncalmable { get { return BardImmune || m_IsDeadPet; } }
  295. public virtual double DispelDifficulty { get { return 0.0; } } // at this skill level we dispel 50% chance
  296. public virtual double DispelFocus { get { return 20.0; } } // at difficulty - focus we have 0%, at difficulty + focus we have 100%
  297. #region Breath ability, like dragon fire breath
  298. private DateTime m_NextBreathTime;
  299. // Must be overriden in subclass to enable
  300. public virtual bool HasBreath { get { return false; } }
  301. // Base damage given is: CurrentHitPoints * BreathDamageScalar
  302. public virtual double BreathDamageScalar { get { return (Core.AOS ? 0.16 : 0.05); } }
  303. // Min/max seconds until next breath
  304. public virtual double BreathMinDelay { get { return 10.0; } }
  305. public virtual double BreathMaxDelay { get { return 15.0; } }
  306. // Creature stops moving for 1.0 seconds while breathing
  307. public virtual double BreathStallTime { get { return 1.0; } }
  308. // Effect is sent 1.3 seconds after BreathAngerSound and BreathAngerAnimation is played
  309. public virtual double BreathEffectDelay { get { return 1.3; } }
  310. // Damage is given 1.0 seconds after effect is sent
  311. public virtual double BreathDamageDelay { get { return 1.0; } }
  312. public virtual int BreathRange { get { return RangePerception; } }
  313. // Damage types
  314. public virtual int BreathPhysicalDamage { get { return 0; } }
  315. public virtual int BreathFireDamage { get { return 100; } }
  316. public virtual int BreathColdDamage { get { return 0; } }
  317. public virtual int BreathPoisonDamage { get { return 0; } }
  318. public virtual int BreathEnergyDamage { get { return 0; } }
  319. // Effect details and sound
  320. public virtual int BreathEffectItemID { get { return 0x36D4; } }
  321. public virtual int BreathEffectSpeed { get { return 5; } }
  322. public virtual int BreathEffectDuration { get { return 0; } }
  323. public virtual bool BreathEffectExplodes { get { return false; } }
  324. public virtual bool BreathEffectFixedDir { get { return false; } }
  325. public virtual int BreathEffectHue { get { return 0; } }
  326. public virtual int BreathEffectRenderMode { get { return 0; } }
  327. public virtual int BreathEffectSound { get { return 0x227; } }
  328. // Anger sound/animations
  329. public virtual int BreathAngerSound { get { return GetAngerSound(); } }
  330. public virtual int BreathAngerAnimation { get { return 12; } }
  331. public virtual void BreathStart(Mobile target)
  332. {
  333. BreathStallMovement();
  334. BreathPlayAngerSound();
  335. BreathPlayAngerAnimation();
  336. this.Direction = this.GetDirectionTo(target);
  337. Timer.DelayCall(TimeSpan.FromSeconds(BreathEffectDelay), new TimerStateCallback(BreathEffect_Callback), target);
  338. }
  339. public virtual void BreathStallMovement()
  340. {
  341. if (m_AI != null)
  342. m_AI.NextMove = DateTime.Now + TimeSpan.FromSeconds(BreathStallTime);
  343. }
  344. public virtual void BreathPlayAngerSound()
  345. {
  346. PlaySound(BreathAngerSound);
  347. }
  348. public virtual void BreathPlayAngerAnimation()
  349. {
  350. Animate(BreathAngerAnimation, 5, 1, true, false, 0);
  351. }
  352. public virtual void BreathEffect_Callback(object state)
  353. {
  354. Mobile target = (Mobile)state;
  355. if (!target.Alive || !CanBeHarmful(target))
  356. return;
  357. BreathPlayEffectSound();
  358. BreathPlayEffect(target);
  359. Timer.DelayCall(TimeSpan.FromSeconds(BreathDamageDelay), new TimerStateCallback(BreathDamage_Callback), target);
  360. }
  361. public virtual void BreathPlayEffectSound()
  362. {
  363. PlaySound(BreathEffectSound);
  364. }
  365. public virtual void BreathPlayEffect(Mobile target)
  366. {
  367. Effects.SendMovingEffect(this, target, BreathEffectItemID,
  368. BreathEffectSpeed, BreathEffectDuration, BreathEffectFixedDir,
  369. BreathEffectExplodes, BreathEffectHue, BreathEffectRenderMode);
  370. }
  371. public virtual void BreathDamage_Callback(object state)
  372. {
  373. Mobile target = (Mobile)state;
  374. if (CanBeHarmful(target))
  375. {
  376. DoHarmful(target);
  377. BreathDealDamage(target);
  378. }
  379. }
  380. public virtual void BreathDealDamage(Mobile target)
  381. {
  382. int physDamage = BreathPhysicalDamage;
  383. int fireDamage = BreathFireDamage;
  384. int coldDamage = BreathColdDamage;
  385. int poisDamage = BreathPoisonDamage;
  386. int nrgyDamage = BreathEnergyDamage;
  387. if (physDamage == 0 && fireDamage == 0 && coldDamage == 0 && poisDamage == 0 && nrgyDamage == 0)
  388. { // Unresistable damage even in AOS
  389. target.Damage(BreathComputeDamage(), this);
  390. }
  391. else
  392. {
  393. AOS.Damage(target, this, BreathComputeDamage(), physDamage, fireDamage, coldDamage, poisDamage, nrgyDamage);
  394. }
  395. }
  396. public virtual int BreathComputeDamage()
  397. {
  398. return (int)(Hits * BreathDamageScalar);
  399. }
  400. #endregion
  401. private DateTime m_EndFlee;
  402. public DateTime EndFleeTime
  403. {
  404. get { return m_EndFlee; }
  405. set { m_EndFlee = value; }
  406. }
  407. public virtual void StopFlee()
  408. {
  409. m_EndFlee = DateTime.MinValue;
  410. }
  411. public virtual bool CheckFlee()
  412. {
  413. if (m_EndFlee == DateTime.MinValue)
  414. return false;
  415. if (DateTime.Now >= m_EndFlee)
  416. {
  417. StopFlee();
  418. return false;
  419. }
  420. return true;
  421. }
  422. public virtual void BeginFlee(TimeSpan maxDuration)
  423. {
  424. m_EndFlee = DateTime.Now + maxDuration;
  425. }
  426. public BaseAI AIObject { get { return m_AI; } }
  427. public const int MaxOwners = 5;
  428. public virtual OppositionGroup OppositionGroup
  429. {
  430. get { return null; }
  431. }
  432. public virtual bool IsFriend(Mobile m)
  433. {
  434. OppositionGroup g = this.OppositionGroup;
  435. if (g != null && g.IsEnemy(this, m))
  436. return false;
  437. if (!(m is BaseCreature))
  438. return false;
  439. BaseCreature c = (BaseCreature)m;
  440. return (m_iTeam == c.m_iTeam && ((m_bSummoned || m_bControled) == (c.m_bSummoned || c.m_bControled)));
  441. }
  442. public virtual bool IsEnemy(Mobile m)
  443. {
  444. OppositionGroup g = this.OppositionGroup;
  445. if (g != null && g.IsEnemy(this, m))
  446. return true;
  447. if (m is BaseGuard)
  448. return false;
  449. if (!(m is BaseCreature))
  450. return true;
  451. BaseCreature c = (BaseCreature)m;
  452. return (m_iTeam != c.m_iTeam || ((m_bSummoned || m_bControled) != (c.m_bSummoned || c.m_bControled)));
  453. }
  454. public virtual bool CheckControlChance(Mobile m)
  455. {
  456. return CheckControlChance(m, 0.0);
  457. }
  458. public virtual bool CheckControlChance(Mobile m, double offset)
  459. {
  460. double v = GetControlChance(m) + offset;
  461. if (v > Utility.RandomDouble())
  462. return true;
  463. PlaySound(GetAngerSound());
  464. if (Body.IsAnimal)
  465. Animate(10, 5, 1, true, false, 0);
  466. else if (Body.IsMonster)
  467. Animate(18, 5, 1, true, false, 0);
  468. return false;
  469. }
  470. public virtual bool CanBeControlledBy(Mobile m)
  471. {
  472. return (GetControlChance(m) > 0.0);
  473. }
  474. public virtual double GetControlChance(Mobile m)
  475. {
  476. return 100;
  477. }
  478. private static Type[] m_AnimateDeadTypes = new Type[]
  479. {
  480. typeof( MoundOfMaggots ), typeof( HellSteed ), typeof( SkeletalMount ),
  481. typeof( WailingBanshee ), typeof( Wraith ), typeof( SkeletalDragon ),
  482. typeof( LichLord ), typeof( FleshGolem ), typeof( Lich ),
  483. typeof( SkeletalKnight ), typeof( BoneKnight ), typeof( Mummy2 ),
  484. typeof( SkeletalMage ), typeof( BoneMagi ), typeof( PatchworkSkeleton )
  485. };
  486. public virtual bool IsAnimatedDead
  487. {
  488. get
  489. {
  490. if (!Summoned)
  491. return false;
  492. Type type = this.GetType();
  493. bool contains = false;
  494. for (int i = 0; !contains && i < m_AnimateDeadTypes.Length; ++i)
  495. contains = (type == m_AnimateDeadTypes[i]);
  496. return contains;
  497. }
  498. }
  499. public override void Damage(int amount, Mobile from)
  500. {
  501. int oldHits = this.Hits;
  502. if (Spells.Necromancy.EvilOmenSpell.CheckEffect(this))
  503. amount = (int)(amount * 1.25);
  504. Mobile oath = Spells.Necromancy.BloodOathSpell.GetBloodOath(from);
  505. if (oath == this)
  506. {
  507. amount = (int)(amount * 1.1);
  508. from.Damage(amount, from);
  509. }
  510. base.Damage(amount, from);
  511. if (SubdueBeforeTame && !Controled)
  512. {
  513. if ((oldHits > (this.HitsMax / 10)) && (this.Hits <= (this.HitsMax / 10)))
  514. PublicOverheadMessage(MessageType.Regular, 0x3B2, false, "* The creature has been beaten into subjugation! *");
  515. }
  516. }
  517. public virtual bool DeleteCorpseOnDeath
  518. {
  519. get
  520. {
  521. return !Core.AOS && m_bSummoned;
  522. }
  523. }
  524. public override void SetLocation(Point3D newLocation, bool isTeleport)
  525. {
  526. base.SetLocation(newLocation, isTeleport);
  527. if (isTeleport && m_AI != null)
  528. m_AI.OnTeleported();
  529. }
  530. public override ApplyPoisonResult ApplyPoison(Mobile from, Poison poison)
  531. {
  532. if (!Alive || IsDeadPet)
  533. return ApplyPoisonResult.Immune;
  534. if (Spells.Necromancy.EvilOmenSpell.CheckEffect(this))
  535. return base.ApplyPoison(from, PoisonImpl.IncreaseLevel(poison));
  536. return base.ApplyPoison(from, poison);
  537. }
  538. public override bool CheckPoisonImmunity(Mobile from, Poison poison)
  539. {
  540. if (base.CheckPoisonImmunity(from, poison))
  541. return true;
  542. Poison p = this.PoisonImmune;
  543. return (p != null && p.Level >= poison.Level);
  544. }
  545. [CommandProperty(AccessLevel.GameMaster)]
  546. public PetLoyalty Loyalty
  547. {
  548. get
  549. {
  550. return m_Loyalty;
  551. }
  552. set
  553. {
  554. m_Loyalty = value;
  555. }
  556. }
  557. [CommandProperty(AccessLevel.GameMaster)]
  558. public WayPoint CurrentWayPoint
  559. {
  560. get
  561. {
  562. return m_CurrentWayPoint;
  563. }
  564. set
  565. {
  566. m_CurrentWayPoint = value;
  567. }
  568. }
  569. [CommandProperty(AccessLevel.GameMaster)]
  570. public Point2D TargetLocation
  571. {
  572. get
  573. {
  574. return m_TargetLocation;
  575. }
  576. set
  577. {
  578. m_TargetLocation = value;
  579. }
  580. }
  581. public virtual Mobile ConstantFocus { get { return null; } }
  582. public virtual bool DisallowAllMoves
  583. {
  584. get
  585. {
  586. return false;
  587. }
  588. }
  589. public virtual bool InitialInnocent
  590. {
  591. get
  592. {
  593. return false;
  594. }
  595. }
  596. public virtual bool AlwaysMurderer
  597. {
  598. get
  599. {
  600. return false;
  601. }
  602. }
  603. public virtual bool AlwaysAttackable
  604. {
  605. get
  606. {
  607. return false;
  608. }
  609. }
  610. [CommandProperty(AccessLevel.GameMaster)]
  611. public virtual int DamageMin { get { return m_DamageMin; } set { m_DamageMin = value; } }
  612. [CommandProperty(AccessLevel.GameMaster)]
  613. public virtual int DamageMax { get { return m_DamageMax; } set { m_DamageMax = value; } }
  614. [CommandProperty(AccessLevel.GameMaster)]
  615. public override int HitsMax
  616. {
  617. get
  618. {
  619. if (m_HitsMax >= 0)
  620. return m_HitsMax;
  621. return Str;
  622. }
  623. }
  624. [CommandProperty(AccessLevel.GameMaster)]
  625. public int HitsMaxSeed
  626. {
  627. get { return m_HitsMax; }
  628. set { m_HitsMax = value; }
  629. }
  630. [CommandProperty(AccessLevel.GameMaster)]
  631. public override int StamMax
  632. {
  633. get
  634. {
  635. if (m_StamMax >= 0)
  636. return m_StamMax;
  637. return Dex;
  638. }
  639. }
  640. [CommandProperty(AccessLevel.GameMaster)]
  641. public int StamMaxSeed
  642. {
  643. get { return m_StamMax; }
  644. set { m_StamMax = value; }
  645. }
  646. [CommandProperty(AccessLevel.GameMaster)]
  647. public override int ManaMax
  648. {
  649. get
  650. {
  651. if (m_ManaMax >= 0)
  652. return m_ManaMax;
  653. return Int;
  654. }
  655. }
  656. [CommandProperty(AccessLevel.GameMaster)]
  657. public int ManaMaxSeed
  658. {
  659. get { return m_ManaMax; }
  660. set { m_ManaMax = value; }
  661. }
  662. public Hashtable FearLove
  663. {
  664. get { return m_FearLove; }
  665. }
  666. public Hashtable Hate
  667. {
  668. get { return m_Hate; }
  669. }
  670. public virtual bool CanOpenDoors
  671. {
  672. get
  673. {
  674. return !this.Body.IsAnimal && !this.Body.IsSea;
  675. }
  676. }
  677. public virtual bool CanMoveOverObstacles
  678. {
  679. get
  680. {
  681. return this.Body.IsMonster;
  682. }
  683. }
  684. public virtual bool CanDestroyObstacles
  685. {
  686. get
  687. {
  688. // to enable breaking of furniture, 'return CanMoveOverObstacles;'
  689. return false;
  690. }
  691. }
  692. public override void OnDamage(int amount, Mobile from, bool willKill)
  693. {
  694. WeightOverloading.FatigueOnDamage(this, amount);
  695. InhumanSpeech speechType = this.SpeechType;
  696. if (speechType != null && !willKill)
  697. speechType.OnDamage(this, amount);
  698. base.OnDamage(amount, from, willKill);
  699. }
  700. public virtual void OnDamagedBySpell(Mobile from)
  701. {
  702. }
  703. public virtual void AlterDamageScalarFrom(Mobile caster, ref double scalar)
  704. {
  705. }
  706. public virtual void AlterDamageScalarTo(Mobile target, ref double scalar)
  707. {
  708. }
  709. public virtual void AlterMeleeDamageFrom(Mobile from, ref int damage)
  710. {
  711. }
  712. public virtual void AlterMeleeDamageTo(Mobile to, ref int damage)
  713. {
  714. }
  715. public virtual void CheckReflect(Mobile caster, ref bool reflect)
  716. {
  717. }
  718. public virtual void OnCarve(Mobile from, Corpse corpse)
  719. {
  720. int feathers = Feathers;
  721. int wool = Wool;
  722. int meat = Meat;
  723. int hides = Hides;
  724. int scales = Scales;
  725. if ((feathers == 0 && wool == 0 && meat == 0 && hides == 0 && scales == 0) || Summoned || IsBonded)
  726. {
  727. from.SendLocalizedMessage(500485); // You see nothing useful to carve from the corpse.
  728. }
  729. else
  730. {
  731. if (corpse.Map == Map.Felucca)
  732. {
  733. feathers *= 2;
  734. wool *= 2;
  735. hides *= 2;
  736. }
  737. new Blood(0x122D).MoveToWorld(corpse.Location, corpse.Map);
  738. if (feathers != 0)
  739. {
  740. corpse.DropItem(new Feather(feathers));
  741. from.SendLocalizedMessage(500479); // You pluck the bird. The feathers are now on the corpse.
  742. }
  743. if (wool != 0)
  744. {
  745. corpse.DropItem(new Wool(wool));
  746. from.SendLocalizedMessage(500483); // You shear it, and the wool is now on the corpse.
  747. }
  748. if (meat != 0)
  749. {
  750. if (MeatType == MeatType.Ribs)
  751. corpse.DropItem(new RawRibs(meat));
  752. else if (MeatType == MeatType.Bird)
  753. corpse.DropItem(new RawBird(meat));
  754. else if (MeatType == MeatType.LambLeg)
  755. corpse.DropItem(new RawLambLeg(meat));
  756. else if (MeatType == MeatType.Chicken)
  757. corpse.DropItem(new RawChickenLeg(meat));
  758. from.SendLocalizedMessage(500467); // You carve some meat, which remains on the corpse.
  759. }
  760. if (hides != 0)
  761. {
  762. if (HideType == HideType.Regular)
  763. corpse.DropItem(new Hides(hides));
  764. else if (HideType == HideType.Spined)
  765. corpse.DropItem(new SpinedHides(hides));
  766. else if (HideType == HideType.Horned)
  767. corpse.DropItem(new HornedHides(hides));
  768. else if (HideType == HideType.Barbed)
  769. corpse.DropItem(new BarbedHides(hides));
  770. from.SendLocalizedMessage(500471); // You skin it, and the hides are now in the corpse.
  771. }
  772. if (scales != 0)
  773. {
  774. ScaleType sc = this.ScaleType;
  775. switch (sc)
  776. {
  777. case ScaleType.Red: corpse.DropItem(new RedScales(scales)); break;
  778. case ScaleType.Yellow: corpse.DropItem(new YellowScales(scales)); break;
  779. case ScaleType.Black: corpse.DropItem(new BlackScales(scales)); break;
  780. case ScaleType.Green: corpse.DropItem(new GreenScales(scales)); break;
  781. case ScaleType.White: corpse.DropItem(new WhiteScales(scales)); break;
  782. case ScaleType.Blue: corpse.DropItem(new BlueScales(scales)); break;
  783. case ScaleType.All:
  784. {
  785. corpse.DropItem(new RedScales(scales));
  786. corpse.DropItem(new YellowScales(scales));
  787. corpse.DropItem(new BlackScales(scales));
  788. corpse.DropItem(new GreenScales(scales));
  789. corpse.DropItem(new WhiteScales(scales));
  790. corpse.DropItem(new BlueScales(scales));
  791. break;
  792. }
  793. }
  794. from.SendMessage("You cut away some scales, but they remain on the corpse.");
  795. }
  796. corpse.Carved = true;
  797. if (corpse.IsCriminalAction(from))
  798. from.CriminalAction(true);
  799. }
  800. }
  801. public const int DefaultRangePerception = 16;
  802. public const int OldRangePerception = 10;
  803. public BaseCreature(AIType ai,
  804. FightMode mode,
  805. int iRangePerception,
  806. int iRangeFight,
  807. double dActiveSpeed,
  808. double dPassiveSpeed)
  809. {
  810. if (iRangePerception == OldRangePerception)
  811. iRangePerception = DefaultRangePerception;
  812. m_Loyalty = PetLoyalty.WonderfullyHappy;
  813. m_CurrentAI = ai;
  814. m_DefaultAI = ai;
  815. m_iRangePerception = iRangePerception;
  816. m_iRangeFight = iRangeFight;
  817. m_FightMode = mode;
  818. m_iTeam = 0;
  819. SpeedInfo.GetSpeeds(this, ref dActiveSpeed, ref dPassiveSpeed);
  820. m_dActiveSpeed = dActiveSpeed;
  821. m_dPassiveSpeed = dPassiveSpeed;
  822. m_dCurrentSpeed = dPassiveSpeed;
  823. m_bDebugAI = false;
  824. m_arSpellAttack = new ArrayList();
  825. m_arSpellDefense = new ArrayList();
  826. m_bControled = false;
  827. m_ControlMaster = null;
  828. m_ControlTarget = null;
  829. m_ControlOrder = OrderType.None;
  830. m_bTamable = false;
  831. m_Owners = new ArrayList();
  832. m_NextReaquireTime = DateTime.Now + ReaquireDelay;
  833. ChangeAIType(AI);
  834. InhumanSpeech speechType = this.SpeechType;
  835. if (speechType != null)
  836. speechType.OnConstruct(this);
  837. GenerateLoot(true);
  838. }
  839. public BaseCreature(Serial serial)
  840. : base(serial)
  841. {
  842. m_arSpellAttack = new ArrayList();
  843. m_arSpellDefense = new ArrayList();
  844. m_bDebugAI = false;
  845. }
  846. public override void Serialize(GenericWriter writer)
  847. {
  848. base.Serialize(writer);
  849. writer.Write((int)17); // version
  850. writer.Write((int)m_LootLevel);
  851. writer.Write(Frozen);
  852. writer.Write(m_IsSystemInitialized);
  853. writer.Write(m_ShowNameTag);
  854. writer.Write(m_SayingsEnabled);
  855. writer.Write(m_SayingsSecondsDelay);
  856. writer.Write(m_Saying1);
  857. writer.Write(m_Saying2);
  858. writer.Write(m_Saying3);
  859. writer.Write(m_Saying4);
  860. writer.Write(m_Saying5);
  861. writer.Write((int)m_CurrentAI);
  862. writer.Write((int)m_DefaultAI);
  863. writer.Write((int)m_iRangePerception);
  864. writer.Write((int)m_iRangeFight);
  865. writer.Write((int)m_iTeam);
  866. writer.Write((double)m_dActiveSpeed);
  867. writer.Write((double)m_dPassiveSpeed);
  868. writer.Write((double)m_dCurrentSpeed);
  869. writer.Write((int)m_pHome.X);
  870. writer.Write((int)m_pHome.Y);
  871. writer.Write((int)m_pHome.Z);
  872. // Version 1
  873. writer.Write((int)m_iRangeHome);
  874. int i = 0;
  875. writer.Write((int)m_arSpellAttack.Count);
  876. for (i = 0; i < m_arSpellAttack.Count; i++)
  877. {
  878. writer.Write(m_arSpellAttack[i].ToString());
  879. }
  880. writer.Write((int)m_arSpellDefense.Count);
  881. for (i = 0; i < m_arSpellDefense.Count; i++)
  882. {
  883. writer.Write(m_arSpellDefense[i].ToString());
  884. }
  885. // Version 2
  886. writer.Write((int)m_FightMode);
  887. writer.Write((bool)m_bControled);
  888. writer.Write((Mobile)m_ControlMaster);
  889. writer.Write((Mobile)m_ControlTarget);
  890. writer.Write((Point3D)m_ControlDest);
  891. writer.Write((int)m_ControlOrder);
  892. writer.Write((double)m_dMinTameSkill);
  893. // Removed in version 9
  894. //writer.Write( (double) m_dMaxTameSkill );
  895. writer.Write((bool)m_bTamable);
  896. writer.Write((bool)m_bSummoned);
  897. if (m_bSummoned)
  898. writer.WriteDeltaTime(m_SummonEnd);
  899. writer.Write((int)m_iControlSlots);
  900. // Version 3
  901. writer.Write((int)m_Loyalty);
  902. // Version 4
  903. writer.Write(m_CurrentWayPoint);
  904. // Verison 5
  905. writer.Write(m_SummonMaster);
  906. // Version 6
  907. writer.Write((int)m_HitsMax);
  908. writer.Write((int)m_StamMax);
  909. writer.Write((int)m_ManaMax);
  910. writer.Write((int)m_DamageMin);
  911. writer.Write((int)m_DamageMax);
  912. // Version 7
  913. writer.Write((int)m_PhysicalResistance);
  914. writer.Write((int)m_PhysicalDamage);
  915. writer.Write((int)m_FireResistance);
  916. writer.Write((int)m_FireDamage);
  917. writer.Write((int)m_ColdResistance);
  918. writer.Write((int)m_ColdDamage);
  919. writer.Write((int)m_PoisonResistance);
  920. writer.Write((int)m_PoisonDamage);
  921. writer.Write((int)m_EnergyResistance);
  922. writer.Write((int)m_EnergyDamage);
  923. // Version 8
  924. writer.WriteMobileList(m_Owners, true);
  925. // Version 10
  926. writer.Write((bool)m_IsDeadPet);
  927. writer.Write((bool)m_IsBonded);
  928. writer.Write((DateTime)m_BondingBegin);
  929. writer.Write((DateTime)m_OwnerAbandonTime);
  930. // Version 11
  931. writer.Write((bool)m_HasGeneratedLoot);
  932. // Version 12
  933. writer.Write((int)Erudition);
  934. //// Version 13
  935. //writer.Write((int)m_FearLove.Count);
  936. //foreach (Mobile mobile in m_FearLove.Keys)
  937. //{
  938. // writer.Write((Mobile)mobile);
  939. // writer.Write((double)m_FearLove[mobile]);
  940. //}
  941. //writer.Write((int)m_Hate.Count);
  942. //foreach (Mobile mobile in m_Hate.Keys)
  943. //{
  944. // writer.Write((Mobile)mobile);
  945. // writer.Write((double)m_Hate[mobile]);
  946. //}
  947. }
  948. private static double[] m_StandardActiveSpeeds = new double[]
  949. {
  950. 0.175, 0.1, 0.15, 0.2, 0.25, 0.3, 0.4, 0.5, 0.6, 0.8
  951. };
  952. private static double[] m_StandardPassiveSpeeds = new double[]
  953. {
  954. 0.350, 0.2, 0.4, 0.5, 0.6, 0.8, 1.0, 1.2, 1.6, 2.0
  955. };
  956. public override void Deserialize(GenericReader reader)
  957. {
  958. base.Deserialize(reader);
  959. int version = reader.ReadInt();
  960. if (version >= 17)
  961. {
  962. m_LootLevel = (LootPackLevel)reader.ReadInt();
  963. }
  964. if (version >= 16)
  965. {
  966. Frozen = reader.ReadBool();
  967. }
  968. if (version >= 15)
  969. {
  970. m_IsSystemInitialized = reader.ReadBool();
  971. }
  972. if (version >= 14)
  973. {
  974. m_ShowNameTag = reader.ReadBool();
  975. }
  976. if (version >= 13)
  977. {
  978. m_SayingsEnabled = reader.ReadBool();
  979. m_SayingsSecondsDelay = reader.ReadInt();
  980. m_Saying1 = reader.ReadString();
  981. m_Saying2 = reader.ReadString();
  982. m_Saying3 = reader.ReadString();
  983. m_Saying4 = reader.ReadString();
  984. m_Saying5 = reader.ReadString();
  985. m_SayingsDelay = TimeSpan.FromSeconds(m_SayingsSecondsDelay);
  986. }
  987. m_CurrentAI = (AIType)reader.ReadInt();
  988. m_DefaultAI = (AIType)reader.ReadInt();
  989. m_iRangePerception = reader.ReadInt();
  990. m_iRangeFight = reader.ReadInt();
  991. m_iTeam = reader.ReadInt();
  992. m_dActiveSpeed = reader.ReadDouble();
  993. m_dPassiveSpeed = reader.ReadDouble();
  994. m_dCurrentSpeed = reader.ReadDouble();
  995. double activeSpeed = m_dActiveSpeed;
  996. double passiveSpeed = m_dPassiveSpeed;
  997. SpeedInfo.GetSpeeds(this, ref activeSpeed, ref passiveSpeed);
  998. bool isStandardActive = false;
  999. for (int i = 0; !isStandardActive && i < m_StandardActiveSpeeds.Length; ++i)
  1000. isStandardActive = (m_dActiveSpeed == m_StandardActiveSpeeds[i]);
  1001. bool isStandardPassive = false;
  1002. for (int i = 0; !isStandardPassive && i < m_StandardPassiveSpeeds.Length; ++i)
  1003. isStandardPassive = (m_dPassiveSpeed == m_StandardPassiveSpeeds[i]);
  1004. if (isStandardActive && m_dCurrentSpeed == m_dActiveSpeed)
  1005. m_dCurrentSpeed = activeSpeed;
  1006. else if (isStandardPassive && m_dCurrentSpeed == m_dPassiveSpeed)
  1007. m_dCurrentSpeed = passiveSpeed;
  1008. if (isStandardActive)
  1009. m_dActiveSpeed = activeSpeed;
  1010. if (isStandardPassive)
  1011. m_dPassiveSpeed = passiveSpeed;
  1012. if (m_iRangePerception == OldRangePerception)
  1013. m_iRangePerception = DefaultRangePerception;
  1014. m_pHome.X = reader.ReadInt();
  1015. m_pHome.Y = reader.ReadInt();
  1016. m_pHome.Z = reader.ReadInt();
  1017. if (version >= 1)
  1018. {
  1019. m_iRangeHome = reader.ReadInt();
  1020. int i, iCount;
  1021. iCount = reader.ReadInt();
  1022. for (i = 0; i < iCount; i++)
  1023. {
  1024. string str = reader.ReadString();
  1025. Type type = Type.GetType(str);
  1026. if (type != null)
  1027. {
  1028. m_arSpellAttack.Add(type);
  1029. }
  1030. }
  1031. iCount = reader.ReadInt();
  1032. for (i = 0; i < iCount; i++)
  1033. {
  1034. string str = reader.ReadString();
  1035. Type type = Type.GetType(str);
  1036. if (type != null)
  1037. {
  1038. m_arSpellDefense.Add(type);
  1039. }
  1040. }
  1041. }
  1042. else
  1043. {
  1044. m_iRangeHome = 0;
  1045. }
  1046. if (version >= 2)
  1047. {
  1048. m_FightMode = (FightMode)reader.ReadInt();
  1049. m_bControled = reader.ReadBool();
  1050. m_ControlMaster = reader.ReadMobile();
  1051. m_ControlTarget = reader.ReadMobile();
  1052. m_ControlDest = reader.ReadPoint3D();
  1053. m_ControlOrder = (OrderType)reader.ReadInt();
  1054. m_dMinTameSkill = reader.ReadDouble();
  1055. if (version < 9)
  1056. reader.ReadDouble();
  1057. m_bTamable = reader.ReadBool();
  1058. m_bSummoned = reader.ReadBool();
  1059. if (m_bSummoned)
  1060. {
  1061. m_SummonEnd = reader.ReadDeltaTime();
  1062. new UnsummonTimer(m_ControlMaster, this, m_SummonEnd - DateTime.Now).Start();
  1063. }
  1064. m_iControlSlots = reader.ReadInt();
  1065. }
  1066. else
  1067. {
  1068. m_FightMode = FightMode.Closest;
  1069. m_bControled = false;
  1070. m_ControlMaster = null;
  1071. m_ControlTarget = null;
  1072. m_ControlOrder = OrderType.None;
  1073. }
  1074. if (version >= 3)
  1075. m_Loyalty = (PetLoyalty)reader.ReadInt();
  1076. else
  1077. m_Loyalty = PetLoyalty.WonderfullyHappy;
  1078. if (version >= 4)
  1079. m_CurrentWayPoint = reader.ReadItem() as WayPoint;
  1080. if (version >= 5)
  1081. m_SummonMaster = reader.ReadMobile();
  1082. if (version >= 6)
  1083. {
  1084. m_HitsMax = reader.ReadInt();
  1085. m_StamMax = reader.ReadInt();
  1086. m_ManaMax = reader.ReadInt();
  1087. m_DamageMin = reader.ReadInt();
  1088. m_DamageMax = reader.ReadInt();
  1089. }
  1090. if (version >= 7)
  1091. {
  1092. m_PhysicalResistance = reader.ReadInt();
  1093. m_PhysicalDamage = reader.ReadInt();
  1094. m_FireResistance = reader.ReadInt();
  1095. m_FireDamage = reader.ReadInt();
  1096. m_ColdResistance = reader.ReadInt();
  1097. m_ColdDamage = reader.ReadInt();
  1098. m_PoisonResistance = reader.ReadInt();
  1099. m_PoisonDamage = reader.ReadInt();
  1100. m_EnergyResistance = reader.ReadInt();
  1101. m_EnergyDamage = reader.ReadInt();
  1102. }
  1103. if (version >= 8)
  1104. m_Owners = reader.ReadMobileList();
  1105. else
  1106. m_Owners = new ArrayList();
  1107. if (version >= 10)
  1108. {
  1109. m_IsDeadPet = reader.ReadBool();
  1110. m_IsBonded = reader.ReadBool();
  1111. m_BondingBegin = reader.ReadDateTime();
  1112. m_OwnerAbandonTime = reader.ReadDateTime();
  1113. }
  1114. if (version >= 11)
  1115. m_HasGeneratedLoot = reader.ReadBool();
  1116. else
  1117. m_HasGeneratedLoot = true;
  1118. if (version >= 12)
  1119. Erudition = reader.ReadInt();
  1120. else
  1121. Erudition = 0;
  1122. CheckStatTimers();
  1123. ChangeAIType(m_CurrentAI);
  1124. AddFollowers();
  1125. if (IsAnimatedDead)
  1126. Spells.Necromancy.AnimateDeadSpell.Register(m_SummonMaster, this);
  1127. }
  1128. #region Fonction ObjectPropertyList
  1129. public override void AddNameProperties(ObjectPropertyList list)
  1130. {
  1131. base.AddNameProperties(list);
  1132. if (Controled && Commandable)
  1133. {
  1134. if (Summoned)
  1135. list.Add(1049646); // (summoned)
  1136. else if (IsBonded)
  1137. list.Add(1049608); // (bonded)
  1138. else
  1139. list.Add(502006); // (tame)
  1140. }
  1141. }
  1142. public override void GetProperties(ObjectPropertyList list)
  1143. {
  1144. base.GetProperties(list);
  1145. }
  1146. protected int m_Erudition = 0;
  1147. [CommandProperty(AccessLevel.GameMaster)]
  1148. public int Erudition
  1149. {
  1150. get { return m_Erudition; }
  1151. set { m_Erudition = value; }
  1152. }
  1153. public override void SendPropertiesTo(Mobile from)
  1154. {
  1155. ObjectPropertyList opl = new ObjectPropertyList(this);
  1156. string name = Name;
  1157. if (from is RacePlayerMobile && (!(this is BaseVendor)))
  1158. {
  1159. RacePlayerMobile pmf = (RacePlayerMobile)from;
  1160. if (pmf.AccessLevel > AccessLevel.Player)
  1161. {
  1162. // SI GM
  1163. if (pmf.Capacities[CapacityName.Lore].Value < Erudition)
  1164. {//pas érudit
  1165. opl.Add(1050045, "{0} \t{1}\t {2}", "", "Créature", ""); // ~1_PREFIX~~2_NAME~~3_SUFFIX~
  1166. }
  1167. else
  1168. {//Assez érudit
  1169. opl.Add(1050045, "{0} \t{1}\t {2}", "", name, ""); // ~1_PREFIX~~2_NAME~~3_SUFFIX~
  1170. }
  1171. }
  1172. else
  1173. {
  1174. // SI PJ
  1175. if (pmf.Capacities[CapacityName.Lore].Value < Erudition)
  1176. {//pas érudit
  1177. opl.Add(1050045, "{0} \t{1}\t {2}", "", "Créature", ""); // ~1_PREFIX~~2_NAME~~3_SUFFIX~
  1178. }
  1179. else
  1180. {//Assez érudit
  1181. opl.Add(1050045, "{0} \t{1}\t {2}", "", name, ""); // ~1_PREFIX~~2_NAME~~3_SUFFIX~
  1182. }
  1183. }
  1184. }
  1185. //from.Send(opl);
  1186. base.SendPropertiesTo(from);
  1187. }
  1188. private static ArrayList m_Hears;
  1189. private static ArrayList m_OnSpeech;
  1190. private static bool m_NoSpeechLOS1;
  1191. [CommandProperty(AccessLevel.GameMaster)]
  1192. public static bool NoSpeechLOS1 { get { return m_NoSpeechLOS1; } set { m_NoSpeechLOS1 = value; } }
  1193. public override bool CanSee(Mobile m)
  1194. {
  1195. //SendPropertiesTo(this);
  1196. //SendPropertiesTo(m);
  1197. return base.CanSee(m);
  1198. }
  1199. public override void DoSpeech(string text, int[] keywords, MessageType type, int hue)
  1200. {
  1201. // base.DoSpeech(text, keywords, type, hue);
  1202. if (Commands.Handle(this, text))
  1203. return;
  1204. int range = 12;
  1205. switch (type)
  1206. {
  1207. case MessageType.Regular: this.SpeechHue = hue; break;
  1208. case MessageType.Emote: this.EmoteHue = hue; break;
  1209. case MessageType.Whisper: this.WhisperHue = hue; range = 2; break;
  1210. case MessageType.Yell:
  1211. this.YellHue = hue; range = 18;
  1212. range = 18;
  1213. break;
  1214. default: type = MessageType.Regular; break;
  1215. }
  1216. SpeechEventArgs regArgs = new SpeechEventArgs(this, text, type, hue, keywords);
  1217. EventSink.InvokeSpeech(regArgs);
  1218. this…

Large files files are truncated, but you can click here to view the full file