PageRenderTime 105ms CodeModel.GetById 23ms RepoModel.GetById 1ms app.codeStats 1ms

/CoreNew/Server/Mobile.cs

https://bitbucket.org/Kel/crepuscule
C# | 9790 lines | 8788 code | 821 blank | 181 comment | 1936 complexity | 95deb2282523021adef688f83ac1f495 MD5 | raw file
  1. namespace Server
  2. {
  3. using Server.Accounting;
  4. using Server.ContextMenus;
  5. using Server.Guilds;
  6. using Server.Gumps;
  7. using Server.HuePickers;
  8. using Server.Items;
  9. using Server.Menus;
  10. using Server.Mobiles;
  11. using Server.Movement;
  12. using Server.Network;
  13. using Server.Prompts;
  14. using Server.Targeting;
  15. using System;
  16. using System.Collections;
  17. using System.Runtime.InteropServices;
  18. using System.Text;
  19. using System.Collections.Generic;
  20. public delegate bool AllowBeneficialHandler(Mobile from, Mobile target);
  21. public delegate bool AllowHarmfulHandler(Mobile from, Mobile target);
  22. public class Mobile : IEntity, IPoint3D, IPoint2D, IHued
  23. {
  24. internal int m_TypeRef;
  25. private Server.AccessLevel m_AccessLevel;
  26. private static string[] m_AccessLevelNames = new string[] { "a player", "a counselor", "a game master", "a seer", "an administrator" };
  27. private IAccount m_Account;
  28. private static TimeSpan m_ActionMessageDelay = TimeSpan.FromSeconds(0.125);
  29. private ArrayList m_Actions;
  30. private ArrayList m_Aggressed;
  31. private ArrayList m_Aggressors;
  32. private static Server.AllowBeneficialHandler m_AllowBeneficialHandler;
  33. private int m_AllowedStealthSteps;
  34. private static Server.AllowHarmfulHandler m_AllowHarmfulHandler;
  35. private static bool m_AsciiClickMessage = true;
  36. private static TimeSpan m_AutoManifestTimeout = TimeSpan.FromSeconds(5.0);
  37. private Timer m_AutoManifestTimer;
  38. private bool m_AutoPageNotify;
  39. private int m_BAC;
  40. private Container m_Backpack;
  41. private Server.Items.BankBox m_BankBox;
  42. private int m_BaseSoundID;
  43. private bool m_Blessed;
  44. private Server.Body m_Body;
  45. private Server.Body m_BodyMod;
  46. private static int m_BodyWeight = 14;
  47. private bool m_CanHearGhosts;
  48. private bool m_CanSwim;
  49. private bool m_CantWalk;
  50. private int m_ChangingCombatant;
  51. private Mobile m_Combatant;
  52. private Timer m_CombatTimer;
  53. private Server.ContextMenus.ContextMenu m_ContextMenu;
  54. private Container m_Corpse;
  55. private static Server.CreateCorpseHandler m_CreateCorpse;
  56. private DateTime m_CreationTime;
  57. private bool m_Criminal;
  58. private ArrayList m_DamageEntries;
  59. private static TimeSpan m_DefaultHitsRate;
  60. private static TimeSpan m_DefaultManaRate;
  61. private static TimeSpan m_DefaultStamRate;
  62. private static IWeapon m_DefaultWeapon;
  63. private bool m_Deleted;
  64. private MobileDelta m_DeltaFlags;
  65. private static Queue m_DeltaQueue = new Queue();
  66. private int m_Dex;
  67. private StatLockType m_DexLock;
  68. private Server.Direction m_Direction;
  69. private static bool m_DisableDismountInWarmode;
  70. private static bool m_DisableHiddenSelfClick = true;
  71. private bool m_DisarmReady;
  72. private bool m_DisplayGuildTitle;
  73. private static bool m_DragEffects = true;
  74. private int m_EmoteHue;
  75. private DateTime m_EndQueue;
  76. private Timer m_ExpireAggrTimer;
  77. private Timer m_ExpireCombatant;
  78. private Timer m_ExpireCriminal;
  79. private static TimeSpan m_ExpireCriminalDelay = TimeSpan.FromMinutes(2.0);
  80. private int m_Fame;
  81. private bool m_Female;
  82. private int m_Followers;
  83. private int m_FollowersMax;
  84. private bool m_Frozen;
  85. private FrozenTimer m_FrozenTimer;
  86. private static Server.AccessLevel m_FwdAccessOverride = Server.AccessLevel.GameMaster;
  87. private static bool m_FwdEnabled = true;
  88. private static int m_FwdMaxSteps = 4;
  89. private static bool m_FwdUOTDOverride = false;
  90. private static char[] m_GhostChars = new char[] { 'o', 'O' };
  91. private static object m_GhostMutateContext = new object();
  92. private BaseGuild m_Guild;
  93. private static bool m_GuildClickMessage = true;
  94. private Mobile m_GuildFealty;
  95. private string m_GuildTitle;
  96. private static string[] m_GuildTypes = new string[] { "", " (Chaos)", " (Order)" };
  97. private static ArrayList m_Hears;
  98. private bool m_Hidden;
  99. private int m_Hits;
  100. private static RegenRateHandler m_HitsRegenRate;
  101. private Timer m_HitsTimer;
  102. private Item m_Holding;
  103. private int m_Hue;
  104. private int m_HueMod;
  105. private int m_Hunger;
  106. private bool m_InDeltaQueue;
  107. private static bool m_InsuranceEnabled;
  108. private int m_Int;
  109. private StatLockType m_IntLock;
  110. private static int[] m_InvalidBodies = new int[] { 0x20, 0x5f, 0x9c, 0xa9, 0xc4, 0xc5, 0xc6, 0xc7 };
  111. private ArrayList m_Items;
  112. private int m_Karma;
  113. private int m_Kills;
  114. private string m_Language;
  115. private Mobile m_LastKiller;
  116. private DateTime m_LastMoveTime;
  117. private DateTime m_LastStatGain;
  118. private int m_LightLevel;
  119. private Point3D m_Location;
  120. private Point3D m_LogoutLocation;
  121. private Server.Map m_LogoutMap;
  122. private Timer m_LogoutTimer;
  123. private int m_MagicDamageAbsorb;
  124. private int m_Mana;
  125. private static RegenRateHandler m_ManaRegenRate;
  126. private Timer m_ManaTimer;
  127. private Server.Map m_Map;
  128. private static int m_MaxPlayerResistance = 70;
  129. private bool m_Meditating;
  130. private int m_MeleeDamageAbsorb;
  131. private Item m_MountItem;
  132. private static ArrayList m_MoveList = new ArrayList();
  133. private Queue m_MoveRecords;
  134. private static MobileMoving[] m_MovingPacketCache = new MobileMoving[8];
  135. private string m_Name;
  136. protected string m_RealName;
  137. private int m_NameHue;
  138. private string m_NameMod;
  139. private Server.Network.NetState m_NetState;
  140. private DateTime m_NextActionMessage;
  141. private DateTime m_NextActionTime;
  142. private DateTime m_NextCombatTime;
  143. private DateTime m_NextSkillTime;
  144. private DateTime m_NextSpellTime;
  145. private DateTime m_NextWarmodeChange;
  146. private static bool m_NoSpeechLOS;
  147. private static ArrayList m_OnSpeech;
  148. private Packet m_OPLPacket;
  149. private bool m_Paralyzed;
  150. private ParalyzedTimer m_ParaTimer;
  151. private object m_Party;
  152. private bool m_Player;
  153. private Server.Poison m_Poison;
  154. private Timer m_PoisonTimer;
  155. private string m_Profile;
  156. private bool m_ProfileLocked;
  157. private Server.Prompts.Prompt m_Prompt;
  158. private ObjectPropertyList m_PropertyList;
  159. private bool m_Pushing;
  160. private Server.QuestArrow m_QuestArrow;
  161. private Server.Region m_Region;
  162. private Packet m_RemovePacket;
  163. private int[] m_Resistances;
  164. private ArrayList m_ResistMods;
  165. private static TimeSpan m_RunFoot = TimeSpan.FromSeconds(0.2);
  166. private static TimeSpan m_RunMount = TimeSpan.FromSeconds(0.1);
  167. private Server.Serial m_Serial;
  168. private int m_ShortTermMurders;
  169. private static Server.SkillCheckDirectLocationHandler m_SkillCheckDirectLocationHandler;
  170. private static Server.SkillCheckDirectTargetHandler m_SkillCheckDirectTargetHandler;
  171. private static Server.SkillCheckLocationHandler m_SkillCheckLocationHandler;
  172. private static Server.SkillCheckTargetHandler m_SkillCheckTargetHandler;
  173. private ArrayList m_SkillMods;
  174. private Server.Skills m_Skills;
  175. private int m_SolidHueOverride;
  176. private int m_SpeechHue;
  177. private ISpell m_Spell;
  178. private bool m_Squelched;
  179. private ArrayList m_Stabled;
  180. private int m_Stam;
  181. private static RegenRateHandler m_StamRegenRate;
  182. private Timer m_StamTimer;
  183. private int m_StatCap;
  184. private ArrayList m_StatMods;
  185. private int m_Str;
  186. private StatLockType m_StrLock;
  187. private DateTime[] m_StuckMenuUses;
  188. private bool m_StunReady;
  189. private Server.Targeting.Target m_Target;
  190. private bool m_TargetLocked;
  191. private int m_Thirst;
  192. private int m_TithingPoints;
  193. private string m_Title;
  194. private int m_TotalGold;
  195. private int m_TotalWeight;
  196. private int m_VirtualArmor;
  197. private int m_VirtualArmorMod;
  198. private VirtueInfo m_Virtues;
  199. private static Server.VisibleDamageType m_VisibleDamageType;
  200. private static TimeSpan m_WalkFoot = TimeSpan.FromSeconds(0.4);
  201. private static TimeSpan m_WalkMount = TimeSpan.FromSeconds(0.2);
  202. private bool m_Warmode;
  203. private int m_WarmodeChanges;
  204. private WarmodeTimer m_WarmodeTimer;
  205. private IWeapon m_Weapon;
  206. private int m_WhisperHue;
  207. private int m_YellHue;
  208. private bool m_YellowHealthbar;
  209. private const int WarmodeCatchCount = 4;
  210. private static TimeSpan WarmodeSpamCatch = TimeSpan.FromSeconds(0.5);
  211. private static TimeSpan WarmodeSpamDelay = TimeSpan.FromSeconds(2.0);
  212. #region RunUO 2 Stuff
  213. // Pre-7.0.0.0 Packet Flags
  214. public virtual int GetOldPacketFlags()
  215. {
  216. int flags = 0x0;
  217. if (m_Female)
  218. flags |= 0x02;
  219. if (m_Poison != null)
  220. flags |= 0x04;
  221. if (m_Blessed || m_YellowHealthbar)
  222. flags |= 0x08;
  223. if (m_Warmode)
  224. flags |= 0x40;
  225. if (m_Hidden)
  226. flags |= 0x80;
  227. return flags;
  228. }
  229. #region Hair
  230. private HairInfo m_Hair;
  231. private FacialHairInfo m_FacialHair;
  232. public void ConvertHair()
  233. {
  234. Item hair;
  235. if ((hair = FindItemOnLayer(Layer.Hair)) != null)
  236. {
  237. HairItemID = hair.ItemID;
  238. HairHue = hair.Hue;
  239. hair.Delete();
  240. }
  241. if ((hair = FindItemOnLayer(Layer.FacialHair)) != null)
  242. {
  243. FacialHairItemID = hair.ItemID;
  244. FacialHairHue = hair.Hue;
  245. hair.Delete();
  246. }
  247. }
  248. [CommandProperty(AccessLevel.GameMaster)]
  249. public int HairItemID
  250. {
  251. get
  252. {
  253. if (m_Hair == null)
  254. return 0;
  255. return m_Hair.ItemID;
  256. }
  257. set
  258. {
  259. if (m_Hair == null && value > 0)
  260. m_Hair = new HairInfo(value);
  261. else if (value <= 0)
  262. m_Hair = null;
  263. else
  264. m_Hair.ItemID = value;
  265. Delta(MobileDelta.Hair);
  266. }
  267. }
  268. // [CommandProperty( AccessLevel.GameMaster )]
  269. // public int HairSerial { get { return HairInfo.FakeSerial( this ); } }
  270. [CommandProperty(AccessLevel.GameMaster)]
  271. public int FacialHairItemID
  272. {
  273. get
  274. {
  275. if (m_FacialHair == null)
  276. return 0;
  277. return m_FacialHair.ItemID;
  278. }
  279. set
  280. {
  281. if (m_FacialHair == null && value > 0)
  282. m_FacialHair = new FacialHairInfo(value);
  283. else if (value <= 0)
  284. m_FacialHair = null;
  285. else
  286. m_FacialHair.ItemID = value;
  287. Delta(MobileDelta.FacialHair);
  288. }
  289. }
  290. // [CommandProperty( AccessLevel.GameMaster )]
  291. // public int FacialHairSerial { get { return FacialHairInfo.FakeSerial( this ); } }
  292. [CommandProperty(AccessLevel.GameMaster)]
  293. public int HairHue
  294. {
  295. get
  296. {
  297. if (m_Hair == null)
  298. return 0;
  299. return m_Hair.Hue;
  300. }
  301. set
  302. {
  303. if (m_Hair != null)
  304. {
  305. m_Hair.Hue = value;
  306. Delta(MobileDelta.Hair);
  307. }
  308. }
  309. }
  310. [CommandProperty(AccessLevel.GameMaster)]
  311. public int FacialHairHue
  312. {
  313. get
  314. {
  315. if (m_FacialHair == null)
  316. return 0;
  317. return m_FacialHair.Hue;
  318. }
  319. set
  320. {
  321. if (m_FacialHair != null)
  322. {
  323. m_FacialHair.Hue = value;
  324. Delta(MobileDelta.FacialHair);
  325. }
  326. }
  327. }
  328. #endregion
  329. public void ClearProperties()
  330. {
  331. Packet.Release(ref m_PropertyList);
  332. Packet.Release(ref m_OPLPacket);
  333. }
  334. public virtual void GetChildNameProperties(ObjectPropertyList list, Item item)
  335. {
  336. }
  337. public virtual void UpdateTotal(Item sender, TotalType type, int delta)
  338. {
  339. if (delta == 0 || sender.IsVirtualItem)
  340. return;
  341. switch (type)
  342. {
  343. case TotalType.Gold:
  344. m_TotalGold += delta;
  345. Delta(MobileDelta.Gold);
  346. break;
  347. case TotalType.Items:
  348. //m_TotalItems += delta;
  349. break;
  350. case TotalType.Weight:
  351. m_TotalWeight += delta;
  352. Delta(MobileDelta.Weight);
  353. OnWeightChange(m_TotalWeight - delta);
  354. break;
  355. }
  356. }
  357. public virtual void OnItemBounceCleared(Item item)
  358. {
  359. }
  360. public virtual void OnSubItemBounceCleared( Item item )
  361. {
  362. }
  363. public static Item LiftItemDupe(Item oldItem, int amount)
  364. {
  365. Item item;
  366. try
  367. {
  368. item = (Item)Activator.CreateInstance(oldItem.GetType());
  369. }
  370. catch
  371. {
  372. Console.WriteLine("Warning: 0x{0:X}: Item must have a zero paramater constructor to be separated from a stack. '{1}'.", oldItem.Serial.Value, oldItem.GetType().Name);
  373. return null;
  374. }
  375. item.Visible = oldItem.Visible;
  376. item.Movable = oldItem.Movable;
  377. item.LootType = oldItem.LootType;
  378. item.Direction = oldItem.Direction;
  379. item.Hue = oldItem.Hue;
  380. item.ItemID = oldItem.ItemID;
  381. item.Location = oldItem.Location;
  382. item.Layer = oldItem.Layer;
  383. item.Name = oldItem.Name;
  384. item.Weight = oldItem.Weight;
  385. item.Amount = oldItem.Amount - amount;
  386. item.Map = oldItem.Map;
  387. oldItem.Amount = amount;
  388. oldItem.OnAfterDuped(item);
  389. if (oldItem.Parent is Mobile)
  390. {
  391. ((Mobile)oldItem.Parent).AddItem(item);
  392. }
  393. else if (oldItem.Parent is Item)
  394. {
  395. ((Item)oldItem.Parent).AddItem(item);
  396. }
  397. item.Delta(ItemDelta.Update);
  398. return item;
  399. }
  400. #endregion
  401. public Mobile()
  402. {
  403. this.m_NameHue = -1;
  404. this.m_WarmodeChanges = 0;
  405. this.m_SkillMods = new ArrayList(1);
  406. this.m_HueMod = -1;
  407. this.m_SolidHueOverride = -1;
  408. this.m_Region = Server.Map.Internal.DefaultRegion;
  409. this.m_Serial = Server.Serial.NewMobile;
  410. this.DefaultMobileInit();
  411. World.AddMobile(this);
  412. Type ourType = this.GetType();
  413. m_TypeRef = World.m_MobileTypes.IndexOf(ourType);
  414. if (m_TypeRef == -1)
  415. m_TypeRef = World.m_MobileTypes.Add(ourType);
  416. }
  417. public Mobile(Server.Serial serial)
  418. {
  419. this.m_NameHue = -1;
  420. this.m_WarmodeChanges = 0;
  421. this.m_SkillMods = new ArrayList(1);
  422. this.m_HueMod = -1;
  423. this.m_SolidHueOverride = -1;
  424. this.m_Region = Server.Map.Internal.DefaultRegion;
  425. this.m_Serial = serial;
  426. this.m_ExpireCombatant = new ExpireCombatantTimer(this);
  427. this.m_ExpireCriminal = new ExpireCriminalTimer(this);
  428. this.m_CombatTimer = new CombatTimer(this);
  429. this.m_Aggressors = new ArrayList(1);
  430. this.m_Aggressed = new ArrayList(1);
  431. this.m_NextSkillTime = DateTime.MinValue;
  432. this.m_DamageEntries = new ArrayList(1);
  433. this.m_LogoutTimer = new LogoutTimer(this);
  434. Type ourType = this.GetType();
  435. m_TypeRef = World.m_MobileTypes.IndexOf(ourType);
  436. if (m_TypeRef == -1)
  437. m_TypeRef = World.m_MobileTypes.Add(ourType);
  438. }
  439. public void AddItem(Item item)
  440. {
  441. if (((item != null) && !item.Deleted) && (item.Parent != this))
  442. {
  443. if (item.Parent is Mobile)
  444. {
  445. ((Mobile) item.Parent).RemoveItem(item);
  446. }
  447. else if (item.Parent is Item)
  448. {
  449. ((Item) item.Parent).RemoveItem(item);
  450. }
  451. else
  452. {
  453. item.SendRemovePacket();
  454. }
  455. item.Parent = this;
  456. item.Map = this.m_Map;
  457. this.m_Items.Add(item);
  458. if (!(item is Server.Items.BankBox))
  459. {
  460. this.TotalWeight += item.TotalWeight + item.PileWeight;
  461. this.TotalGold += item.TotalGold;
  462. }
  463. item.Delta(ItemDelta.Update);
  464. item.OnAdded(this);
  465. this.OnItemAdded(item);
  466. if (((item.PhysicalResistance != 0) || (item.FireResistance != 0)) || (((item.ColdResistance != 0) || (item.PoisonResistance != 0)) || (item.EnergyResistance != 0)))
  467. {
  468. this.UpdateResistances();
  469. }
  470. }
  471. }
  472. public virtual void AddNameProperties(ObjectPropertyList list)
  473. {
  474. string name = this.Name;
  475. if (name == null)
  476. {
  477. name = string.Empty;
  478. }
  479. string str2 = "";
  480. if ((this.ShowFameTitle && (this.m_Player || this.m_Body.IsHuman)) && (this.m_Fame >= 0x2710))
  481. {
  482. str2 = this.m_Female ? "Lady" : "Lord";
  483. }
  484. string title = "";
  485. if ((this.ClickTitle && (this.Title != null)) && (this.Title.Length > 0))
  486. {
  487. title = this.Title;
  488. }
  489. BaseGuild guild = this.m_Guild;
  490. if ((guild != null) && (this.m_Player || this.m_DisplayGuildTitle))
  491. {
  492. if (title.Length > 0)
  493. {
  494. title = string.Format("{0} [{1}]", title, Utility.FixHtml(guild.Abbreviation));
  495. }
  496. else
  497. {
  498. title = string.Format("[{0}]", Utility.FixHtml(guild.Abbreviation));
  499. }
  500. }
  501. list.Add(0x1005bd, "{0} \t{1}\t {2}", str2, name, title);
  502. if ((guild != null) && (this.m_DisplayGuildTitle || (this.m_Player && (guild.Type != GuildType.None))))
  503. {
  504. string str4;
  505. if ((guild.Type >= GuildType.None) && ((int)guild.Type < m_GuildTypes.Length))
  506. {
  507. str4 = m_GuildTypes[(int) guild.Type];
  508. }
  509. else
  510. {
  511. str4 = "";
  512. }
  513. string guildTitle = this.GuildTitle;
  514. if (guildTitle == null)
  515. {
  516. guildTitle = "";
  517. }
  518. else
  519. {
  520. guildTitle = guildTitle.Trim();
  521. }
  522. if (guildTitle.Length > 0)
  523. {
  524. list.Add("{0}, {1} Guild{2}", Utility.FixHtml(guildTitle), Utility.FixHtml(guild.Name), str4);
  525. }
  526. else
  527. {
  528. list.Add(Utility.FixHtml(guild.Name));
  529. }
  530. }
  531. }
  532. public virtual void AddResistanceMod(ResistanceMod toAdd)
  533. {
  534. if (this.m_ResistMods == null)
  535. {
  536. this.m_ResistMods = new ArrayList(2);
  537. }
  538. this.m_ResistMods.Add(toAdd);
  539. this.UpdateResistances();
  540. }
  541. public virtual void AddSkillMod(SkillMod mod)
  542. {
  543. if (mod != null)
  544. {
  545. this.ValidateSkillMods();
  546. if (!this.m_SkillMods.Contains(mod))
  547. {
  548. this.m_SkillMods.Add(mod);
  549. mod.Owner = this;
  550. Skill skill = this.m_Skills[mod.Skill];
  551. if (skill != null)
  552. {
  553. skill.Update();
  554. }
  555. }
  556. }
  557. }
  558. private void AddSpeechItemsFrom(ArrayList list, Container cont)
  559. {
  560. for (int i = 0; i < cont.Items.Count; i++)
  561. {
  562. Item item = (Item) cont.Items[i];
  563. if (item.HandlesOnSpeech)
  564. {
  565. list.Add(item);
  566. }
  567. if (item is Container)
  568. {
  569. this.AddSpeechItemsFrom(list, (Container) item);
  570. }
  571. }
  572. }
  573. public void AddStatMod(StatMod mod)
  574. {
  575. for (int i = 0; i < this.m_StatMods.Count; i++)
  576. {
  577. StatMod mod2 = (StatMod) this.m_StatMods[i];
  578. if (mod2.Name == mod.Name)
  579. {
  580. this.Delta(MobileDelta.Stat);
  581. this.m_StatMods.RemoveAt(i);
  582. break;
  583. }
  584. }
  585. this.m_StatMods.Add(mod);
  586. this.Delta(MobileDelta.Stat);
  587. this.CheckStatTimers();
  588. }
  589. public bool AddToBackpack(Item item)
  590. {
  591. if (item.Deleted)
  592. {
  593. return false;
  594. }
  595. if (!this.PlaceInBackpack(item))
  596. {
  597. item.MoveToWorld(this.Location, this.Map);
  598. return false;
  599. }
  600. return true;
  601. }
  602. public virtual void AggressiveAction(Mobile aggressor)
  603. {
  604. this.AggressiveAction(aggressor, false);
  605. }
  606. public virtual void AggressiveAction(Mobile aggressor, bool criminal)
  607. {
  608. if (aggressor != this)
  609. {
  610. AggressiveActionEventArgs e = AggressiveActionEventArgs.Create(this, aggressor, criminal);
  611. EventSink.InvokeAggressiveAction(e);
  612. e.Free();
  613. if (this.Combatant == aggressor)
  614. {
  615. this.m_ExpireCombatant.Stop();
  616. this.m_ExpireCombatant.Start();
  617. }
  618. bool flag = true;
  619. ArrayList aggressors = this.m_Aggressors;
  620. for (int i = 0; i < aggressors.Count; i++)
  621. {
  622. AggressorInfo info = (AggressorInfo) aggressors[i];
  623. if (info.Attacker == aggressor)
  624. {
  625. info.Refresh();
  626. info.CriminalAggression = criminal;
  627. info.CanReportMurder = criminal;
  628. flag = false;
  629. }
  630. }
  631. aggressors = aggressor.m_Aggressors;
  632. for (int j = 0; j < aggressors.Count; j++)
  633. {
  634. AggressorInfo info2 = (AggressorInfo) aggressors[j];
  635. if (info2.Attacker == this)
  636. {
  637. info2.Refresh();
  638. flag = false;
  639. }
  640. }
  641. bool flag2 = true;
  642. aggressors = this.m_Aggressed;
  643. for (int k = 0; k < aggressors.Count; k++)
  644. {
  645. AggressorInfo info3 = (AggressorInfo) aggressors[k];
  646. if (info3.Defender == aggressor)
  647. {
  648. info3.Refresh();
  649. flag2 = false;
  650. }
  651. }
  652. aggressors = aggressor.m_Aggressed;
  653. for (int m = 0; m < aggressors.Count; m++)
  654. {
  655. AggressorInfo info4 = (AggressorInfo) aggressors[m];
  656. if (info4.Defender == this)
  657. {
  658. info4.Refresh();
  659. info4.CriminalAggression = criminal;
  660. info4.CanReportMurder = criminal;
  661. flag2 = false;
  662. }
  663. }
  664. bool flag3 = false;
  665. if (flag)
  666. {
  667. this.m_Aggressors.Add(AggressorInfo.Create(aggressor, this, criminal));
  668. if (this.CanSee(aggressor) && (this.m_NetState != null))
  669. {
  670. this.m_NetState.Send(new MobileIncoming(this, aggressor));
  671. }
  672. if (this.Combatant == null)
  673. {
  674. flag3 = true;
  675. }
  676. this.UpdateAggrExpire();
  677. }
  678. if (flag2)
  679. {
  680. aggressor.m_Aggressed.Add(AggressorInfo.Create(aggressor, this, criminal));
  681. if (this.CanSee(aggressor) && (this.m_NetState != null))
  682. {
  683. this.m_NetState.Send(new MobileIncoming(this, aggressor));
  684. }
  685. if (this.Combatant == null)
  686. {
  687. flag3 = true;
  688. }
  689. this.UpdateAggrExpire();
  690. }
  691. if (flag3)
  692. {
  693. this.Combatant = aggressor;
  694. }
  695. this.Region.OnAggressed(aggressor, this, criminal);
  696. }
  697. }
  698. public virtual bool AllowItemUse(Item item)
  699. {
  700. return true;
  701. }
  702. public virtual bool AllowSkillUse(SkillName name)
  703. {
  704. return true;
  705. }
  706. public virtual void Animate(int action, int frameCount, int repeatCount, bool forward, bool repeat, int delay)
  707. {
  708. Server.Map map = this.m_Map;
  709. if (map != null)
  710. {
  711. this.ProcessDelta();
  712. Packet p = null;
  713. IPooledEnumerable clientsInRange = map.GetClientsInRange(this.m_Location);
  714. foreach (Server.Network.NetState state in clientsInRange)
  715. {
  716. if (state.Mobile.CanSee(this))
  717. {
  718. state.Mobile.ProcessDelta();
  719. if (p == null)
  720. {
  721. p = new MobileAnimation(this, action, frameCount, repeatCount, forward, repeat, delay);
  722. }
  723. state.Send(p);
  724. }
  725. }
  726. clientsInRange.Free();
  727. }
  728. }
  729. public virtual ApplyPoisonResult ApplyPoison(Mobile from, Server.Poison poison)
  730. {
  731. if (poison == null)
  732. {
  733. this.CurePoison(from);
  734. return ApplyPoisonResult.Cured;
  735. }
  736. if (this.CheckHigherPoison(from, poison))
  737. {
  738. this.OnHigherPoison(from, poison);
  739. return ApplyPoisonResult.HigherPoisonActive;
  740. }
  741. if (this.CheckPoisonImmunity(from, poison))
  742. {
  743. this.OnPoisonImmunity(from, poison);
  744. return ApplyPoisonResult.Immune;
  745. }
  746. Server.Poison oldPoison = this.m_Poison;
  747. this.Poison = poison;
  748. this.OnPoisoned(from, poison, oldPoison);
  749. return ApplyPoisonResult.Poisoned;
  750. }
  751. public virtual void Attack(Mobile m)
  752. {
  753. if (this.CheckAttack(m))
  754. {
  755. this.Combatant = m;
  756. }
  757. }
  758. public bool BeginAction(object toLock)
  759. {
  760. if (this.m_Actions == null)
  761. {
  762. this.m_Actions = new ArrayList(2);
  763. this.m_Actions.Add(toLock);
  764. return true;
  765. }
  766. if (!this.m_Actions.Contains(toLock))
  767. {
  768. this.m_Actions.Add(toLock);
  769. return true;
  770. }
  771. return false;
  772. }
  773. public Server.Targeting.Target BeginTarget(int range, bool allowGround, TargetFlags flags, TargetCallback callback)
  774. {
  775. Server.Targeting.Target target = new SimpleTarget(range, flags, allowGround, callback);
  776. this.Target = target;
  777. return target;
  778. }
  779. public Server.Targeting.Target BeginTarget(int range, bool allowGround, TargetFlags flags, TargetStateCallback callback, object state)
  780. {
  781. Server.Targeting.Target target = new SimpleStateTarget(range, flags, allowGround, callback, state);
  782. this.Target = target;
  783. return target;
  784. }
  785. public virtual bool BeneficialCheck(Mobile target)
  786. {
  787. if (this.CanBeBeneficial(target, true))
  788. {
  789. this.DoBeneficial(target);
  790. return true;
  791. }
  792. return false;
  793. }
  794. public void BoltEffect(int hue)
  795. {
  796. Effects.SendBoltEffect(this, true, hue);
  797. }
  798. public virtual bool CanBeBeneficial(Mobile target)
  799. {
  800. return this.CanBeBeneficial(target, true, false);
  801. }
  802. public virtual bool CanBeBeneficial(Mobile target, bool message)
  803. {
  804. return this.CanBeBeneficial(target, message, false);
  805. }
  806. public virtual bool CanBeBeneficial(Mobile target, bool message, bool allowDead)
  807. {
  808. if (target != null)
  809. {
  810. if (((this.m_Deleted || target.m_Deleted) || (!this.Alive || this.IsDeadBondedPet)) || (!allowDead && (!target.Alive || this.IsDeadBondedPet)))
  811. {
  812. if (message)
  813. {
  814. this.SendLocalizedMessage(0xf4639);
  815. }
  816. return false;
  817. }
  818. if (target == this)
  819. {
  820. return true;
  821. }
  822. if (this.Region.AllowBenificial(this, target))
  823. {
  824. return true;
  825. }
  826. if (message)
  827. {
  828. this.SendLocalizedMessage(0xf4639);
  829. }
  830. }
  831. return false;
  832. }
  833. public virtual bool CanBeDamaged()
  834. {
  835. return !this.m_Blessed;
  836. }
  837. public bool CanBeginAction(object toLock)
  838. {
  839. if (this.m_Actions != null)
  840. {
  841. return !this.m_Actions.Contains(toLock);
  842. }
  843. return true;
  844. }
  845. public virtual bool CanBeHarmful(Mobile target)
  846. {
  847. return this.CanBeHarmful(target, true);
  848. }
  849. public virtual bool CanBeHarmful(Mobile target, bool message)
  850. {
  851. return this.CanBeHarmful(target, message, false);
  852. }
  853. public virtual bool CanBeHarmful(Mobile target, bool message, bool ignoreOurBlessedness)
  854. {
  855. if (target != null)
  856. {
  857. if ((this.m_Deleted || (!ignoreOurBlessedness && this.m_Blessed)) || (((target.m_Deleted || target.m_Blessed) || (!this.Alive || this.IsDeadBondedPet)) || (!target.Alive || target.IsDeadBondedPet)))
  858. {
  859. if (message)
  860. {
  861. this.SendLocalizedMessage(0xf463a);
  862. }
  863. return false;
  864. }
  865. if (target == this)
  866. {
  867. return true;
  868. }
  869. if (this.Region.AllowHarmful(this, target))
  870. {
  871. return true;
  872. }
  873. if (message)
  874. {
  875. this.SendLocalizedMessage(0xf463a);
  876. }
  877. }
  878. return false;
  879. }
  880. public virtual bool CanBeRenamedBy(Mobile from)
  881. {
  882. return (from.m_AccessLevel > this.m_AccessLevel);
  883. }
  884. public virtual bool CanPaperdollBeOpenedBy(Mobile from)
  885. {
  886. if (!this.Body.IsHuman && !this.Body.IsGhost)
  887. {
  888. return this.IsBodyMod;
  889. }
  890. return true;
  891. }
  892. public virtual bool CanSee(Item item)
  893. {
  894. if (this.m_Map == Server.Map.Internal)
  895. {
  896. return false;
  897. }
  898. if (item.Map == Server.Map.Internal)
  899. {
  900. return false;
  901. }
  902. if (item.Parent != null)
  903. {
  904. if (item.Parent is Item)
  905. {
  906. if (!this.CanSee((Item) item.Parent))
  907. {
  908. return false;
  909. }
  910. }
  911. else if ((item.Parent is Mobile) && !this.CanSee((Mobile) item.Parent))
  912. {
  913. return false;
  914. }
  915. }
  916. if (item is Server.Items.BankBox)
  917. {
  918. Server.Items.BankBox box = item as Server.Items.BankBox;
  919. if (((box != null) && (this.m_AccessLevel <= Server.AccessLevel.Counselor)) && ((box.Owner != this) || !box.Opened))
  920. {
  921. return false;
  922. }
  923. }
  924. else if (item is SecureTradeContainer)
  925. {
  926. SecureTrade trade = ((SecureTradeContainer) item).Trade;
  927. if (((trade != null) && (trade.From.Mobile != this)) && (trade.To.Mobile != this))
  928. {
  929. return false;
  930. }
  931. }
  932. if (item.Deleted || (item.Map != this.m_Map))
  933. {
  934. return false;
  935. }
  936. if (!item.Visible)
  937. {
  938. return (this.m_AccessLevel > Server.AccessLevel.Counselor);
  939. }
  940. return true;
  941. }
  942. public virtual bool CanSee(Mobile m)
  943. {
  944. if ((this.m_Deleted || m.m_Deleted) || ((this.m_Map == Server.Map.Internal) || (m.m_Map == Server.Map.Internal)))
  945. {
  946. return false;
  947. }
  948. if (this != m)
  949. {
  950. if ((m.m_Map != this.m_Map) || (m.Hidden && (this.m_AccessLevel <= m.AccessLevel)))
  951. {
  952. return false;
  953. }
  954. if ((!m.Alive && this.Alive) && (this.m_AccessLevel <= Server.AccessLevel.Player))
  955. {
  956. return m.Warmode;
  957. }
  958. }
  959. return true;
  960. }
  961. public virtual bool CanSee(object o)
  962. {
  963. if (o is Item)
  964. {
  965. return this.CanSee((Item) o);
  966. }
  967. if (o is Mobile)
  968. {
  969. return this.CanSee((Mobile) o);
  970. }
  971. return true;
  972. }
  973. public bool CanUseStuckMenu()
  974. {
  975. if (this.m_StuckMenuUses == null)
  976. {
  977. return true;
  978. }
  979. for (int i = 0; i < this.m_StuckMenuUses.Length; i++)
  980. {
  981. if ((DateTime.Now - this.m_StuckMenuUses[i]) > TimeSpan.FromDays(1.0))
  982. {
  983. return true;
  984. }
  985. }
  986. return false;
  987. }
  988. private void CheckAggrExpire()
  989. {
  990. for (int i = this.m_Aggressors.Count - 1; i >= 0; i--)
  991. {
  992. if (i < this.m_Aggressors.Count)
  993. {
  994. AggressorInfo info = (AggressorInfo) this.m_Aggressors[i];
  995. if (info.Expired)
  996. {
  997. Mobile attacker = info.Attacker;
  998. attacker.RemoveAggressed(this);
  999. this.m_Aggressors.RemoveAt(i);
  1000. info.Free();
  1001. if (((this.m_NetState != null) && this.CanSee(attacker)) && Utility.InUpdateRange(this.m_Location, attacker.m_Location))
  1002. {
  1003. this.m_NetState.Send(new MobileIncoming(this, attacker));
  1004. }
  1005. }
  1006. }
  1007. }
  1008. for (int j = this.m_Aggressed.Count - 1; j >= 0; j--)
  1009. {
  1010. if (j < this.m_Aggressed.Count)
  1011. {
  1012. AggressorInfo info2 = (AggressorInfo) this.m_Aggressed[j];
  1013. if (info2.Expired)
  1014. {
  1015. Mobile defender = info2.Defender;
  1016. defender.RemoveAggressor(this);
  1017. this.m_Aggressed.RemoveAt(j);
  1018. info2.Free();
  1019. if (((this.m_NetState != null) && this.CanSee(defender)) && Utility.InUpdateRange(this.m_Location, defender.m_Location))
  1020. {
  1021. this.m_NetState.Send(new MobileIncoming(this, defender));
  1022. }
  1023. }
  1024. }
  1025. }
  1026. this.UpdateAggrExpire();
  1027. }
  1028. public bool CheckAlive()
  1029. {
  1030. return this.CheckAlive(true);
  1031. }
  1032. public bool CheckAlive(bool message)
  1033. {
  1034. if (this.Alive)
  1035. {
  1036. return true;
  1037. }
  1038. if (message)
  1039. {
  1040. this.LocalOverheadMessage(MessageType.Regular, 0x3b2, 0xf8ca8);
  1041. }
  1042. return false;
  1043. }
  1044. public virtual bool CheckAttack(Mobile m)
  1045. {
  1046. return ((Utility.InUpdateRange(this, m) && this.CanSee(m)) && this.InLOS(m));
  1047. }
  1048. public virtual bool CheckContextMenuDisplay(IEntity target)
  1049. {
  1050. return true;
  1051. }
  1052. public virtual bool CheckCure(Mobile from)
  1053. {
  1054. return true;
  1055. }
  1056. public virtual bool CheckEquip(Item item)
  1057. {
  1058. for (int i = 0; i < this.m_Items.Count; i++)
  1059. {
  1060. if (((Item) this.m_Items[i]).CheckConflictingLayer(this, item, item.Layer) || item.CheckConflictingLayer(this, (Item) this.m_Items[i], ((Item) this.m_Items[i]).Layer))
  1061. {
  1062. return false;
  1063. }
  1064. }
  1065. return true;
  1066. }
  1067. public virtual bool CheckHearsMutatedSpeech(Mobile m, object context)
  1068. {
  1069. return ((context != m_GhostMutateContext) || (m.Alive && !m.CanHearGhosts));
  1070. }
  1071. public virtual bool CheckHigherPoison(Mobile from, Server.Poison poison)
  1072. {
  1073. return ((this.m_Poison != null) && (this.m_Poison.Level >= poison.Level));
  1074. }
  1075. public virtual bool CheckItemUse(Mobile from, Item item)
  1076. {
  1077. return true;
  1078. }
  1079. public virtual bool CheckLift(Mobile from, Item item, ref LRReason reject)
  1080. {
  1081. return true;
  1082. }
  1083. public virtual void CheckLightLevels(bool forceResend)
  1084. {
  1085. }
  1086. public virtual bool CheckMovement(Server.Direction d, out int newZ)
  1087. {
  1088. return Server.Movement.Movement.CheckMovement(this, d, out newZ);
  1089. }
  1090. public virtual bool CheckNonlocalDrop(Mobile from, Item item, Item target)
  1091. {
  1092. if ((from != this) && ((from.AccessLevel <= this.AccessLevel) || (from.AccessLevel < Server.AccessLevel.GameMaster)))
  1093. {
  1094. return false;
  1095. }
  1096. return true;
  1097. }
  1098. public virtual bool CheckNonlocalLift(Mobile from, Item item)
  1099. {
  1100. if ((from != this) && ((from.AccessLevel <= this.AccessLevel) || (from.AccessLevel < Server.AccessLevel.GameMaster)))
  1101. {
  1102. return false;
  1103. }
  1104. return true;
  1105. }
  1106. public virtual bool CheckPoisonImmunity(Mobile from, Server.Poison poison)
  1107. {
  1108. return false;
  1109. }
  1110. public virtual bool CheckResurrect()
  1111. {
  1112. return true;
  1113. }
  1114. public bool CheckSkill(SkillName skill, double chance)
  1115. {
  1116. if (m_SkillCheckDirectLocationHandler == null)
  1117. {
  1118. return false;
  1119. }
  1120. return m_SkillCheckDirectLocationHandler(this, skill, chance);
  1121. }
  1122. public bool CheckSkill(SkillName skill, double minSkill, double maxSkill)
  1123. {
  1124. if (m_SkillCheckLocationHandler == null)
  1125. {
  1126. return false;
  1127. }
  1128. return m_SkillCheckLocationHandler(this, skill, minSkill, maxSkill);
  1129. }
  1130. public virtual bool CheckSpeechManifest()
  1131. {
  1132. if (this.Alive)
  1133. {
  1134. return false;
  1135. }
  1136. TimeSpan autoManifestTimeout = m_AutoManifestTimeout;
  1137. if ((autoManifestTimeout <= TimeSpan.Zero) || (this.Warmode && (this.m_AutoManifestTimer == null)))
  1138. {
  1139. return false;
  1140. }
  1141. this.Manifest(autoManifestTimeout);
  1142. return true;
  1143. }
  1144. public virtual bool CheckSpellCast(ISpell spell)
  1145. {
  1146. return true;
  1147. }
  1148. public virtual void CheckStatTimers()
  1149. {
  1150. if (this.Hits < this.HitsMax)
  1151. {
  1152. if (this.m_HitsTimer == null)
  1153. {
  1154. this.m_HitsTimer = new HitsTimer(this);
  1155. }
  1156. this.m_HitsTimer.Start();
  1157. }
  1158. else
  1159. {
  1160. this.Hits = this.HitsMax;
  1161. }
  1162. if (this.Stam < this.StamMax)
  1163. {
  1164. if (this.m_StamTimer == null)
  1165. {
  1166. this.m_StamTimer = new StamTimer(this);
  1167. }
  1168. this.m_StamTimer.Start();
  1169. }
  1170. else
  1171. {
  1172. this.Stam = this.StamMax;
  1173. }
  1174. if (this.Mana < this.ManaMax)
  1175. {
  1176. if (this.m_ManaTimer == null)
  1177. {
  1178. this.m_ManaTimer = new ManaTimer(this);
  1179. }
  1180. this.m_ManaTimer.Start();
  1181. }
  1182. else
  1183. {
  1184. this.Mana = this.ManaMax;
  1185. }
  1186. }
  1187. public virtual bool CheckTarget(Mobile from, Server.Targeting.Target targ, object targeted)
  1188. {
  1189. return true;
  1190. }
  1191. public bool CheckTargetSkill(SkillName skill, object target, double chance)
  1192. {
  1193. if (m_SkillCheckDirectTargetHandler == null)
  1194. {
  1195. return false;
  1196. }
  1197. return m_SkillCheckDirectTargetHandler(this, skill, target, chance);
  1198. }
  1199. public bool CheckTargetSkill(SkillName skill, object target, double minSkill, double maxSkill)
  1200. {
  1201. if (m_SkillCheckTargetHandler == null)
  1202. {
  1203. return false;
  1204. }
  1205. return m_SkillCheckTargetHandler(this, skill, target, minSkill, maxSkill);
  1206. }
  1207. public virtual void ClearFastwalkStack()
  1208. {
  1209. if ((this.m_MoveRecords != null) && (this.m_MoveRecords.Count > 0))
  1210. {
  1211. this.m_MoveRecords.Clear();
  1212. }
  1213. this.m_EndQueue = DateTime.Now;
  1214. }
  1215. public virtual void ClearHand(Item item)
  1216. {
  1217. if (((item != null) && item.Movable) && !item.AllowEquipedCast(this))
  1218. {
  1219. this.AddToBackpack(item);
  1220. }
  1221. }
  1222. public virtual void ClearHands()
  1223. {
  1224. this.ClearHand(this.FindItemOnLayer(Layer.FirstValid));
  1225. this.ClearHand(this.FindItemOnLayer(Layer.TwoHanded));
  1226. }
  1227. public void ClearQuestArrow()
  1228. {
  1229. this.m_QuestArrow = null;
  1230. }
  1231. public void ClearScreen()
  1232. {
  1233. Server.Network.NetState netState = this.m_NetState;
  1234. if ((this.m_Map != null) && (netState != null))
  1235. {
  1236. IPooledEnumerable objectsInRange = this.m_Map.GetObjectsInRange(this.m_Location, Core.GlobalMaxUpdateRange);
  1237. foreach (object obj2 in objectsInRange)
  1238. {
  1239. if (obj2 is Mobile)
  1240. {
  1241. Mobile mobile = (Mobile) obj2;
  1242. if ((mobile != this) && Utility.InUpdateRange(this.m_Location, mobile.m_Location))
  1243. {
  1244. netState.Send(mobile.RemovePacket);
  1245. }
  1246. }
  1247. else if (obj2 is Item)
  1248. {
  1249. Item item = (Item) obj2;
  1250. if (this.InRange(item.Location, item.GetUpdateRange(this)))
  1251. {
  1252. netState.Send(item.RemovePacket);
  1253. }
  1254. }
  1255. }
  1256. objectsInRange.Free();
  1257. }
  1258. }
  1259. public void ClearTarget()
  1260. {
  1261. this.m_Target = null;
  1262. }
  1263. public bool CloseAllGumps()
  1264. {
  1265. return this.CloseAllGumps(false);
  1266. }
  1267. public bool CloseAllGumps(bool throwOnOffline)
  1268. {
  1269. Server.Network.NetState netState = this.m_NetState;
  1270. if (netState != null)
  1271. {
  1272. var gumps = netState.Gumps;
  1273. foreach(Gump gump in gumps)
  1274. {
  1275. netState.Send(new Server.Network.CloseGump(gump.TypeID, 0));
  1276. }
  1277. return true;
  1278. }
  1279. if (throwOnOffline)
  1280. {
  1281. throw new MobileNotConnectedException(this, "Gump close packets could not be sent.");
  1282. }
  1283. return false;
  1284. }
  1285. public bool CloseGump(Type type)
  1286. {
  1287. return this.CloseGump(type, 0, false);
  1288. }
  1289. public bool CloseGump(Type type, int buttonID)
  1290. {
  1291. return this.CloseGump(type, buttonID, false);
  1292. }
  1293. public bool CloseGump(Type type, int buttonID, bool throwOnOffline)
  1294. {
  1295. if (this.m_NetState != null)
  1296. {
  1297. this.m_NetState.Send(new Server.Network.CloseGump(Gump.GetTypeID(type), buttonID));
  1298. return true;
  1299. }
  1300. if (throwOnOffline)
  1301. {
  1302. throw new MobileNotConnectedException(this, "Gump close packet could not be sent.");
  1303. }
  1304. return false;
  1305. }
  1306. public virtual void ComputeBaseLightLevels(out int global, out int personal)
  1307. {
  1308. global = 0;
  1309. personal = this.m_LightLevel;
  1310. }
  1311. public virtual void ComputeLightLevels(out int global, out int personal)
  1312. {
  1313. this.ComputeBaseLightLevels(out global, out personal);
  1314. if (this.m_Region != null)
  1315. {
  1316. this.m_Region.AlterLightLevel(this, ref global, ref personal);
  1317. }
  1318. }
  1319. public virtual void ComputeResistances()
  1320. {
  1321. int[] numArray;
  1322. if (this.m_Resistances == null)
  1323. {
  1324. this.m_Resistances = new int[] { -2147483648, -2147483648, -2147483648, -2147483648, -2147483648 };
  1325. }
  1326. for (int i = 0; i < this.m_Resistances.Length; i++)
  1327. {
  1328. this.m_Resistances[i] = 0;
  1329. }
  1330. (numArray = this.m_Resistances)[0] = numArray[0] + this.BasePhysicalResistance;
  1331. (numArray = this.m_Resistances)[1] = numArray[1] + this.BaseFireResistance;
  1332. (numArray = this.m_Resistances)[2] = numArray[2] + this.BaseColdResistance;
  1333. (numArray = this.m_Resistances)[3] = numArray[3] + this.BasePoisonResistance;
  1334. (numArray = this.m_Resistances)[4] = numArray[4] + this.BaseEnergyResistance;
  1335. for (int j = 0; (this.m_ResistMods != null) && (j < this.m_ResistMods.Count); j++)
  1336. {
  1337. ResistanceMod mod = (ResistanceMod) this.m_ResistMods[j];
  1338. int type = (int) mod.Type;
  1339. if ((type >= 0) && (type < this.m_Resistances.Length))
  1340. {
  1341. IntPtr ptr;
  1342. (numArray = this.m_Resistances)[(int) (ptr = (IntPtr) type)] = numArray[(int) ptr] + mod.Offset;
  1343. }
  1344. }
  1345. for (int k = 0; k < this.m_Items.Count; k++)
  1346. {
  1347. Item item = (Item) this.m_Items[k];
  1348. if (!item.CheckPropertyConfliction(this))
  1349. {
  1350. (numArray = this.m_Resistances)[0] = numArray[0] + item.PhysicalResistance;
  1351. (numArray = this.m_Resistances)[1] = numArray[1] + item.FireResistance;
  1352. (numArray = this.m_Resistances)[2] = numArray[2] + item.ColdResistance;
  1353. (numArray = this.m_Resistances)[3] = numArray[3] + item.PoisonResistance;
  1354. (numArray = this.m_Resistances)[4] = numArray[4] + item.EnergyResistance;
  1355. }
  1356. }
  1357. for (int m = 0; m < this.m_Resistances.Length; m++)
  1358. {
  1359. int minResistance = this.GetMinResistance((ResistanceType) m);
  1360. int maxResistance = this.GetMaxResistance((ResistanceType) m);
  1361. if (maxResistance < minResistance)
  1362. {
  1363. maxResistance = minResistance;
  1364. }
  1365. if (this.m_Resistances[m] > maxResistance)
  1366. {
  1367. this.m_Resistances[m] = maxResistance;
  1368. }
  1369. else if (this.m_Resistances[m] < minResistance)
  1370. {
  1371. this.m_Resistances[m] = minResistance;
  1372. }
  1373. }
  1374. }
  1375. public virtual void CriminalAction(bool message)
  1376. {
  1377. this.Criminal = true;
  1378. this.m_Region.OnCriminalAction(this, message);
  1379. }
  1380. public virtual bool CurePoison(Mobile from)
  1381. {
  1382. if (this.CheckCure(from))
  1383. {
  1384. Server.Poison oldPoison = this.m_Poison;
  1385. this.Poison = null;
  1386. this.OnCured(from, oldPoison);
  1387. return true;
  1388. }
  1389. this.OnFailedCure(from);
  1390. return false;
  1391. }
  1392. public virtual void Damage(int amount)
  1393. {
  1394. this.Damage(amount, null);
  1395. }
  1396. public virtual void Damage(int amount, Mobile from)
  1397. {
  1398. if ((this.CanBeDamaged() && this.Region.OnDamage(this, ref amount)) && (amount > 0))
  1399. {
  1400. int hits = this.Hits;
  1401. int num2 = hits - amount;
  1402. if (this.m_Spell != null)
  1403. {
  1404. this.m_Spell.OnCasterHurt();
  1405. }
  1406. if (from != null)
  1407. {
  1408. this.RegisterDamage(amount, from);
  1409. }
  1410. this.DisruptiveAction();
  1411. this.Paralyzed = false;
  1412. switch (m_VisibleDamageType)
  1413. {
  1414. case Server.VisibleDamageType.Related:
  1415. {
  1416. Server.Network.NetState netState = this.m_NetState;
  1417. Server.Network.NetState state2 = (from == null) ? null : from.m_NetState;
  1418. if ((amount > 0) && ((netState != null) || (state2 != null)))
  1419. {
  1420. Packet p = new DamagePacket(this, amount);
  1421. if (netState != null)
  1422. {
  1423. netState.Send(p);
  1424. }
  1425. if ((state2 != null) && (state2 != netState))
  1426. {
  1427. state2.Send(p);
  1428. }
  1429. }
  1430. break;
  1431. }
  1432. case Server.VisibleDamageType.Everyone:
  1433. this.SendDamageToAll(amount);
  1434. break;
  1435. }
  1436. this.OnDamage(amount, from, num2 < 0);
  1437. if (num2 < 0)
  1438. {
  1439. this.m_LastKiller = from;
  1440. this.Hits = 0;
  1441. if (hits >= 0)
  1442. {
  1443. this.Kill();
  1444. }
  1445. }
  1446. else
  1447. {
  1448. this.Hits = num2;
  1449. }
  1450. }
  1451. }
  1452. public void DefaultMobileInit()
  1453. {
  1454. this.m_StatCap = 0xe1;
  1455. this.m_FollowersMax = 5;
  1456. this.m_Skills = new Server.Skills(this);
  1457. this.m_Items = new ArrayList(1);
  1458. this.m_StatMods = new ArrayList(1);
  1459. this.Map = Server.Map.Internal;
  1460. this.m_AutoPageNotify = true;
  1461. this.m_Aggressors = new ArrayList(1);
  1462. this.m_Aggressed = new ArrayList(1);
  1463. this.m_Virtues = new VirtueInfo();
  1464. this.m_Stabled = new ArrayList(1);
  1465. this.m_DamageEntries = new ArrayList(1);
  1466. this.m_ExpireCombatant = new ExpireCombatantTimer(this);
  1467. this.m_ExpireCriminal = new ExpireCriminalTimer(this);
  1468. this.m_CombatTimer = new CombatTimer(this);
  1469. this.m_LogoutTimer = new LogoutTimer(this);
  1470. this.m_NextSkillTime = DateTime.MinValue;
  1471. this.m_CreationTime = DateTime.Now;
  1472. }
  1473. public void DelayChangeWarmode(bool value)
  1474. {
  1475. if (this.m_WarmodeTimer != null)
  1476. {
  1477. this.m_WarmodeTimer.Value = value;
  1478. }
  1479. else if (this.m_Warmode != value)
  1480. {
  1481. DateTime now = DateTime.Now;
  1482. DateTime nextWarmodeChange = this.m_NextWarmodeChange;
  1483. if ((now > nextWarmodeChange) || (this.m_WarmodeChanges == 0))
  1484. {
  1485. this.m_WarmodeChanges = 1;
  1486. this.m_NextWarmodeChange = now + WarmodeSpamCatch;
  1487. }
  1488. else
  1489. {
  1490. if (this.m_WarmodeChanges == 4)
  1491. {
  1492. this.m_WarmodeTimer = new WarmodeTimer(this, value);
  1493. this.m_WarmodeTimer.Start();
  1494. return;
  1495. }
  1496. this.m_WarmodeChanges++;
  1497. }
  1498. this.Warmode = value;
  1499. }
  1500. }
  1501. public virtual void Delete()
  1502. {
  1503. if (!this.m_Deleted && World.OnDelete(this))
  1504. {
  1505. if (this.m_NetState != null)
  1506. {
  1507. this.m_NetState.CancelAllTrades();
  1508. }
  1509. if (this.m_NetState != null)
  1510. {
  1511. this.m_NetState.Dispose();
  1512. }
  1513. this.DropHolding();
  1514. this.Region.InternalExit(this);
  1515. this.OnDelete();
  1516. for (int i = this.m_Items.Count - 1; i >= 0; i--)
  1517. {
  1518. if (i < this.m_Items.Count)
  1519. {
  1520. ((Item) this.m_Items[i]).OnParentDeleted(this);
  1521. }
  1522. }
  1523. this.SendRemovePacket();
  1524. if (this.m_Guild != null)
  1525. {
  1526. this.m_Guild.OnMobileDelete(this);
  1527. }
  1528. this.m_Deleted = true;
  1529. if (this.m_Map != null)
  1530. {
  1531. this.m_Map.OnLeave(this);
  1532. this.m_Map = null;
  1533. }
  1534. m_Hair = null;
  1535. m_FacialHair = null;
  1536. this.m_MountItem = null;
  1537. World.RemoveMobile(this);
  1538. this.OnAfterDelete();
  1539. this.m_RemovePacket = null;
  1540. this.m_OPLPacket = null;
  1541. this.m_PropertyList = null;
  1542. }
  1543. }
  1544. public virtual void Delta(MobileDelta flag)
  1545. {
  1546. if ((this.m_Map != null) && (this.m_Map != Server.Map.Internal))
  1547. {
  1548. this.m_DeltaFlags |= flag;
  1549. if (!this.m_InDeltaQueue)
  1550. {
  1551. this.m_InDeltaQueue = true;
  1552. m_DeltaQueue.Enqueue(this);
  1553. }
  1554. }
  1555. }
  1556. public virtual void Deserialize(GenericReader reader)
  1557. {
  1558. int version = reader.ReadInt();
  1559. switch (version)
  1560. {
  1561. case 28:
  1562. {
  1563. m_LastStatGain = reader.ReadDeltaTime();
  1564. goto case 27;
  1565. }
  1566. case 27:
  1567. {
  1568. m_TithingPoints = reader.ReadInt();
  1569. goto case 26;
  1570. }
  1571. case 26:
  1572. case 25:
  1573. case 24:
  1574. {
  1575. m_Corpse = reader.ReadItem() as Container;
  1576. goto case 23;
  1577. }
  1578. case 23:
  1579. {
  1580. m_CreationTime = reader.ReadDateTime();
  1581. goto case 22;
  1582. }
  1583. case 22: // Just removed followers
  1584. case 21:
  1585. {
  1586. m_Stabled = reader.ReadMobileList();
  1587. goto case 20;
  1588. }
  1589. case 20:
  1590. {
  1591. m_CantWalk = reader.ReadBool();
  1592. goto case 19;
  1593. }
  1594. case 19: // Just removed variables
  1595. case 18:
  1596. {
  1597. m_Virtues = new VirtueInfo(reader);
  1598. goto case 17;
  1599. }
  1600. case 17:
  1601. {
  1602. m_Thirst = reader.ReadInt();
  1603. m_BAC = reader.ReadInt();
  1604. goto case 16;
  1605. }
  1606. case 16:
  1607. {
  1608. m_ShortTermMurders = reader.ReadInt();
  1609. if (version <= 24)
  1610. {
  1611. reader.ReadDateTime();
  1612. reader.ReadDateTime();
  1613. }
  1614. goto case 15;
  1615. }
  1616. case 15:
  1617. {
  1618. if (version < 22)
  1619. reader.ReadInt(); // followers
  1620. m_FollowersMax = reader.ReadInt();
  1621. goto case 14;
  1622. }
  1623. case 14:
  1624. {
  1625. m_MagicDamageAbsorb = reader.ReadInt();
  1626. goto case 13;
  1627. }
  1628. case 13:
  1629. {
  1630. m_GuildFealty = reader.ReadMobile();
  1631. goto case 12;
  1632. }
  1633. case 12:
  1634. {
  1635. m_Guild = reader.ReadGuild();
  1636. goto case 11;
  1637. }
  1638. case 11:
  1639. {
  1640. m_DisplayGuildTitle = reader.ReadBool();
  1641. goto case 10;
  1642. }
  1643. case 10:
  1644. {
  1645. m_CanSwim = reader.ReadBool();
  1646. goto case 9;
  1647. }
  1648. case 9:
  1649. {
  1650. m_Squelched = reader.ReadBool();
  1651. goto case 8;
  1652. }
  1653. case 8:
  1654. {
  1655. m_Holding = reader.ReadItem();
  1656. goto case 7;
  1657. }
  1658. case 7:
  1659. {
  1660. m_VirtualArmor = reader.ReadInt();
  1661. goto case 6;
  1662. }
  1663. case 6:
  1664. {
  1665. m_BaseSoundID = reader.ReadInt();
  1666. goto case 5;
  1667. }
  1668. case 5:
  1669. {
  1670. m_DisarmReady = reader.ReadBool();
  1671. m_StunReady = reader.ReadBool();
  1672. goto case 4;
  1673. }
  1674. case 4:
  1675. {
  1676. if (version <= 25)
  1677. {
  1678. Poison.Deserialize(reader);
  1679. /*if ( m_Poison != null )
  1680. {
  1681. m_PoisonTimer = new PoisonTimer( this );
  1682. m_PoisonTimer.Start();
  1683. }*/
  1684. }
  1685. goto case 3;
  1686. }
  1687. case 3:
  1688. {
  1689. m_StatCap = reader.ReadInt();
  1690. goto case 2;
  1691. }
  1692. case 2:
  1693. {
  1694. m_NameHue = reader.ReadInt();
  1695. goto case 1;
  1696. }
  1697. case 1:
  1698. {
  1699. m_Hunger = reader.ReadInt();
  1700. goto case 0;
  1701. }
  1702. case 0:
  1703. {
  1704. if (version < 21)
  1705. m_Stabled = new ArrayList();
  1706. if (version < 18)
  1707. m_Virtues = new VirtueInfo();
  1708. if (version < 11)
  1709. m_DisplayGuildTitle = true;
  1710. if (version < 3)
  1711. m_StatCap = 225;
  1712. if (version < 15)
  1713. {
  1714. m_Followers = 0;
  1715. m_FollowersMax = 5;
  1716. }
  1717. m_Location = reader.ReadPoint3D();
  1718. m_Body = new Body(reader.ReadInt());
  1719. m_Name = reader.ReadString();
  1720. m_GuildTitle = reader.ReadString();
  1721. m_Criminal = reader.ReadBool();
  1722. m_Kills = reader.ReadInt();
  1723. m_SpeechHue = reader.ReadInt();
  1724. m_EmoteHue = reader.ReadInt();
  1725. m_WhisperHue = reader.ReadInt();
  1726. m_YellHue = reader.ReadInt();
  1727. m_Language = reader.ReadString();
  1728. m_Female = reader.ReadBool();
  1729. m_Warmode = reader.ReadBool();
  1730. m_Hidden = reader.ReadBool();
  1731. m_Direction = (Direction)reader.ReadByte();
  1732. m_Hue = reader.ReadInt();
  1733. m_Str = reader.ReadInt();
  1734. m_Dex = reader.ReadInt();
  1735. m_Int = reader.ReadInt();
  1736. m_Hits = reader.ReadInt();
  1737. m_Stam = reader.ReadInt();
  1738. m_Mana = reader.ReadInt();
  1739. m_Map = reader.ReadMap();
  1740. m_Blessed = reader.ReadBool();
  1741. m_Fame = reader.ReadInt();
  1742. m_Karma = reader.ReadInt();
  1743. m_AccessLevel = (AccessLevel)reader.ReadByte();
  1744. m_Skills = new Skills(this, reader);
  1745. int itemCount = reader.ReadInt();
  1746. m_Items = new ArrayList(itemCount);
  1747. for (int i = 0; i < itemCount; ++i)
  1748. {
  1749. Item item = reader.ReadItem();
  1750. if (item != null)
  1751. m_Items.Add(item);
  1752. }
  1753. m_Player = reader.ReadBool();
  1754. m_Title = reader.ReadString();
  1755. m_Profile = reader.ReadString();
  1756. m_ProfileLocked = reader.ReadBool();
  1757. if (version <= 18)
  1758. {
  1759. /*m_LightLevel =*/
  1760. reader.ReadInt();
  1761. /*m_TotalGold =*/
  1762. reader.ReadInt();
  1763. /*m_TotalWeight =*/
  1764. reader.ReadInt();
  1765. }
  1766. m_AutoPageNotify = reader.ReadBool();
  1767. m_LogoutLocation = reader.ReadPoint3D();
  1768. m_LogoutMap = reader.ReadMap();
  1769. m_StrLock = (StatLockType)reader.ReadByte();
  1770. m_DexLock = (StatLockType)reader.ReadByte();
  1771. m_IntLock = (StatLockType)reader.ReadByte();
  1772. m_StatMods = new ArrayList();
  1773. if (reader.ReadBool())
  1774. {
  1775. int StuckMenuLength = reader.ReadInt();
  1776. m_StuckMenuUses = new DateTime[StuckMenuLength];
  1777. for (int i = 0; i < m_StuckMenuUses.Length; ++i)
  1778. {
  1779. m_StuckMenuUses[i] = reader.ReadDateTime();
  1780. }
  1781. }
  1782. else
  1783. {
  1784. m_StuckMenuUses = null;
  1785. }
  1786. if (m_Player && m_Map != Map.Internal)
  1787. {
  1788. m_LogoutLocation = m_Location;
  1789. m_LogoutMap = m_Map;
  1790. m_Map = Map.Internal;
  1791. }
  1792. if (m_Map != null)
  1793. m_Map.OnEnter(this);
  1794. if (m_Criminal)
  1795. {
  1796. if (m_ExpireCriminal == null)
  1797. m_ExpireCriminal = new ExpireCriminalTimer(this);
  1798. m_ExpireCriminal.Start();
  1799. }
  1800. if (ShouldCheckStatTimers)
  1801. CheckStatTimers();
  1802. if (!m_Player && m_Dex <= 100 && m_CombatTimer != null)
  1803. m_CombatTimer.Priority = TimerPriority.FiftyMS;
  1804. else if (m_CombatTimer != null)
  1805. m_CombatTimer.Priority = TimerPriority.EveryTick;
  1806. m_Region = Region.Find(m_Location, m_Map);
  1807. //m_Region.InternalEnter(this);
  1808. UpdateRegion(); // Roman / Kel : Replced by this new method!
  1809. UpdateResistances();
  1810. break;
  1811. }
  1812. }
  1813. }
  1814. /// <summary>
  1815. /// New method, perf work
  1816. /// </summary>
  1817. internal void UpdateRegion()
  1818. {
  1819. if (m_Player)
  1820. {
  1821. m_Region.Players.Add(this);
  1822. }
  1823. m_Region.Mobiles.Add(this);
  1824. }
  1825. public virtual void DisplayPaperdollTo(Mobile to)
  1826. {
  1827. EventSink.InvokePaperdollRequest(new PaperdollRequestEventArgs(to, this));
  1828. }
  1829. public virtual void DisruptiveAction()
  1830. {
  1831. if (this.Meditating)
  1832. {
  1833. this.Meditating = false;
  1834. this.SendLocalizedMessage(0x7a1a6);
  1835. }
  1836. }
  1837. public virtual void DoBeneficial(Mobile target)
  1838. {
  1839. if (target != null)
  1840. {
  1841. this.OnBeneficialAction(target, this.IsBeneficialCriminal(target));
  1842. this.Region.OnBenificialAction(this, target);
  1843. target.Region.OnGotBenificialAction(this, target);
  1844. }
  1845. }
  1846. public virtual void DoHarmful(Mobile target)
  1847. {
  1848. this.DoHarmful(target, false);
  1849. }
  1850. public virtual void DoHarmful(Mobile target, bool indirect)
  1851. {
  1852. if (target != null)
  1853. {
  1854. bool isCriminal = this.IsHarmfulCriminal(target);
  1855. this.OnHarmfulAction(target, isCriminal);
  1856. target.AggressiveAction(this, isCriminal);
  1857. this.Region.OnDidHarmful(this, target);
  1858. target.Region.OnGotHarmful(this, target);
  1859. if (!indirect)
  1860. {
  1861. this.Combatant = target;
  1862. }
  1863. this.m_ExpireCombatant.Stop();
  1864. this.m_ExpireCombatant.Start();
  1865. }
  1866. }
  1867. public virtual void DoSpeech(string text, int[] keywords, MessageType type, int hue)
  1868. {
  1869. if (!this.m_Deleted && !Commands.Handle(this, text))
  1870. {
  1871. int range = 15;
  1872. switch (type)
  1873. {
  1874. case MessageType.Regular:
  1875. this.m_SpeechHue = hue;
  1876. break;
  1877. case MessageType.Emote:
  1878. this.m_EmoteHue = hue;
  1879. break;
  1880. case MessageType.Whisper:
  1881. this.m_WhisperHue = hue;
  1882. range = 1;
  1883. break;
  1884. case MessageType.Yell:
  1885. this.m_YellHue = hue;
  1886. range = 0x12;
  1887. break;
  1888. default:
  1889. type = MessageType.Regular;
  1890. break;
  1891. }
  1892. SpeechEventArgs e = new SpeechEventArgs(this, text, type, hue, keywords);
  1893. EventSink.InvokeSpeech(e);
  1894. this.m_Region.OnSpeech(e);
  1895. this.OnSaid(e);
  1896. if (!e.Blocked)
  1897. {
  1898. text = e.Speech;
  1899. if ((text != null) && (text.Length != 0))
  1900. {
  1901. if (m_Hears == null)
  1902. {
  1903. m_Hears = new ArrayList();
  1904. }
  1905. else if (m_Hears.Count > 0)
  1906. {
  1907. m_Hears.Clear();
  1908. }
  1909. if (m_OnSpeech == null)
  1910. {
  1911. m_OnSpeech = new ArrayList();
  1912. }
  1913. else if (m_OnSpeech.Count > 0)
  1914. {
  1915. m_OnSpeech.Clear();
  1916. }
  1917. ArrayList hears = m_Hears;
  1918. ArrayList onSpeech = m_OnSpeech;
  1919. if (this.m_Map != null)
  1920. {
  1921. Label_023C:
  1922. foreach (object obj2 in this.m_Map.GetObjectsInRange(this.m_Location, range))
  1923. {
  1924. if (obj2 is Mobile)
  1925. {
  1926. Mobile mobile = (Mobile) obj2;
  1927. if (mobile.CanSee(this) && ((m_NoSpeechLOS || !mobile.Player) || mobile.InLOS(this)))
  1928. {
  1929. if (mobile.m_NetState != null)
  1930. {
  1931. hears.Add(mobile);
  1932. }
  1933. if (mobile.HandlesOnSpeech(this))
  1934. {
  1935. onSpeech.Add(mobile);
  1936. }
  1937. for (int k = 0; k < mobile.Items.Count; k++)
  1938. {
  1939. Item item = (Item) mobile.Items[k];
  1940. if (item.HandlesOnSpeech)
  1941. {
  1942. onSpeech.Add(item);
  1943. }
  1944. if (item is Container)
  1945. {
  1946. this.AddSpeechItemsFrom(onSpeech, (Container) item);
  1947. }
  1948. }
  1949. }
  1950. goto Label_023C;
  1951. }
  1952. if (obj2 is Item)
  1953. {
  1954. if (((Item) obj2).HandlesOnSpeech)
  1955. {
  1956. onSpeech.Add(obj2);
  1957. }
  1958. if (obj2 is Container)
  1959. {
  1960. this.AddSpeechItemsFrom(onSpeech, (Container) obj2);
  1961. }
  1962. }
  1963. }
  1964. object context = null;
  1965. string str = text;
  1966. SpeechEventArgs args2 = null;
  1967. if (this.MutateSpeech(hears, ref str, ref context))
  1968. {
  1969. args2 = new SpeechEventArgs(this, str, type, hue, new int[0]);
  1970. }
  1971. this.CheckSpeechManifest();
  1972. this.ProcessDelta();
  1973. Packet p = null;
  1974. Packet packet2 = null;
  1975. for (int i = 0; i < hears.Count; i++)
  1976. {
  1977. Mobile m = (Mobile) hears[i];
  1978. if ((args2 == null) || !this.CheckHearsMutatedSpeech(m, context))
  1979. {
  1980. m.OnSpeech(e);
  1981. Server.Network.NetState netState = m.NetState;
  1982. if (netState != null)
  1983. {
  1984. if (p == null)
  1985. {
  1986. p = new UnicodeMessage(this.m_Serial, (int) this.Body, type, hue, 3, this.m_Language, this.Name, text);
  1987. }
  1988. netState.Send(p);
  1989. }
  1990. }
  1991. else
  1992. {
  1993. m.OnSpeech(args2);
  1994. Server.Network.NetState state2 = m.NetState;
  1995. if (state2 != null)
  1996. {
  1997. if (packet2 == null)
  1998. {
  1999. packet2 = new UnicodeMessage(this.m_Serial, (int) this.Body, type, hue, 3, this.m_Language, this.Name, str);
  2000. }
  2001. state2.Send(packet2);
  2002. }
  2003. }
  2004. }
  2005. if (onSpeech.Count > 1)
  2006. {
  2007. onSpeech.Sort(new LocationComparer(this));
  2008. }
  2009. for (int j = 0; j < onSpeech.Count; j++)
  2010. {
  2011. object obj4 = onSpeech[j];
  2012. if (obj4 is Mobile)
  2013. {
  2014. Mobile mobile3 = (Mobile) obj4;
  2015. if ((args2 == null) || !this.CheckHearsMutatedSpeech(mobile3, context))
  2016. {
  2017. mobile3.OnSpeech(e);
  2018. }
  2019. else
  2020. {
  2021. mobile3.OnSpeech(args2);
  2022. }
  2023. }
  2024. else
  2025. {
  2026. ((Item) obj4).OnSpeech(e);
  2027. }
  2028. }
  2029. }
  2030. }
  2031. }
  2032. }
  2033. }
  2034. public virtual bool Drop(Point3D loc)
  2035. {
  2036. Mobile from = this;
  2037. Item holding = from.Holding;
  2038. if (holding == null)
  2039. {
  2040. return false;
  2041. }
  2042. from.Holding = null;
  2043. bool flag = true;
  2044. holding.SetLastMoved();
  2045. if (!holding.DropToWorld(from, loc))
  2046. {
  2047. holding.Bounce(from);
  2048. }
  2049. else
  2050. {
  2051. flag = false;
  2052. }
  2053. holding.ClearBounce();
  2054. if (!flag)
  2055. {
  2056. this.SendDropEffect(holding);
  2057. }
  2058. return !flag;
  2059. }
  2060. public virtual bool Drop(Item to, Point3D loc)
  2061. {
  2062. Mobile from = this;
  2063. Item holding = from.Holding;
  2064. if (holding == null)
  2065. {
  2066. return false;
  2067. }
  2068. from.Holding = null;
  2069. bool flag = true;
  2070. holding.SetLastMoved();
  2071. if ((to == null) || !holding.DropToItem(from, to, loc))
  2072. {
  2073. holding.Bounce(from);
  2074. }
  2075. else
  2076. {
  2077. flag = false;
  2078. }
  2079. holding.ClearBounce();
  2080. if (!flag)
  2081. {
  2082. this.SendDropEffect(holding);
  2083. }
  2084. return !flag;
  2085. }
  2086. public virtual bool Drop(Mobile to, Point3D loc)
  2087. {
  2088. Mobile from = this;
  2089. Item holding = from.Holding;
  2090. if (holding == null)
  2091. {
  2092. return false;
  2093. }
  2094. from.Holding = null;
  2095. bool flag = true;
  2096. holding.SetLastMoved();
  2097. if ((to == null) || !holding.DropToMobile(from, to, loc))
  2098. {
  2099. holding.Bounce(from);
  2100. }
  2101. else
  2102. {
  2103. flag = false;
  2104. }
  2105. holding.ClearBounce();
  2106. if (!flag)
  2107. {
  2108. this.SendDropEffect(holding);
  2109. }
  2110. return !flag;
  2111. }
  2112. public void DropHolding()
  2113. {
  2114. Item holding = this.m_Holding;
  2115. if (holding != null)
  2116. {
  2117. if (!holding.Deleted && (holding.Map == Server.Map.Internal))
  2118. {
  2119. holding.MoveToWorld(this.m_Location, this.m_Map);
  2120. }
  2121. holding.ClearBounce();
  2122. this.Holding = null;
  2123. }
  2124. }
  2125. public void Emote(int number)
  2126. {
  2127. this.Emote(number, "");
  2128. }
  2129. public void Emote(string text)
  2130. {
  2131. this.PublicOverheadMessage(MessageType.Emote, this.m_EmoteHue, false, text);
  2132. }
  2133. public void Emote(int number, string args)
  2134. {
  2135. this.PublicOverheadMessage(MessageType.Emote, this.m_EmoteHue, number, args);
  2136. }
  2137. public void Emote(string format, params object[] args)
  2138. {
  2139. this.Emote(string.Format(format, args));
  2140. }
  2141. public void EndAction(object toLock)
  2142. {
  2143. if (this.m_Actions != null)
  2144. {
  2145. this.m_Actions.Remove(toLock);
  2146. if (this.m_Actions.Count == 0)
  2147. {
  2148. this.m_Actions = null;
  2149. }
  2150. }
  2151. }
  2152. public virtual bool EquipItem(Item item)
  2153. {
  2154. if (((item == null) || item.Deleted) || !item.CanEquip(this))
  2155. {
  2156. return false;
  2157. }
  2158. if ((!this.CheckEquip(item) || !this.OnEquip(item)) || !item.OnEquip(this))
  2159. {
  2160. return false;
  2161. }
  2162. if ((this.m_Spell != null) && !this.m_Spell.OnCasterEquiping(item))
  2163. {
  2164. return false;
  2165. }
  2166. this.AddItem(item);
  2167. return true;
  2168. }
  2169. public Server.Items.BankBox FindBankNoCreate()
  2170. {
  2171. if (((this.m_BankBox == null) || this.m_BankBox.Deleted) || (this.m_BankBox.Parent != this))
  2172. {
  2173. this.m_BankBox = this.FindItemOnLayer(Layer.Bank) as Server.Items.BankBox;
  2174. }
  2175. return this.m_BankBox;
  2176. }
  2177. public DamageEntry FindDamageEntryFor(Mobile m)
  2178. {
  2179. for (int i = this.m_DamageEntries.Count - 1; i >= 0; i--)
  2180. {
  2181. if (i < this.m_DamageEntries.Count)
  2182. {
  2183. DamageEntry entry = (DamageEntry) this.m_DamageEntries[i];
  2184. if (entry.HasExpired)
  2185. {
  2186. this.m_DamageEntries.RemoveAt(i);
  2187. }
  2188. else if (entry.Damager == m)
  2189. {
  2190. return entry;
  2191. }
  2192. }
  2193. }
  2194. return null;
  2195. }
  2196. public Item FindItemOnLayer(Layer layer)
  2197. {
  2198. ArrayList items = this.m_Items;
  2199. int count = items.Count;
  2200. for (int i = 0; i < count; i++)
  2201. {
  2202. Item item = (Item) items[i];
  2203. if (!item.Deleted && (item.Layer == layer))
  2204. {
  2205. return item;
  2206. }
  2207. }
  2208. return null;
  2209. }
  2210. public DamageEntry FindLeastRecentDamageEntry(bool allowSelf)
  2211. {
  2212. for (int i = 0; i < this.m_DamageEntries.Count; i++)
  2213. {
  2214. if (i >= 0)
  2215. {
  2216. DamageEntry entry = (DamageEntry) this.m_DamageEntries[i];
  2217. if (entry.HasExpired)
  2218. {
  2219. this.m_DamageEntries.RemoveAt(i);
  2220. i--;
  2221. }
  2222. else if (allowSelf || (entry.Damager != this))
  2223. {
  2224. return entry;
  2225. }
  2226. }
  2227. }
  2228. return null;
  2229. }
  2230. public Mobile FindLeastRecentDamager(bool allowSelf)
  2231. {
  2232. return GetDamagerFrom(this.FindLeastRecentDamageEntry(allowSelf));
  2233. }
  2234. public DamageEntry FindLeastTotalDamageEntry(bool allowSelf)
  2235. {
  2236. DamageEntry entry = null;
  2237. for (int i = this.m_DamageEntries.Count - 1; i >= 0; i--)
  2238. {
  2239. if (i < this.m_DamageEntries.Count)
  2240. {
  2241. DamageEntry entry2 = (DamageEntry) this.m_DamageEntries[i];
  2242. if (entry2.HasExpired)
  2243. {
  2244. this.m_DamageEntries.RemoveAt(i);
  2245. }
  2246. else if ((allowSelf || (entry2.Damager != this)) && ((entry == null) || (entry2.DamageGiven < entry.DamageGiven)))
  2247. {
  2248. entry = entry2;
  2249. }
  2250. }
  2251. }
  2252. return entry;
  2253. }
  2254. public Mobile FindLeastTotalDamger(bool allowSelf)
  2255. {
  2256. return GetDamagerFrom(this.FindLeastTotalDamageEntry(allowSelf));
  2257. }
  2258. public DamageEntry FindMostRecentDamageEntry(bool allowSelf)
  2259. {
  2260. for (int i = this.m_DamageEntries.Count - 1; i >= 0; i--)
  2261. {
  2262. if (i < this.m_DamageEntries.Count)
  2263. {
  2264. DamageEntry entry = (DamageEntry) this.m_DamageEntries[i];
  2265. if (entry.HasExpired)
  2266. {
  2267. this.m_DamageEntries.RemoveAt(i);
  2268. }
  2269. else if (allowSelf || (entry.Damager != this))
  2270. {
  2271. return entry;
  2272. }
  2273. }
  2274. }
  2275. return null;
  2276. }
  2277. public Mobile FindMostRecentDamager(bool allowSelf)
  2278. {
  2279. return GetDamagerFrom(this.FindMostRecentDamageEntry(allowSelf));
  2280. }
  2281. public DamageEntry FindMostTotalDamageEntry(bool allowSelf)
  2282. {
  2283. DamageEntry entry = null;
  2284. for (int i = this.m_DamageEntries.Count - 1; i >= 0; i--)
  2285. {
  2286. if (i < this.m_DamageEntries.Count)
  2287. {
  2288. DamageEntry entry2 = (DamageEntry) this.m_DamageEntries[i];
  2289. if (entry2.HasExpired)
  2290. {
  2291. this.m_DamageEntries.RemoveAt(i);
  2292. }
  2293. else if ((allowSelf || (entry2.Damager != this)) && ((entry == null) || (entry2.DamageGiven > entry.DamageGiven)))
  2294. {
  2295. entry = entry2;
  2296. }
  2297. }
  2298. }
  2299. return entry;
  2300. }
  2301. public Mobile FindMostTotalDamger(bool allowSelf)
  2302. {
  2303. return GetDamagerFrom(this.FindMostTotalDamageEntry(allowSelf));
  2304. }
  2305. public void FixedEffect(int itemID, int speed, int duration)
  2306. {
  2307. Effects.SendTargetEffect(this, itemID, speed, duration, 0, 0);
  2308. }
  2309. public void FixedEffect(int itemID, int speed, int duration, int hue, int renderMode)
  2310. {
  2311. Effects.SendTargetEffect(this, itemID, speed, duration, hue, renderMode);
  2312. }
  2313. public void FixedParticles(int itemID, int speed, int duration, int effect, EffectLayer layer)
  2314. {
  2315. Effects.SendTargetParticles(this, itemID, speed, duration, 0, 0, effect, layer, 0);
  2316. }
  2317. public void FixedParticles(int itemID, int speed, int duration, int effect, EffectLayer layer, int unknown)
  2318. {
  2319. Effects.SendTargetParticles(this, itemID, speed, duration, 0, 0, effect, layer, unknown);
  2320. }
  2321. public void FixedParticles(int itemID, int speed, int duration, int effect, int hue, int renderMode, EffectLayer layer)
  2322. {
  2323. Effects.SendTargetParticles(this, itemID, speed, duration, hue, renderMode, effect, layer, 0);
  2324. }
  2325. public void FixedParticles(int itemID, int speed, int duration, int effect, int hue, int renderMode, EffectLayer layer, int unknown)
  2326. {
  2327. Effects.SendTargetParticles(this, itemID, speed, duration, hue, renderMode, effect, layer, unknown);
  2328. }
  2329. public void ForceRegionReEnter(bool Exit)
  2330. {
  2331. if (!this.m_Deleted)
  2332. {
  2333. Server.Region old = Server.Region.Find(this.m_Location, this.m_Map);
  2334. if (old != this.m_Region)
  2335. {
  2336. if (Exit)
  2337. {
  2338. this.m_Region.InternalExit(this);
  2339. }
  2340. this.m_Region = old;
  2341. this.OnRegionChange(old, this.m_Region);
  2342. this.m_Region.InternalEnter(this);
  2343. this.CheckLightLevels(false);
  2344. }
  2345. }
  2346. }
  2347. public void FreeCache()
  2348. {
  2349. this.m_RemovePacket = null;
  2350. this.m_OPLPacket = null;
  2351. this.m_PropertyList = null;
  2352. }
  2353. public void Freeze(TimeSpan duration)
  2354. {
  2355. if (!this.m_Frozen)
  2356. {
  2357. this.m_Frozen = true;
  2358. this.m_FrozenTimer = new FrozenTimer(this, duration);
  2359. this.m_FrozenTimer.Start();
  2360. }
  2361. }
  2362. public static string GetAccessLevelName(Server.AccessLevel level)
  2363. {
  2364. return m_AccessLevelNames[(int) level];
  2365. }
  2366. public virtual int GetAngerSound()
  2367. {
  2368. if (this.m_BaseSoundID != 0)
  2369. {
  2370. return this.m_BaseSoundID;
  2371. }
  2372. return -1;
  2373. }
  2374. public virtual int GetAttackSound()
  2375. {
  2376. if (this.m_BaseSoundID != 0)
  2377. {
  2378. return (this.m_BaseSoundID + 2);
  2379. }
  2380. return -1;
  2381. }
  2382. public virtual void GetChildProperties(ObjectPropertyList list, Item item)
  2383. {
  2384. }
  2385. public IPooledEnumerable GetClientsInRange(int range)
  2386. {
  2387. Server.Map map = this.m_Map;
  2388. if (map == null)
  2389. {
  2390. return Server.Map.NullEnumerable.Instance;
  2391. }
  2392. return map.GetClientsInRange(this.m_Location, range);
  2393. }
  2394. public virtual void GetChildContextMenuEntries(Mobile from, List<ContextMenuEntry> list, Item item)
  2395. {
  2396. }
  2397. public virtual void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
  2398. {
  2399. if (!this.m_Deleted)
  2400. {
  2401. if (this.CanPaperdollBeOpenedBy(from))
  2402. {
  2403. list.Add(new PaperdollEntry(this));
  2404. }
  2405. if (((from == this) && (this.Backpack != null)) && (this.CanSee((Item) this.Backpack) && this.CheckAlive(false)))
  2406. {
  2407. list.Add(new OpenBackpackEntry(this));
  2408. }
  2409. }
  2410. }
  2411. public virtual Mobile GetDamageMaster(Mobile damagee)
  2412. {
  2413. return null;
  2414. }
  2415. public static Mobile GetDamagerFrom(DamageEntry de)
  2416. {
  2417. if (de != null)
  2418. {
  2419. return de.Damager;
  2420. }
  2421. return null;
  2422. }
  2423. public virtual int GetDeathSound()
  2424. {
  2425. if (this.m_BaseSoundID != 0)
  2426. {
  2427. return (this.m_BaseSoundID + 4);
  2428. }
  2429. if (this.m_Body.IsHuman)
  2430. {
  2431. return Utility.Random(this.m_Female ? 0x314 : 0x423, this.m_Female ? 4 : 5);
  2432. }
  2433. return -1;
  2434. }
  2435. public virtual IWeapon GetDefaultWeapon()
  2436. {
  2437. return m_DefaultWeapon;
  2438. }
  2439. public Server.Direction GetDirectionTo(IPoint2D p)
  2440. {
  2441. if (p == null)
  2442. {
  2443. return Server.Direction.North;
  2444. }
  2445. return this.GetDirectionTo(p.X, p.Y);
  2446. }
  2447. public Server.Direction GetDirectionTo(Point2D p)
  2448. {
  2449. return this.GetDirectionTo(p.m_X, p.m_Y);
  2450. }
  2451. public Server.Direction GetDirectionTo(Point3D p)
  2452. {
  2453. return this.GetDirectionTo(p.m_X, p.m_Y);
  2454. }
  2455. public Server.Direction GetDirectionTo(int x, int y)
  2456. {
  2457. int num = this.m_Location.m_X - x;
  2458. int num2 = this.m_Location.m_Y - y;
  2459. int num3 = (num - num2) * 0x2c;
  2460. int num4 = (num + num2) * 0x2c;
  2461. int num5 = Math.Abs(num3);
  2462. int num6 = Math.Abs(num4);
  2463. if (((num6 >> 1) - num5) >= 0)
  2464. {
  2465. return ((num4 > 0) ? Server.Direction.Up : Server.Direction.Down);
  2466. }
  2467. if (((num5 >> 1) - num6) >= 0)
  2468. {
  2469. return ((num3 > 0) ? Server.Direction.Left : Server.Direction.Right);
  2470. }
  2471. if ((num3 >= 0) && (num4 >= 0))
  2472. {
  2473. return Server.Direction.West;
  2474. }
  2475. if ((num3 >= 0) && (num4 < 0))
  2476. {
  2477. return Server.Direction.South;
  2478. }
  2479. if ((num3 < 0) && (num4 < 0))
  2480. {
  2481. return Server.Direction.East;
  2482. }
  2483. return Server.Direction.North;
  2484. }
  2485. public double GetDistanceToSqrt(IPoint2D p)
  2486. {
  2487. int num = this.m_Location.m_X - p.X;
  2488. int num2 = this.m_Location.m_Y - p.Y;
  2489. return Math.Sqrt((double) ((num * num) + (num2 * num2)));
  2490. }
  2491. public double GetDistanceToSqrt(Mobile m)
  2492. {
  2493. int num = this.m_Location.m_X - m.m_Location.m_X;
  2494. int num2 = this.m_Location.m_Y - m.m_Location.m_Y;
  2495. return Math.Sqrt((double) ((num * num) + (num2 * num2)));
  2496. }
  2497. public double GetDistanceToSqrt(Point3D p)
  2498. {
  2499. int num = this.m_Location.m_X - p.m_X;
  2500. int num2 = this.m_Location.m_Y - p.m_Y;
  2501. return Math.Sqrt((double) ((num * num) + (num2 * num2)));
  2502. }
  2503. public static TimeSpan GetHitsRegenRate(Mobile m)
  2504. {
  2505. if (m_HitsRegenRate == null)
  2506. {
  2507. return m_DefaultHitsRate;
  2508. }
  2509. return m_HitsRegenRate(m);
  2510. }
  2511. public virtual int GetHurtSound()
  2512. {
  2513. if (this.m_BaseSoundID != 0)
  2514. {
  2515. return (this.m_BaseSoundID + 3);
  2516. }
  2517. return -1;
  2518. }
  2519. public virtual int GetIdleSound()
  2520. {
  2521. if (this.m_BaseSoundID != 0)
  2522. {
  2523. return (this.m_BaseSoundID + 1);
  2524. }
  2525. return -1;
  2526. }
  2527. public virtual DeathMoveResult GetInventoryMoveResultFor(Item item)
  2528. {
  2529. return item.OnInventoryDeath(this);
  2530. }
  2531. public IPooledEnumerable GetItemsInRange(int range)
  2532. {
  2533. Server.Map map = this.m_Map;
  2534. if (map == null)
  2535. {
  2536. return Server.Map.NullEnumerable.Instance;
  2537. }
  2538. return map.GetItemsInRange(this.m_Location, range);
  2539. }
  2540. public virtual TimeSpan GetLogoutDelay()
  2541. {
  2542. return this.Region.GetLogoutDelay(this);
  2543. }
  2544. public static TimeSpan GetManaRegenRate(Mobile m)
  2545. {
  2546. if (m_ManaRegenRate == null)
  2547. {
  2548. return m_DefaultManaRate;
  2549. }
  2550. return m_ManaRegenRate(m);
  2551. }
  2552. public virtual int GetMaxResistance(ResistanceType type)
  2553. {
  2554. if (this.m_Player)
  2555. {
  2556. return m_MaxPlayerResistance;
  2557. }
  2558. return 0x7fffffff;
  2559. }
  2560. public virtual int GetMinResistance(ResistanceType type)
  2561. {
  2562. return -2147483648;
  2563. }
  2564. public IPooledEnumerable GetMobilesInRange(int range)
  2565. {
  2566. Server.Map map = this.m_Map;
  2567. if (map == null)
  2568. {
  2569. return Server.Map.NullEnumerable.Instance;
  2570. }
  2571. return map.GetMobilesInRange(this.m_Location, range);
  2572. }
  2573. public IPooledEnumerable GetObjectsInRange(int range)
  2574. {
  2575. Server.Map map = this.m_Map;
  2576. if (map == null)
  2577. {
  2578. return Server.Map.NullEnumerable.Instance;
  2579. }
  2580. return map.GetObjectsInRange(this.m_Location, range);
  2581. }
  2582. public virtual int GetPacketFlags()
  2583. {
  2584. int num = 0;
  2585. if (this.m_Female)
  2586. {
  2587. num |= 2;
  2588. }
  2589. if (this.m_Poison != null)
  2590. {
  2591. num |= 4;
  2592. }
  2593. if (this.m_Blessed || this.m_YellowHealthbar)
  2594. {
  2595. num |= 8;
  2596. }
  2597. if (this.m_Warmode)
  2598. {
  2599. num |= 0x40;
  2600. }
  2601. if (this.m_Hidden)
  2602. {
  2603. num |= 0x80;
  2604. }
  2605. return num;
  2606. }
  2607. public virtual DeathMoveResult GetParentMoveResultFor(Item item)
  2608. {
  2609. return item.OnParentDeath(this);
  2610. }
  2611. public virtual void GetProperties(ObjectPropertyList list)
  2612. {
  2613. this.AddNameProperties(list);
  2614. }
  2615. public virtual int GetResistance(ResistanceType type)
  2616. {
  2617. if (this.m_Resistances == null)
  2618. {
  2619. this.m_Resistances = new int[] { -2147483648, -2147483648, -2147483648, -2147483648, -2147483648 };
  2620. }
  2621. int index = (int) type;
  2622. if ((index < 0) || (index >= this.m_Resistances.Length))
  2623. {
  2624. return 0;
  2625. }
  2626. int num2 = this.m_Resistances[index];
  2627. if (num2 == -2147483648)
  2628. {
  2629. this.ComputeResistances();
  2630. num2 = this.m_Resistances[index];
  2631. }
  2632. return num2;
  2633. }
  2634. public virtual int GetSeason()
  2635. {
  2636. if (this.m_Map != null)
  2637. {
  2638. return this.m_Map.Season;
  2639. }
  2640. return 1;
  2641. }
  2642. public static TimeSpan GetStamRegenRate(Mobile m)
  2643. {
  2644. if (m_StamRegenRate == null)
  2645. {
  2646. return m_DefaultStamRate;
  2647. }
  2648. return m_StamRegenRate(m);
  2649. }
  2650. public StatMod GetStatMod(string name)
  2651. {
  2652. for (int i = 0; i < this.m_StatMods.Count; i++)
  2653. {
  2654. StatMod mod = (StatMod) this.m_StatMods[i];
  2655. if (mod.Name == name)
  2656. {
  2657. return mod;
  2658. }
  2659. }
  2660. return null;
  2661. }
  2662. public int GetStatOffset(StatType type)
  2663. {
  2664. int num = 0;
  2665. for (int i = 0; i < this.m_StatMods.Count; i++)
  2666. {
  2667. StatMod mod = (StatMod) this.m_StatMods[i];
  2668. if (mod.HasElapsed())
  2669. {
  2670. this.m_StatMods.RemoveAt(i);
  2671. this.Delta(MobileDelta.Stat);
  2672. this.CheckStatTimers();
  2673. i--;
  2674. }
  2675. else if ((mod.Type & type) != 0)
  2676. {
  2677. num += mod.Offset;
  2678. }
  2679. }
  2680. return num;
  2681. }
  2682. public virtual bool HandlesOnSpeech(Mobile from)
  2683. {
  2684. return false;
  2685. }
  2686. public virtual bool HarmfulCheck(Mobile target)
  2687. {
  2688. if (this.CanBeHarmful(target))
  2689. {
  2690. this.DoHarmful(target);
  2691. return true;
  2692. }
  2693. return false;
  2694. }
  2695. public bool HasFreeHand()
  2696. {
  2697. return (this.FindItemOnLayer(Layer.TwoHanded) == null);
  2698. }
  2699. public bool HasGump(Type type)
  2700. {
  2701. return (FindGump(type) != null);
  2702. }
  2703. public Gump FindGump(Type type)
  2704. {
  2705. NetState ns = m_NetState;
  2706. if (ns != null)
  2707. {
  2708. foreach (Gump gump in ns.Gumps)
  2709. {
  2710. if (type.IsAssignableFrom(gump.GetType()))
  2711. {
  2712. return gump;
  2713. }
  2714. }
  2715. }
  2716. return null;
  2717. }
  2718. public void Heal(int amount)
  2719. {
  2720. if ((this.Alive && !this.IsDeadBondedPet) && this.Region.OnHeal(this, ref amount))
  2721. {
  2722. if ((this.Hits + amount) > this.HitsMax)
  2723. {
  2724. amount = this.HitsMax - this.Hits;
  2725. }
  2726. this.Hits += amount;
  2727. if ((amount > 0) && (this.m_NetState != null))
  2728. {
  2729. this.m_NetState.Send(new MessageLocalizedAffix(Server.Serial.MinusOne, -1, MessageType.Label, 0x3b2, 3, 0xf621e, "", AffixType.System, amount.ToString(), ""));
  2730. }
  2731. }
  2732. }
  2733. public void InitStats(int str, int dex, int intel)
  2734. {
  2735. this.m_Str = str;
  2736. this.m_Dex = dex;
  2737. this.m_Int = intel;
  2738. this.Hits = this.HitsMax;
  2739. this.Stam = this.StamMax;
  2740. this.Mana = this.ManaMax;
  2741. this.Delta(MobileDelta.Stat | MobileDelta.Attributes);
  2742. }
  2743. public bool InLOS(Mobile target)
  2744. {
  2745. if (this.m_Deleted || (this.m_Map == null))
  2746. {
  2747. return false;
  2748. }
  2749. if ((target != this) && (this.m_AccessLevel <= Server.AccessLevel.Player))
  2750. {
  2751. return this.m_Map.LineOfSight(this, target);
  2752. }
  2753. return true;
  2754. }
  2755. public bool InLOS(Point3D target)
  2756. {
  2757. if (this.m_Deleted || (this.m_Map == null))
  2758. {
  2759. return false;
  2760. }
  2761. return ((this.m_AccessLevel > Server.AccessLevel.Player) || this.m_Map.LineOfSight(this, target));
  2762. }
  2763. public bool InLOS(object target)
  2764. {
  2765. if (this.m_Deleted || (this.m_Map == null))
  2766. {
  2767. return false;
  2768. }
  2769. return (((target == this) || (this.m_AccessLevel > Server.AccessLevel.Player)) || (((target is Item) && (((Item) target).RootParent == this)) || this.m_Map.LineOfSight(this, target)));
  2770. }
  2771. public bool InRange(IPoint2D p, int range)
  2772. {
  2773. return ((((p.X >= (this.m_Location.m_X - range)) && (p.X <= (this.m_Location.m_X + range))) && (p.Y >= (this.m_Location.m_Y - range))) && (p.Y <= (this.m_Location.m_Y + range)));
  2774. }
  2775. public bool InRange(Point2D p, int range)
  2776. {
  2777. return ((((p.m_X >= (this.m_Location.m_X - range)) && (p.m_X <= (this.m_Location.m_X + range))) && (p.m_Y >= (this.m_Location.m_Y - range))) && (p.m_Y <= (this.m_Location.m_Y + range)));
  2778. }
  2779. public bool InRange(Point3D p, int range)
  2780. {
  2781. return ((((p.m_X >= (this.m_Location.m_X - range)) && (p.m_X <= (this.m_Location.m_X + range))) && (p.m_Y >= (this.m_Location.m_Y - range))) && (p.m_Y <= (this.m_Location.m_Y + range)));
  2782. }
  2783. public void Internalize()
  2784. {
  2785. this.Map = Server.Map.Internal;
  2786. }
  2787. private bool InternalOnMove(Server.Direction d)
  2788. {
  2789. if (!this.OnMove(d))
  2790. {
  2791. return false;
  2792. }
  2793. MovementEventArgs e = MovementEventArgs.Create(this, d);
  2794. EventSink.InvokeMovement(e);
  2795. bool flag = !e.Blocked;
  2796. e.Free();
  2797. return flag;
  2798. }
  2799. private void InternalRemoveSkillMod(SkillMod mod)
  2800. {
  2801. if (this.m_SkillMods.Contains(mod))
  2802. {
  2803. this.m_SkillMods.Remove(mod);
  2804. mod.Owner = null;
  2805. Skill skill = this.m_Skills[mod.Skill];
  2806. if (skill != null)
  2807. {
  2808. skill.Update();
  2809. }
  2810. }
  2811. }
  2812. public void InvalidateProperties()
  2813. {
  2814. if (Core.AOS)
  2815. {
  2816. if ((this.m_Map != null) && (this.m_Map != Server.Map.Internal))
  2817. {
  2818. ObjectPropertyList propertyList = this.m_PropertyList;
  2819. this.m_PropertyList = null;
  2820. ObjectPropertyList list2 = this.PropertyList;
  2821. if ((propertyList == null) || (propertyList.Hash != list2.Hash))
  2822. {
  2823. this.m_OPLPacket = null;
  2824. this.Delta(MobileDelta.Properties);
  2825. }
  2826. }
  2827. else
  2828. {
  2829. this.m_PropertyList = null;
  2830. this.m_OPLPacket = null;
  2831. }
  2832. }
  2833. }
  2834. public virtual bool IsBeneficialCriminal(Mobile target)
  2835. {
  2836. if (this == target)
  2837. {
  2838. return false;
  2839. }
  2840. int num = Notoriety.Compute(this, target);
  2841. if (num != 4)
  2842. {
  2843. return (num == 6);
  2844. }
  2845. return true;
  2846. }
  2847. public virtual bool IsHarmfulCriminal(Mobile target)
  2848. {
  2849. if (this == target)
  2850. {
  2851. return false;
  2852. }
  2853. return (Notoriety.Compute(this, target) == 1);
  2854. }
  2855. public virtual bool IsSnoop(Mobile from)
  2856. {
  2857. return (from != this);
  2858. }
  2859. public virtual void Kill()
  2860. {
  2861. if ((((this.CanBeDamaged() && (this.Alive && !this.IsDeadBondedPet)) && !this.m_Deleted) && this.Region.OnDeath(this)) && this.OnBeforeDeath())
  2862. {
  2863. Server.Items.BankBox box = this.FindBankNoCreate();
  2864. if ((box != null) && box.Opened)
  2865. {
  2866. box.Close();
  2867. }
  2868. if (this.m_NetState != null)
  2869. {
  2870. this.m_NetState.CancelAllTrades();
  2871. }
  2872. if (this.m_Spell != null)
  2873. {
  2874. this.m_Spell.OnCasterKilled();
  2875. }
  2876. if (this.m_Target != null)
  2877. {
  2878. this.m_Target.Cancel(this, TargetCancelType.Canceled);
  2879. }
  2880. this.DisruptiveAction();
  2881. this.Warmode = false;
  2882. this.DropHolding();
  2883. this.Hits = 0;
  2884. this.Stam = 0;
  2885. this.Mana = 0;
  2886. this.Poison = null;
  2887. this.Combatant = null;
  2888. if (this.Paralyzed)
  2889. {
  2890. this.Paralyzed = false;
  2891. if (this.m_ParaTimer != null)
  2892. {
  2893. this.m_ParaTimer.Stop();
  2894. }
  2895. }
  2896. if (this.Frozen)
  2897. {
  2898. this.Frozen = false;
  2899. if (this.m_FrozenTimer != null)
  2900. {
  2901. this.m_FrozenTimer.Stop();
  2902. }
  2903. }
  2904. ArrayList initialContent = new ArrayList();
  2905. ArrayList equipedItems = new ArrayList();
  2906. ArrayList list3 = new ArrayList();
  2907. ArrayList list4 = new ArrayList(this.m_Items);
  2908. Container backpack = this.Backpack;
  2909. for (int i = 0; i < list4.Count; i++)
  2910. {
  2911. Item item = (Item) list4[i];
  2912. if (item != backpack)
  2913. {
  2914. switch (this.GetParentMoveResultFor(item))
  2915. {
  2916. case DeathMoveResult.MoveToCorpse:
  2917. initialContent.Add(item);
  2918. equipedItems.Add(item);
  2919. break;
  2920. case DeathMoveResult.MoveToBackpack:
  2921. list3.Add(item);
  2922. break;
  2923. }
  2924. }
  2925. }
  2926. if (backpack != null)
  2927. {
  2928. ArrayList list5 = new ArrayList(backpack.Items);
  2929. for (int j = 0; j < list5.Count; j++)
  2930. {
  2931. Item item2 = (Item) list5[j];
  2932. if (this.GetInventoryMoveResultFor(item2) == DeathMoveResult.MoveToCorpse)
  2933. {
  2934. initialContent.Add(item2);
  2935. }
  2936. else
  2937. {
  2938. list3.Add(item2);
  2939. }
  2940. }
  2941. for (int k = 0; k < list3.Count; k++)
  2942. {
  2943. Item dropped = (Item) list3[k];
  2944. if (!this.RetainPackLocsOnDeath || (dropped.Parent != backpack))
  2945. {
  2946. backpack.DropItem(dropped);
  2947. }
  2948. }
  2949. }
  2950. HairInfo hair = null;
  2951. if (m_Hair != null)
  2952. hair = new HairInfo(m_Hair.ItemID, m_Hair.Hue);
  2953. FacialHairInfo facialhair = null;
  2954. if (m_FacialHair != null)
  2955. facialhair = new FacialHairInfo(m_FacialHair.ItemID, m_FacialHair.Hue);
  2956. Container corpse = (m_CreateCorpse == null) ? null : m_CreateCorpse(this, initialContent, equipedItems);
  2957. if (this.m_Map != null)
  2958. {
  2959. Packet p = null;
  2960. Packet removePacket = null;
  2961. IPooledEnumerable clientsInRange = this.m_Map.GetClientsInRange(this.m_Location);
  2962. foreach (Server.Network.NetState state in clientsInRange)
  2963. {
  2964. if (state != this.m_NetState)
  2965. {
  2966. if (p == null)
  2967. {
  2968. p = new DeathAnimation(this, corpse);
  2969. }
  2970. state.Send(p);
  2971. if (!state.Mobile.CanSee(this))
  2972. {
  2973. if (removePacket == null)
  2974. {
  2975. removePacket = this.RemovePacket;
  2976. }
  2977. state.Send(removePacket);
  2978. }
  2979. }
  2980. }
  2981. clientsInRange.Free();
  2982. }
  2983. this.OnDeath(corpse);
  2984. }
  2985. }
  2986. public void LaunchBrowser(string url)
  2987. {
  2988. if (this.m_NetState != null)
  2989. {
  2990. this.m_NetState.LaunchBrowser(url);
  2991. }
  2992. }
  2993. public virtual void Lift(Item item, int amount, out bool rejected, out LRReason reject)
  2994. {
  2995. rejected = true;
  2996. reject = LRReason.Inspecific;
  2997. if (item == null)
  2998. return;
  2999. Mobile from = this;
  3000. NetState state = m_NetState;
  3001. if (from.AccessLevel >= AccessLevel.GameMaster || DateTime.Now >= from.NextActionTime)
  3002. {
  3003. if (from.CheckAlive())
  3004. {
  3005. from.DisruptiveAction();
  3006. if (from.Holding != null)
  3007. {
  3008. reject = LRReason.AreHolding;
  3009. }
  3010. else if (from.AccessLevel < AccessLevel.GameMaster && !from.InRange(item.GetWorldLocation(), 2))
  3011. {
  3012. reject = LRReason.OutOfRange;
  3013. }
  3014. else if (!from.CanSee(item) || !from.InLOS(item))
  3015. {
  3016. reject = LRReason.OutOfSight;
  3017. }
  3018. else if (!item.VerifyMove(from))
  3019. {
  3020. reject = LRReason.CannotLift;
  3021. }
  3022. else if (!item.IsAccessibleTo(from))
  3023. {
  3024. reject = LRReason.CannotLift;
  3025. }
  3026. else if (!item.CheckLift(from, item, ref reject))
  3027. {
  3028. }
  3029. else
  3030. {
  3031. object root = item.RootParent;
  3032. if (root != null && root is Mobile && !((Mobile)root).CheckNonlocalLift(from, item))
  3033. {
  3034. reject = LRReason.TryToSteal;
  3035. }
  3036. else if (!from.OnDragLift(item) || !item.OnDragLift(from))
  3037. {
  3038. reject = LRReason.Inspecific;
  3039. }
  3040. else if (!from.CheckAlive())
  3041. {
  3042. reject = LRReason.Inspecific;
  3043. }
  3044. else
  3045. {
  3046. item.SetLastMoved();
  3047. if (item.Spawner != null)
  3048. {
  3049. item.Spawner.Remove(item);
  3050. item.Spawner = null;
  3051. }
  3052. if (amount == 0)
  3053. amount = 1;
  3054. if (amount > item.Amount)
  3055. amount = item.Amount;
  3056. int oldAmount = item.Amount;
  3057. //item.Amount = amount; //Set in LiftItemDupe
  3058. if (amount < oldAmount)
  3059. LiftItemDupe(item, amount);
  3060. //item.Dupe( oldAmount - amount );
  3061. Map map = from.Map;
  3062. if (Mobile.DragEffects && map != null && (root == null || root is Item))
  3063. {
  3064. IPooledEnumerable eable = map.GetClientsInRange(from.Location);
  3065. Packet p = null;
  3066. foreach (NetState ns in eable)
  3067. {
  3068. if (!ns.StygianAbyss && ns.Mobile != from && ns.Mobile.CanSee(from))
  3069. {
  3070. if (p == null)
  3071. {
  3072. IEntity src;
  3073. if (root == null)
  3074. src = new Entity(Serial.Zero, item.Location, map);
  3075. else
  3076. src = new Entity(((Item)root).Serial, ((Item)root).Location, map);
  3077. p = Packet.Acquire(new DragEffect(src, from, item.ItemID, item.Hue, amount));
  3078. }
  3079. ns.Send(p);
  3080. }
  3081. }
  3082. Packet.Release(p);
  3083. eable.Free();
  3084. }
  3085. Point3D fixLoc = item.Location;
  3086. Map fixMap = item.Map;
  3087. bool shouldFix = (item.Parent == null);
  3088. item.RecordBounce();
  3089. item.OnItemLifted(from, item);
  3090. item.Internalize();
  3091. from.Holding = item;
  3092. int liftSound = item.GetLiftSound(from);
  3093. if (liftSound != -1)
  3094. from.Send(new PlaySound(liftSound, from));
  3095. from.NextActionTime = DateTime.Now + TimeSpan.FromSeconds(0.5);
  3096. if (fixMap != null && shouldFix)
  3097. fixMap.FixColumn(fixLoc.m_X, fixLoc.m_Y);
  3098. reject = LRReason.Inspecific;
  3099. rejected = false;
  3100. }
  3101. }
  3102. }
  3103. else
  3104. {
  3105. reject = LRReason.Inspecific;
  3106. }
  3107. }
  3108. else
  3109. {
  3110. SendActionMessage();
  3111. reject = LRReason.Inspecific;
  3112. }
  3113. if (rejected && state != null)
  3114. {
  3115. state.Send(new LiftRej(reject));
  3116. if (item.Parent is Item)
  3117. {
  3118. if (state.ContainerGridLines)
  3119. state.Send(new ContainerContentUpdate6017(item));
  3120. else
  3121. state.Send(new ContainerContentUpdate(item));
  3122. }
  3123. else if (item.Parent is Mobile)
  3124. state.Send(new EquipUpdate(item));
  3125. else
  3126. item.SendInfoTo(state);
  3127. if (ObjectPropertyList.Enabled && item.Parent != null)
  3128. state.Send(item.OPLPacket);
  3129. }
  3130. }
  3131. public void LocalOverheadMessage(MessageType type, int hue, int number)
  3132. {
  3133. this.LocalOverheadMessage(type, hue, number, "");
  3134. }
  3135. public void LocalOverheadMessage(MessageType type, int hue, bool ascii, string text)
  3136. {
  3137. Server.Network.NetState netState = this.m_NetState;
  3138. if (netState != null)
  3139. {
  3140. if (ascii)
  3141. {
  3142. netState.Send(new AsciiMessage(this.m_Serial, (int) this.Body, type, hue, 3, this.Name, text));
  3143. }
  3144. else
  3145. {
  3146. netState.Send(new UnicodeMessage(this.m_Serial, (int) this.Body, type, hue, 3, this.m_Language, this.Name, text));
  3147. }
  3148. }
  3149. }
  3150. public void LocalOverheadMessage(MessageType type, int hue, int number, string args)
  3151. {
  3152. Server.Network.NetState netState = this.m_NetState;
  3153. if (netState != null)
  3154. {
  3155. netState.Send(new MessageLocalized(this.m_Serial, (int) this.Body, type, hue, 3, number, this.Name, args));
  3156. }
  3157. }
  3158. public virtual void Manifest(TimeSpan delay)
  3159. {
  3160. this.Warmode = true;
  3161. if (this.m_AutoManifestTimer == null)
  3162. {
  3163. this.m_AutoManifestTimer = new AutoManifestTimer(this, delay);
  3164. }
  3165. else
  3166. {
  3167. this.m_AutoManifestTimer.Stop();
  3168. }
  3169. this.m_AutoManifestTimer.Start();
  3170. }
  3171. public virtual bool Move(Server.Direction d)
  3172. {
  3173. if (this.m_Deleted)
  3174. {
  3175. return false;
  3176. }
  3177. Server.Items.BankBox box = this.FindBankNoCreate();
  3178. if ((box != null) && box.Opened)
  3179. {
  3180. box.Close();
  3181. }
  3182. Point3D location = this.Location;
  3183. Point3D oldLocation = location;
  3184. if ((this.m_Direction & Server.Direction.Up) == (d & Server.Direction.Up))
  3185. {
  3186. int num;
  3187. ArrayList mobiles;
  3188. if ((this.m_Spell != null) && !this.m_Spell.OnCasterMoving(d))
  3189. {
  3190. return false;
  3191. }
  3192. if (this.m_Paralyzed || this.m_Frozen)
  3193. {
  3194. this.SendLocalizedMessage(0x7a18f);
  3195. return false;
  3196. }
  3197. if (!this.CheckMovement(d, out num))
  3198. {
  3199. return false;
  3200. }
  3201. int x = this.m_Location.m_X;
  3202. int y = this.m_Location.m_Y;
  3203. int num4 = x;
  3204. int num5 = y;
  3205. int z = this.m_Location.m_Z;
  3206. switch ((d & Server.Direction.Up))
  3207. {
  3208. case Server.Direction.North:
  3209. y--;
  3210. break;
  3211. case Server.Direction.Right:
  3212. x++;
  3213. y--;
  3214. break;
  3215. case Server.Direction.East:
  3216. x++;
  3217. break;
  3218. case Server.Direction.Down:
  3219. x++;
  3220. y++;
  3221. break;
  3222. case Server.Direction.South:
  3223. y++;
  3224. break;
  3225. case Server.Direction.Left:
  3226. x--;
  3227. y++;
  3228. break;
  3229. case Server.Direction.West:
  3230. x--;
  3231. break;
  3232. case Server.Direction.Up:
  3233. x--;
  3234. y--;
  3235. break;
  3236. }
  3237. this.m_Pushing = false;
  3238. Server.Map map = this.m_Map;
  3239. if (map == null)
  3240. {
  3241. return false;
  3242. }
  3243. Sector sector = map.GetSector(num4, num5);
  3244. Sector sector2 = map.GetSector(x, y);
  3245. if (sector != sector2)
  3246. {
  3247. mobiles = sector.Mobiles;
  3248. for (int i = 0; i < mobiles.Count; i++)
  3249. {
  3250. Mobile mobile = (Mobile) mobiles[i];
  3251. if ((((mobile != this) && (mobile.X == num4)) && ((mobile.Y == num5) && ((mobile.Z + 15) > z))) && (((z + 15) > mobile.Z) && !mobile.OnMoveOff(this)))
  3252. {
  3253. return false;
  3254. }
  3255. }
  3256. mobiles = sector.Items;
  3257. for (int j = 0; j < mobiles.Count; j++)
  3258. {
  3259. Item item = (Item) mobiles[j];
  3260. if ((item.AtWorldPoint(num4, num5) && ((item.Z == z) || (((item.Z + item.ItemData.Height) > z) && ((z + 15) > item.Z)))) && !item.OnMoveOff(this))
  3261. {
  3262. return false;
  3263. }
  3264. }
  3265. mobiles = sector2.Mobiles;
  3266. for (int k = 0; k < mobiles.Count; k++)
  3267. {
  3268. Mobile mobile2 = (Mobile) mobiles[k];
  3269. if ((((mobile2.X == x) && (mobile2.Y == y)) && (((mobile2.Z + 15) > num) && ((num + 15) > mobile2.Z))) && !mobile2.OnMoveOver(this))
  3270. {
  3271. return false;
  3272. }
  3273. }
  3274. mobiles = sector2.Items;
  3275. for (int m = 0; m < mobiles.Count; m++)
  3276. {
  3277. Item item2 = (Item) mobiles[m];
  3278. if ((item2.AtWorldPoint(x, y) && ((item2.Z == num) || (((item2.Z + item2.ItemData.Height) > num) && ((num + 15) > item2.Z)))) && !item2.OnMoveOver(this))
  3279. {
  3280. return false;
  3281. }
  3282. }
  3283. }
  3284. else
  3285. {
  3286. mobiles = sector.Mobiles;
  3287. for (int n = 0; n < mobiles.Count; n++)
  3288. {
  3289. Mobile mobile3 = (Mobile) mobiles[n];
  3290. if ((((mobile3 != this) && (mobile3.X == num4)) && ((mobile3.Y == num5) && ((mobile3.Z + 15) > z))) && (((z + 15) > mobile3.Z) && !mobile3.OnMoveOff(this)))
  3291. {
  3292. return false;
  3293. }
  3294. if ((((mobile3.X == x) && (mobile3.Y == y)) && (((mobile3.Z + 15) > num) && ((num + 15) > mobile3.Z))) && !mobile3.OnMoveOver(this))
  3295. {
  3296. return false;
  3297. }
  3298. }
  3299. mobiles = sector.Items;
  3300. for (int num12 = 0; num12 < mobiles.Count; num12++)
  3301. {
  3302. Item item3 = (Item) mobiles[num12];
  3303. if ((item3.AtWorldPoint(num4, num5) && ((item3.Z == z) || (((item3.Z + item3.ItemData.Height) > z) && ((z + 15) > item3.Z)))) && !item3.OnMoveOff(this))
  3304. {
  3305. return false;
  3306. }
  3307. if ((item3.AtWorldPoint(x, y) && ((item3.Z == num) || (((item3.Z + item3.ItemData.Height) > num) && ((num + 15) > item3.Z)))) && !item3.OnMoveOver(this))
  3308. {
  3309. return false;
  3310. }
  3311. }
  3312. }
  3313. Server.Region region = Server.Region.Find(new Point3D(x, y, num), this.m_Map);
  3314. if ((region != null) && !region.OnMoveInto(this, d, new Point3D(x, y, num), oldLocation))
  3315. {
  3316. return false;
  3317. }
  3318. if (!this.InternalOnMove(d))
  3319. {
  3320. return false;
  3321. }
  3322. if (((m_FwdEnabled && (this.m_NetState != null)) && (this.m_AccessLevel < m_FwdAccessOverride)) && (!m_FwdUOTDOverride || ((this.m_NetState.Version != null) && (this.m_NetState.Version.Type != ClientType.UOTD))))
  3323. {
  3324. TimeSpan span;
  3325. DateTime time;
  3326. if (this.m_MoveRecords == null)
  3327. {
  3328. this.m_MoveRecords = new Queue(6);
  3329. }
  3330. while (this.m_MoveRecords.Count > 0)
  3331. {
  3332. MovementRecord record = (MovementRecord) this.m_MoveRecords.Peek();
  3333. if (!record.Expired())
  3334. {
  3335. break;
  3336. }
  3337. this.m_MoveRecords.Dequeue();
  3338. }
  3339. if (this.m_MoveRecords.Count >= m_FwdMaxSteps)
  3340. {
  3341. FastWalkEventArgs e = new FastWalkEventArgs(this.m_NetState);
  3342. EventSink.InvokeFastWalk(e);
  3343. if (e.Blocked)
  3344. {
  3345. return false;
  3346. }
  3347. }
  3348. if (this.Mounted)
  3349. {
  3350. span = ((d & Server.Direction.Running) != Server.Direction.North) ? m_RunMount : m_WalkMount;
  3351. }
  3352. else
  3353. {
  3354. span = ((d & Server.Direction.Running) != Server.Direction.North) ? m_RunFoot : m_WalkFoot;
  3355. }
  3356. if (this.m_MoveRecords.Count > 0)
  3357. {
  3358. time = this.m_EndQueue + span;
  3359. }
  3360. else
  3361. {
  3362. time = DateTime.Now + span;
  3363. }
  3364. this.m_MoveRecords.Enqueue(MovementRecord.NewInstance(time));
  3365. this.m_EndQueue = time;
  3366. }
  3367. this.m_LastMoveTime = DateTime.Now;
  3368. location = new Point3D(x, y, num);
  3369. this.DisruptiveAction();
  3370. }
  3371. if (this.m_NetState != null)
  3372. {
  3373. this.m_NetState.Send(MovementAck.Instantiate(this.m_NetState.Sequence, this));
  3374. }
  3375. this.SetLocation(location, false);
  3376. this.SetDirection(d);
  3377. if (this.m_Map != null)
  3378. {
  3379. MobileMoving[] movingPacketCache = m_MovingPacketCache;
  3380. for (int num13 = 0; num13 < movingPacketCache.Length; num13++)
  3381. {
  3382. movingPacketCache[num13] = null;
  3383. }
  3384. IPooledEnumerable objectsInRange = this.m_Map.GetObjectsInRange(this.m_Location, Core.GlobalMaxUpdateRange);
  3385. foreach (object obj2 in objectsInRange)
  3386. {
  3387. if (obj2 != this)
  3388. {
  3389. if (obj2 is Mobile)
  3390. {
  3391. m_MoveList.Add(obj2);
  3392. }
  3393. else if (obj2 is Item)
  3394. {
  3395. Item item4 = (Item) obj2;
  3396. if (item4.HandlesOnMovement)
  3397. {
  3398. m_MoveList.Add(item4);
  3399. }
  3400. }
  3401. }
  3402. }
  3403. objectsInRange.Free();
  3404. for (int num14 = 0; num14 < m_MoveList.Count; num14++)
  3405. {
  3406. object obj3 = m_MoveList[num14];
  3407. if (obj3 is Mobile)
  3408. {
  3409. Mobile source = (Mobile) m_MoveList[num14];
  3410. Server.Network.NetState netState = source.NetState;
  3411. if (((netState != null) && Utility.InUpdateRange(this.m_Location, source.m_Location)) && source.CanSee(this))
  3412. {
  3413. int index = Notoriety.Compute(source, this);
  3414. MobileMoving p = movingPacketCache[index];
  3415. if (p == null)
  3416. {
  3417. p = movingPacketCache[index] = new MobileMoving(this, index);
  3418. }
  3419. netState.Send(p);
  3420. }
  3421. source.OnMovement(this, oldLocation);
  3422. }
  3423. else if (obj3 is Item)
  3424. {
  3425. ((Item) obj3).OnMovement(this, oldLocation);
  3426. }
  3427. }
  3428. if (m_MoveList.Count > 0)
  3429. {
  3430. m_MoveList.Clear();
  3431. }
  3432. }
  3433. return true;
  3434. }
  3435. public virtual void MoveToWorld(Point3D newLocation, Server.Map map)
  3436. {
  3437. if (m_Deleted)
  3438. return;
  3439. if (m_Map == map)
  3440. {
  3441. SetLocation(newLocation, true);
  3442. return;
  3443. }
  3444. BankBox box = FindBankNoCreate();
  3445. if (box != null && box.Opened)
  3446. box.Close();
  3447. Point3D oldLocation = m_Location;
  3448. Map oldMap = m_Map;
  3449. Region oldRegion = m_Region;
  3450. if (oldMap != null)
  3451. {
  3452. oldMap.OnLeave(this);
  3453. ClearScreen();
  3454. SendRemovePacket();
  3455. }
  3456. for (int i = 0; i < m_Items.Count; ++i)
  3457. (m_Items[i] as Item).Map = map;
  3458. m_Map = map;
  3459. m_Location = newLocation;
  3460. NetState ns = m_NetState;
  3461. if (m_Map != null)
  3462. {
  3463. m_Map.OnEnter(this);
  3464. UpdateRegion();
  3465. if (ns != null && m_Map != null)
  3466. {
  3467. ns.Sequence = 0;
  3468. ns.Send(new MapChange(this));
  3469. ns.Send(new MapPatches());
  3470. ns.Send(SeasonChange.Instantiate(GetSeason(), true));
  3471. if (ns.StygianAbyss)
  3472. ns.Send(new MobileUpdate(this));
  3473. else
  3474. ns.Send(new MobileUpdateOld(this));
  3475. ClearFastwalkStack();
  3476. }
  3477. }
  3478. else
  3479. {
  3480. UpdateRegion();
  3481. }
  3482. if (ns != null)
  3483. {
  3484. if (m_Map != null)
  3485. Send(new ServerChange(this, m_Map));
  3486. ns.Sequence = 0;
  3487. ClearFastwalkStack();
  3488. if (ns.StygianAbyss)
  3489. {
  3490. Send(new MobileIncoming(this, this));
  3491. Send(new MobileUpdate(this));
  3492. CheckLightLevels(true);
  3493. Send(new MobileUpdate(this));
  3494. }
  3495. else
  3496. {
  3497. Send(new MobileIncomingOld(this, this));
  3498. Send(new MobileUpdateOld(this));
  3499. CheckLightLevels(true);
  3500. Send(new MobileUpdateOld(this));
  3501. }
  3502. }
  3503. SendEverything();
  3504. SendIncomingPacket();
  3505. if (ns != null)
  3506. {
  3507. ns.Sequence = 0;
  3508. ClearFastwalkStack();
  3509. if (ns.StygianAbyss)
  3510. {
  3511. Send(new MobileIncoming(this, this));
  3512. Send(SupportedFeatures.Instantiate(ns));
  3513. Send(new MobileUpdate(this));
  3514. Send(new MobileAttributes(this));
  3515. }
  3516. else
  3517. {
  3518. Send(new MobileIncomingOld(this, this));
  3519. Send(SupportedFeatures.Instantiate(ns));
  3520. Send(new MobileUpdateOld(this));
  3521. Send(new MobileAttributes(this));
  3522. }
  3523. }
  3524. OnMapChange(oldMap);
  3525. OnLocationChange(oldLocation);
  3526. if (m_Region != null)
  3527. m_Region.OnLocationChanged(this, oldLocation);
  3528. /*if (this.m_Map == map)
  3529. {
  3530. this.SetLocation(newLocation, true);
  3531. }
  3532. else
  3533. {
  3534. Server.Items.BankBox box = this.FindBankNoCreate();
  3535. if ((box != null) && box.Opened)
  3536. {
  3537. box.Close();
  3538. }
  3539. Point3D location = this.m_Location;
  3540. Server.Map oldMap = this.m_Map;
  3541. Server.Region old = this.m_Region;
  3542. if (oldMap != null)
  3543. {
  3544. oldMap.OnLeave(this);
  3545. this.ClearScreen();
  3546. this.SendRemovePacket();
  3547. }
  3548. for (int i = 0; i < this.m_Items.Count; i++)
  3549. {
  3550. ((Item) this.m_Items[i]).Map = map;
  3551. }
  3552. this.m_Map = map;
  3553. this.m_Region.InternalExit(this);
  3554. this.m_Location = newLocation;
  3555. if (this.m_Map != null)
  3556. {
  3557. this.m_Map.OnEnter(this);
  3558. this.m_Region = Server.Region.Find(this.m_Location, this.m_Map);
  3559. this.OnRegionChange(old, this.m_Region);
  3560. this.m_Region.InternalEnter(this);
  3561. Server.Network.NetState netState = this.m_NetState;
  3562. if ((netState != null) && (this.m_Map != null))
  3563. {
  3564. netState.Sequence = 0;
  3565. netState.Send(new MapChange(this));
  3566. netState.Send(new MapPatches());
  3567. netState.Send(SeasonChange.Instantiate(this.GetSeason(), true));
  3568. netState.Send(new MobileUpdate(this));
  3569. this.ClearFastwalkStack();
  3570. }
  3571. }
  3572. if (this.m_NetState != null)
  3573. {
  3574. if (this.m_Map != null)
  3575. {
  3576. this.Send(new ServerChange(this, this.m_Map));
  3577. }
  3578. if (this.m_NetState != null)
  3579. {
  3580. this.m_NetState.Sequence = 0;
  3581. this.ClearFastwalkStack();
  3582. }
  3583. this.Send(new MobileIncoming(this, this));
  3584. this.Send(new MobileUpdate(this));
  3585. this.CheckLightLevels(true);
  3586. this.Send(new MobileUpdate(this));
  3587. }
  3588. this.SendEverything();
  3589. this.SendIncomingPacket();
  3590. if (this.m_NetState != null)
  3591. {
  3592. if (this.m_NetState != null)
  3593. {
  3594. this.m_NetState.Sequence = 0;
  3595. this.ClearFastwalkStack();
  3596. }
  3597. this.Send(new MobileIncoming(this, this));
  3598. this.Send(SupportedFeatures.Instantiate());
  3599. this.Send(new MobileUpdate(this));
  3600. this.Send(new MobileAttributes(this));
  3601. }
  3602. this.OnMapChange(oldMap);
  3603. this.OnLocationChange(location);
  3604. this.m_Region.OnLocationChanged(this, location);
  3605. }*/
  3606. }
  3607. public void MovingEffect(IEntity to, int itemID, int speed, int duration, bool fixedDirection, bool explodes)
  3608. {
  3609. Effects.SendMovingEffect(this, to, itemID, speed, duration, fixedDirection, explodes, 0, 0);
  3610. }
  3611. public void MovingEffect(IEntity to, int itemID, int speed, int duration, bool fixedDirection, bool explodes, int hue, int renderMode)
  3612. {
  3613. Effects.SendMovingEffect(this, to, itemID, speed, duration, fixedDirection, explodes, hue, renderMode);
  3614. }
  3615. public void MovingParticles(IEntity to, int itemID, int speed, int duration, bool fixedDirection, bool explodes, int effect, int explodeEffect, int explodeSound)
  3616. {
  3617. Effects.SendMovingParticles(this, to, itemID, speed, duration, fixedDirection, explodes, 0, 0, effect, explodeEffect, explodeSound, 0);
  3618. }
  3619. public void MovingParticles(IEntity to, int itemID, int speed, int duration, bool fixedDirection, bool explodes, int effect, int explodeEffect, int explodeSound, int unknown)
  3620. {
  3621. Effects.SendMovingParticles(this, to, itemID, speed, duration, fixedDirection, explodes, effect, explodeEffect, explodeSound, unknown);
  3622. }
  3623. public void MovingParticles(IEntity to, int itemID, int speed, int duration, bool fixedDirection, bool explodes, int hue, int renderMode, int effect, int explodeEffect, int explodeSound, int unknown)
  3624. {
  3625. Effects.SendMovingParticles(this, to, itemID, speed, duration, fixedDirection, explodes, hue, renderMode, effect, explodeEffect, explodeSound, (EffectLayer) 0xff, unknown);
  3626. }
  3627. public void MovingParticles(IEntity to, int itemID, int speed, int duration, bool fixedDirection, bool explodes, int hue, int renderMode, int effect, int explodeEffect, int explodeSound, EffectLayer layer, int unknown)
  3628. {
  3629. Effects.SendMovingParticles(this, to, itemID, speed, duration, fixedDirection, explodes, hue, renderMode, effect, explodeEffect, explodeSound, layer, unknown);
  3630. }
  3631. public virtual bool MutateSpeech(ArrayList hears, ref string text, ref object context)
  3632. {
  3633. if (this.Alive)
  3634. {
  3635. return false;
  3636. }
  3637. StringBuilder builder = new StringBuilder(text.Length, text.Length);
  3638. for (int i = 0; i < text.Length; i++)
  3639. {
  3640. if (text[i] != ' ')
  3641. {
  3642. builder.Append(m_GhostChars[Utility.Random(m_GhostChars.Length)]);
  3643. }
  3644. else
  3645. {
  3646. builder.Append(' ');
  3647. }
  3648. }
  3649. text = builder.ToString();
  3650. context = m_GhostMutateContext;
  3651. return true;
  3652. }
  3653. public void NonlocalOverheadMessage(MessageType type, int hue, int number)
  3654. {
  3655. this.NonlocalOverheadMessage(type, hue, number, "");
  3656. }
  3657. public void NonlocalOverheadMessage(MessageType type, int hue, bool ascii, string text)
  3658. {
  3659. if (this.m_Map != null)
  3660. {
  3661. Packet p = null;
  3662. IPooledEnumerable clientsInRange = this.m_Map.GetClientsInRange(this.m_Location);
  3663. foreach (Server.Network.NetState state in clientsInRange)
  3664. {
  3665. if ((state == this.m_NetState) || !state.Mobile.CanSee(this))
  3666. {
  3667. continue;
  3668. }
  3669. if (p == null)
  3670. {
  3671. if (ascii)
  3672. {
  3673. p = new AsciiMessage(this.m_Serial, (int) this.Body, type, hue, 3, this.Name, text);
  3674. }
  3675. else
  3676. {
  3677. p = new UnicodeMessage(this.m_Serial, (int) this.Body, type, hue, 3, this.Language, this.Name, text);
  3678. }
  3679. }
  3680. state.Send(p);
  3681. }
  3682. clientsInRange.Free();
  3683. }
  3684. }
  3685. public void NonlocalOverheadMessage(MessageType type, int hue, int number, string args)
  3686. {
  3687. if (this.m_Map != null)
  3688. {
  3689. Packet p = null;
  3690. IPooledEnumerable clientsInRange = this.m_Map.GetClientsInRange(this.m_Location);
  3691. foreach (Server.Network.NetState state in clientsInRange)
  3692. {
  3693. if ((state != this.m_NetState) && state.Mobile.CanSee(this))
  3694. {
  3695. if (p == null)
  3696. {
  3697. p = new MessageLocalized(this.m_Serial, (int) this.Body, type, hue, 3, number, this.Name, args);
  3698. }
  3699. state.Send(p);
  3700. }
  3701. }
  3702. clientsInRange.Free();
  3703. }
  3704. }
  3705. public virtual void OnAccessLevelChanged(Server.AccessLevel oldLevel)
  3706. {
  3707. }
  3708. public virtual void OnAfterDelete()
  3709. {
  3710. this.StopAggrExpire();
  3711. this.CheckAggrExpire();
  3712. if (this.m_PoisonTimer != null)
  3713. {
  3714. this.m_PoisonTimer.Stop();
  3715. }
  3716. if (this.m_HitsTimer != null)
  3717. {
  3718. this.m_HitsTimer.Stop();
  3719. }
  3720. if (this.m_StamTimer != null)
  3721. {
  3722. this.m_StamTimer.Stop();
  3723. }
  3724. if (this.m_ManaTimer != null)
  3725. {
  3726. this.m_ManaTimer.Stop();
  3727. }
  3728. this.m_CombatTimer.Stop();
  3729. this.m_ExpireCombatant.Stop();
  3730. this.m_ExpireCriminal.Stop();
  3731. this.m_LogoutTimer.Stop();
  3732. if (this.m_WarmodeTimer != null)
  3733. {
  3734. this.m_WarmodeTimer.Stop();
  3735. }
  3736. if (this.m_ParaTimer != null)
  3737. {
  3738. this.m_ParaTimer.Stop();
  3739. }
  3740. if (this.m_FrozenTimer != null)
  3741. {
  3742. this.m_FrozenTimer.Stop();
  3743. }
  3744. }
  3745. public virtual void OnAfterResurrect()
  3746. {
  3747. }
  3748. public virtual void OnAosSingleClick(Mobile from)
  3749. {
  3750. ObjectPropertyList propertyList = this.PropertyList;
  3751. if (propertyList.Header > 0)
  3752. {
  3753. int nameHue;
  3754. if (this.m_NameHue != -1)
  3755. {
  3756. nameHue = this.m_NameHue;
  3757. }
  3758. else if (this.m_AccessLevel > Server.AccessLevel.Player)
  3759. {
  3760. nameHue = 11;
  3761. }
  3762. else
  3763. {
  3764. nameHue = Notoriety.GetHue(Notoriety.Compute(from, this));
  3765. }
  3766. from.Send(new MessageLocalized(this.m_Serial, (int) this.Body, MessageType.Label, nameHue, 3, propertyList.Header, this.Name, propertyList.HeaderArgs));
  3767. }
  3768. }
  3769. public virtual bool OnBeforeDeath()
  3770. {
  3771. return true;
  3772. }
  3773. public virtual void OnBeforeResurrect()
  3774. {
  3775. }
  3776. public virtual void OnBeneficialAction(Mobile target, bool isCriminal)
  3777. {
  3778. if (isCriminal)
  3779. {
  3780. this.CriminalAction(false);
  3781. }
  3782. }
  3783. public virtual void OnCombatantChange()
  3784. {
  3785. }
  3786. public virtual void OnConnected()
  3787. {
  3788. }
  3789. public virtual void OnCured(Mobile from, Server.Poison oldPoison)
  3790. {
  3791. }
  3792. public virtual void OnDamage(int amount, Mobile from, bool willKill)
  3793. {
  3794. }
  3795. public virtual void OnDeath(Container c)
  3796. {
  3797. int deathSound = this.GetDeathSound();
  3798. if (deathSound >= 0)
  3799. {
  3800. Effects.PlaySound(this, this.Map, deathSound);
  3801. }
  3802. if (!this.m_Player)
  3803. {
  3804. this.Delete();
  3805. }
  3806. else
  3807. {
  3808. this.Send(DeathStatus.Instantiate(true));
  3809. this.Warmode = false;
  3810. this.BodyMod = 0;
  3811. this.Body = this.Female ? 0x193 : 0x192;
  3812. Item item = new Item(0x204e);
  3813. item.Movable = false;
  3814. item.Layer = Layer.OuterTorso;
  3815. this.AddItem(item);
  3816. this.m_Items.Remove(item);
  3817. this.m_Items.Insert(0, item);
  3818. this.Poison = null;
  3819. this.Combatant = null;
  3820. this.Hits = 0;
  3821. this.Stam = 0;
  3822. this.Mana = 0;
  3823. EventSink.InvokePlayerDeath(new PlayerDeathEventArgs(this));
  3824. ProcessDeltaQueue();
  3825. this.Send(DeathStatus.Instantiate(false));
  3826. }
  3827. }
  3828. public virtual void OnDelete()
  3829. {
  3830. }
  3831. public virtual void OnDisconnected()
  3832. {
  3833. }
  3834. public virtual void OnDoubleClick(Mobile from)
  3835. {
  3836. if ((this == from) && (!m_DisableDismountInWarmode || !this.m_Warmode))
  3837. {
  3838. IMount mount = this.Mount;
  3839. if (mount != null)
  3840. {
  3841. mount.Rider = null;
  3842. return;
  3843. }
  3844. }
  3845. if (this.CanPaperdollBeOpenedBy(from))
  3846. {
  3847. this.DisplayPaperdollTo(from);
  3848. }
  3849. }
  3850. public virtual void OnDoubleClickCantSee(Mobile from)
  3851. {
  3852. }
  3853. public virtual void OnDoubleClickDead(Mobile from)
  3854. {
  3855. if (this.CanPaperdollBeOpenedBy(from))
  3856. {
  3857. this.DisplayPaperdollTo(from);
  3858. }
  3859. }
  3860. public virtual void OnDoubleClickOutOfRange(Mobile from)
  3861. {
  3862. }
  3863. public virtual bool OnDragDrop(Mobile from, Item dropped)
  3864. {
  3865. if (from == this)
  3866. {
  3867. Container pack = this.Backpack;
  3868. if (pack != null)
  3869. return dropped.DropToItem(from, pack, new Point3D(-1, -1, 0));
  3870. return false;
  3871. }
  3872. else if (from.Player && this.Player && from.Alive && this.Alive && from.InRange(Location, 2))
  3873. {
  3874. NetState ourState = m_NetState;
  3875. NetState theirState = from.m_NetState;
  3876. if (ourState != null && theirState != null)
  3877. {
  3878. SecureTradeContainer cont = theirState.FindTradeContainer(this);
  3879. if (!from.CheckTrade(this, dropped, cont, true, true, 0, 0))
  3880. return false;
  3881. if (cont == null)
  3882. cont = theirState.AddTrade(ourState);
  3883. cont.DropItem(dropped);
  3884. return true;
  3885. }
  3886. return false;
  3887. }
  3888. else
  3889. {
  3890. return false;
  3891. }
  3892. }
  3893. public virtual bool CheckTrade(Mobile to, Item item, SecureTradeContainer cont, bool message, bool checkItems, int plusItems, int plusWeight)
  3894. {
  3895. return true;
  3896. }
  3897. public virtual bool AllowEquipFrom(Mobile mob)
  3898. {
  3899. return (mob == this || (mob.AccessLevel >= AccessLevel.GameMaster && mob.AccessLevel > this.AccessLevel));
  3900. }
  3901. public bool HasTrade
  3902. {
  3903. get
  3904. {
  3905. if (m_NetState != null)
  3906. return m_NetState.Trades.Count > 0;
  3907. return false;
  3908. }
  3909. }
  3910. public virtual bool OnDragLift(Item item)
  3911. {
  3912. return true;
  3913. }
  3914. public virtual bool OnDroppedItemInto(Item item, Container container, Point3D loc)
  3915. {
  3916. return true;
  3917. }
  3918. public virtual bool OnDroppedItemOnto(Item item, Item target)
  3919. {
  3920. return true;
  3921. }
  3922. public virtual bool OnDroppedItemToItem(Item item, Item target, Point3D loc)
  3923. {
  3924. return true;
  3925. }
  3926. public virtual bool OnDroppedItemToMobile(Item item, Mobile target)
  3927. {
  3928. return true;
  3929. }
  3930. public virtual bool OnDroppedItemToWorld(Item item, Point3D location)
  3931. {
  3932. return true;
  3933. }
  3934. public virtual bool OnEquip(Item item)
  3935. {
  3936. return true;
  3937. }
  3938. public virtual void OnFailedCure(Mobile from)
  3939. {
  3940. }
  3941. public virtual void OnFameChange(int oldValue)
  3942. {
  3943. }
  3944. public virtual void OnGenderChanged(bool oldFemale)
  3945. {
  3946. }
  3947. public virtual void OnGuildChange(BaseGuild oldGuild)
  3948. {
  3949. }
  3950. public virtual void OnGuildTitleChange(string oldTitle)
  3951. {
  3952. }
  3953. public virtual void OnHarmfulAction(Mobile target, bool isCriminal)
  3954. {
  3955. if (isCriminal)
  3956. {
  3957. this.CriminalAction(false);
  3958. }
  3959. }
  3960. public virtual void OnHelpRequest(Mobile from)
  3961. {
  3962. }
  3963. public virtual void OnHigherPoison(Mobile from, Server.Poison poison)
  3964. {
  3965. }
  3966. public virtual void OnItemAdded(Item item)
  3967. {
  3968. }
  3969. public virtual void OnItemLifted(Mobile from, Item item)
  3970. {
  3971. }
  3972. public virtual void OnItemRemoved(Item item)
  3973. {
  3974. }
  3975. public virtual void OnItemUsed(Mobile from, Item item)
  3976. {
  3977. }
  3978. public virtual void OnKarmaChange(int oldValue)
  3979. {
  3980. }
  3981. public virtual void OnKillsChange(int oldValue)
  3982. {
  3983. }
  3984. protected virtual void OnLocationChange(Point3D oldLocation)
  3985. {
  3986. }
  3987. protected virtual void OnMapChange(Server.Map oldMap)
  3988. {
  3989. }
  3990. protected virtual bool OnMove(Server.Direction d)
  3991. {
  3992. if ((this.m_Hidden && (this.m_AccessLevel == Server.AccessLevel.Player)) && (((this.m_AllowedStealthSteps-- <= 0) || ((d & Server.Direction.Running) != Server.Direction.North)) || this.Mounted))
  3993. {
  3994. this.RevealingAction();
  3995. }
  3996. return true;
  3997. }
  3998. public virtual void OnMovement(Mobile m, Point3D oldLocation)
  3999. {
  4000. }
  4001. public virtual bool OnMoveOff(Mobile m)
  4002. {
  4003. return true;
  4004. }
  4005. public virtual bool OnMoveOver(Mobile m)
  4006. {
  4007. if (((this.m_Map != null) && !this.m_Deleted) && ((this.m_Map.Rules & MapRules.FreeMovement) == MapRules.FeluccaRules))
  4008. {
  4009. if ((!this.Alive || !m.Alive) || (this.IsDeadBondedPet || m.IsDeadBondedPet))
  4010. {
  4011. return true;
  4012. }
  4013. if (this.m_Hidden && (this.m_AccessLevel > Server.AccessLevel.Player))
  4014. {
  4015. return true;
  4016. }
  4017. if (!m.m_Pushing)
  4018. {
  4019. int num;
  4020. m.m_Pushing = true;
  4021. if (m.AccessLevel > Server.AccessLevel.Player)
  4022. {
  4023. num = this.m_Hidden ? 0xf8ca1 : 0xf8ca0;
  4024. }
  4025. else if (m.Stam == m.StamMax)
  4026. {
  4027. num = this.m_Hidden ? 0xf8ca3 : 0xf8ca2;
  4028. m.Stam -= 10;
  4029. m.RevealingAction();
  4030. }
  4031. else
  4032. {
  4033. return false;
  4034. }
  4035. m.SendLocalizedMessage(num);
  4036. }
  4037. }
  4038. return true;
  4039. }
  4040. public virtual void OnNetStateChanged()
  4041. {
  4042. }
  4043. public virtual void OnPaperdollRequest()
  4044. {
  4045. if (this.CanPaperdollBeOpenedBy(this))
  4046. {
  4047. this.DisplayPaperdollTo(this);
  4048. }
  4049. }
  4050. public virtual void OnPoisoned(Mobile from, Server.Poison poison, Server.Poison oldPoison)
  4051. {
  4052. if (poison != null)
  4053. {
  4054. this.LocalOverheadMessage(MessageType.Regular, 0x22, 0xfe9a9 + (poison.Level * 2));
  4055. this.NonlocalOverheadMessage(MessageType.Regular, 0x22, (int) (0xfe9aa + (poison.Level * 2)), this.Name);
  4056. }
  4057. }
  4058. public virtual void OnPoisonImmunity(Mobile from, Server.Poison poison)
  4059. {
  4060. this.PublicOverheadMessage(MessageType.Emote, 0x3b2, 0xf57de);
  4061. }
  4062. public virtual void OnRawDexChange(int oldValue)
  4063. {
  4064. }
  4065. public virtual void OnRawIntChange(int oldValue)
  4066. {
  4067. }
  4068. public virtual void OnRawStatChange(StatType stat, int oldValue)
  4069. {
  4070. }
  4071. public virtual void OnRawStrChange(int oldValue)
  4072. {
  4073. }
  4074. public virtual void OnRegionChange(Server.Region Old, Server.Region New)
  4075. {
  4076. }
  4077. public virtual void OnSaid(SpeechEventArgs e)
  4078. {
  4079. if (this.m_Squelched)
  4080. {
  4081. this.SendLocalizedMessage(0x7a1c8);
  4082. e.Blocked = true;
  4083. }
  4084. if (!e.Blocked)
  4085. {
  4086. this.RevealingAction();
  4087. }
  4088. }
  4089. public virtual void OnSectorActivate()
  4090. {
  4091. }
  4092. public virtual void OnSectorDeactivate()
  4093. {
  4094. }
  4095. public virtual void OnSingleClick(Mobile from)
  4096. {
  4097. if (!this.m_Deleted && (((this.AccessLevel != Server.AccessLevel.Player) || !DisableHiddenSelfClick) || (!this.Hidden || (from != this))))
  4098. {
  4099. int nameHue;
  4100. string str5;
  4101. if (m_GuildClickMessage)
  4102. {
  4103. BaseGuild guild = this.m_Guild;
  4104. if ((guild != null) && (this.m_DisplayGuildTitle || (this.m_Player && (guild.Type != GuildType.None))))
  4105. {
  4106. string str2;
  4107. string guildTitle = this.GuildTitle;
  4108. if (guildTitle == null)
  4109. {
  4110. guildTitle = "";
  4111. }
  4112. else
  4113. {
  4114. guildTitle = guildTitle.Trim();
  4115. }
  4116. if ((guild.Type >= GuildType.None) && ((int)guild.Type < m_GuildTypes.Length))
  4117. {
  4118. str2 = m_GuildTypes[(int) guild.Type];
  4119. }
  4120. else
  4121. {
  4122. str2 = "";
  4123. }
  4124. string text = string.Format((guildTitle.Length <= 0) ? "[{1}]{2}" : "[{0}, {1}]{2}", guildTitle, guild.Abbreviation, str2);
  4125. this.PrivateOverheadMessage(MessageType.Regular, this.SpeechHue, true, text, from.NetState);
  4126. }
  4127. }
  4128. if (this.m_NameHue != -1)
  4129. {
  4130. nameHue = this.m_NameHue;
  4131. }
  4132. else if (this.AccessLevel > Server.AccessLevel.Player)
  4133. {
  4134. nameHue = 11;
  4135. }
  4136. else
  4137. {
  4138. nameHue = Notoriety.GetHue(Notoriety.Compute(from, this));
  4139. }
  4140. string name = this.Name;
  4141. if (name == null)
  4142. {
  4143. name = string.Empty;
  4144. }
  4145. if ((this.ShowFameTitle && (this.m_Player || this.m_Body.IsHuman)) && (this.m_Fame >= 0x2710))
  4146. {
  4147. str5 = (this.m_Female ? "Lady " : "Lord ") + name;
  4148. }
  4149. else
  4150. {
  4151. str5 = name;
  4152. }
  4153. if ((this.ClickTitle && (this.Title != null)) && (this.Title.Length > 0))
  4154. {
  4155. str5 = str5 + " " + this.Title;
  4156. }
  4157. this.PrivateOverheadMessage(MessageType.Label, nameHue, m_AsciiClickMessage, str5, from.NetState);
  4158. }
  4159. }
  4160. public virtual void OnSkillChange(SkillName skill, double oldBase)
  4161. {
  4162. }
  4163. public virtual void OnSkillInvalidated(Skill skill)
  4164. {
  4165. }
  4166. public virtual void OnSkillsQuery(Mobile from)
  4167. {
  4168. if (from == this)
  4169. {
  4170. this.Send(new SkillUpdate(this.m_Skills));
  4171. }
  4172. }
  4173. public virtual void OnSpeech(SpeechEventArgs e)
  4174. {
  4175. }
  4176. public virtual void OnSpellCast(ISpell spell)
  4177. {
  4178. }
  4179. public virtual void OnStatsQuery(Mobile from)
  4180. {
  4181. if (((from.Map == this.Map) && Utility.InUpdateRange(this, from)) && from.CanSee(this))
  4182. {
  4183. from.Send(new MobileStatus(from, this));
  4184. }
  4185. if (from == this)
  4186. {
  4187. this.Send(new StatLockInfo(this));
  4188. }
  4189. IParty party = this.m_Party as IParty;
  4190. if (party != null)
  4191. {
  4192. party.OnStatsQuery(from, this);
  4193. }
  4194. }
  4195. public virtual void OnSubItemAdded(Item item)
  4196. {
  4197. }
  4198. public virtual void OnSubItemRemoved(Item item)
  4199. {
  4200. }
  4201. protected virtual void OnTargetChange()
  4202. {
  4203. }
  4204. public virtual void OnWeightChange(int oldValue)
  4205. {
  4206. }
  4207. public void Paralyze(TimeSpan duration)
  4208. {
  4209. if (!this.m_Paralyzed)
  4210. {
  4211. this.Paralyzed = true;
  4212. this.m_ParaTimer = new ParalyzedTimer(this, duration);
  4213. this.m_ParaTimer.Start();
  4214. }
  4215. }
  4216. public bool PlaceInBackpack(Item item)
  4217. {
  4218. if (item.Deleted)
  4219. {
  4220. return false;
  4221. }
  4222. Container backpack = this.Backpack;
  4223. return ((backpack != null) && backpack.TryDropItem(this, item, false));
  4224. }
  4225. public void PlaySound(int soundID)
  4226. {
  4227. if ((soundID != -1) && (this.m_Map != null))
  4228. {
  4229. Packet p = null;
  4230. IPooledEnumerable clientsInRange = this.m_Map.GetClientsInRange(this.m_Location);
  4231. foreach (Server.Network.NetState state in clientsInRange)
  4232. {
  4233. if (state.Mobile.CanSee(this))
  4234. {
  4235. if (p == null)
  4236. {
  4237. p = new Server.Network.PlaySound(soundID, this);
  4238. }
  4239. state.Send(p);
  4240. }
  4241. }
  4242. clientsInRange.Free();
  4243. }
  4244. }
  4245. public void PrivateOverheadMessage(MessageType type, int hue, int number, Server.Network.NetState state)
  4246. {
  4247. this.PrivateOverheadMessage(type, hue, number, "", state);
  4248. }
  4249. public void PrivateOverheadMessage(MessageType type, int hue, bool ascii, string text, Server.Network.NetState state)
  4250. {
  4251. if (state != null)
  4252. {
  4253. if (ascii)
  4254. {
  4255. state.Send(new AsciiMessage(this.m_Serial, (int) this.Body, type, hue, 3, this.Name, text));
  4256. }
  4257. else
  4258. {
  4259. state.Send(new UnicodeMessage(this.m_Serial, (int) this.Body, type, hue, 3, this.m_Language, this.Name, text));
  4260. }
  4261. }
  4262. }
  4263. public void PrivateOverheadMessage(MessageType type, int hue, int number, string args, Server.Network.NetState state)
  4264. {
  4265. if (state != null)
  4266. {
  4267. state.Send(new MessageLocalized(this.m_Serial, (int) this.Body, type, hue, 3, number, this.Name, args));
  4268. }
  4269. }
  4270. public virtual void ProcessDelta()
  4271. {
  4272. Mobile m = this;
  4273. MobileDelta deltaFlags = m.m_DeltaFlags;
  4274. if (deltaFlags != MobileDelta.None)
  4275. {
  4276. MobileDelta delta2 = deltaFlags & MobileDelta.Attributes;
  4277. m.m_DeltaFlags = MobileDelta.None;
  4278. m.m_InDeltaQueue = false;
  4279. bool flag = false;
  4280. bool flag2 = false;
  4281. bool flag3 = false;
  4282. bool flag4 = false;
  4283. bool flag5 = false;
  4284. bool flag6 = false;
  4285. bool flag7 = false;
  4286. bool flag8 = false;
  4287. bool flag9 = false;
  4288. bool flag10 = false;
  4289. bool flag11 = false;
  4290. bool flag12 = false;
  4291. bool flag13 = false;
  4292. bool flag14 = Core.AOS && ((deltaFlags & MobileDelta.Properties) != MobileDelta.None);
  4293. if (delta2 != MobileDelta.None)
  4294. {
  4295. flag5 = true;
  4296. if (delta2 == MobileDelta.Attributes)
  4297. {
  4298. flag4 = true;
  4299. }
  4300. else
  4301. {
  4302. flag = (delta2 & MobileDelta.Hits) != MobileDelta.None;
  4303. flag2 = (delta2 & MobileDelta.Stam) != MobileDelta.None;
  4304. flag3 = (delta2 & MobileDelta.Mana) != MobileDelta.None;
  4305. }
  4306. }
  4307. if ((deltaFlags & MobileDelta.GhostUpdate) != MobileDelta.None)
  4308. {
  4309. flag7 = true;
  4310. }
  4311. if ((deltaFlags & MobileDelta.Hue) != MobileDelta.None)
  4312. {
  4313. flag7 = true;
  4314. flag8 = true;
  4315. flag9 = true;
  4316. }
  4317. if ((deltaFlags & MobileDelta.Direction) != MobileDelta.None)
  4318. {
  4319. flag13 = true;
  4320. flag8 = true;
  4321. }
  4322. if ((deltaFlags & MobileDelta.Body) != MobileDelta.None)
  4323. {
  4324. flag8 = true;
  4325. flag6 = true;
  4326. }
  4327. if ((deltaFlags & (MobileDelta.Noto | MobileDelta.Flags)) != MobileDelta.None)
  4328. {
  4329. flag12 = true;
  4330. }
  4331. if ((deltaFlags & MobileDelta.Name) != MobileDelta.None)
  4332. {
  4333. flag4 = false;
  4334. flag = false;
  4335. flag5 = flag2 || flag3;
  4336. flag10 = true;
  4337. }
  4338. if ((deltaFlags & (MobileDelta.WeaponDamage | MobileDelta.Resistances | MobileDelta.TithingPoints | MobileDelta.Followers | MobileDelta.StatCap | MobileDelta.Armor | MobileDelta.Weight | MobileDelta.Gold | MobileDelta.Stat)) != MobileDelta.None)
  4339. {
  4340. flag11 = true;
  4341. }
  4342. MobileMoving[] movingPacketCache = m_MovingPacketCache;
  4343. if (flag12 || flag13)
  4344. {
  4345. for (int i = 0; i < movingPacketCache.Length; i++)
  4346. {
  4347. movingPacketCache[i] = null;
  4348. }
  4349. }
  4350. Server.Network.NetState netState = m.m_NetState;
  4351. if (netState != null)
  4352. {
  4353. if (flag8)
  4354. {
  4355. netState.Sequence = 0;
  4356. netState.Send(new MobileUpdate(m));
  4357. this.ClearFastwalkStack();
  4358. }
  4359. if (flag6)
  4360. {
  4361. netState.Send(new MobileIncoming(m, m));
  4362. }
  4363. if (flag12)
  4364. {
  4365. MobileMoving moving2;
  4366. int index = Notoriety.Compute(m, m);
  4367. movingPacketCache[index] = moving2 = new MobileMoving(m, index);
  4368. netState.Send(moving2);
  4369. }
  4370. if (flag10 || flag11)
  4371. {
  4372. netState.Send(new MobileStatusExtended(m));
  4373. }
  4374. else if (flag4)
  4375. {
  4376. netState.Send(new MobileAttributes(m));
  4377. }
  4378. else if (flag5)
  4379. {
  4380. if (flag)
  4381. {
  4382. netState.Send(new MobileHits(m));
  4383. }
  4384. if (flag2)
  4385. {
  4386. netState.Send(new MobileStam(m));
  4387. }
  4388. if (flag3)
  4389. {
  4390. netState.Send(new MobileMana(m));
  4391. }
  4392. }
  4393. if (flag2 || flag3)
  4394. {
  4395. IParty party = this.m_Party as IParty;
  4396. if ((party != null) && flag2)
  4397. {
  4398. party.OnStamChanged(this);
  4399. }
  4400. if ((party != null) && flag3)
  4401. {
  4402. party.OnManaChanged(this);
  4403. }
  4404. }
  4405. if (flag14)
  4406. {
  4407. netState.Send(this.OPLPacket);
  4408. }
  4409. }
  4410. flag12 = flag12 || flag13;
  4411. flag6 = flag6 || flag7;
  4412. if ((m.m_Map != null) && (((flag9 || flag6) || (flag10 || flag)) || (flag12 || flag14)))
  4413. {
  4414. IPooledEnumerable clientsInRange = m.Map.GetClientsInRange(m.m_Location);
  4415. Packet p = null;
  4416. Packet packet2 = null;
  4417. Packet packet3 = null;
  4418. foreach (Server.Network.NetState state2 in clientsInRange)
  4419. {
  4420. Mobile mobile = state2.Mobile;
  4421. if ((mobile != m) && mobile.CanSee(m))
  4422. {
  4423. if (flag9)
  4424. {
  4425. state2.Send(m.RemovePacket);
  4426. }
  4427. if (flag6)
  4428. {
  4429. state2.Send(new MobileIncoming(mobile, m));
  4430. if (m.IsDeadBondedPet)
  4431. {
  4432. state2.Send(new BondedStatus(0, m.m_Serial, 1));
  4433. }
  4434. }
  4435. if (flag12)
  4436. {
  4437. int num3 = Notoriety.Compute(mobile, m);
  4438. MobileMoving moving = movingPacketCache[num3];
  4439. if (moving == null)
  4440. {
  4441. movingPacketCache[num3] = moving = new MobileMoving(m, num3);
  4442. }
  4443. state2.Send(moving);
  4444. }
  4445. if (flag10)
  4446. {
  4447. if (m.CanBeRenamedBy(mobile))
  4448. {
  4449. if (packet2 == null)
  4450. {
  4451. packet2 = new MobileStatusCompact(true, m);
  4452. }
  4453. state2.Send(packet2);
  4454. }
  4455. else
  4456. {
  4457. if (packet3 == null)
  4458. {
  4459. packet3 = new MobileStatusCompact(false, m);
  4460. }
  4461. state2.Send(packet3);
  4462. }
  4463. }
  4464. else if (flag)
  4465. {
  4466. if (p == null)
  4467. {
  4468. p = new MobileHitsN(m);
  4469. }
  4470. state2.Send(p);
  4471. }
  4472. if (flag14)
  4473. {
  4474. state2.Send(this.OPLPacket);
  4475. }
  4476. }
  4477. }
  4478. clientsInRange.Free();
  4479. }
  4480. }
  4481. }
  4482. public static void ProcessDeltaQueue()
  4483. {
  4484. int count = m_DeltaQueue.Count;
  4485. int num2 = 0;
  4486. while ((m_DeltaQueue.Count > 0) && (num2++ < count))
  4487. {
  4488. ((Mobile) m_DeltaQueue.Dequeue()).ProcessDelta();
  4489. }
  4490. }
  4491. public void PublicOverheadMessage(MessageType type, int hue, int number)
  4492. {
  4493. this.PublicOverheadMessage(type, hue, number, "", true);
  4494. }
  4495. public void PublicOverheadMessage(MessageType type, int hue, bool ascii, string text)
  4496. {
  4497. this.PublicOverheadMessage(type, hue, ascii, text, true);
  4498. }
  4499. public void PublicOverheadMessage(MessageType type, int hue, int number, string args)
  4500. {
  4501. this.PublicOverheadMessage(type, hue, number, args, true);
  4502. }
  4503. public void PublicOverheadMessage(MessageType type, int hue, bool ascii, string text, bool noLineOfSight)
  4504. {
  4505. if (this.m_Map != null)
  4506. {
  4507. Packet p = null;
  4508. IPooledEnumerable clientsInRange = this.m_Map.GetClientsInRange(this.m_Location);
  4509. foreach (Server.Network.NetState state in clientsInRange)
  4510. {
  4511. if (!state.Mobile.CanSee(this) || (!noLineOfSight && !state.Mobile.InLOS(this)))
  4512. {
  4513. continue;
  4514. }
  4515. if (p == null)
  4516. {
  4517. if (ascii)
  4518. {
  4519. p = new AsciiMessage(this.m_Serial, (int) this.Body, type, hue, 3, this.Name, text);
  4520. }
  4521. else
  4522. {
  4523. p = new UnicodeMessage(this.m_Serial, (int) this.Body, type, hue, 3, this.m_Language, this.Name, text);
  4524. }
  4525. }
  4526. state.Send(p);
  4527. }
  4528. clientsInRange.Free();
  4529. }
  4530. }
  4531. public void PublicOverheadMessage(MessageType type, int hue, int number, string args, bool noLineOfSight)
  4532. {
  4533. if (this.m_Map != null)
  4534. {
  4535. Packet p = null;
  4536. IPooledEnumerable clientsInRange = this.m_Map.GetClientsInRange(this.m_Location);
  4537. foreach (Server.Network.NetState state in clientsInRange)
  4538. {
  4539. if (state.Mobile.CanSee(this) && (noLineOfSight || state.Mobile.InLOS(this)))
  4540. {
  4541. if (p == null)
  4542. {
  4543. p = new MessageLocalized(this.m_Serial, (int) this.Body, type, hue, 3, number, this.Name, args);
  4544. }
  4545. state.Send(p);
  4546. }
  4547. }
  4548. clientsInRange.Free();
  4549. }
  4550. }
  4551. public void PublicOverheadMessage(MessageType type, int hue, int number, AffixType affixType, string affix, string args)
  4552. {
  4553. this.PublicOverheadMessage(type, hue, number, affixType, affix, args, true);
  4554. }
  4555. public void PublicOverheadMessage(MessageType type, int hue, int number, AffixType affixType, string affix, string args, bool noLineOfSight)
  4556. {
  4557. if (this.m_Map != null)
  4558. {
  4559. Packet p = null;
  4560. IPooledEnumerable clientsInRange = this.m_Map.GetClientsInRange(this.m_Location);
  4561. foreach (Server.Network.NetState state in clientsInRange)
  4562. {
  4563. if (state.Mobile.CanSee(this) && (noLineOfSight || state.Mobile.InLOS(this)))
  4564. {
  4565. if (p == null)
  4566. {
  4567. p = new MessageLocalizedAffix(this.m_Serial, (int) this.Body, type, hue, 3, number, this.Name, affixType, affix, args);
  4568. }
  4569. state.Send(p);
  4570. }
  4571. }
  4572. clientsInRange.Free();
  4573. }
  4574. }
  4575. public virtual DamageEntry RegisterDamage(int amount, Mobile from)
  4576. {
  4577. DamageEntry entry = this.FindDamageEntryFor(from);
  4578. if (entry == null)
  4579. {
  4580. entry = new DamageEntry(from);
  4581. }
  4582. entry.DamageGiven += amount;
  4583. entry.LastDamage = DateTime.Now;
  4584. this.m_DamageEntries.Remove(entry);
  4585. this.m_DamageEntries.Add(entry);
  4586. Mobile damageMaster = from.GetDamageMaster(this);
  4587. if (damageMaster != null)
  4588. {
  4589. ArrayList responsible = entry.Responsible;
  4590. if (responsible == null)
  4591. {
  4592. entry.Responsible = responsible = new ArrayList();
  4593. }
  4594. DamageEntry entry2 = null;
  4595. for (int i = 0; i < responsible.Count; i++)
  4596. {
  4597. DamageEntry entry3 = (DamageEntry) responsible[i];
  4598. if (entry3.Damager == damageMaster)
  4599. {
  4600. entry2 = entry3;
  4601. break;
  4602. }
  4603. }
  4604. if (entry2 == null)
  4605. {
  4606. responsible.Add(entry2 = new DamageEntry(damageMaster));
  4607. }
  4608. entry2.DamageGiven += amount;
  4609. entry2.LastDamage = DateTime.Now;
  4610. }
  4611. return entry;
  4612. }
  4613. public void RemoveAggressed(Mobile aggressed)
  4614. {
  4615. if (!this.m_Deleted)
  4616. {
  4617. ArrayList list = this.m_Aggressed;
  4618. for (int i = 0; i < list.Count; i++)
  4619. {
  4620. AggressorInfo info = (AggressorInfo) list[i];
  4621. if (info.Defender == aggressed)
  4622. {
  4623. this.m_Aggressed.RemoveAt(i);
  4624. info.Free();
  4625. if ((this.m_NetState != null) && this.CanSee(aggressed))
  4626. {
  4627. this.m_NetState.Send(new MobileIncoming(this, aggressed));
  4628. }
  4629. break;
  4630. }
  4631. }
  4632. this.UpdateAggrExpire();
  4633. }
  4634. }
  4635. public void RemoveAggressor(Mobile aggressor)
  4636. {
  4637. if (!this.m_Deleted)
  4638. {
  4639. ArrayList aggressors = this.m_Aggressors;
  4640. for (int i = 0; i < aggressors.Count; i++)
  4641. {
  4642. AggressorInfo info = (AggressorInfo) aggressors[i];
  4643. if (info.Attacker == aggressor)
  4644. {
  4645. this.m_Aggressors.RemoveAt(i);
  4646. info.Free();
  4647. if ((this.m_NetState != null) && this.CanSee(aggressor))
  4648. {
  4649. this.m_NetState.Send(new MobileIncoming(this, aggressor));
  4650. }
  4651. break;
  4652. }
  4653. }
  4654. this.UpdateAggrExpire();
  4655. }
  4656. }
  4657. public void RemoveItem(Item item)
  4658. {
  4659. if (((item != null) && (this.m_Items != null)) && this.m_Items.Contains(item))
  4660. {
  4661. item.SendRemovePacket();
  4662. int count = this.m_Items.Count;
  4663. this.m_Items.Remove(item);
  4664. if (!(item is Server.Items.BankBox))
  4665. {
  4666. this.TotalWeight -= item.TotalWeight + item.PileWeight;
  4667. this.TotalGold -= item.TotalGold;
  4668. }
  4669. item.Parent = null;
  4670. item.OnRemoved(this);
  4671. this.OnItemRemoved(item);
  4672. if (((item.PhysicalResistance != 0) || (item.FireResistance != 0)) || (((item.ColdResistance != 0) || (item.PoisonResistance != 0)) || (item.EnergyResistance != 0)))
  4673. {
  4674. this.UpdateResistances();
  4675. }
  4676. }
  4677. }
  4678. public virtual void RemoveResistanceMod(ResistanceMod toRemove)
  4679. {
  4680. if (this.m_ResistMods != null)
  4681. {
  4682. this.m_ResistMods.Remove(toRemove);
  4683. if (this.m_ResistMods.Count == 0)
  4684. {
  4685. this.m_ResistMods = null;
  4686. }
  4687. }
  4688. this.UpdateResistances();
  4689. }
  4690. public virtual void RemoveSkillMod(SkillMod mod)
  4691. {
  4692. if (mod != null)
  4693. {
  4694. this.ValidateSkillMods();
  4695. this.InternalRemoveSkillMod(mod);
  4696. }
  4697. }
  4698. public bool RemoveStatMod(string name)
  4699. {
  4700. for (int i = 0; i < this.m_StatMods.Count; i++)
  4701. {
  4702. StatMod mod = (StatMod) this.m_StatMods[i];
  4703. if (mod.Name == name)
  4704. {
  4705. this.m_StatMods.RemoveAt(i);
  4706. this.CheckStatTimers();
  4707. this.Delta(MobileDelta.Stat);
  4708. return true;
  4709. }
  4710. }
  4711. return false;
  4712. }
  4713. public virtual void Resurrect()
  4714. {
  4715. if ((!this.Alive && this.Region.OnResurrect(this)) && this.CheckResurrect())
  4716. {
  4717. this.OnBeforeResurrect();
  4718. Server.Items.BankBox box = this.FindBankNoCreate();
  4719. if ((box != null) && box.Opened)
  4720. {
  4721. box.Close();
  4722. }
  4723. this.Poison = null;
  4724. this.Warmode = false;
  4725. this.Hits = 10;
  4726. this.Stam = this.StamMax;
  4727. this.Mana = 0;
  4728. this.BodyMod = 0;
  4729. this.Body = this.m_Female ? 0x191 : 400;
  4730. ProcessDeltaQueue();
  4731. for (int i = this.m_Items.Count - 1; i >= 0; i--)
  4732. {
  4733. if (i < this.m_Items.Count)
  4734. {
  4735. Item item = (Item) this.m_Items[i];
  4736. if (item.ItemID == 0x204e)
  4737. {
  4738. item.Delete();
  4739. }
  4740. }
  4741. }
  4742. this.SendIncomingPacket();
  4743. this.SendIncomingPacket();
  4744. this.OnAfterResurrect();
  4745. }
  4746. }
  4747. public virtual void RevealingAction()
  4748. {
  4749. if (this.m_Hidden && (this.m_AccessLevel == Server.AccessLevel.Player))
  4750. {
  4751. this.Hidden = false;
  4752. }
  4753. this.DisruptiveAction();
  4754. }
  4755. public virtual int SafeBody(int body)
  4756. {
  4757. int num = -1;
  4758. for (int i = 0; (num < 0) && (i < m_InvalidBodies.Length); i++)
  4759. {
  4760. num = m_InvalidBodies[i] - body;
  4761. }
  4762. if (num != 0)
  4763. {
  4764. return body;
  4765. }
  4766. return 0;
  4767. }
  4768. public void Say(int number)
  4769. {
  4770. this.Say(number, "");
  4771. }
  4772. public void Say(string text)
  4773. {
  4774. this.PublicOverheadMessage(MessageType.Regular, this.m_SpeechHue, false, text);
  4775. }
  4776. public void Say(bool ascii, string text)
  4777. {
  4778. this.PublicOverheadMessage(MessageType.Regular, this.m_SpeechHue, ascii, text);
  4779. }
  4780. public void Say(int number, string args)
  4781. {
  4782. this.PublicOverheadMessage(MessageType.Regular, this.m_SpeechHue, number, args);
  4783. }
  4784. public void Say(string format, params object[] args)
  4785. {
  4786. this.Say(string.Format(format, args));
  4787. }
  4788. public void Say(int number, AffixType type, string affix, string args)
  4789. {
  4790. this.PublicOverheadMessage(MessageType.Regular, this.m_SpeechHue, number, type, affix, args);
  4791. }
  4792. public void SayTo(Mobile to, int number)
  4793. {
  4794. to.Send(new MessageLocalized(this.m_Serial, (int) this.Body, MessageType.Regular, this.m_SpeechHue, 3, number, this.Name, ""));
  4795. }
  4796. public void SayTo(Mobile to, string text)
  4797. {
  4798. this.SayTo(to, false, text);
  4799. }
  4800. public void SayTo(Mobile to, bool ascii, string text)
  4801. {
  4802. this.PrivateOverheadMessage(MessageType.Regular, this.m_SpeechHue, ascii, text, to.NetState);
  4803. }
  4804. public void SayTo(Mobile to, int number, string args)
  4805. {
  4806. to.Send(new MessageLocalized(this.m_Serial, (int) this.Body, MessageType.Regular, this.m_SpeechHue, 3, number, this.Name, args));
  4807. }
  4808. public void SayTo(Mobile to, string format, params object[] args)
  4809. {
  4810. this.SayTo(to, false, string.Format(format, args));
  4811. }
  4812. public void SayTo(Mobile to, bool ascii, string format, params object[] args)
  4813. {
  4814. this.SayTo(to, ascii, string.Format(format, args));
  4815. }
  4816. public bool Send(Packet p)
  4817. {
  4818. return this.Send(p, false);
  4819. }
  4820. public bool Send(Packet p, bool throwOnOffline)
  4821. {
  4822. if (this.m_NetState != null)
  4823. {
  4824. this.m_NetState.Send(p);
  4825. return true;
  4826. }
  4827. if (throwOnOffline)
  4828. {
  4829. throw new MobileNotConnectedException(this, "Packet could not be sent.");
  4830. }
  4831. return false;
  4832. }
  4833. public virtual void SendActionMessage()
  4834. {
  4835. if (DateTime.Now >= this.m_NextActionMessage)
  4836. {
  4837. this.m_NextActionMessage = DateTime.Now + m_ActionMessageDelay;
  4838. this.SendLocalizedMessage(0x7a197);
  4839. }
  4840. }
  4841. public void SendAsciiMessage(string text)
  4842. {
  4843. this.SendAsciiMessage(0x3b2, text);
  4844. }
  4845. public void SendAsciiMessage(int hue, string text)
  4846. {
  4847. Server.Network.NetState netState = this.m_NetState;
  4848. if (netState != null)
  4849. {
  4850. netState.Send(new AsciiMessage(Server.Serial.MinusOne, -1, MessageType.Regular, hue, 3, "System", text));
  4851. }
  4852. }
  4853. public void SendAsciiMessage(string format, params object[] args)
  4854. {
  4855. this.SendAsciiMessage(0x3b2, string.Format(format, args));
  4856. }
  4857. public void SendAsciiMessage(int hue, string format, params object[] args)
  4858. {
  4859. this.SendAsciiMessage(hue, string.Format(format, args));
  4860. }
  4861. public virtual void SendDamageToAll(int amount)
  4862. {
  4863. if (amount >= 0)
  4864. {
  4865. Server.Map map = this.m_Map;
  4866. if (map != null)
  4867. {
  4868. IPooledEnumerable clientsInRange = map.GetClientsInRange(this.m_Location);
  4869. Packet p = null;
  4870. foreach (Server.Network.NetState state in clientsInRange)
  4871. {
  4872. if (state.Mobile.CanSee(this))
  4873. {
  4874. if (p == null)
  4875. {
  4876. p = new DamagePacket(this, amount);
  4877. }
  4878. state.Send(p);
  4879. }
  4880. }
  4881. clientsInRange.Free();
  4882. }
  4883. }
  4884. }
  4885. public virtual void SendDropEffect(Item item)
  4886. {
  4887. if (DragEffects)
  4888. {
  4889. Server.Map map = this.m_Map;
  4890. object rootParent = item.RootParent;
  4891. if ((map != null) && ((rootParent == null) || (rootParent is Item)))
  4892. {
  4893. IPooledEnumerable clientsInRange = map.GetClientsInRange(this.m_Location);
  4894. Packet p = null;
  4895. foreach (Server.Network.NetState state in clientsInRange)
  4896. {
  4897. if ((state.Mobile == this) || !state.Mobile.CanSee(this))
  4898. {
  4899. continue;
  4900. }
  4901. if (p == null)
  4902. {
  4903. IEntity entity;
  4904. if (rootParent == null)
  4905. {
  4906. entity = new Entity(Server.Serial.Zero, item.Location, map);
  4907. }
  4908. else
  4909. {
  4910. entity = new Entity(((Item) rootParent).Serial, ((Item) rootParent).Location, map);
  4911. }
  4912. p = new DragEffect(this, entity, item.ItemID, item.Hue, item.Amount);
  4913. }
  4914. state.Send(p);
  4915. }
  4916. clientsInRange.Free();
  4917. }
  4918. }
  4919. }
  4920. public void SendEverything()
  4921. {
  4922. Server.Network.NetState netState = this.m_NetState;
  4923. if ((this.m_Map != null) && (netState != null))
  4924. {
  4925. IPooledEnumerable objectsInRange = this.m_Map.GetObjectsInRange(this.m_Location, Core.GlobalMaxUpdateRange);
  4926. foreach (object obj2 in objectsInRange)
  4927. {
  4928. if (obj2 is Item)
  4929. {
  4930. Item item = (Item) obj2;
  4931. if (this.CanSee(item) && this.InRange(item.Location, item.GetUpdateRange(this)))
  4932. {
  4933. item.SendInfoTo(netState);
  4934. }
  4935. }
  4936. else if (obj2 is Mobile)
  4937. {
  4938. Mobile m = (Mobile) obj2;
  4939. if (this.CanSee(m) && Utility.InUpdateRange(this.m_Location, m.m_Location))
  4940. {
  4941. netState.Send(new MobileIncoming(this, m));
  4942. if (m.IsDeadBondedPet)
  4943. {
  4944. netState.Send(new BondedStatus(0, m.m_Serial, 1));
  4945. }
  4946. if (ObjectPropertyList.Enabled)
  4947. {
  4948. netState.Send(m.OPLPacket);
  4949. }
  4950. }
  4951. }
  4952. }
  4953. objectsInRange.Free();
  4954. }
  4955. }
  4956. public bool SendGump(Gump g)
  4957. {
  4958. return this.SendGump(g, false);
  4959. }
  4960. public bool SendGump(Gump g, bool throwOnOffline)
  4961. {
  4962. if (this.m_NetState != null)
  4963. {
  4964. g.SendTo(this.m_NetState);
  4965. return true;
  4966. }
  4967. if (throwOnOffline)
  4968. {
  4969. throw new MobileNotConnectedException(this, "Gump could not be sent.");
  4970. }
  4971. return false;
  4972. }
  4973. public bool SendHuePicker(HuePicker p)
  4974. {
  4975. return this.SendHuePicker(p, false);
  4976. }
  4977. public bool SendHuePicker(HuePicker p, bool throwOnOffline)
  4978. {
  4979. if (this.m_NetState != null)
  4980. {
  4981. p.SendTo(this.m_NetState);
  4982. return true;
  4983. }
  4984. if (throwOnOffline)
  4985. {
  4986. throw new MobileNotConnectedException(this, "Hue picker could not be sent.");
  4987. }
  4988. return false;
  4989. }
  4990. public void SendIncomingPacket()
  4991. {
  4992. if (this.m_Map != null)
  4993. {
  4994. IPooledEnumerable clientsInRange = this.m_Map.GetClientsInRange(this.m_Location);
  4995. foreach (Server.Network.NetState state in clientsInRange)
  4996. {
  4997. if (state.Mobile.CanSee(this))
  4998. {
  4999. state.Send(new MobileIncoming(state.Mobile, this));
  5000. if (this.IsDeadBondedPet)
  5001. {
  5002. state.Send(new BondedStatus(0, this.m_Serial, 1));
  5003. }
  5004. if (ObjectPropertyList.Enabled)
  5005. {
  5006. state.Send(this.OPLPacket);
  5007. }
  5008. }
  5009. }
  5010. clientsInRange.Free();
  5011. }
  5012. }
  5013. public void SendLocalizedMessage(int number)
  5014. {
  5015. Server.Network.NetState netState = this.m_NetState;
  5016. if (netState != null)
  5017. {
  5018. netState.Send(MessageLocalized.InstantiateGeneric(number));
  5019. }
  5020. }
  5021. public void SendLocalizedMessage(int number, string args)
  5022. {
  5023. if ((args == null) || (args.Length == 0))
  5024. {
  5025. Server.Network.NetState netState = this.m_NetState;
  5026. if (netState != null)
  5027. {
  5028. netState.Send(MessageLocalized.InstantiateGeneric(number));
  5029. }
  5030. }
  5031. else
  5032. {
  5033. Server.Network.NetState state2 = this.m_NetState;
  5034. if (state2 != null)
  5035. {
  5036. state2.Send(new MessageLocalized(Server.Serial.MinusOne, -1, MessageType.Regular, 0x3b2, 3, number, "System", args));
  5037. }
  5038. }
  5039. }
  5040. public void SendLocalizedMessage(int number, bool append, string affix)
  5041. {
  5042. this.SendLocalizedMessage(number, append, affix, "", 0x3b2);
  5043. }
  5044. public void SendLocalizedMessage(int number, string args, int hue)
  5045. {
  5046. if ((hue == 0x3b2) && ((args == null) || (args.Length == 0)))
  5047. {
  5048. Server.Network.NetState netState = this.m_NetState;
  5049. if (netState != null)
  5050. {
  5051. netState.Send(MessageLocalized.InstantiateGeneric(number));
  5052. }
  5053. }
  5054. else
  5055. {
  5056. Server.Network.NetState state2 = this.m_NetState;
  5057. if (state2 != null)
  5058. {
  5059. state2.Send(new MessageLocalized(Server.Serial.MinusOne, -1, MessageType.Regular, hue, 3, number, "System", args));
  5060. }
  5061. }
  5062. }
  5063. public void SendLocalizedMessage(int number, bool append, string affix, string args)
  5064. {
  5065. this.SendLocalizedMessage(number, append, affix, args);
  5066. }
  5067. public void SendLocalizedMessage(int number, bool append, string affix, string args, int hue)
  5068. {
  5069. Server.Network.NetState netState = this.m_NetState;
  5070. if (netState != null)
  5071. {
  5072. netState.Send(new MessageLocalizedAffix(Server.Serial.MinusOne, -1, MessageType.Regular, hue, 3, number, "System", (append ? AffixType.Append : AffixType.Prepend) | AffixType.System, affix, args));
  5073. }
  5074. }
  5075. public bool SendMenu(IMenu m)
  5076. {
  5077. return this.SendMenu(m, false);
  5078. }
  5079. public bool SendMenu(IMenu m, bool throwOnOffline)
  5080. {
  5081. if (this.m_NetState != null)
  5082. {
  5083. m.SendTo(this.m_NetState);
  5084. return true;
  5085. }
  5086. if (throwOnOffline)
  5087. {
  5088. throw new MobileNotConnectedException(this, "Menu could not be sent.");
  5089. }
  5090. return false;
  5091. }
  5092. public void SendMessage(string text)
  5093. {
  5094. this.SendMessage(0x3b2, text);
  5095. }
  5096. public void SendMessage(int hue, string text)
  5097. {
  5098. Server.Network.NetState netState = this.m_NetState;
  5099. if (netState != null)
  5100. {
  5101. netState.Send(new UnicodeMessage(Server.Serial.MinusOne, -1, MessageType.Regular, hue, 3, "ENU", "System", text));
  5102. }
  5103. }
  5104. public void SendMessage(string format, params object[] args)
  5105. {
  5106. this.SendMessage(0x3b2, string.Format(format, args));
  5107. }
  5108. public void SendMessage(int hue, string format, params object[] args)
  5109. {
  5110. this.SendMessage(hue, string.Format(format, args));
  5111. }
  5112. public virtual void SendPropertiesTo(Mobile from)
  5113. {
  5114. from.Send(this.PropertyList);
  5115. }
  5116. public void SendRemovePacket()
  5117. {
  5118. this.SendRemovePacket(true);
  5119. }
  5120. public void SendRemovePacket(bool everyone)
  5121. {
  5122. if (this.m_Map != null)
  5123. {
  5124. Packet p = null;
  5125. IPooledEnumerable clientsInRange = this.m_Map.GetClientsInRange(this.m_Location);
  5126. foreach (Server.Network.NetState state in clientsInRange)
  5127. {
  5128. if ((state != this.m_NetState) && (everyone || !state.Mobile.CanSee(this)))
  5129. {
  5130. if (p == null)
  5131. {
  5132. p = this.RemovePacket;
  5133. }
  5134. state.Send(p);
  5135. }
  5136. }
  5137. clientsInRange.Free();
  5138. }
  5139. }
  5140. public virtual void SendSkillMessage()
  5141. {
  5142. if (DateTime.Now >= this.m_NextActionMessage)
  5143. {
  5144. this.m_NextActionMessage = DateTime.Now + m_ActionMessageDelay;
  5145. this.SendLocalizedMessage(0x7a196);
  5146. }
  5147. }
  5148. public void SendSound(int soundID)
  5149. {
  5150. if ((soundID != -1) && (this.m_NetState != null))
  5151. {
  5152. this.Send(new Server.Network.PlaySound(soundID, this));
  5153. }
  5154. }
  5155. public void SendSound(int soundID, IPoint3D p)
  5156. {
  5157. if ((soundID != -1) && (this.m_NetState != null))
  5158. {
  5159. this.Send(new Server.Network.PlaySound(soundID, p));
  5160. }
  5161. }
  5162. public virtual void Serialize(GenericWriter writer)
  5163. {
  5164. writer.Write(0x1c);
  5165. writer.WriteDeltaTime(this.m_LastStatGain);
  5166. writer.Write(this.m_TithingPoints);
  5167. writer.Write(this.m_Corpse);
  5168. writer.Write(this.m_CreationTime);
  5169. writer.WriteMobileList(this.m_Stabled, true);
  5170. writer.Write(this.m_CantWalk);
  5171. VirtueInfo.Serialize(writer, this.m_Virtues);
  5172. writer.Write(this.m_Thirst);
  5173. writer.Write(this.m_BAC);
  5174. writer.Write(this.m_ShortTermMurders);
  5175. writer.Write(this.m_FollowersMax);
  5176. writer.Write(this.m_MagicDamageAbsorb);
  5177. writer.Write(this.m_GuildFealty);
  5178. writer.Write(this.m_Guild);
  5179. writer.Write(this.m_DisplayGuildTitle);
  5180. writer.Write(this.m_CanSwim);
  5181. writer.Write(this.m_Squelched);
  5182. writer.Write(this.m_Holding);
  5183. writer.Write(this.m_VirtualArmor);
  5184. writer.Write(this.m_BaseSoundID);
  5185. writer.Write(this.m_DisarmReady);
  5186. writer.Write(this.m_StunReady);
  5187. writer.Write(this.m_StatCap);
  5188. writer.Write(this.m_NameHue);
  5189. writer.Write(this.m_Hunger);
  5190. writer.Write(this.m_Location);
  5191. writer.Write((int) this.m_Body);
  5192. writer.Write(this.m_Name);
  5193. writer.Write(this.m_GuildTitle);
  5194. writer.Write(this.m_Criminal);
  5195. writer.Write(this.m_Kills);
  5196. writer.Write(this.m_SpeechHue);
  5197. writer.Write(this.m_EmoteHue);
  5198. writer.Write(this.m_WhisperHue);
  5199. writer.Write(this.m_YellHue);
  5200. writer.Write(this.m_Language);
  5201. writer.Write(this.m_Female);
  5202. writer.Write(this.m_Warmode);
  5203. writer.Write(this.m_Hidden);
  5204. writer.Write((byte) this.m_Direction);
  5205. writer.Write(this.m_Hue);
  5206. writer.Write(this.m_Str);
  5207. writer.Write(this.m_Dex);
  5208. writer.Write(this.m_Int);
  5209. writer.Write(this.m_Hits);
  5210. writer.Write(this.m_Stam);
  5211. writer.Write(this.m_Mana);
  5212. writer.Write(this.m_Map);
  5213. writer.Write(this.m_Blessed);
  5214. writer.Write(this.m_Fame);
  5215. writer.Write(this.m_Karma);
  5216. writer.Write((byte) this.m_AccessLevel);
  5217. this.m_Skills.Serialize(writer);
  5218. writer.Write(this.m_Items.Count);
  5219. for (int i = 0; i < this.m_Items.Count; i++)
  5220. {
  5221. writer.Write((Item) this.m_Items[i]);
  5222. }
  5223. writer.Write(this.m_Player);
  5224. writer.Write(this.m_Title);
  5225. writer.Write(this.m_Profile);
  5226. writer.Write(this.m_ProfileLocked);
  5227. writer.Write(this.m_AutoPageNotify);
  5228. writer.Write(this.m_LogoutLocation);
  5229. writer.Write(this.m_LogoutMap);
  5230. writer.Write((byte) this.m_StrLock);
  5231. writer.Write((byte) this.m_DexLock);
  5232. writer.Write((byte) this.m_IntLock);
  5233. if (this.m_StuckMenuUses != null)
  5234. {
  5235. writer.Write(true);
  5236. writer.Write(this.m_StuckMenuUses.Length);
  5237. for (int j = 0; j < this.m_StuckMenuUses.Length; j++)
  5238. {
  5239. writer.Write(this.m_StuckMenuUses[j]);
  5240. }
  5241. }
  5242. else
  5243. {
  5244. writer.Write(false);
  5245. }
  5246. }
  5247. public void SetDirection(Server.Direction dir)
  5248. {
  5249. this.m_Direction = dir;
  5250. }
  5251. public virtual void SetLocation(Point3D newLocation, bool isTeleport)
  5252. {
  5253. Point3D location = this.m_Location;
  5254. Server.Region old = this.m_Region;
  5255. if (location != newLocation)
  5256. {
  5257. this.m_Location = newLocation;
  5258. Server.Items.BankBox box = this.FindBankNoCreate();
  5259. if ((box != null) && box.Opened)
  5260. {
  5261. box.Close();
  5262. }
  5263. if (this.m_NetState != null)
  5264. {
  5265. this.m_NetState.ValidateAllTrades();
  5266. }
  5267. if (this.m_Map != null)
  5268. {
  5269. this.m_Map.OnMove(location, this);
  5270. }
  5271. if (isTeleport && (this.m_NetState != null))
  5272. {
  5273. this.m_NetState.Sequence = 0;
  5274. this.m_NetState.Send(new MobileUpdate(this));
  5275. this.ClearFastwalkStack();
  5276. }
  5277. Server.Map map = this.m_Map;
  5278. if (map != null)
  5279. {
  5280. Packet p = null;
  5281. IPooledEnumerable clientsInRange = map.GetClientsInRange(location);
  5282. foreach (Server.Network.NetState state in clientsInRange)
  5283. {
  5284. if ((state != this.m_NetState) && !Utility.InUpdateRange(newLocation, state.Mobile.Location))
  5285. {
  5286. if (p == null)
  5287. {
  5288. p = this.RemovePacket;
  5289. }
  5290. state.Send(p);
  5291. }
  5292. }
  5293. clientsInRange.Free();
  5294. Server.Network.NetState netState = this.m_NetState;
  5295. if (netState != null)
  5296. {
  5297. clientsInRange = map.GetObjectsInRange(newLocation, Core.GlobalMaxUpdateRange);
  5298. foreach (object obj2 in clientsInRange)
  5299. {
  5300. if (obj2 is Item)
  5301. {
  5302. Item item = (Item) obj2;
  5303. int updateRange = item.GetUpdateRange(this);
  5304. Point3D pointd2 = item.Location;
  5305. if ((this.CanSee(item) && !Utility.InRange(location, pointd2, updateRange)) && Utility.InRange(newLocation, pointd2, updateRange))
  5306. {
  5307. item.SendInfoTo(netState);
  5308. }
  5309. continue;
  5310. }
  5311. if ((obj2 != this) && (obj2 is Mobile))
  5312. {
  5313. Mobile beholder = (Mobile) obj2;
  5314. if (Utility.InUpdateRange(newLocation, beholder.m_Location))
  5315. {
  5316. bool flag = Utility.InUpdateRange(location, beholder.m_Location);
  5317. if ((isTeleport || !flag) && ((beholder.m_NetState != null) && beholder.CanSee(this)))
  5318. {
  5319. beholder.m_NetState.Send(new MobileIncoming(beholder, this));
  5320. if (this.IsDeadBondedPet)
  5321. {
  5322. beholder.m_NetState.Send(new BondedStatus(0, this.m_Serial, 1));
  5323. }
  5324. if (ObjectPropertyList.Enabled)
  5325. {
  5326. beholder.m_NetState.Send(this.OPLPacket);
  5327. }
  5328. }
  5329. if (!flag && this.CanSee(beholder))
  5330. {
  5331. netState.Send(new MobileIncoming(this, beholder));
  5332. if (beholder.IsDeadBondedPet)
  5333. {
  5334. netState.Send(new BondedStatus(0, beholder.m_Serial, 1));
  5335. }
  5336. if (ObjectPropertyList.Enabled)
  5337. {
  5338. netState.Send(beholder.OPLPacket);
  5339. }
  5340. }
  5341. }
  5342. }
  5343. }
  5344. clientsInRange.Free();
  5345. }
  5346. else
  5347. {
  5348. clientsInRange = map.GetClientsInRange(newLocation);
  5349. foreach (Server.Network.NetState state3 in clientsInRange)
  5350. {
  5351. if ((isTeleport || !Utility.InUpdateRange(location, state3.Mobile.Location)) && state3.Mobile.CanSee(this))
  5352. {
  5353. state3.Send(new MobileIncoming(state3.Mobile, this));
  5354. if (this.IsDeadBondedPet)
  5355. {
  5356. state3.Send(new BondedStatus(0, this.m_Serial, 1));
  5357. }
  5358. if (ObjectPropertyList.Enabled)
  5359. {
  5360. state3.Send(this.OPLPacket);
  5361. }
  5362. }
  5363. }
  5364. clientsInRange.Free();
  5365. }
  5366. }
  5367. this.m_Region = Server.Region.Find(this.m_Location, this.m_Map);
  5368. if (old != this.m_Region)
  5369. {
  5370. old.InternalExit(this);
  5371. this.m_Region.InternalEnter(this);
  5372. this.OnRegionChange(old, this.m_Region);
  5373. }
  5374. this.OnLocationChange(location);
  5375. this.CheckLightLevels(false);
  5376. this.m_Region.OnLocationChanged(this, location);
  5377. }
  5378. }
  5379. private void StopAggrExpire()
  5380. {
  5381. if (this.m_ExpireAggrTimer != null)
  5382. {
  5383. this.m_ExpireAggrTimer.Stop();
  5384. }
  5385. this.m_ExpireAggrTimer = null;
  5386. }
  5387. public override string ToString()
  5388. {
  5389. return string.Format("0x{0:X} \"{1}\"", this.m_Serial.Value, this.Name);
  5390. }
  5391. private void UpdateAggrExpire()
  5392. {
  5393. if (this.m_Deleted || ((this.m_Aggressors.Count == 0) && (this.m_Aggressed.Count == 0)))
  5394. {
  5395. this.StopAggrExpire();
  5396. }
  5397. else if (this.m_ExpireAggrTimer == null)
  5398. {
  5399. this.m_ExpireAggrTimer = new ExpireAggressorsTimer(this);
  5400. this.m_ExpireAggrTimer.Start();
  5401. }
  5402. }
  5403. public virtual void UpdateResistances()
  5404. {
  5405. if (this.m_Resistances == null)
  5406. {
  5407. this.m_Resistances = new int[] { -2147483648, -2147483648, -2147483648, -2147483648, -2147483648 };
  5408. }
  5409. bool flag = false;
  5410. for (int i = 0; i < this.m_Resistances.Length; i++)
  5411. {
  5412. if (this.m_Resistances[i] != -2147483648)
  5413. {
  5414. this.m_Resistances[i] = -2147483648;
  5415. flag = true;
  5416. }
  5417. }
  5418. if (flag)
  5419. {
  5420. this.Delta(MobileDelta.Resistances);
  5421. }
  5422. }
  5423. public virtual void UpdateSkillMods()
  5424. {
  5425. this.ValidateSkillMods();
  5426. for (int i = 0; i < this.m_SkillMods.Count; i++)
  5427. {
  5428. SkillMod mod = (SkillMod) this.m_SkillMods[i];
  5429. Skill skill = this.m_Skills[mod.Skill];
  5430. if (skill != null)
  5431. {
  5432. skill.Update();
  5433. }
  5434. }
  5435. }
  5436. public virtual void UpdateTotals()
  5437. {
  5438. if (this.m_Items != null)
  5439. {
  5440. int totalWeight = this.m_TotalWeight;
  5441. this.m_TotalGold = 0;
  5442. this.m_TotalWeight = 0;
  5443. for (int i = 0; i < this.m_Items.Count; i++)
  5444. {
  5445. Item item = (Item) this.m_Items[i];
  5446. item.UpdateTotals();
  5447. if (!(item is Server.Items.BankBox))
  5448. {
  5449. this.m_TotalGold += item.TotalGold;
  5450. this.m_TotalWeight += item.TotalWeight + item.PileWeight;
  5451. }
  5452. }
  5453. if (this.m_Holding != null)
  5454. {
  5455. this.m_TotalWeight += this.m_Holding.TotalWeight + this.m_Holding.PileWeight;
  5456. }
  5457. this.OnWeightChange(totalWeight);
  5458. }
  5459. }
  5460. public virtual void Use(Item item)
  5461. {
  5462. if ((item != null) && !item.Deleted)
  5463. {
  5464. this.DisruptiveAction();
  5465. if ((this.m_Spell == null) || this.m_Spell.OnCasterUsingObject(item))
  5466. {
  5467. object rootParent = item.RootParent;
  5468. bool flag = false;
  5469. if (!Utility.InUpdateRange(this, item.GetWorldLocation()))
  5470. {
  5471. item.OnDoubleClickOutOfRange(this);
  5472. }
  5473. else if (!this.CanSee(item))
  5474. {
  5475. item.OnDoubleClickCantSee(this);
  5476. }
  5477. else if (!item.IsAccessibleTo(this))
  5478. {
  5479. Server.Region region = Server.Region.Find(item.GetWorldLocation(), item.Map);
  5480. if ((region == null) || !region.SendInaccessibleMessage(item, this))
  5481. {
  5482. item.OnDoubleClickNotAccessible(this);
  5483. }
  5484. }
  5485. else if (!this.CheckAlive(false))
  5486. {
  5487. item.OnDoubleClickDead(this);
  5488. }
  5489. else if (item.InSecureTrade)
  5490. {
  5491. item.OnDoubleClickSecureTrade(this);
  5492. }
  5493. else if (!this.AllowItemUse(item))
  5494. {
  5495. flag = false;
  5496. }
  5497. else if (!item.CheckItemUse(this, item))
  5498. {
  5499. flag = false;
  5500. }
  5501. else if (((rootParent != null) && (rootParent is Mobile)) && ((Mobile) rootParent).IsSnoop(this))
  5502. {
  5503. item.OnSnoop(this);
  5504. }
  5505. else if (this.m_Region.OnDoubleClick(this, item))
  5506. {
  5507. flag = true;
  5508. }
  5509. if (flag)
  5510. {
  5511. if (!item.Deleted)
  5512. {
  5513. item.OnItemUsed(this, item);
  5514. }
  5515. if (!item.Deleted)
  5516. {
  5517. item.OnDoubleClick(this);
  5518. }
  5519. }
  5520. }
  5521. }
  5522. }
  5523. public virtual void Use(Mobile m)
  5524. {
  5525. if ((m != null) && !m.Deleted)
  5526. {
  5527. this.DisruptiveAction();
  5528. if ((this.m_Spell == null) || this.m_Spell.OnCasterUsingObject(m))
  5529. {
  5530. if (!Utility.InUpdateRange(this, m))
  5531. {
  5532. m.OnDoubleClickOutOfRange(this);
  5533. }
  5534. else if (!this.CanSee(m))
  5535. {
  5536. m.OnDoubleClickCantSee(this);
  5537. }
  5538. else if (!this.CheckAlive(false))
  5539. {
  5540. m.OnDoubleClickDead(this);
  5541. }
  5542. else if (this.m_Region.OnDoubleClick(this, m) && !m.Deleted)
  5543. {
  5544. m.OnDoubleClick(this);
  5545. }
  5546. }
  5547. }
  5548. }
  5549. public void UsedStuckMenu()
  5550. {
  5551. if (this.m_StuckMenuUses == null)
  5552. {
  5553. this.m_StuckMenuUses = new DateTime[2];
  5554. }
  5555. for (int i = 0; i < this.m_StuckMenuUses.Length; i++)
  5556. {
  5557. if ((DateTime.Now - this.m_StuckMenuUses[i]) > TimeSpan.FromDays(1.0))
  5558. {
  5559. this.m_StuckMenuUses[i] = DateTime.Now;
  5560. return;
  5561. }
  5562. }
  5563. }
  5564. public virtual bool UseSkill(SkillName name)
  5565. {
  5566. return Server.Skills.UseSkill(this, name);
  5567. }
  5568. public virtual bool UseSkill(int skillID)
  5569. {
  5570. return Server.Skills.UseSkill(this, skillID);
  5571. }
  5572. public virtual void ValidateSkillMods()
  5573. {
  5574. int num = 0;
  5575. while (num < this.m_SkillMods.Count)
  5576. {
  5577. SkillMod mod = (SkillMod) this.m_SkillMods[num];
  5578. if (mod.CheckCondition())
  5579. {
  5580. num++;
  5581. }
  5582. else
  5583. {
  5584. this.InternalRemoveSkillMod(mod);
  5585. }
  5586. }
  5587. }
  5588. public void Whisper(int number)
  5589. {
  5590. this.Whisper(number, "");
  5591. }
  5592. public void Whisper(string text)
  5593. {
  5594. this.PublicOverheadMessage(MessageType.Whisper, this.m_WhisperHue, false, text);
  5595. }
  5596. public void Whisper(int number, string args)
  5597. {
  5598. this.PublicOverheadMessage(MessageType.Whisper, this.m_WhisperHue, number, args);
  5599. }
  5600. public void Whisper(string format, params object[] args)
  5601. {
  5602. this.Whisper(string.Format(format, args));
  5603. }
  5604. public void Yell(int number)
  5605. {
  5606. this.Yell(number, "");
  5607. }
  5608. public void Yell(string text)
  5609. {
  5610. this.PublicOverheadMessage(MessageType.Yell, this.m_YellHue, false, text);
  5611. }
  5612. public void Yell(int number, string args)
  5613. {
  5614. this.PublicOverheadMessage(MessageType.Yell, this.m_YellHue, number, args);
  5615. }
  5616. public void Yell(string format, params object[] args)
  5617. {
  5618. this.Yell(string.Format(format, args));
  5619. }
  5620. [CommandProperty(Server.AccessLevel.Counselor, Server.AccessLevel.Administrator)]
  5621. public Server.AccessLevel AccessLevel
  5622. {
  5623. get
  5624. {
  5625. return this.m_AccessLevel;
  5626. }
  5627. set
  5628. {
  5629. Server.AccessLevel accessLevel = this.m_AccessLevel;
  5630. if (accessLevel != value)
  5631. {
  5632. this.m_AccessLevel = value;
  5633. this.Delta(MobileDelta.Noto);
  5634. this.InvalidateProperties();
  5635. this.SendMessage("Your access level has been changed. You are now {0}.", new object[] { GetAccessLevelName(value) });
  5636. this.ClearScreen();
  5637. this.SendEverything();
  5638. this.OnAccessLevelChanged(accessLevel);
  5639. }
  5640. }
  5641. }
  5642. [CommandProperty(Server.AccessLevel.Counselor, Server.AccessLevel.Administrator | Server.AccessLevel.Counselor)]
  5643. public IAccount Account
  5644. {
  5645. get
  5646. {
  5647. return this.m_Account;
  5648. }
  5649. set
  5650. {
  5651. this.m_Account = value;
  5652. }
  5653. }
  5654. public static TimeSpan ActionMessageDelay
  5655. {
  5656. get
  5657. {
  5658. return m_ActionMessageDelay;
  5659. }
  5660. set
  5661. {
  5662. m_ActionMessageDelay = value;
  5663. }
  5664. }
  5665. public ArrayList Aggressed
  5666. {
  5667. get
  5668. {
  5669. return this.m_Aggressed;
  5670. }
  5671. }
  5672. public ArrayList Aggressors
  5673. {
  5674. get
  5675. {
  5676. return this.m_Aggressors;
  5677. }
  5678. }
  5679. public virtual bool Alive
  5680. {
  5681. get
  5682. {
  5683. if (this.m_Deleted)
  5684. {
  5685. return false;
  5686. }
  5687. if (this.m_Player)
  5688. {
  5689. return !this.m_Body.IsGhost;
  5690. }
  5691. return true;
  5692. }
  5693. }
  5694. public static Server.AllowBeneficialHandler AllowBeneficialHandler
  5695. {
  5696. get
  5697. {
  5698. return m_AllowBeneficialHandler;
  5699. }
  5700. set
  5701. {
  5702. m_AllowBeneficialHandler = value;
  5703. }
  5704. }
  5705. [CommandProperty(Server.AccessLevel.GameMaster)]
  5706. public int AllowedStealthSteps
  5707. {
  5708. get
  5709. {
  5710. return this.m_AllowedStealthSteps;
  5711. }
  5712. set
  5713. {
  5714. this.m_AllowedStealthSteps = value;
  5715. }
  5716. }
  5717. public static Server.AllowHarmfulHandler AllowHarmfulHandler
  5718. {
  5719. get
  5720. {
  5721. return m_AllowHarmfulHandler;
  5722. }
  5723. set
  5724. {
  5725. m_AllowHarmfulHandler = value;
  5726. }
  5727. }
  5728. [CommandProperty(Server.AccessLevel.GameMaster)]
  5729. public double ArmorRating
  5730. {
  5731. get
  5732. {
  5733. double num = 0.0;
  5734. IArmor neckArmor = this.NeckArmor;
  5735. if (neckArmor != null)
  5736. {
  5737. num += neckArmor.ArmorRating;
  5738. }
  5739. neckArmor = this.HandArmor;
  5740. if (neckArmor != null)
  5741. {
  5742. num += neckArmor.ArmorRating;
  5743. }
  5744. neckArmor = this.HeadArmor;
  5745. if (neckArmor != null)
  5746. {
  5747. num += neckArmor.ArmorRating;
  5748. }
  5749. neckArmor = this.ArmsArmor;
  5750. if (neckArmor != null)
  5751. {
  5752. num += neckArmor.ArmorRating;
  5753. }
  5754. neckArmor = this.LegsArmor;
  5755. if (neckArmor != null)
  5756. {
  5757. num += neckArmor.ArmorRating;
  5758. }
  5759. neckArmor = this.ChestArmor;
  5760. if (neckArmor != null)
  5761. {
  5762. num += neckArmor.ArmorRating;
  5763. }
  5764. neckArmor = this.ShieldArmor;
  5765. if (neckArmor != null)
  5766. {
  5767. num += neckArmor.ArmorRating;
  5768. }
  5769. return ((this.m_VirtualArmor + this.m_VirtualArmorMod) + num);
  5770. }
  5771. }
  5772. public IArmor ArmsArmor
  5773. {
  5774. get
  5775. {
  5776. return (this.FindItemOnLayer(Layer.Arms) as IArmor);
  5777. }
  5778. }
  5779. public static bool AsciiClickMessage
  5780. {
  5781. get
  5782. {
  5783. return m_AsciiClickMessage;
  5784. }
  5785. set
  5786. {
  5787. m_AsciiClickMessage = value;
  5788. }
  5789. }
  5790. public static TimeSpan AutoManifestTimeout
  5791. {
  5792. get
  5793. {
  5794. return m_AutoManifestTimeout;
  5795. }
  5796. set
  5797. {
  5798. m_AutoManifestTimeout = value;
  5799. }
  5800. }
  5801. [CommandProperty(Server.AccessLevel.Administrator)]
  5802. public bool AutoPageNotify
  5803. {
  5804. get
  5805. {
  5806. return this.m_AutoPageNotify;
  5807. }
  5808. set
  5809. {
  5810. this.m_AutoPageNotify = value;
  5811. }
  5812. }
  5813. [CommandProperty(Server.AccessLevel.GameMaster)]
  5814. public int BAC
  5815. {
  5816. get
  5817. {
  5818. return this.m_BAC;
  5819. }
  5820. set
  5821. {
  5822. this.m_BAC = value;
  5823. }
  5824. }
  5825. [CommandProperty(Server.AccessLevel.GameMaster)]
  5826. public Container Backpack
  5827. {
  5828. get
  5829. {
  5830. if (((this.m_Backpack != null) && !this.m_Backpack.Deleted) && (this.m_Backpack.Parent == this))
  5831. {
  5832. return this.m_Backpack;
  5833. }
  5834. return (this.m_Backpack = this.FindItemOnLayer(Layer.Backpack) as Container);
  5835. }
  5836. }
  5837. [CommandProperty(Server.AccessLevel.GameMaster)]
  5838. public Server.Items.BankBox BankBox
  5839. {
  5840. get
  5841. {
  5842. if (((this.m_BankBox == null) || this.m_BankBox.Deleted) || (this.m_BankBox.Parent != this))
  5843. {
  5844. this.m_BankBox = this.FindItemOnLayer(Layer.Bank) as Server.Items.BankBox;
  5845. if (this.m_BankBox == null)
  5846. {
  5847. this.AddItem(this.m_BankBox = new Server.Items.BankBox(this));
  5848. }
  5849. }
  5850. return this.m_BankBox;
  5851. }
  5852. }
  5853. public virtual int BaseColdResistance
  5854. {
  5855. get
  5856. {
  5857. return 0;
  5858. }
  5859. }
  5860. public virtual int BaseEnergyResistance
  5861. {
  5862. get
  5863. {
  5864. return 0;
  5865. }
  5866. }
  5867. public virtual int BaseFireResistance
  5868. {
  5869. get
  5870. {
  5871. return 0;
  5872. }
  5873. }
  5874. public virtual int BasePhysicalResistance
  5875. {
  5876. get
  5877. {
  5878. return 0;
  5879. }
  5880. }
  5881. public virtual int BasePoisonResistance
  5882. {
  5883. get
  5884. {
  5885. return 0;
  5886. }
  5887. }
  5888. [CommandProperty(Server.AccessLevel.GameMaster)]
  5889. public int BaseSoundID
  5890. {
  5891. get
  5892. {
  5893. return this.m_BaseSoundID;
  5894. }
  5895. set
  5896. {
  5897. this.m_BaseSoundID = value;
  5898. }
  5899. }
  5900. [CommandProperty(Server.AccessLevel.GameMaster)]
  5901. public bool Blessed
  5902. {
  5903. get
  5904. {
  5905. return this.m_Blessed;
  5906. }
  5907. set
  5908. {
  5909. if (this.m_Blessed != value)
  5910. {
  5911. this.m_Blessed = value;
  5912. this.Delta(MobileDelta.Flags);
  5913. }
  5914. }
  5915. }
  5916. [Body, CommandProperty(Server.AccessLevel.GameMaster)]
  5917. public Server.Body Body
  5918. {
  5919. get
  5920. {
  5921. if (this.IsBodyMod)
  5922. {
  5923. return this.m_BodyMod;
  5924. }
  5925. return this.m_Body;
  5926. }
  5927. set
  5928. {
  5929. if ((this.m_Body != value) && !this.IsBodyMod)
  5930. {
  5931. this.m_Body = this.SafeBody((int) value);
  5932. this.Delta(MobileDelta.Body);
  5933. this.InvalidateProperties();
  5934. }
  5935. }
  5936. }
  5937. [CommandProperty(Server.AccessLevel.GameMaster)]
  5938. public Server.Body BodyMod
  5939. {
  5940. get
  5941. {
  5942. return this.m_BodyMod;
  5943. }
  5944. set
  5945. {
  5946. if (this.m_BodyMod != value)
  5947. {
  5948. this.m_BodyMod = value;
  5949. this.Delta(MobileDelta.Body);
  5950. this.InvalidateProperties();
  5951. }
  5952. }
  5953. }
  5954. [Body, CommandProperty(Server.AccessLevel.GameMaster)]
  5955. public int BodyValue
  5956. {
  5957. get
  5958. {
  5959. return this.Body.BodyID;
  5960. }
  5961. set
  5962. {
  5963. this.Body = value;
  5964. }
  5965. }
  5966. public static int BodyWeight
  5967. {
  5968. get
  5969. {
  5970. return m_BodyWeight;
  5971. }
  5972. set
  5973. {
  5974. m_BodyWeight = value;
  5975. }
  5976. }
  5977. [CommandProperty(Server.AccessLevel.GameMaster)]
  5978. public bool CanHearGhosts
  5979. {
  5980. get
  5981. {
  5982. if (!this.m_CanHearGhosts)
  5983. {
  5984. return (this.AccessLevel >= Server.AccessLevel.Counselor);
  5985. }
  5986. return true;
  5987. }
  5988. set
  5989. {
  5990. this.m_CanHearGhosts = value;
  5991. }
  5992. }
  5993. public virtual bool CanRegenHits
  5994. {
  5995. get
  5996. {
  5997. return (this.Alive && !this.Poisoned);
  5998. }
  5999. }
  6000. public virtual bool CanRegenMana
  6001. {
  6002. get
  6003. {
  6004. return this.Alive;
  6005. }
  6006. }
  6007. public virtual bool CanRegenStam
  6008. {
  6009. get
  6010. {
  6011. return this.Alive;
  6012. }
  6013. }
  6014. [CommandProperty(Server.AccessLevel.GameMaster)]
  6015. public bool CanSwim
  6016. {
  6017. get
  6018. {
  6019. return this.m_CanSwim;
  6020. }
  6021. set
  6022. {
  6023. this.m_CanSwim = value;
  6024. }
  6025. }
  6026. public virtual bool CanTarget
  6027. {
  6028. get
  6029. {
  6030. return true;
  6031. }
  6032. }
  6033. [CommandProperty(Server.AccessLevel.GameMaster)]
  6034. public bool CantWalk
  6035. {
  6036. get
  6037. {
  6038. return this.m_CantWalk;
  6039. }
  6040. set
  6041. {
  6042. this.m_CantWalk = value;
  6043. }
  6044. }
  6045. public bool ChangingCombatant
  6046. {
  6047. get
  6048. {
  6049. return (this.m_ChangingCombatant > 0);
  6050. }
  6051. }
  6052. public IArmor ChestArmor
  6053. {
  6054. get
  6055. {
  6056. IArmor armor = this.FindItemOnLayer(Layer.InnerTorso) as IArmor;
  6057. if (armor == null)
  6058. {
  6059. armor = this.FindItemOnLayer(Layer.Shirt) as IArmor;
  6060. }
  6061. return armor;
  6062. }
  6063. }
  6064. public virtual bool ClickTitle
  6065. {
  6066. get
  6067. {
  6068. return true;
  6069. }
  6070. }
  6071. [CommandProperty(Server.AccessLevel.Counselor)]
  6072. public virtual int ColdResistance
  6073. {
  6074. get
  6075. {
  6076. return this.GetResistance(ResistanceType.Cold);
  6077. }
  6078. }
  6079. [CommandProperty(Server.AccessLevel.GameMaster)]
  6080. public virtual Mobile Combatant
  6081. {
  6082. get
  6083. {
  6084. return this.m_Combatant;
  6085. }
  6086. set
  6087. {
  6088. if ((this.m_Combatant != value) && (value != this))
  6089. {
  6090. Mobile combatant = this.m_Combatant;
  6091. this.m_ChangingCombatant++;
  6092. this.m_Combatant = value;
  6093. if (((this.m_Combatant != null) && !this.CanBeHarmful(this.m_Combatant, false)) || !this.Region.OnCombatantChange(this, combatant, this.m_Combatant))
  6094. {
  6095. this.m_Combatant = combatant;
  6096. this.m_ChangingCombatant--;
  6097. }
  6098. else
  6099. {
  6100. if (this.m_NetState != null)
  6101. {
  6102. this.m_NetState.Send(new ChangeCombatant(this.m_Combatant));
  6103. }
  6104. if (this.m_Combatant == null)
  6105. {
  6106. this.m_ExpireCombatant.Stop();
  6107. this.m_CombatTimer.Stop();
  6108. }
  6109. else
  6110. {
  6111. this.m_ExpireCombatant.Start();
  6112. this.m_CombatTimer.Start();
  6113. }
  6114. if ((this.m_Combatant != null) && this.CanBeHarmful(this.m_Combatant, false))
  6115. {
  6116. this.DoHarmful(this.m_Combatant);
  6117. if (this.m_Combatant != null)
  6118. {
  6119. this.m_Combatant.PlaySound(this.m_Combatant.GetAngerSound());
  6120. }
  6121. }
  6122. this.OnCombatantChange();
  6123. this.m_ChangingCombatant--;
  6124. }
  6125. }
  6126. }
  6127. }
  6128. public Server.ContextMenus.ContextMenu ContextMenu
  6129. {
  6130. get
  6131. {
  6132. return this.m_ContextMenu;
  6133. }
  6134. set
  6135. {
  6136. this.m_ContextMenu = value;
  6137. if (this.m_ContextMenu != null)
  6138. {
  6139. this.Send(new DisplayContextMenu(this.m_ContextMenu));
  6140. }
  6141. }
  6142. }
  6143. [CommandProperty(Server.AccessLevel.GameMaster)]
  6144. public Container Corpse
  6145. {
  6146. get
  6147. {
  6148. return this.m_Corpse;
  6149. }
  6150. set
  6151. {
  6152. this.m_Corpse = value;
  6153. }
  6154. }
  6155. public static Server.CreateCorpseHandler CreateCorpseHandler
  6156. {
  6157. get
  6158. {
  6159. return m_CreateCorpse;
  6160. }
  6161. set
  6162. {
  6163. m_CreateCorpse = value;
  6164. }
  6165. }
  6166. public DateTime CreationTime
  6167. {
  6168. get
  6169. {
  6170. return this.m_CreationTime;
  6171. }
  6172. set
  6173. {
  6174. this.m_CreationTime = value;
  6175. }
  6176. }
  6177. [CommandProperty(Server.AccessLevel.Counselor, Server.AccessLevel.GameMaster)]
  6178. public bool Criminal
  6179. {
  6180. get
  6181. {
  6182. return this.m_Criminal;
  6183. }
  6184. set
  6185. {
  6186. if (this.m_Criminal != value)
  6187. {
  6188. this.m_Criminal = value;
  6189. this.Delta(MobileDelta.Noto);
  6190. this.InvalidateProperties();
  6191. }
  6192. this.m_ExpireCriminal.Stop();
  6193. if (this.m_Criminal)
  6194. {
  6195. this.m_ExpireCriminal.Start();
  6196. }
  6197. }
  6198. }
  6199. public ArrayList DamageEntries
  6200. {
  6201. get
  6202. {
  6203. return this.m_DamageEntries;
  6204. }
  6205. }
  6206. public static TimeSpan DefaultHitsRate
  6207. {
  6208. get
  6209. {
  6210. return m_DefaultHitsRate;
  6211. }
  6212. set
  6213. {
  6214. m_DefaultHitsRate = value;
  6215. }
  6216. }
  6217. public static TimeSpan DefaultManaRate
  6218. {
  6219. get
  6220. {
  6221. return m_DefaultManaRate;
  6222. }
  6223. set
  6224. {
  6225. m_DefaultManaRate = value;
  6226. }
  6227. }
  6228. public static TimeSpan DefaultStamRate
  6229. {
  6230. get
  6231. {
  6232. return m_DefaultStamRate;
  6233. }
  6234. set
  6235. {
  6236. m_DefaultStamRate = value;
  6237. }
  6238. }
  6239. public static IWeapon DefaultWeapon
  6240. {
  6241. get
  6242. {
  6243. return m_DefaultWeapon;
  6244. }
  6245. set
  6246. {
  6247. m_DefaultWeapon = value;
  6248. }
  6249. }
  6250. public bool Deleted
  6251. {
  6252. get
  6253. {
  6254. return this.m_Deleted;
  6255. }
  6256. }
  6257. [CommandProperty(Server.AccessLevel.GameMaster)]
  6258. public int Dex
  6259. {
  6260. get
  6261. {
  6262. int num = this.m_Dex + this.GetStatOffset(StatType.Dex);
  6263. if (num < 1)
  6264. {
  6265. return 1;
  6266. }
  6267. if (num > 0xfde8)
  6268. {
  6269. num = 0xfde8;
  6270. }
  6271. return num;
  6272. }
  6273. set
  6274. {
  6275. if (this.m_StatMods.Count == 0)
  6276. {
  6277. this.RawDex = value;
  6278. }
  6279. }
  6280. }
  6281. [CommandProperty(Server.AccessLevel.Counselor, Server.AccessLevel.GameMaster)]
  6282. public StatLockType DexLock
  6283. {
  6284. get
  6285. {
  6286. return this.m_DexLock;
  6287. }
  6288. set
  6289. {
  6290. if (this.m_DexLock != value)
  6291. {
  6292. this.m_DexLock = value;
  6293. if (this.m_NetState != null)
  6294. {
  6295. this.m_NetState.Send(new StatLockInfo(this));
  6296. }
  6297. }
  6298. }
  6299. }
  6300. [CommandProperty(Server.AccessLevel.GameMaster)]
  6301. public Server.Direction Direction
  6302. {
  6303. get
  6304. {
  6305. return this.m_Direction;
  6306. }
  6307. set
  6308. {
  6309. if (this.m_Direction != value)
  6310. {
  6311. this.m_Direction = value;
  6312. this.Delta(MobileDelta.Direction);
  6313. }
  6314. }
  6315. }
  6316. public static bool DisableDismountInWarmode
  6317. {
  6318. get
  6319. {
  6320. return m_DisableDismountInWarmode;
  6321. }
  6322. set
  6323. {
  6324. m_DisableDismountInWarmode = value;
  6325. }
  6326. }
  6327. public static bool DisableHiddenSelfClick
  6328. {
  6329. get
  6330. {
  6331. return m_DisableHiddenSelfClick;
  6332. }
  6333. set
  6334. {
  6335. m_DisableHiddenSelfClick = value;
  6336. }
  6337. }
  6338. [CommandProperty(Server.AccessLevel.GameMaster)]
  6339. public bool DisarmReady
  6340. {
  6341. get
  6342. {
  6343. return this.m_DisarmReady;
  6344. }
  6345. set
  6346. {
  6347. this.m_DisarmReady = value;
  6348. }
  6349. }
  6350. [CommandProperty(Server.AccessLevel.GameMaster)]
  6351. public bool DisplayGuildTitle
  6352. {
  6353. get
  6354. {
  6355. return this.m_DisplayGuildTitle;
  6356. }
  6357. set
  6358. {
  6359. this.m_DisplayGuildTitle = value;
  6360. this.InvalidateProperties();
  6361. }
  6362. }
  6363. public static bool DragEffects
  6364. {
  6365. get
  6366. {
  6367. return m_DragEffects;
  6368. }
  6369. set
  6370. {
  6371. m_DragEffects = value;
  6372. }
  6373. }
  6374. [CommandProperty(Server.AccessLevel.GameMaster)]
  6375. public int EmoteHue
  6376. {
  6377. get
  6378. {
  6379. return this.m_EmoteHue;
  6380. }
  6381. set
  6382. {
  6383. this.m_EmoteHue = value;
  6384. }
  6385. }
  6386. [CommandProperty(Server.AccessLevel.Counselor)]
  6387. public virtual int EnergyResistance
  6388. {
  6389. get
  6390. {
  6391. return this.GetResistance(ResistanceType.Energy);
  6392. }
  6393. }
  6394. public static TimeSpan ExpireCriminalDelay
  6395. {
  6396. get
  6397. {
  6398. return m_ExpireCriminalDelay;
  6399. }
  6400. set
  6401. {
  6402. m_ExpireCriminalDelay = value;
  6403. }
  6404. }
  6405. [CommandProperty(Server.AccessLevel.GameMaster)]
  6406. public int Fame
  6407. {
  6408. get
  6409. {
  6410. return this.m_Fame;
  6411. }
  6412. set
  6413. {
  6414. int fame = this.m_Fame;
  6415. if (fame != value)
  6416. {
  6417. this.m_Fame = value;
  6418. if ((this.ShowFameTitle && (this.m_Player || this.m_Body.IsHuman)) && ((fame >= 0x2710) != (value >= 0x2710)))
  6419. {
  6420. this.InvalidateProperties();
  6421. }
  6422. this.OnFameChange(fame);
  6423. }
  6424. }
  6425. }
  6426. [CommandProperty(Server.AccessLevel.GameMaster)]
  6427. public bool Female
  6428. {
  6429. get
  6430. {
  6431. return this.m_Female;
  6432. }
  6433. set
  6434. {
  6435. if (this.m_Female != value)
  6436. {
  6437. this.m_Female = value;
  6438. this.Delta(MobileDelta.Flags);
  6439. this.OnGenderChanged(!this.m_Female);
  6440. }
  6441. }
  6442. }
  6443. [CommandProperty(Server.AccessLevel.Counselor)]
  6444. public virtual int FireResistance
  6445. {
  6446. get
  6447. {
  6448. return this.GetResistance(ResistanceType.Fire);
  6449. }
  6450. }
  6451. [CommandProperty(Server.AccessLevel.GameMaster)]
  6452. public int Followers
  6453. {
  6454. get
  6455. {
  6456. return this.m_Followers;
  6457. }
  6458. set
  6459. {
  6460. if (this.m_Followers != value)
  6461. {
  6462. this.m_Followers = value;
  6463. this.Delta(MobileDelta.Followers);
  6464. }
  6465. }
  6466. }
  6467. [CommandProperty(Server.AccessLevel.GameMaster)]
  6468. public int FollowersMax
  6469. {
  6470. get
  6471. {
  6472. return this.m_FollowersMax;
  6473. }
  6474. set
  6475. {
  6476. if (this.m_FollowersMax != value)
  6477. {
  6478. this.m_FollowersMax = value;
  6479. this.Delta(MobileDelta.Followers);
  6480. }
  6481. }
  6482. }
  6483. [CommandProperty(Server.AccessLevel.GameMaster)]
  6484. public bool Frozen
  6485. {
  6486. get
  6487. {
  6488. return this.m_Frozen;
  6489. }
  6490. set
  6491. {
  6492. if (this.m_Frozen != value)
  6493. {
  6494. this.m_Frozen = value;
  6495. if (this.m_FrozenTimer != null)
  6496. {
  6497. this.m_FrozenTimer.Stop();
  6498. this.m_FrozenTimer = null;
  6499. }
  6500. }
  6501. }
  6502. }
  6503. public static Server.AccessLevel FwdAccessOverride
  6504. {
  6505. get
  6506. {
  6507. return m_FwdAccessOverride;
  6508. }
  6509. set
  6510. {
  6511. m_FwdAccessOverride = value;
  6512. }
  6513. }
  6514. public static bool FwdEnabled
  6515. {
  6516. get
  6517. {
  6518. return m_FwdEnabled;
  6519. }
  6520. set
  6521. {
  6522. m_FwdEnabled = value;
  6523. }
  6524. }
  6525. public static int FwdMaxSteps
  6526. {
  6527. get
  6528. {
  6529. return m_FwdMaxSteps;
  6530. }
  6531. set
  6532. {
  6533. m_FwdMaxSteps = value;
  6534. }
  6535. }
  6536. public static bool FwdUOTDOverride
  6537. {
  6538. get
  6539. {
  6540. return m_FwdUOTDOverride;
  6541. }
  6542. set
  6543. {
  6544. m_FwdUOTDOverride = value;
  6545. }
  6546. }
  6547. public static char[] GhostChars
  6548. {
  6549. get
  6550. {
  6551. return m_GhostChars;
  6552. }
  6553. set
  6554. {
  6555. m_GhostChars = value;
  6556. }
  6557. }
  6558. public BaseGuild Guild
  6559. {
  6560. get
  6561. {
  6562. return this.m_Guild;
  6563. }
  6564. set
  6565. {
  6566. BaseGuild oldGuild = this.m_Guild;
  6567. if (oldGuild != value)
  6568. {
  6569. if (value == null)
  6570. {
  6571. this.GuildTitle = null;
  6572. }
  6573. this.m_Guild = value;
  6574. this.Delta(MobileDelta.Noto);
  6575. this.InvalidateProperties();
  6576. this.OnGuildChange(oldGuild);
  6577. }
  6578. }
  6579. }
  6580. public static bool GuildClickMessage
  6581. {
  6582. get
  6583. {
  6584. return m_GuildClickMessage;
  6585. }
  6586. set
  6587. {
  6588. m_GuildClickMessage = value;
  6589. }
  6590. }
  6591. [CommandProperty(Server.AccessLevel.GameMaster)]
  6592. public Mobile GuildFealty
  6593. {
  6594. get
  6595. {
  6596. return this.m_GuildFealty;
  6597. }
  6598. set
  6599. {
  6600. this.m_GuildFealty = value;
  6601. }
  6602. }
  6603. [CommandProperty(Server.AccessLevel.GameMaster)]
  6604. public string GuildTitle
  6605. {
  6606. get
  6607. {
  6608. return this.m_GuildTitle;
  6609. }
  6610. set
  6611. {
  6612. string guildTitle = this.m_GuildTitle;
  6613. if (guildTitle != value)
  6614. {
  6615. this.m_GuildTitle = value;
  6616. if (((this.m_Guild != null) && !this.m_Guild.Disbanded) && (this.m_GuildTitle != null))
  6617. {
  6618. this.SendLocalizedMessage(0xf88aa, true, this.m_GuildTitle);
  6619. }
  6620. this.InvalidateProperties();
  6621. this.OnGuildTitleChange(guildTitle);
  6622. }
  6623. }
  6624. }
  6625. public IArmor HandArmor
  6626. {
  6627. get
  6628. {
  6629. return (this.FindItemOnLayer(Layer.Gloves) as IArmor);
  6630. }
  6631. }
  6632. public IArmor HeadArmor
  6633. {
  6634. get
  6635. {
  6636. return (this.FindItemOnLayer(Layer.Helm) as IArmor);
  6637. }
  6638. }
  6639. [CommandProperty(Server.AccessLevel.GameMaster)]
  6640. public bool Hidden
  6641. {
  6642. get
  6643. {
  6644. return this.m_Hidden;
  6645. }
  6646. set
  6647. {
  6648. if (this.m_Hidden != value)
  6649. {
  6650. this.m_AllowedStealthSteps = 0;
  6651. this.m_Hidden = value;
  6652. if (this.m_Map != null)
  6653. {
  6654. Packet p = null;
  6655. IPooledEnumerable clientsInRange = this.m_Map.GetClientsInRange(this.m_Location);
  6656. foreach (Server.Network.NetState state in clientsInRange)
  6657. {
  6658. if (!state.Mobile.CanSee(this))
  6659. {
  6660. if (p == null)
  6661. {
  6662. p = this.RemovePacket;
  6663. }
  6664. state.Send(p);
  6665. continue;
  6666. }
  6667. state.Send(new MobileIncoming(state.Mobile, this));
  6668. if (this.IsDeadBondedPet)
  6669. {
  6670. state.Send(new BondedStatus(0, this.m_Serial, 1));
  6671. }
  6672. if (ObjectPropertyList.Enabled)
  6673. {
  6674. state.Send(this.OPLPacket);
  6675. }
  6676. }
  6677. clientsInRange.Free();
  6678. }
  6679. }
  6680. }
  6681. }
  6682. [CommandProperty(Server.AccessLevel.GameMaster)]
  6683. public int Hits
  6684. {
  6685. get
  6686. {
  6687. return this.m_Hits;
  6688. }
  6689. set
  6690. {
  6691. if (value < 0)
  6692. {
  6693. value = 0;
  6694. }
  6695. else if (value >= this.HitsMax)
  6696. {
  6697. value = this.HitsMax;
  6698. if (this.m_HitsTimer != null)
  6699. {
  6700. this.m_HitsTimer.Stop();
  6701. }
  6702. for (int i = 0; i < this.m_Aggressors.Count; i++)
  6703. {
  6704. ((AggressorInfo) this.m_Aggressors[i]).CanReportMurder = false;
  6705. }
  6706. if (this.m_DamageEntries.Count > 0)
  6707. {
  6708. this.m_DamageEntries.Clear();
  6709. }
  6710. }
  6711. if (value < this.HitsMax)
  6712. {
  6713. if (this.m_HitsTimer == null)
  6714. {
  6715. this.m_HitsTimer = new HitsTimer(this);
  6716. }
  6717. this.m_HitsTimer.Start();
  6718. }
  6719. if (this.m_Hits != value)
  6720. {
  6721. this.m_Hits = value;
  6722. this.Delta(MobileDelta.Hits);
  6723. }
  6724. }
  6725. }
  6726. [CommandProperty(Server.AccessLevel.GameMaster)]
  6727. public virtual int HitsMax
  6728. {
  6729. get
  6730. {
  6731. return (50 + (this.Str / 2));
  6732. }
  6733. }
  6734. public static RegenRateHandler HitsRegenRateHandler
  6735. {
  6736. get
  6737. {
  6738. return m_HitsRegenRate;
  6739. }
  6740. set
  6741. {
  6742. m_HitsRegenRate = value;
  6743. }
  6744. }
  6745. public Item Holding
  6746. {
  6747. get
  6748. {
  6749. return this.m_Holding;
  6750. }
  6751. set
  6752. {
  6753. if (this.m_Holding != value)
  6754. {
  6755. if (this.m_Holding != null)
  6756. {
  6757. this.TotalWeight -= this.m_Holding.TotalWeight + this.m_Holding.PileWeight;
  6758. if (this.m_Holding.HeldBy == this)
  6759. {
  6760. this.m_Holding.HeldBy = null;
  6761. }
  6762. }
  6763. if ((value != null) && (this.m_Holding != null))
  6764. {
  6765. value.ClearBounce();
  6766. this.DropHolding();
  6767. }
  6768. this.m_Holding = value;
  6769. if (this.m_Holding != null)
  6770. {
  6771. this.TotalWeight += this.m_Holding.TotalWeight + this.m_Holding.PileWeight;
  6772. if (this.m_Holding.HeldBy == null)
  6773. {
  6774. this.m_Holding.HeldBy = this;
  6775. }
  6776. }
  6777. }
  6778. }
  6779. }
  6780. [Hue, CommandProperty(Server.AccessLevel.GameMaster)]
  6781. public virtual int Hue
  6782. {
  6783. get
  6784. {
  6785. if (this.m_HueMod != -1)
  6786. {
  6787. return this.m_HueMod;
  6788. }
  6789. return this.m_Hue;
  6790. }
  6791. set
  6792. {
  6793. if (this.m_Hue != value)
  6794. {
  6795. this.m_Hue = value;
  6796. this.Delta(MobileDelta.Hue);
  6797. }
  6798. }
  6799. }
  6800. public virtual int HuedItemID
  6801. {
  6802. get
  6803. {
  6804. if (!this.m_Female)
  6805. {
  6806. return 0x2106;
  6807. }
  6808. return 0x2107;
  6809. }
  6810. }
  6811. [Hue, CommandProperty(Server.AccessLevel.GameMaster)]
  6812. public int HueMod
  6813. {
  6814. get
  6815. {
  6816. return this.m_HueMod;
  6817. }
  6818. set
  6819. {
  6820. if (this.m_HueMod != value)
  6821. {
  6822. this.m_HueMod = value;
  6823. this.Delta(MobileDelta.Hue);
  6824. }
  6825. }
  6826. }
  6827. [CommandProperty(Server.AccessLevel.GameMaster)]
  6828. public int Hunger
  6829. {
  6830. get
  6831. {
  6832. return this.m_Hunger;
  6833. }
  6834. set
  6835. {
  6836. int hunger = this.m_Hunger;
  6837. if (hunger != value)
  6838. {
  6839. this.m_Hunger = value;
  6840. EventSink.InvokeHungerChanged(new HungerChangedEventArgs(this, hunger));
  6841. }
  6842. }
  6843. }
  6844. public static bool InsuranceEnabled
  6845. {
  6846. get
  6847. {
  6848. return m_InsuranceEnabled;
  6849. }
  6850. set
  6851. {
  6852. m_InsuranceEnabled = value;
  6853. }
  6854. }
  6855. [CommandProperty(Server.AccessLevel.GameMaster)]
  6856. public int Int
  6857. {
  6858. get
  6859. {
  6860. int num = this.m_Int + this.GetStatOffset(StatType.Int);
  6861. if (num < 1)
  6862. {
  6863. return 1;
  6864. }
  6865. if (num > 0xfde8)
  6866. {
  6867. num = 0xfde8;
  6868. }
  6869. return num;
  6870. }
  6871. set
  6872. {
  6873. if (this.m_StatMods.Count == 0)
  6874. {
  6875. this.RawInt = value;
  6876. }
  6877. }
  6878. }
  6879. [CommandProperty(Server.AccessLevel.Counselor, Server.AccessLevel.GameMaster)]
  6880. public StatLockType IntLock
  6881. {
  6882. get
  6883. {
  6884. return this.m_IntLock;
  6885. }
  6886. set
  6887. {
  6888. if (this.m_IntLock != value)
  6889. {
  6890. this.m_IntLock = value;
  6891. if (this.m_NetState != null)
  6892. {
  6893. this.m_NetState.Send(new StatLockInfo(this));
  6894. }
  6895. }
  6896. }
  6897. }
  6898. [CommandProperty(Server.AccessLevel.GameMaster)]
  6899. public bool IsBodyMod
  6900. {
  6901. get
  6902. {
  6903. return (this.m_BodyMod.BodyID != 0);
  6904. }
  6905. }
  6906. public virtual bool IsDeadBondedPet
  6907. {
  6908. get
  6909. {
  6910. return false;
  6911. }
  6912. }
  6913. public ArrayList Items
  6914. {
  6915. get
  6916. {
  6917. return this.m_Items;
  6918. }
  6919. }
  6920. [CommandProperty(Server.AccessLevel.GameMaster)]
  6921. public int Karma
  6922. {
  6923. get
  6924. {
  6925. return this.m_Karma;
  6926. }
  6927. set
  6928. {
  6929. int karma = this.m_Karma;
  6930. if (karma != value)
  6931. {
  6932. this.m_Karma = value;
  6933. this.OnKarmaChange(karma);
  6934. }
  6935. }
  6936. }
  6937. public virtual bool KeepsItemsOnDeath
  6938. {
  6939. get
  6940. {
  6941. return (this.m_AccessLevel > Server.AccessLevel.Player);
  6942. }
  6943. }
  6944. [CommandProperty(Server.AccessLevel.Counselor, Server.AccessLevel.GameMaster)]
  6945. public int Kills
  6946. {
  6947. get
  6948. {
  6949. return this.m_Kills;
  6950. }
  6951. set
  6952. {
  6953. int kills = this.m_Kills;
  6954. if (this.m_Kills != value)
  6955. {
  6956. this.m_Kills = value;
  6957. if (this.m_Kills < 0)
  6958. {
  6959. this.m_Kills = 0;
  6960. }
  6961. if ((kills >= 5) != (this.m_Kills >= 5))
  6962. {
  6963. this.Delta(MobileDelta.Noto);
  6964. this.InvalidateProperties();
  6965. }
  6966. this.OnKillsChange(kills);
  6967. }
  6968. }
  6969. }
  6970. [CommandProperty(Server.AccessLevel.GameMaster)]
  6971. public string Language
  6972. {
  6973. get
  6974. {
  6975. return this.m_Language;
  6976. }
  6977. set
  6978. {
  6979. this.m_Language = value;
  6980. }
  6981. }
  6982. [CommandProperty(Server.AccessLevel.GameMaster)]
  6983. public Mobile LastKiller
  6984. {
  6985. get
  6986. {
  6987. return this.m_LastKiller;
  6988. }
  6989. set
  6990. {
  6991. this.m_LastKiller = value;
  6992. }
  6993. }
  6994. public DateTime LastMoveTime
  6995. {
  6996. get
  6997. {
  6998. return this.m_LastMoveTime;
  6999. }
  7000. set
  7001. {
  7002. this.m_LastMoveTime = value;
  7003. }
  7004. }
  7005. [CommandProperty(Server.AccessLevel.GameMaster)]
  7006. public DateTime LastStatGain
  7007. {
  7008. get
  7009. {
  7010. return this.m_LastStatGain;
  7011. }
  7012. set
  7013. {
  7014. this.m_LastStatGain = value;
  7015. }
  7016. }
  7017. public IArmor LegsArmor
  7018. {
  7019. get
  7020. {
  7021. IArmor armor = this.FindItemOnLayer(Layer.InnerLegs) as IArmor;
  7022. if (armor == null)
  7023. {
  7024. armor = this.FindItemOnLayer(Layer.Pants) as IArmor;
  7025. }
  7026. return armor;
  7027. }
  7028. }
  7029. [CommandProperty(Server.AccessLevel.GameMaster)]
  7030. public int LightLevel
  7031. {
  7032. get
  7033. {
  7034. return this.m_LightLevel;
  7035. }
  7036. set
  7037. {
  7038. if (this.m_LightLevel != value)
  7039. {
  7040. this.m_LightLevel = value;
  7041. this.CheckLightLevels(false);
  7042. }
  7043. }
  7044. }
  7045. [CommandProperty(Server.AccessLevel.Counselor, Server.AccessLevel.GameMaster)]
  7046. public Point3D Location
  7047. {
  7048. get
  7049. {
  7050. return this.m_Location;
  7051. }
  7052. set
  7053. {
  7054. this.SetLocation(value, true);
  7055. }
  7056. }
  7057. public Point3D LogoutLocation
  7058. {
  7059. get
  7060. {
  7061. return this.m_LogoutLocation;
  7062. }
  7063. set
  7064. {
  7065. this.m_LogoutLocation = value;
  7066. }
  7067. }
  7068. public Server.Map LogoutMap
  7069. {
  7070. get
  7071. {
  7072. return this.m_LogoutMap;
  7073. }
  7074. set
  7075. {
  7076. this.m_LogoutMap = value;
  7077. }
  7078. }
  7079. public virtual int Luck
  7080. {
  7081. get
  7082. {
  7083. return 0;
  7084. }
  7085. }
  7086. [CommandProperty(Server.AccessLevel.GameMaster)]
  7087. public int MagicDamageAbsorb
  7088. {
  7089. get
  7090. {
  7091. return this.m_MagicDamageAbsorb;
  7092. }
  7093. set
  7094. {
  7095. this.m_MagicDamageAbsorb = value;
  7096. }
  7097. }
  7098. [CommandProperty(Server.AccessLevel.GameMaster)]
  7099. public int Mana
  7100. {
  7101. get
  7102. {
  7103. return this.m_Mana;
  7104. }
  7105. set
  7106. {
  7107. if (value < 0)
  7108. {
  7109. value = 0;
  7110. }
  7111. else if (value >= this.ManaMax)
  7112. {
  7113. value = this.ManaMax;
  7114. if (this.m_ManaTimer != null)
  7115. {
  7116. this.m_ManaTimer.Stop();
  7117. }
  7118. if (this.Meditating)
  7119. {
  7120. this.Meditating = false;
  7121. this.SendLocalizedMessage(0x7a856);
  7122. }
  7123. }
  7124. if (value < this.ManaMax)
  7125. {
  7126. if (this.m_ManaTimer == null)
  7127. {
  7128. this.m_ManaTimer = new ManaTimer(this);
  7129. }
  7130. this.m_ManaTimer.Start();
  7131. }
  7132. if (this.m_Mana != value)
  7133. {
  7134. this.m_Mana = value;
  7135. this.Delta(MobileDelta.Mana);
  7136. }
  7137. }
  7138. }
  7139. [CommandProperty(Server.AccessLevel.GameMaster)]
  7140. public virtual int ManaMax
  7141. {
  7142. get
  7143. {
  7144. return this.Int;
  7145. }
  7146. }
  7147. public static RegenRateHandler ManaRegenRateHandler
  7148. {
  7149. get
  7150. {
  7151. return m_ManaRegenRate;
  7152. }
  7153. set
  7154. {
  7155. m_ManaRegenRate = value;
  7156. }
  7157. }
  7158. /*[CommandProperty(Server.AccessLevel.Counselor, Server.AccessLevel.GameMaster)]
  7159. public Server.Map Map
  7160. {
  7161. get
  7162. {
  7163. return this.m_Map;
  7164. }
  7165. set
  7166. {
  7167. if (this.m_Map != value)
  7168. {
  7169. if (this.m_NetState != null)
  7170. {
  7171. this.m_NetState.ValidateAllTrades();
  7172. }
  7173. Server.Map oldMap = this.m_Map;
  7174. if (this.m_Map != null)
  7175. {
  7176. this.m_Map.OnLeave(this);
  7177. this.ClearScreen();
  7178. this.SendRemovePacket();
  7179. }
  7180. for (int i = 0; i < this.m_Items.Count; i++)
  7181. {
  7182. ((Item) this.m_Items[i]).Map = value;
  7183. }
  7184. this.m_Map = value;
  7185. if (this.m_Map != null)
  7186. {
  7187. this.m_Map.OnEnter(this);
  7188. }
  7189. this.m_Region.InternalExit(this);
  7190. if (this.m_Map != null)
  7191. {
  7192. Server.Region old = this.m_Region;
  7193. this.m_Region = Server.Region.Find(this.m_Location, this.m_Map);
  7194. this.OnRegionChange(old, this.m_Region);
  7195. this.m_Region.InternalEnter(this);
  7196. Server.Network.NetState netState = this.m_NetState;
  7197. if ((netState != null) && (this.m_Map != null))
  7198. {
  7199. netState.Sequence = 0;
  7200. netState.Send(new MapChange(this));
  7201. netState.Send(new MapPatches());
  7202. netState.Send(SeasonChange.Instantiate(this.GetSeason(), true));
  7203. netState.Send(new MobileUpdate(this));
  7204. this.ClearFastwalkStack();
  7205. }
  7206. }
  7207. if (this.m_NetState != null)
  7208. {
  7209. if (this.m_Map != null)
  7210. {
  7211. this.Send(new ServerChange(this, this.m_Map));
  7212. }
  7213. if (this.m_NetState != null)
  7214. {
  7215. this.m_NetState.Sequence = 0;
  7216. this.ClearFastwalkStack();
  7217. }
  7218. this.Send(new MobileIncoming(this, this));
  7219. this.Send(new MobileUpdate(this));
  7220. this.CheckLightLevels(true);
  7221. this.Send(new MobileUpdate(this));
  7222. }
  7223. this.SendEverything();
  7224. this.SendIncomingPacket();
  7225. if (this.m_NetState != null)
  7226. {
  7227. if (this.m_NetState != null)
  7228. {
  7229. this.m_NetState.Sequence = 0;
  7230. this.ClearFastwalkStack();
  7231. }
  7232. this.Send(new MobileIncoming(this, this));
  7233. this.Send(SupportedFeatures.Instantiate());
  7234. this.Send(new MobileUpdate(this));
  7235. this.Send(new MobileAttributes(this));
  7236. }
  7237. this.OnMapChange(oldMap);
  7238. }
  7239. }
  7240. }*/
  7241. [CommandProperty(AccessLevel.Counselor, AccessLevel.GameMaster)]
  7242. public Map Map
  7243. {
  7244. get
  7245. {
  7246. return m_Map;
  7247. }
  7248. set
  7249. {
  7250. if (m_Deleted)
  7251. return;
  7252. if (m_Map != value)
  7253. {
  7254. if (m_NetState != null)
  7255. m_NetState.ValidateAllTrades();
  7256. Map oldMap = m_Map;
  7257. if (m_Map != null)
  7258. {
  7259. m_Map.OnLeave(this);
  7260. ClearScreen();
  7261. SendRemovePacket();
  7262. }
  7263. for (int i = 0; i < m_Items.Count; ++i)
  7264. (m_Items[i] as Item).Map = value;
  7265. m_Map = value;
  7266. UpdateRegion();
  7267. if (m_Map != null)
  7268. m_Map.OnEnter(this);
  7269. NetState ns = m_NetState;
  7270. if (ns != null && m_Map != null)
  7271. {
  7272. ns.Sequence = 0;
  7273. ns.Send(new MapChange(this));
  7274. ns.Send(new MapPatches());
  7275. ns.Send(SeasonChange.Instantiate(GetSeason(), true));
  7276. if (ns.StygianAbyss)
  7277. ns.Send(new MobileUpdate(this));
  7278. else
  7279. ns.Send(new MobileUpdateOld(this));
  7280. ClearFastwalkStack();
  7281. }
  7282. if (ns != null)
  7283. {
  7284. if (m_Map != null)
  7285. Send(new ServerChange(this, m_Map));
  7286. ns.Sequence = 0;
  7287. ClearFastwalkStack();
  7288. if (ns.StygianAbyss)
  7289. {
  7290. Send(new MobileIncoming(this, this));
  7291. Send(new MobileUpdate(this));
  7292. CheckLightLevels(true);
  7293. Send(new MobileUpdate(this));
  7294. }
  7295. else
  7296. {
  7297. Send(new MobileIncomingOld(this, this));
  7298. Send(new MobileUpdateOld(this));
  7299. CheckLightLevels(true);
  7300. Send(new MobileUpdateOld(this));
  7301. }
  7302. }
  7303. SendEverything();
  7304. SendIncomingPacket();
  7305. if (ns != null)
  7306. {
  7307. ns.Sequence = 0;
  7308. ClearFastwalkStack();
  7309. if (ns.StygianAbyss)
  7310. {
  7311. Send(new MobileIncoming(this, this));
  7312. Send(SupportedFeatures.Instantiate(ns));
  7313. Send(new MobileUpdate(this));
  7314. Send(new MobileAttributes(this));
  7315. }
  7316. else
  7317. {
  7318. Send(new MobileIncomingOld(this, this));
  7319. Send(SupportedFeatures.Instantiate(ns));
  7320. Send(new MobileUpdateOld(this));
  7321. Send(new MobileAttributes(this));
  7322. }
  7323. }
  7324. OnMapChange(oldMap);
  7325. }
  7326. }
  7327. }
  7328. public static int MaxPlayerResistance
  7329. {
  7330. get
  7331. {
  7332. return m_MaxPlayerResistance;
  7333. }
  7334. set
  7335. {
  7336. m_MaxPlayerResistance = value;
  7337. }
  7338. }
  7339. [CommandProperty(Server.AccessLevel.GameMaster)]
  7340. public bool Meditating
  7341. {
  7342. get
  7343. {
  7344. return this.m_Meditating;
  7345. }
  7346. set
  7347. {
  7348. this.m_Meditating = value;
  7349. }
  7350. }
  7351. [CommandProperty(Server.AccessLevel.GameMaster)]
  7352. public int MeleeDamageAbsorb
  7353. {
  7354. get
  7355. {
  7356. return this.m_MeleeDamageAbsorb;
  7357. }
  7358. set
  7359. {
  7360. this.m_MeleeDamageAbsorb = value;
  7361. }
  7362. }
  7363. [CommandProperty(Server.AccessLevel.GameMaster)]
  7364. public IMount Mount
  7365. {
  7366. get
  7367. {
  7368. IMountItem mountItem = null;
  7369. if (((this.m_MountItem != null) && !this.m_MountItem.Deleted) && (this.m_MountItem.Parent == this))
  7370. {
  7371. mountItem = (IMountItem) this.m_MountItem;
  7372. }
  7373. if (mountItem == null)
  7374. {
  7375. this.m_MountItem = (mountItem = this.FindItemOnLayer(Layer.Mount) as IMountItem) as Item;
  7376. }
  7377. if (mountItem != null)
  7378. {
  7379. return mountItem.Mount;
  7380. }
  7381. return null;
  7382. }
  7383. }
  7384. [CommandProperty(Server.AccessLevel.GameMaster)]
  7385. public bool Mounted
  7386. {
  7387. get
  7388. {
  7389. return (this.Mount != null);
  7390. }
  7391. }
  7392. [CommandProperty(Server.AccessLevel.GameMaster)]
  7393. public string Name
  7394. {
  7395. get
  7396. {
  7397. if (this.m_NameMod != null)
  7398. {
  7399. return this.m_NameMod;
  7400. }
  7401. return this.m_Name;
  7402. }
  7403. set
  7404. {
  7405. if (this.m_Name != value)
  7406. {
  7407. this.m_Name = value;
  7408. this.Delta(MobileDelta.Name);
  7409. this.InvalidateProperties();
  7410. }
  7411. }
  7412. }
  7413. public virtual string GetKnownName(Mobile mobile)
  7414. {
  7415. return Name;
  7416. }
  7417. public virtual string GetKnownNameFixed(Mobile mobile)
  7418. {
  7419. var name = GetKnownName(mobile);
  7420. if (name == null) return "";
  7421. if (name.Length > 30)
  7422. {
  7423. var composedParts = name.Split(' ');
  7424. name = composedParts[0];
  7425. }
  7426. if (name.Length > 30)
  7427. {
  7428. name = name.Remove(29, name.Length - 29);
  7429. }
  7430. return name;
  7431. }
  7432. public virtual string RealName
  7433. {
  7434. get
  7435. {
  7436. return this.m_RealName;
  7437. }
  7438. set
  7439. {
  7440. if (this.m_RealName != value)
  7441. {
  7442. this.m_RealName = value;
  7443. this.Delta(MobileDelta.Name);
  7444. this.InvalidateProperties();
  7445. }
  7446. }
  7447. }
  7448. [CommandProperty(Server.AccessLevel.GameMaster)]
  7449. public int NameHue
  7450. {
  7451. get
  7452. {
  7453. return this.m_NameHue;
  7454. }
  7455. set
  7456. {
  7457. this.m_NameHue = value;
  7458. }
  7459. }
  7460. [CommandProperty(Server.AccessLevel.GameMaster)]
  7461. public string NameMod
  7462. {
  7463. get
  7464. {
  7465. return this.m_NameMod;
  7466. }
  7467. set
  7468. {
  7469. if (this.m_NameMod != value)
  7470. {
  7471. this.m_NameMod = value;
  7472. this.Delta(MobileDelta.Name);
  7473. this.InvalidateProperties();
  7474. }
  7475. }
  7476. }
  7477. public IArmor NeckArmor
  7478. {
  7479. get
  7480. {
  7481. return (this.FindItemOnLayer(Layer.Neck) as IArmor);
  7482. }
  7483. }
  7484. public Server.Network.NetState NetState
  7485. {
  7486. get
  7487. {
  7488. if ((this.m_NetState != null) && (this.m_NetState.Socket == null))
  7489. {
  7490. this.NetState = null;
  7491. }
  7492. return this.m_NetState;
  7493. }
  7494. set
  7495. {
  7496. if (this.m_NetState != value)
  7497. {
  7498. if (this.m_Map != null)
  7499. {
  7500. this.m_Map.OnClientChange(this.m_NetState, value, this);
  7501. }
  7502. if (this.m_Target != null)
  7503. {
  7504. this.m_Target.Cancel(this, TargetCancelType.Disconnected);
  7505. }
  7506. if (this.m_QuestArrow != null)
  7507. {
  7508. this.QuestArrow = null;
  7509. }
  7510. if (this.m_Spell != null)
  7511. {
  7512. this.m_Spell.OnConnectionChanged();
  7513. }
  7514. if (this.m_NetState != null)
  7515. {
  7516. this.m_NetState.CancelAllTrades();
  7517. }
  7518. Server.Items.BankBox box = this.FindBankNoCreate();
  7519. if ((box != null) && box.Opened)
  7520. {
  7521. box.Close();
  7522. }
  7523. this.m_NetState = value;
  7524. if (this.m_NetState == null)
  7525. {
  7526. this.OnDisconnected();
  7527. EventSink.InvokeDisconnected(new DisconnectedEventArgs(this));
  7528. this.m_LogoutTimer.Stop();
  7529. this.m_LogoutTimer.Delay = this.GetLogoutDelay();
  7530. this.m_LogoutTimer.Start();
  7531. }
  7532. else
  7533. {
  7534. this.OnConnected();
  7535. EventSink.InvokeConnected(new ConnectedEventArgs(this));
  7536. this.m_LogoutTimer.Stop();
  7537. if ((this.m_Map == Server.Map.Internal) && (this.m_LogoutMap != null))
  7538. {
  7539. this.Map = this.m_LogoutMap;
  7540. this.Location = this.m_LogoutLocation;
  7541. }
  7542. }
  7543. for (int i = this.m_Items.Count - 1; i >= 0; i--)
  7544. {
  7545. if (i < this.m_Items.Count)
  7546. {
  7547. Item item = (Item) this.m_Items[i];
  7548. if (item is SecureTradeContainer)
  7549. {
  7550. for (int j = item.Items.Count - 1; j >= 0; j--)
  7551. {
  7552. if (j < item.Items.Count)
  7553. {
  7554. ((Item) item.Items[j]).OnSecureTrade(this, this, this, false);
  7555. this.AddToBackpack((Item) item.Items[j]);
  7556. }
  7557. }
  7558. item.Delete();
  7559. }
  7560. }
  7561. }
  7562. this.DropHolding();
  7563. this.OnNetStateChanged();
  7564. }
  7565. }
  7566. }
  7567. public DateTime NextActionMessage
  7568. {
  7569. get
  7570. {
  7571. return this.m_NextActionMessage;
  7572. }
  7573. set
  7574. {
  7575. this.m_NextActionMessage = value;
  7576. }
  7577. }
  7578. public DateTime NextActionTime
  7579. {
  7580. get
  7581. {
  7582. return this.m_NextActionTime;
  7583. }
  7584. set
  7585. {
  7586. this.m_NextActionTime = value;
  7587. }
  7588. }
  7589. public DateTime NextCombatTime
  7590. {
  7591. get
  7592. {
  7593. return this.m_NextCombatTime;
  7594. }
  7595. set
  7596. {
  7597. this.m_NextCombatTime = value;
  7598. }
  7599. }
  7600. public DateTime NextSkillTime
  7601. {
  7602. get
  7603. {
  7604. return this.m_NextSkillTime;
  7605. }
  7606. set
  7607. {
  7608. this.m_NextSkillTime = value;
  7609. }
  7610. }
  7611. public DateTime NextSpellTime
  7612. {
  7613. get
  7614. {
  7615. return this.m_NextSpellTime;
  7616. }
  7617. set
  7618. {
  7619. this.m_NextSpellTime = value;
  7620. }
  7621. }
  7622. public static bool NoSpeechLOS
  7623. {
  7624. get
  7625. {
  7626. return m_NoSpeechLOS;
  7627. }
  7628. set
  7629. {
  7630. m_NoSpeechLOS = value;
  7631. }
  7632. }
  7633. public Packet OPLPacket
  7634. {
  7635. get
  7636. {
  7637. if (this.m_OPLPacket == null)
  7638. {
  7639. this.m_OPLPacket = new OPLInfo(this.PropertyList);
  7640. }
  7641. return this.m_OPLPacket;
  7642. }
  7643. }
  7644. [CommandProperty(Server.AccessLevel.GameMaster)]
  7645. public bool Paralyzed
  7646. {
  7647. get
  7648. {
  7649. return this.m_Paralyzed;
  7650. }
  7651. set
  7652. {
  7653. if (this.m_Paralyzed != value)
  7654. {
  7655. this.m_Paralyzed = value;
  7656. this.SendLocalizedMessage(this.m_Paralyzed ? 0x7aa6d : 0x7aa6e);
  7657. if (this.m_ParaTimer != null)
  7658. {
  7659. this.m_ParaTimer.Stop();
  7660. this.m_ParaTimer = null;
  7661. }
  7662. }
  7663. }
  7664. }
  7665. public object Party
  7666. {
  7667. get
  7668. {
  7669. return this.m_Party;
  7670. }
  7671. set
  7672. {
  7673. this.m_Party = value;
  7674. }
  7675. }
  7676. [CommandProperty(Server.AccessLevel.Counselor)]
  7677. public virtual int PhysicalResistance
  7678. {
  7679. get
  7680. {
  7681. return this.GetResistance(ResistanceType.Physical);
  7682. }
  7683. }
  7684. [CommandProperty(Server.AccessLevel.GameMaster, Server.AccessLevel.Administrator)]
  7685. public bool Player
  7686. {
  7687. get
  7688. {
  7689. return this.m_Player;
  7690. }
  7691. set
  7692. {
  7693. this.m_Player = value;
  7694. this.InvalidateProperties();
  7695. if (!this.m_Player && (this.m_CombatTimer != null))
  7696. {
  7697. this.m_CombatTimer.Priority = TimerPriority.FiftyMS;
  7698. }
  7699. else if (this.m_CombatTimer != null)
  7700. {
  7701. this.m_CombatTimer.Priority = TimerPriority.EveryTick;
  7702. }
  7703. }
  7704. }
  7705. [CommandProperty(Server.AccessLevel.GameMaster)]
  7706. public Server.Poison Poison
  7707. {
  7708. get
  7709. {
  7710. return this.m_Poison;
  7711. }
  7712. set
  7713. {
  7714. this.m_Poison = value;
  7715. this.Delta(MobileDelta.Flags);
  7716. if (this.m_PoisonTimer != null)
  7717. {
  7718. this.m_PoisonTimer.Stop();
  7719. this.m_PoisonTimer = null;
  7720. }
  7721. if (this.m_Poison != null)
  7722. {
  7723. this.m_PoisonTimer = this.m_Poison.ConstructTimer(this);
  7724. if (this.m_PoisonTimer != null)
  7725. {
  7726. this.m_PoisonTimer.Start();
  7727. }
  7728. }
  7729. }
  7730. }
  7731. [CommandProperty(Server.AccessLevel.GameMaster)]
  7732. public bool Poisoned
  7733. {
  7734. get
  7735. {
  7736. return (this.m_Poison != null);
  7737. }
  7738. }
  7739. [CommandProperty(Server.AccessLevel.Counselor)]
  7740. public virtual int PoisonResistance
  7741. {
  7742. get
  7743. {
  7744. return this.GetResistance(ResistanceType.Poison);
  7745. }
  7746. }
  7747. [CommandProperty(Server.AccessLevel.Counselor, Server.AccessLevel.GameMaster)]
  7748. public string Profile
  7749. {
  7750. get
  7751. {
  7752. return this.m_Profile;
  7753. }
  7754. set
  7755. {
  7756. this.m_Profile = value;
  7757. }
  7758. }
  7759. [CommandProperty(Server.AccessLevel.Counselor, Server.AccessLevel.GameMaster)]
  7760. public bool ProfileLocked
  7761. {
  7762. get
  7763. {
  7764. return this.m_ProfileLocked;
  7765. }
  7766. set
  7767. {
  7768. this.m_ProfileLocked = value;
  7769. }
  7770. }
  7771. public Server.Prompts.Prompt Prompt
  7772. {
  7773. get
  7774. {
  7775. return this.m_Prompt;
  7776. }
  7777. set
  7778. {
  7779. Server.Prompts.Prompt prompt = this.m_Prompt;
  7780. Server.Prompts.Prompt prompt2 = value;
  7781. if (prompt != prompt2)
  7782. {
  7783. this.m_Prompt = null;
  7784. if ((prompt != null) && (prompt2 != null))
  7785. {
  7786. prompt.OnCancel(this);
  7787. }
  7788. this.m_Prompt = prompt2;
  7789. if (prompt2 != null)
  7790. {
  7791. this.Send(new UnicodePrompt(prompt2));
  7792. }
  7793. }
  7794. }
  7795. }
  7796. public ObjectPropertyList PropertyList
  7797. {
  7798. get
  7799. {
  7800. if (this.m_PropertyList == null)
  7801. {
  7802. this.m_PropertyList = new ObjectPropertyList(this);
  7803. this.GetProperties(this.m_PropertyList);
  7804. this.m_PropertyList.Terminate();
  7805. }
  7806. return this.m_PropertyList;
  7807. }
  7808. }
  7809. public bool Pushing
  7810. {
  7811. get
  7812. {
  7813. return this.m_Pushing;
  7814. }
  7815. set
  7816. {
  7817. this.m_Pushing = value;
  7818. }
  7819. }
  7820. public Server.QuestArrow QuestArrow
  7821. {
  7822. get
  7823. {
  7824. return this.m_QuestArrow;
  7825. }
  7826. set
  7827. {
  7828. if (this.m_QuestArrow != value)
  7829. {
  7830. if (this.m_QuestArrow != null)
  7831. {
  7832. this.m_QuestArrow.Stop();
  7833. }
  7834. this.m_QuestArrow = value;
  7835. }
  7836. }
  7837. }
  7838. [CommandProperty(Server.AccessLevel.GameMaster)]
  7839. public int RawDex
  7840. {
  7841. get
  7842. {
  7843. return this.m_Dex;
  7844. }
  7845. set
  7846. {
  7847. if (value < 1)
  7848. {
  7849. value = 1;
  7850. }
  7851. else if (value > 0xfde8)
  7852. {
  7853. value = 0xfde8;
  7854. }
  7855. if (this.m_Dex != value)
  7856. {
  7857. int dex = this.m_Dex;
  7858. this.m_Dex = value;
  7859. this.Delta(MobileDelta.Stat | MobileDelta.Stam);
  7860. if (this.Stam < this.StamMax)
  7861. {
  7862. if (this.m_StamTimer == null)
  7863. {
  7864. this.m_StamTimer = new StamTimer(this);
  7865. }
  7866. this.m_StamTimer.Start();
  7867. }
  7868. else if (this.Stam > this.StamMax)
  7869. {
  7870. this.Stam = this.StamMax;
  7871. }
  7872. this.OnRawDexChange(dex);
  7873. this.OnRawStatChange(StatType.Dex, dex);
  7874. }
  7875. }
  7876. }
  7877. [CommandProperty(Server.AccessLevel.GameMaster)]
  7878. public int RawInt
  7879. {
  7880. get
  7881. {
  7882. return this.m_Int;
  7883. }
  7884. set
  7885. {
  7886. if (value < 1)
  7887. {
  7888. value = 1;
  7889. }
  7890. else if (value > 0xfde8)
  7891. {
  7892. value = 0xfde8;
  7893. }
  7894. if (this.m_Int != value)
  7895. {
  7896. int @int = this.m_Int;
  7897. this.m_Int = value;
  7898. this.Delta(MobileDelta.Stat | MobileDelta.Mana);
  7899. if (this.Mana < this.ManaMax)
  7900. {
  7901. if (this.m_ManaTimer == null)
  7902. {
  7903. this.m_ManaTimer = new ManaTimer(this);
  7904. }
  7905. this.m_ManaTimer.Start();
  7906. }
  7907. else if (this.Mana > this.ManaMax)
  7908. {
  7909. this.Mana = this.ManaMax;
  7910. }
  7911. this.OnRawIntChange(@int);
  7912. this.OnRawStatChange(StatType.Int, @int);
  7913. }
  7914. }
  7915. }
  7916. [CommandProperty(Server.AccessLevel.GameMaster)]
  7917. public string RawName
  7918. {
  7919. get
  7920. {
  7921. return this.m_Name;
  7922. }
  7923. set
  7924. {
  7925. this.Name = value;
  7926. }
  7927. }
  7928. [CommandProperty(Server.AccessLevel.GameMaster)]
  7929. public int RawStatTotal
  7930. {
  7931. get
  7932. {
  7933. return ((this.RawStr + this.RawDex) + this.RawInt);
  7934. }
  7935. }
  7936. [CommandProperty(Server.AccessLevel.GameMaster)]
  7937. public int RawStr
  7938. {
  7939. get
  7940. {
  7941. return this.m_Str;
  7942. }
  7943. set
  7944. {
  7945. if (value < 1)
  7946. {
  7947. value = 1;
  7948. }
  7949. else if (value > 0xfde8)
  7950. {
  7951. value = 0xfde8;
  7952. }
  7953. if (this.m_Str != value)
  7954. {
  7955. int str = this.m_Str;
  7956. this.m_Str = value;
  7957. this.Delta(MobileDelta.Stat | MobileDelta.Hits);
  7958. if (this.Hits < this.HitsMax)
  7959. {
  7960. if (this.m_HitsTimer == null)
  7961. {
  7962. this.m_HitsTimer = new HitsTimer(this);
  7963. }
  7964. this.m_HitsTimer.Start();
  7965. }
  7966. else if (this.Hits > this.HitsMax)
  7967. {
  7968. this.Hits = this.HitsMax;
  7969. }
  7970. this.OnRawStrChange(str);
  7971. this.OnRawStatChange(StatType.Str, str);
  7972. }
  7973. }
  7974. }
  7975. public Server.Region Region
  7976. {
  7977. get
  7978. {
  7979. return this.m_Region;
  7980. }
  7981. }
  7982. public Packet RemovePacket
  7983. {
  7984. get
  7985. {
  7986. if (this.m_RemovePacket == null)
  7987. {
  7988. this.m_RemovePacket = new RemoveMobile(this);
  7989. }
  7990. return this.m_RemovePacket;
  7991. }
  7992. }
  7993. public ArrayList ResistanceMods
  7994. {
  7995. get
  7996. {
  7997. return this.m_ResistMods;
  7998. }
  7999. set
  8000. {
  8001. this.m_ResistMods = value;
  8002. }
  8003. }
  8004. public int[] Resistances
  8005. {
  8006. get
  8007. {
  8008. return this.m_Resistances;
  8009. }
  8010. }
  8011. public virtual bool RetainPackLocsOnDeath
  8012. {
  8013. get
  8014. {
  8015. return Core.AOS;
  8016. }
  8017. }
  8018. [CommandProperty(Server.AccessLevel.Counselor)]
  8019. public Server.Serial Serial
  8020. {
  8021. get
  8022. {
  8023. return this.m_Serial;
  8024. }
  8025. }
  8026. Point3D IEntity.Location
  8027. {
  8028. get
  8029. {
  8030. return this.m_Location;
  8031. }
  8032. }
  8033. public IArmor ShieldArmor
  8034. {
  8035. get
  8036. {
  8037. return (this.FindItemOnLayer(Layer.TwoHanded) as IArmor);
  8038. }
  8039. }
  8040. [CommandProperty(Server.AccessLevel.GameMaster)]
  8041. public int ShortTermMurders
  8042. {
  8043. get
  8044. {
  8045. return this.m_ShortTermMurders;
  8046. }
  8047. set
  8048. {
  8049. if (this.m_ShortTermMurders != value)
  8050. {
  8051. this.m_ShortTermMurders = value;
  8052. if (this.m_ShortTermMurders < 0)
  8053. {
  8054. this.m_ShortTermMurders = 0;
  8055. }
  8056. }
  8057. }
  8058. }
  8059. public virtual bool ShouldCheckStatTimers
  8060. {
  8061. get
  8062. {
  8063. return true;
  8064. }
  8065. }
  8066. public virtual bool ShowFameTitle
  8067. {
  8068. get
  8069. {
  8070. return true;
  8071. }
  8072. }
  8073. public static Server.SkillCheckDirectLocationHandler SkillCheckDirectLocationHandler
  8074. {
  8075. get
  8076. {
  8077. return m_SkillCheckDirectLocationHandler;
  8078. }
  8079. set
  8080. {
  8081. m_SkillCheckDirectLocationHandler = value;
  8082. }
  8083. }
  8084. public static Server.SkillCheckDirectTargetHandler SkillCheckDirectTargetHandler
  8085. {
  8086. get
  8087. {
  8088. return m_SkillCheckDirectTargetHandler;
  8089. }
  8090. set
  8091. {
  8092. m_SkillCheckDirectTargetHandler = value;
  8093. }
  8094. }
  8095. public static Server.SkillCheckLocationHandler SkillCheckLocationHandler
  8096. {
  8097. get
  8098. {
  8099. return m_SkillCheckLocationHandler;
  8100. }
  8101. set
  8102. {
  8103. m_SkillCheckLocationHandler = value;
  8104. }
  8105. }
  8106. public static Server.SkillCheckTargetHandler SkillCheckTargetHandler
  8107. {
  8108. get
  8109. {
  8110. return m_SkillCheckTargetHandler;
  8111. }
  8112. set
  8113. {
  8114. m_SkillCheckTargetHandler = value;
  8115. }
  8116. }
  8117. public ArrayList SkillMods
  8118. {
  8119. get
  8120. {
  8121. return this.m_SkillMods;
  8122. }
  8123. }
  8124. [CommandProperty(Server.AccessLevel.Counselor)]
  8125. public Server.Skills Skills
  8126. {
  8127. get
  8128. {
  8129. return this.m_Skills;
  8130. }
  8131. set
  8132. {
  8133. }
  8134. }
  8135. [CommandProperty(Server.AccessLevel.GameMaster)]
  8136. public int SkillsCap
  8137. {
  8138. get
  8139. {
  8140. if (this.m_Skills != null)
  8141. {
  8142. return this.m_Skills.Cap;
  8143. }
  8144. return 0;
  8145. }
  8146. set
  8147. {
  8148. if (this.m_Skills != null)
  8149. {
  8150. this.m_Skills.Cap = value;
  8151. }
  8152. }
  8153. }
  8154. [CommandProperty(Server.AccessLevel.GameMaster)]
  8155. public int SkillsTotal
  8156. {
  8157. get
  8158. {
  8159. if (this.m_Skills != null)
  8160. {
  8161. return this.m_Skills.Total;
  8162. }
  8163. return 0;
  8164. }
  8165. }
  8166. [CommandProperty(Server.AccessLevel.GameMaster)]
  8167. public int SolidHueOverride
  8168. {
  8169. get
  8170. {
  8171. return this.m_SolidHueOverride;
  8172. }
  8173. set
  8174. {
  8175. if (this.m_SolidHueOverride != value)
  8176. {
  8177. this.m_SolidHueOverride = value;
  8178. this.Delta(MobileDelta.Body | MobileDelta.Hue);
  8179. }
  8180. }
  8181. }
  8182. [CommandProperty(Server.AccessLevel.GameMaster)]
  8183. public int SpeechHue
  8184. {
  8185. get
  8186. {
  8187. return this.m_SpeechHue;
  8188. }
  8189. set
  8190. {
  8191. this.m_SpeechHue = value;
  8192. }
  8193. }
  8194. public ISpell Spell
  8195. {
  8196. get
  8197. {
  8198. return this.m_Spell;
  8199. }
  8200. set
  8201. {
  8202. if ((this.m_Spell != null) && (value != null))
  8203. {
  8204. Console.WriteLine("Warning: Spell has been overwritten");
  8205. }
  8206. this.m_Spell = value;
  8207. }
  8208. }
  8209. [CommandProperty(Server.AccessLevel.GameMaster)]
  8210. public bool Squelched
  8211. {
  8212. get
  8213. {
  8214. return this.m_Squelched;
  8215. }
  8216. set
  8217. {
  8218. this.m_Squelched = value;
  8219. }
  8220. }
  8221. public ArrayList Stabled
  8222. {
  8223. get
  8224. {
  8225. return this.m_Stabled;
  8226. }
  8227. set
  8228. {
  8229. this.m_Stabled = value;
  8230. }
  8231. }
  8232. [CommandProperty(Server.AccessLevel.GameMaster)]
  8233. public int Stam
  8234. {
  8235. get
  8236. {
  8237. return this.m_Stam;
  8238. }
  8239. set
  8240. {
  8241. if (value < 0)
  8242. {
  8243. value = 0;
  8244. }
  8245. else if (value >= this.StamMax)
  8246. {
  8247. value = this.StamMax;
  8248. if (this.m_StamTimer != null)
  8249. {
  8250. this.m_StamTimer.Stop();
  8251. }
  8252. }
  8253. if (value < this.StamMax)
  8254. {
  8255. if (this.m_StamTimer == null)
  8256. {
  8257. this.m_StamTimer = new StamTimer(this);
  8258. }
  8259. this.m_StamTimer.Start();
  8260. }
  8261. if (this.m_Stam != value)
  8262. {
  8263. this.m_Stam = value;
  8264. this.Delta(MobileDelta.Stam);
  8265. }
  8266. }
  8267. }
  8268. [CommandProperty(Server.AccessLevel.GameMaster)]
  8269. public virtual int StamMax
  8270. {
  8271. get
  8272. {
  8273. return this.Dex;
  8274. }
  8275. }
  8276. public static RegenRateHandler StamRegenRateHandler
  8277. {
  8278. get
  8279. {
  8280. return m_StamRegenRate;
  8281. }
  8282. set
  8283. {
  8284. m_StamRegenRate = value;
  8285. }
  8286. }
  8287. [CommandProperty(Server.AccessLevel.GameMaster)]
  8288. public int StatCap
  8289. {
  8290. get
  8291. {
  8292. return this.m_StatCap;
  8293. }
  8294. set
  8295. {
  8296. if (this.m_StatCap != value)
  8297. {
  8298. this.m_StatCap = value;
  8299. this.Delta(MobileDelta.StatCap);
  8300. }
  8301. }
  8302. }
  8303. public ArrayList StatMods
  8304. {
  8305. get
  8306. {
  8307. return this.m_StatMods;
  8308. }
  8309. }
  8310. [CommandProperty(Server.AccessLevel.GameMaster)]
  8311. public int Str
  8312. {
  8313. get
  8314. {
  8315. int num = this.m_Str + this.GetStatOffset(StatType.Str);
  8316. if (num < 1)
  8317. {
  8318. return 1;
  8319. }
  8320. if (num > 0xfde8)
  8321. {
  8322. num = 0xfde8;
  8323. }
  8324. return num;
  8325. }
  8326. set
  8327. {
  8328. if (this.m_StatMods.Count == 0)
  8329. {
  8330. this.RawStr = value;
  8331. }
  8332. }
  8333. }
  8334. [CommandProperty(Server.AccessLevel.Counselor, Server.AccessLevel.GameMaster)]
  8335. public StatLockType StrLock
  8336. {
  8337. get
  8338. {
  8339. return this.m_StrLock;
  8340. }
  8341. set
  8342. {
  8343. if (this.m_StrLock != value)
  8344. {
  8345. this.m_StrLock = value;
  8346. if (this.m_NetState != null)
  8347. {
  8348. this.m_NetState.Send(new StatLockInfo(this));
  8349. }
  8350. }
  8351. }
  8352. }
  8353. [CommandProperty(Server.AccessLevel.GameMaster)]
  8354. public bool StunReady
  8355. {
  8356. get
  8357. {
  8358. return this.m_StunReady;
  8359. }
  8360. set
  8361. {
  8362. this.m_StunReady = value;
  8363. }
  8364. }
  8365. public Server.Targeting.Target Target
  8366. {
  8367. get
  8368. {
  8369. return this.m_Target;
  8370. }
  8371. set
  8372. {
  8373. Server.Targeting.Target target = this.m_Target;
  8374. Server.Targeting.Target target2 = value;
  8375. if (target != target2)
  8376. {
  8377. this.m_Target = null;
  8378. if ((target != null) && (target2 != null))
  8379. {
  8380. target.Cancel(this, TargetCancelType.Overriden);
  8381. }
  8382. this.m_Target = target2;
  8383. if (((target2 != null) && (this.m_NetState != null)) && !this.m_TargetLocked)
  8384. {
  8385. this.m_NetState.Send(target2.GetPacket());
  8386. }
  8387. this.OnTargetChange();
  8388. }
  8389. }
  8390. }
  8391. public bool TargetLocked
  8392. {
  8393. get
  8394. {
  8395. return this.m_TargetLocked;
  8396. }
  8397. set
  8398. {
  8399. this.m_TargetLocked = value;
  8400. }
  8401. }
  8402. [CommandProperty(Server.AccessLevel.GameMaster)]
  8403. public int Thirst
  8404. {
  8405. get
  8406. {
  8407. return this.m_Thirst;
  8408. }
  8409. set
  8410. {
  8411. this.m_Thirst = value;
  8412. }
  8413. }
  8414. [CommandProperty(Server.AccessLevel.GameMaster)]
  8415. public int TithingPoints
  8416. {
  8417. get
  8418. {
  8419. return this.m_TithingPoints;
  8420. }
  8421. set
  8422. {
  8423. if (this.m_TithingPoints != value)
  8424. {
  8425. this.m_TithingPoints = value;
  8426. this.Delta(MobileDelta.TithingPoints);
  8427. }
  8428. }
  8429. }
  8430. [CommandProperty(Server.AccessLevel.GameMaster)]
  8431. public string Title
  8432. {
  8433. get
  8434. {
  8435. return this.m_Title;
  8436. }
  8437. set
  8438. {
  8439. this.m_Title = value;
  8440. this.InvalidateProperties();
  8441. }
  8442. }
  8443. [CommandProperty(Server.AccessLevel.GameMaster)]
  8444. public int TotalGold
  8445. {
  8446. get
  8447. {
  8448. return this.m_TotalGold;
  8449. }
  8450. set
  8451. {
  8452. if (this.m_TotalGold != value)
  8453. {
  8454. this.m_TotalGold = value;
  8455. this.Delta(MobileDelta.Gold);
  8456. }
  8457. }
  8458. }
  8459. public virtual int MaxWeight { get { return int.MaxValue; } }
  8460. [CommandProperty(Server.AccessLevel.GameMaster)]
  8461. public int TotalWeight
  8462. {
  8463. get
  8464. {
  8465. return this.m_TotalWeight;
  8466. }
  8467. set
  8468. {
  8469. int totalWeight = this.m_TotalWeight;
  8470. if (totalWeight != value)
  8471. {
  8472. this.m_TotalWeight = value;
  8473. this.Delta(MobileDelta.Weight);
  8474. this.OnWeightChange(totalWeight);
  8475. }
  8476. }
  8477. }
  8478. [CommandProperty(Server.AccessLevel.GameMaster)]
  8479. public int VirtualArmor
  8480. {
  8481. get
  8482. {
  8483. return this.m_VirtualArmor;
  8484. }
  8485. set
  8486. {
  8487. if (this.m_VirtualArmor != value)
  8488. {
  8489. this.m_VirtualArmor = value;
  8490. this.Delta(MobileDelta.Armor);
  8491. }
  8492. }
  8493. }
  8494. [CommandProperty(Server.AccessLevel.GameMaster)]
  8495. public int VirtualArmorMod
  8496. {
  8497. get
  8498. {
  8499. return this.m_VirtualArmorMod;
  8500. }
  8501. set
  8502. {
  8503. if (this.m_VirtualArmorMod != value)
  8504. {
  8505. this.m_VirtualArmorMod = value;
  8506. this.Delta(MobileDelta.Armor);
  8507. }
  8508. }
  8509. }
  8510. [CommandProperty(Server.AccessLevel.Counselor, Server.AccessLevel.GameMaster)]
  8511. public VirtueInfo Virtues
  8512. {
  8513. get
  8514. {
  8515. return this.m_Virtues;
  8516. }
  8517. set
  8518. {
  8519. }
  8520. }
  8521. public static Server.VisibleDamageType VisibleDamageType
  8522. {
  8523. get
  8524. {
  8525. return m_VisibleDamageType;
  8526. }
  8527. set
  8528. {
  8529. m_VisibleDamageType = value;
  8530. }
  8531. }
  8532. [CommandProperty(Server.AccessLevel.GameMaster)]
  8533. public bool Warmode
  8534. {
  8535. get
  8536. {
  8537. return this.m_Warmode;
  8538. }
  8539. set
  8540. {
  8541. if (this.m_Warmode != value)
  8542. {
  8543. if (this.m_AutoManifestTimer != null)
  8544. {
  8545. this.m_AutoManifestTimer.Stop();
  8546. this.m_AutoManifestTimer = null;
  8547. }
  8548. this.m_Warmode = value;
  8549. this.Delta(MobileDelta.Flags);
  8550. if (this.m_NetState != null)
  8551. {
  8552. this.Send(SetWarMode.Instantiate(value));
  8553. }
  8554. if (!this.m_Warmode)
  8555. {
  8556. this.Combatant = null;
  8557. }
  8558. if (!this.Alive)
  8559. {
  8560. if (value)
  8561. {
  8562. this.Delta(MobileDelta.GhostUpdate);
  8563. }
  8564. else
  8565. {
  8566. this.SendRemovePacket(false);
  8567. }
  8568. }
  8569. }
  8570. }
  8571. }
  8572. [CommandProperty(Server.AccessLevel.GameMaster)]
  8573. public virtual IWeapon Weapon
  8574. {
  8575. get
  8576. {
  8577. Item weapon = this.m_Weapon as Item;
  8578. if (((weapon != null) && !weapon.Deleted) && ((weapon.Parent == this) && this.CanSee(weapon)))
  8579. {
  8580. return this.m_Weapon;
  8581. }
  8582. this.m_Weapon = null;
  8583. weapon = this.FindItemOnLayer(Layer.FirstValid);
  8584. if (weapon == null)
  8585. {
  8586. weapon = this.FindItemOnLayer(Layer.TwoHanded);
  8587. }
  8588. if (weapon is IWeapon)
  8589. {
  8590. return (this.m_Weapon = (IWeapon) weapon);
  8591. }
  8592. return this.GetDefaultWeapon();
  8593. }
  8594. }
  8595. [CommandProperty(Server.AccessLevel.GameMaster)]
  8596. public int WhisperHue
  8597. {
  8598. get
  8599. {
  8600. return this.m_WhisperHue;
  8601. }
  8602. set
  8603. {
  8604. this.m_WhisperHue = value;
  8605. }
  8606. }
  8607. [CommandProperty(Server.AccessLevel.Counselor, Server.AccessLevel.GameMaster)]
  8608. public int X
  8609. {
  8610. get
  8611. {
  8612. return this.m_Location.m_X;
  8613. }
  8614. set
  8615. {
  8616. this.Location = new Point3D(value, this.m_Location.m_Y, this.m_Location.m_Z);
  8617. }
  8618. }
  8619. [CommandProperty(Server.AccessLevel.Counselor, Server.AccessLevel.GameMaster)]
  8620. public int Y
  8621. {
  8622. get
  8623. {
  8624. return this.m_Location.m_Y;
  8625. }
  8626. set
  8627. {
  8628. this.Location = new Point3D(this.m_Location.m_X, value, this.m_Location.m_Z);
  8629. }
  8630. }
  8631. [CommandProperty(Server.AccessLevel.GameMaster)]
  8632. public int YellHue
  8633. {
  8634. get
  8635. {
  8636. return this.m_YellHue;
  8637. }
  8638. set
  8639. {
  8640. this.m_YellHue = value;
  8641. }
  8642. }
  8643. [CommandProperty(Server.AccessLevel.GameMaster)]
  8644. public bool YellowHealthbar
  8645. {
  8646. get
  8647. {
  8648. return this.m_YellowHealthbar;
  8649. }
  8650. set
  8651. {
  8652. this.m_YellowHealthbar = value;
  8653. this.Delta(MobileDelta.Flags);
  8654. }
  8655. }
  8656. [CommandProperty(Server.AccessLevel.Counselor, Server.AccessLevel.GameMaster)]
  8657. public int Z
  8658. {
  8659. get
  8660. {
  8661. return this.m_Location.m_Z;
  8662. }
  8663. set
  8664. {
  8665. this.Location = new Point3D(this.m_Location.m_X, this.m_Location.m_Y, value);
  8666. }
  8667. }
  8668. private class AutoManifestTimer : Timer
  8669. {
  8670. private Mobile m_Mobile;
  8671. public AutoManifestTimer(Mobile m, TimeSpan delay) : base(delay)
  8672. {
  8673. this.m_Mobile = m;
  8674. }
  8675. protected override void OnTick()
  8676. {
  8677. if (!this.m_Mobile.Alive)
  8678. {
  8679. this.m_Mobile.Warmode = false;
  8680. }
  8681. }
  8682. }
  8683. private class CombatTimer : Timer
  8684. {
  8685. private Mobile m_Mobile;
  8686. public CombatTimer(Mobile m) : base(TimeSpan.FromSeconds(0.0), TimeSpan.FromSeconds(0.01), 0)
  8687. {
  8688. this.m_Mobile = m;
  8689. if (!this.m_Mobile.m_Player && (this.m_Mobile.m_Dex <= 100))
  8690. {
  8691. base.Priority = TimerPriority.FiftyMS;
  8692. }
  8693. }
  8694. protected override void OnTick()
  8695. {
  8696. if (DateTime.Now > this.m_Mobile.m_NextCombatTime)
  8697. {
  8698. Mobile combatant = this.m_Mobile.Combatant;
  8699. if ((((combatant == null) || combatant.m_Deleted) || (this.m_Mobile.m_Deleted || (combatant.m_Map != this.m_Mobile.m_Map))) || ((!combatant.Alive || !this.m_Mobile.Alive) || ((!this.m_Mobile.CanSee(combatant) || combatant.IsDeadBondedPet) || this.m_Mobile.IsDeadBondedPet)))
  8700. {
  8701. this.m_Mobile.Combatant = null;
  8702. base.Stop();
  8703. }
  8704. else
  8705. {
  8706. IWeapon weapon = this.m_Mobile.Weapon;
  8707. if (this.m_Mobile.InRange(combatant, weapon.MaxRange) && this.m_Mobile.InLOS(combatant))
  8708. {
  8709. this.m_Mobile.RevealingAction();
  8710. this.m_Mobile.m_NextCombatTime = DateTime.Now + weapon.OnSwing(this.m_Mobile, combatant);
  8711. }
  8712. }
  8713. }
  8714. }
  8715. }
  8716. private class ExpireAggressorsTimer : Timer
  8717. {
  8718. private Mobile m_Mobile;
  8719. public ExpireAggressorsTimer(Mobile m) : base(TimeSpan.FromSeconds(5.0), TimeSpan.FromSeconds(5.0))
  8720. {
  8721. this.m_Mobile = m;
  8722. base.Priority = TimerPriority.FiveSeconds;
  8723. }
  8724. protected override void OnTick()
  8725. {
  8726. if (this.m_Mobile.Deleted || ((this.m_Mobile.Aggressors.Count == 0) && (this.m_Mobile.Aggressed.Count == 0)))
  8727. {
  8728. this.m_Mobile.StopAggrExpire();
  8729. }
  8730. else
  8731. {
  8732. this.m_Mobile.CheckAggrExpire();
  8733. }
  8734. }
  8735. }
  8736. private class ExpireCombatantTimer : Timer
  8737. {
  8738. private Mobile m_Mobile;
  8739. public ExpireCombatantTimer(Mobile m) : base(TimeSpan.FromMinutes(1.0))
  8740. {
  8741. base.Priority = TimerPriority.FiveSeconds;
  8742. this.m_Mobile = m;
  8743. }
  8744. protected override void OnTick()
  8745. {
  8746. this.m_Mobile.Combatant = null;
  8747. }
  8748. }
  8749. private class ExpireCriminalTimer : Timer
  8750. {
  8751. private Mobile m_Mobile;
  8752. public ExpireCriminalTimer(Mobile m) : base(Mobile.m_ExpireCriminalDelay)
  8753. {
  8754. base.Priority = TimerPriority.FiveSeconds;
  8755. this.m_Mobile = m;
  8756. }
  8757. protected override void OnTick()
  8758. {
  8759. this.m_Mobile.Criminal = false;
  8760. }
  8761. }
  8762. private class FrozenTimer : Timer
  8763. {
  8764. private Mobile m_Mobile;
  8765. public FrozenTimer(Mobile m, TimeSpan duration) : base(duration)
  8766. {
  8767. base.Priority = TimerPriority.TwentyFiveMS;
  8768. this.m_Mobile = m;
  8769. }
  8770. protected override void OnTick()
  8771. {
  8772. this.m_Mobile.Frozen = false;
  8773. }
  8774. }
  8775. private class HitsTimer : Timer
  8776. {
  8777. private Mobile m_Owner;
  8778. public HitsTimer(Mobile m) : base(Mobile.GetHitsRegenRate(m), Mobile.GetHitsRegenRate(m))
  8779. {
  8780. base.Priority = TimerPriority.FiftyMS;
  8781. this.m_Owner = m;
  8782. }
  8783. protected override void OnTick()
  8784. {
  8785. if (this.m_Owner.CanRegenHits)
  8786. {
  8787. this.m_Owner.Hits++;
  8788. }
  8789. base.Delay = base.Interval = Mobile.GetHitsRegenRate(this.m_Owner);
  8790. }
  8791. }
  8792. private class LocationComparer : IComparer
  8793. {
  8794. private IPoint3D m_RelativeTo;
  8795. public LocationComparer(IPoint3D relativeTo)
  8796. {
  8797. this.m_RelativeTo = relativeTo;
  8798. }
  8799. public int Compare(object x, object y)
  8800. {
  8801. IPoint3D p = x as IPoint3D;
  8802. IPoint3D pointd2 = y as IPoint3D;
  8803. return (this.GetDistance(p) - this.GetDistance(pointd2));
  8804. }
  8805. private int GetDistance(IPoint3D p)
  8806. {
  8807. int num = this.m_RelativeTo.X - p.X;
  8808. int num2 = this.m_RelativeTo.Y - p.Y;
  8809. int num3 = this.m_RelativeTo.Z - p.Z;
  8810. num *= 11;
  8811. num2 *= 11;
  8812. return (((num * num) + (num2 * num2)) + (num3 * num3));
  8813. }
  8814. }
  8815. private class LogoutTimer : Timer
  8816. {
  8817. private Mobile m_Mobile;
  8818. public LogoutTimer(Mobile m) : base(TimeSpan.FromDays(1.0))
  8819. {
  8820. base.Priority = TimerPriority.OneSecond;
  8821. this.m_Mobile = m;
  8822. }
  8823. protected override void OnTick()
  8824. {
  8825. if (this.m_Mobile.m_Map != Map.Internal)
  8826. {
  8827. EventSink.InvokeLogout(new LogoutEventArgs(this.m_Mobile));
  8828. this.m_Mobile.m_LogoutLocation = this.m_Mobile.m_Location;
  8829. this.m_Mobile.m_LogoutMap = this.m_Mobile.m_Map;
  8830. this.m_Mobile.Internalize();
  8831. }
  8832. }
  8833. }
  8834. private class ManaTimer : Timer
  8835. {
  8836. private Mobile m_Owner;
  8837. public ManaTimer(Mobile m) : base(Mobile.GetManaRegenRate(m), Mobile.GetManaRegenRate(m))
  8838. {
  8839. base.Priority = TimerPriority.FiftyMS;
  8840. this.m_Owner = m;
  8841. }
  8842. protected override void OnTick()
  8843. {
  8844. if (this.m_Owner.CanRegenMana)
  8845. {
  8846. this.m_Owner.Mana++;
  8847. }
  8848. base.Delay = base.Interval = Mobile.GetManaRegenRate(this.m_Owner);
  8849. }
  8850. }
  8851. private class MovementRecord
  8852. {
  8853. public DateTime m_End;
  8854. private static Queue m_InstancePool = new Queue();
  8855. private MovementRecord(DateTime end)
  8856. {
  8857. this.m_End = end;
  8858. }
  8859. public bool Expired()
  8860. {
  8861. bool flag = DateTime.Now >= this.m_End;
  8862. if (flag)
  8863. {
  8864. m_InstancePool.Enqueue(this);
  8865. }
  8866. return flag;
  8867. }
  8868. public static Mobile.MovementRecord NewInstance(DateTime end)
  8869. {
  8870. if (m_InstancePool.Count > 0)
  8871. {
  8872. Mobile.MovementRecord record = (Mobile.MovementRecord) m_InstancePool.Dequeue();
  8873. record.m_End = end;
  8874. return record;
  8875. }
  8876. return new Mobile.MovementRecord(end);
  8877. }
  8878. }
  8879. private class ParalyzedTimer : Timer
  8880. {
  8881. private Mobile m_Mobile;
  8882. public ParalyzedTimer(Mobile m, TimeSpan duration) : base(duration)
  8883. {
  8884. base.Priority = TimerPriority.TwentyFiveMS;
  8885. this.m_Mobile = m;
  8886. }
  8887. protected override void OnTick()
  8888. {
  8889. this.m_Mobile.Paralyzed = false;
  8890. }
  8891. }
  8892. private class SimpleStateTarget : Target
  8893. {
  8894. private TargetStateCallback m_Callback;
  8895. private object m_State;
  8896. public SimpleStateTarget(int range, TargetFlags flags, bool allowGround, TargetStateCallback callback, object state) : base(range, allowGround, flags)
  8897. {
  8898. this.m_Callback = callback;
  8899. this.m_State = state;
  8900. }
  8901. protected override void OnTarget(Mobile from, object targeted)
  8902. {
  8903. if (this.m_Callback != null)
  8904. {
  8905. this.m_Callback(from, targeted, this.m_State);
  8906. }
  8907. }
  8908. }
  8909. private class SimpleTarget : Target
  8910. {
  8911. private TargetCallback m_Callback;
  8912. public SimpleTarget(int range, TargetFlags flags, bool allowGround, TargetCallback callback) : base(range, allowGround, flags)
  8913. {
  8914. this.m_Callback = callback;
  8915. }
  8916. protected override void OnTarget(Mobile from, object targeted)
  8917. {
  8918. if (this.m_Callback != null)
  8919. {
  8920. this.m_Callback(from, targeted);
  8921. }
  8922. }
  8923. }
  8924. private class StamTimer : Timer
  8925. {
  8926. private Mobile m_Owner;
  8927. public StamTimer(Mobile m) : base(Mobile.GetStamRegenRate(m), Mobile.GetStamRegenRate(m))
  8928. {
  8929. base.Priority = TimerPriority.FiftyMS;
  8930. this.m_Owner = m;
  8931. }
  8932. protected override void OnTick()
  8933. {
  8934. if (this.m_Owner.CanRegenStam)
  8935. {
  8936. this.m_Owner.Stam++;
  8937. }
  8938. base.Delay = base.Interval = Mobile.GetStamRegenRate(this.m_Owner);
  8939. }
  8940. }
  8941. private class WarmodeTimer : Timer
  8942. {
  8943. private Mobile m_Mobile;
  8944. private bool m_Value;
  8945. public WarmodeTimer(Mobile m, bool value) : base(Mobile.WarmodeSpamDelay)
  8946. {
  8947. this.m_Mobile = m;
  8948. this.m_Value = value;
  8949. }
  8950. protected override void OnTick()
  8951. {
  8952. this.m_Mobile.Warmode = this.m_Value;
  8953. this.m_Mobile.m_WarmodeChanges = 0;
  8954. this.m_Mobile.m_WarmodeTimer = null;
  8955. }
  8956. public bool Value
  8957. {
  8958. get
  8959. {
  8960. return this.m_Value;
  8961. }
  8962. set
  8963. {
  8964. this.m_Value = value;
  8965. }
  8966. }
  8967. }
  8968. }
  8969. }