Advertisement
sibble

Stealth UO Client C# API - ScriptAPI.cs

Mar 22nd, 2015
539
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 44.46 KB | None | 0 0
  1. /* Stealth UO Client C# API
  2.  * ScriptAPI.cs updated for ScriptDotNet2.dll 22.3.2015 */
  3.  
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Diagnostics;
  10. using System.Text.RegularExpressions;
  11.  
  12.  
  13. namespace ScriptAPI
  14. {
  15.     using ScriptDotNet2;
  16.     using ScriptDotNet2.Data;
  17.     using ScriptDotNet2.Model;
  18.  
  19.  
  20.     static class Constants
  21.     {
  22.         static public readonly string[] MapDirection = new string[] { "North", "NorthEast", "East", "SouthEast", "South", "SouthWest", "West", "NorthWest" };
  23.     }
  24.  
  25.     #region Client
  26.     public static class Client
  27.     {
  28.         public static void Print(string message)
  29.         {
  30.             Stealth.Default.ClientPrint(message);
  31.         }
  32.         public static void Print(uint Obj, ushort Color, ushort Font, string Text)
  33.         {
  34.             Stealth.Default.ClientPrintEx(Obj, Color, Font, Text);
  35.         }
  36.     }
  37.     #endregion
  38.  
  39.     #region Profile Methods
  40.     public static class Profile
  41.     {
  42.         public static bool IsConnected
  43.         {
  44.             private set { }
  45.             get
  46.             {
  47.                 return Stealth.Default.GetConnectedStatus();
  48.             }
  49.         }
  50.     }
  51.     #endregion
  52.  
  53.     #region Script Methods
  54.     public static class Script
  55.     {
  56.         public static void Wait(int WaitMS)
  57.         {
  58.             Stealth.Default.Wait(WaitMS);
  59.         }
  60.     }
  61.     #endregion
  62.  
  63.     #region Item Find/Search Methods
  64.     public static class Find
  65.     {
  66.         /// <summary>
  67.         /// Find an Item
  68.         /// </summary>
  69.         /// <param name="Type">Item Type</param>
  70.         /// <param name="Container">[Optional] ID of Container To Search [Default: 0x0 = Ground]</param>
  71.         /// <param name="Recursive">[Optional] Search Sub-Containers Recursively [Default: False]</param>
  72.         /// <param name="Color">[Optional] Color Category To Search[Default: 0xFFFF = All Colors]</param>
  73.         /// <returns>Returns Item if Found or NULL if Not Found</returns>
  74.         public static Item FindItem(ushort Type, uint Container = 0x00000000, bool Recursive = false, ushort Color = 0xFFFF)
  75.         {
  76.             uint finditem = Stealth.Default.FindTypeEx(Type, Color, Container, Recursive);
  77.             if (finditem > 0)
  78.                 return new Item(finditem);
  79.             else
  80.                 return null;
  81.         }
  82.  
  83.         /// <summary>
  84.         /// Find all items of a certain type
  85.         /// </summary>
  86.         /// <param name="Type">Item Type</param>
  87.         /// <param name="Container">[Optional] ID of Container To Search [Default: 0x0 = Ground]</param>
  88.         /// <param name="Recursive">[Optional] Search Sub-Containers Recursively [Default: False]</param>
  89.         /// <param name="Color">[Optional] Color Category To Search[Default: 0xFFFF = All Colors]</param>
  90.         /// <returns>List of Items Found</Item></returns>
  91.         public static List<Item> FindItems(ushort Type, uint Container = 0x00000000, bool Recursive = false, ushort Color = 0xFFFF)
  92.         {
  93.             List<Item> AllList = new List<Item>();
  94.             Stealth.Default.FindTypeEx(Type, Color, Container, Recursive);
  95.             if (Stealth.Default.GetFindCount() == 0)
  96.                 return AllList;
  97.                 List<uint> findlist = Stealth.Default.GetFindList();
  98.  
  99.             foreach (uint item in findlist)
  100.                 AllList.Add(new Item(item));
  101.  
  102.             return AllList;
  103.         }
  104.  
  105.         /// <summary>
  106.         /// Searches for items of Types[], in Containers[], and of Colors[]
  107.         /// </summary>
  108.         /// <param name="Types">Array of Item Types to search for</param>
  109.         /// <param name="Containers">Array of Containers to search in [new uint[] = {0x00000000};] for Ground</param>
  110.         /// <param name="Colors">Array of Colors to search for [new ushort[] = { 0xFFFF };] for all colors</param>
  111.         /// <param name="Recursive">[Optional] Search Sub-Containers Recursively [Default: False]</param>
  112.         /// <returns>List of Items Found</returns>
  113.         public static List<Item> FindItems(ushort[] Types, uint[] Containers, ushort[] Colors, bool Recursive = false)
  114.         {
  115.             Stealth.Default.FindTypesArrayEx(Types, Colors, Containers, Recursive);
  116.             List<uint> findlist = Stealth.Default.GetFindList();
  117.             List<Item> AllList = new List<Item>();
  118.             foreach (uint item in findlist)
  119.                 AllList.Add(new Item(item));
  120.             return AllList;
  121.         }
  122.  
  123.         /// <summary>
  124.         /// Set distance (from player) to scan for items
  125.         /// </summary>
  126.         public static uint FindDistance
  127.         {
  128.             get
  129.             {
  130.                 return Stealth.Default.GetFindDistance();
  131.             }
  132.             set
  133.             {
  134.                 Stealth.Default.SetFindDistance(value);
  135.             }
  136.         }
  137.  
  138.         /// <summary>
  139.         /// Set Vertical distance (from player) to scan for items
  140.         /// </summary>
  141.         public static uint FindVerticalDistance
  142.         {
  143.             get
  144.             {
  145.                 return Stealth.Default.GetFindVertical();
  146.             }
  147.             set
  148.             {
  149.                 Stealth.Default.SetFindVertical(value);
  150.             }
  151.         }
  152.     }
  153.     #endregion
  154.  
  155.     #region Target / Targeting Methods
  156.     public static class Target
  157.     {
  158.         public static Item RequestTileTarget(uint TimeoutMS = 0)
  159.         {
  160.             Stealth.Default.ClientRequestTileTarget();
  161.             Stopwatch timer = new Stopwatch();
  162.  
  163.  
  164.             timer.Start();
  165.             while (Stealth.Default.ClientTargetResponsePresent() == false)
  166.             {
  167.                 if (TimeoutMS != 0 && timer.ElapsedMilliseconds >= TimeoutMS)
  168.                     return default(Item);
  169.             }
  170.  
  171.             return new Item(Stealth.Default.ClientTargetResponse().ID);
  172.         }
  173.  
  174.         public static Item RequestTarget(uint TimeoutMS = 0)
  175.         {
  176.             Stealth.Default.ClientRequestObjectTarget();
  177.             Stopwatch timer = new Stopwatch();
  178.  
  179.  
  180.             timer.Start();
  181.             while (Stealth.Default.ClientTargetResponsePresent() == false)
  182.             {
  183.                 if (TimeoutMS != 0 && timer.ElapsedMilliseconds >= TimeoutMS)
  184.                     return default(Item);
  185.             }
  186.  
  187.             return new Item(Stealth.Default.ClientTargetResponse().ID);
  188.         }
  189.  
  190.         public static TargetInfo TargetSelection
  191.         {
  192.             private set {}
  193.             get
  194.             {
  195.                 return Stealth.Default.ClientTargetResponse();
  196.             }
  197.         }
  198.  
  199.         public static bool IsTargetSet
  200.         {
  201.             private set { }
  202.             get { return Stealth.Default.ClientTargetResponsePresent();  }
  203.         }
  204.  
  205.         public static void WaitForTarget(int TimeoutMS = 10000)
  206.         {
  207.             Stealth.Default.WaitForTarget(TimeoutMS);
  208.         }
  209.  
  210.         public static void TargetObject(Item obj)
  211.         {
  212.             Stealth.Default.TargetToObject(obj.ID);
  213.         }
  214.  
  215.         public static void TargetCoord(ushort X, ushort Y, sbyte Z)
  216.         {
  217.             Stealth.Default.TargetToXYZ(X, Y, Z);
  218.         }
  219.  
  220.         public static void MakeTargetPointer()
  221.         {
  222.             Stealth.Default.ClientRequestObjectTarget();
  223.         }
  224.     }
  225.     #endregion
  226.  
  227.     // These aren't very important to most people
  228.     #region BaseType
  229.     /// <summary>
  230.     /// Where it all starts.  Every thing has an Item Type.
  231.     /// </summary>
  232.     public class BaseType
  233.     {
  234.         private readonly ushort _type;
  235.         public ushort Type { private set { } get { return _type; } }
  236.  
  237.         protected BaseType(uint ID)
  238.         {
  239.             _type = Stealth.Default.GetType(ID);
  240.         }
  241.         public BaseType(ushort Type)
  242.         {
  243.             _type = Type;
  244.         }
  245.     }
  246.     #endregion
  247.     #region BaseThing
  248.     /// <summary>
  249.     /// Most basic class to describe any "thing" in UO
  250.     /// ID, Type, X, Y, Z
  251.     /// </summary>
  252.     public class BaseThing : BaseType, IEquatable<BaseThing>
  253.     {
  254.         protected uint _id;
  255.  
  256.         public BaseThing(uint ID)
  257.             : base(ID)
  258.         {
  259.             _id = ID;
  260.         }
  261.         public BaseThing(BaseThing thing)
  262.             : base(thing.ID)
  263.         {
  264.             _id = thing.ID;
  265.         }
  266.         public BaseThing(uint ID, ushort TYPE)
  267.             : base(TYPE)
  268.         {
  269.             _id = ID;
  270.         }
  271.  
  272.         /// <summary>
  273.         /// X Coordinate [Relative to container]
  274.         /// </summary>
  275.         public int X
  276.         {
  277.             private set { }
  278.             get
  279.             {
  280.                 return Stealth.Default.GetX(_id);
  281.             }
  282.         }
  283.         /// <summary>
  284.         /// Y Coordinate [Relative to container]
  285.         /// </summary>
  286.         public int Y
  287.         {
  288.             private set { }
  289.             get
  290.             {
  291.                 return Stealth.Default.GetY(_id);
  292.             }
  293.         }
  294.         /// <summary>
  295.         /// Z Coordinate [Relative to container]
  296.         /// </summary>
  297.         public sbyte Z
  298.         {
  299.             private set { }
  300.             get
  301.             {
  302.                 return Stealth.Default.GetZ(_id);
  303.             }
  304.         }
  305.  
  306.         /// <summary>
  307.         /// UO Unique Identifier Number
  308.         /// </summary>
  309.         public uint ID { private set { } get { return _id; } }
  310.  
  311.         public override int GetHashCode()
  312.         {
  313.             return this._id.GetHashCode();
  314.         }
  315.  
  316.         public override bool Equals(Object obj)
  317.         {
  318.             BaseThing other = obj as BaseThing;
  319.             if (other == null)
  320.                 return false;
  321.             return (this.ID.Equals(other.ID));
  322.         }
  323.  
  324.         public bool Equals(BaseThing other)
  325.         {
  326.             if (other == null)
  327.                 return false;
  328.             return (this._id.Equals(other.ID));
  329.         }
  330.  
  331.         public static bool operator ==(BaseThing a, BaseThing b)
  332.         {
  333.             if (object.ReferenceEquals(a, b)) return true;
  334.             if (object.ReferenceEquals(a, null)) return false;
  335.             if (object.ReferenceEquals(b, null)) return false;
  336.  
  337.             return a.Equals(b);
  338.         }
  339.         public static bool operator !=(BaseThing a, BaseThing b)
  340.         {
  341.             if (object.ReferenceEquals(a, b)) return !true;
  342.             if (object.ReferenceEquals(a, null)) return !false;
  343.             if (object.ReferenceEquals(b, null)) return !false;
  344.  
  345.             return !a.Equals(b);
  346.         }
  347.     }
  348.     #endregion
  349.  
  350.     // These are the important ones
  351.     #region Item
  352.     /// <summary>
  353.     /// Basic Item class (all in-game objects derive from this)
  354.     /// </summary>
  355.     public class Item : BaseThing
  356.     {
  357.         public Item Parent
  358.         {
  359.             private set { }
  360.             get
  361.             {
  362.                 return new Item(Stealth.Default.GetParent(ID));
  363.             }
  364.         }
  365.  
  366.         public void Click()
  367.         {
  368.             Stealth.Default.ClickOnObject(_id);
  369.         }
  370.  
  371.         public void Use()
  372.         {
  373.             Stealth.Default.UseObject(_id);
  374.         }
  375.  
  376.         /// <summary>
  377.         /// True/False if Item Exists
  378.         /// </summary>
  379.         public bool IsExists
  380.         {
  381.             private set { }
  382.             get
  383.             {
  384.                 return Stealth.Default.IsObjectExists(_id);
  385.             }
  386.         }
  387.         public bool IsNPC
  388.         {
  389.             private set { }
  390.  
  391.             get
  392.             {
  393.                 return Stealth.Default.IsNPC(_id);
  394.             }
  395.         }
  396.         public bool IsContainer
  397.         {
  398.             private set { }
  399.             get
  400.             {
  401.                 return Stealth.Default.IsContainer(_id);
  402.             }
  403.         }
  404.         public bool IsMovable
  405.         {
  406.             private set { }
  407.             get
  408.             {
  409.                 return Stealth.Default.IsMovable(_id);
  410.             }
  411.         }
  412.  
  413.  
  414.  
  415.         /// <summary>
  416.         /// Returns distance from player
  417.         /// [-1 if invalid / non-existant]
  418.         /// </summary>
  419.         public int Distance
  420.         {
  421.             private set { }
  422.             get
  423.             {
  424.                 return Stealth.Default.GetDistance(_id);
  425.             }
  426.         }
  427.  
  428.         /// <summary>
  429.         /// Tooltip describing properties of the item
  430.         /// [Value = NULL if unable to Scan]
  431.         /// </summary>
  432.         public string Tooltip
  433.         {
  434.             private set { }
  435.             get
  436.             {
  437.                 return Stealth.Default.GetTooltip(_id);
  438.             }
  439.         }
  440.         public string WaitForTooltip(int WaitMS)
  441.         {
  442.             return Stealth.Default.GetTooltip(ID, WaitMS);
  443.         }
  444.  
  445.         /// <summary>
  446.         /// UO Color Value
  447.         /// </summary>
  448.         public ushort Color
  449.         {
  450.             private set { }
  451.             get
  452.             {
  453.                 return Stealth.Default.GetColor(_id);
  454.             }
  455.         }
  456.  
  457.         /// <summary>
  458.         /// Quantity of this ID
  459.         /// </summary>
  460.         public int Quantity
  461.         {
  462.             private set { }
  463.             get
  464.             {
  465.                 return Stealth.Default.GetQuantity(_id);
  466.             }
  467.         }
  468.  
  469.         /// <summary>
  470.         /// UO Name Value
  471.         /// </summary>
  472.         public string Name
  473.         {
  474.             private set { }
  475.             get
  476.             {
  477.                 return Stealth.Default.GetName(_id);
  478.             }
  479.         }
  480.  
  481.         public Item(uint ID)
  482.             : base(ID)
  483.         {
  484.         }
  485.         public Item(BaseThing thing)
  486.             : base(thing.ID)
  487.         {
  488.         }
  489.     }
  490.     #endregion
  491.  
  492.     #region Container
  493.     public class Container : Item
  494.     {
  495.         public Container(uint ID)
  496.             : base(ID)
  497.         {
  498.         }
  499.         public Container(BaseThing thing)
  500.             : base(thing.ID)
  501.         {
  502.         }
  503.  
  504.  
  505.         public List<Item> Inventory(ushort FindType = 0xFFFF, bool Recursive = true)
  506.         {
  507.             return Find.FindItems(FindType, _id, Recursive);
  508.         }
  509.  
  510.         public bool Open()
  511.         {
  512.             base.Use();
  513.             Stealth.Default.Wait(250);
  514.             if (Stealth.Default.GetLastContainer() == _id)
  515.                 return true;
  516.  
  517.             return false;
  518.         }
  519.  
  520.         public void Close()
  521.         {
  522.             Stealth.Default.CloseClientUIWindow(UIWindowType.Container, _id);
  523.         }
  524.     }
  525.     #endregion
  526.  
  527.     #region Creature
  528.     /// <summary>
  529.     /// Creature Class
  530.     /// Base type for all living things
  531.     /// Properties Include MaxHP, HP (current), Notoriety
  532.     /// </summary>
  533.     public class Creature : Item
  534.     {
  535.         /// <summary>
  536.         /// Maximum HP of Creature
  537.         /// </summary>
  538.         public int MaxHP
  539.         {
  540.             private set { }
  541.             get
  542.             {
  543.                 return Stealth.Default.GetMaxHP(ID);
  544.             }
  545.         }
  546.  
  547.         /// <summary>
  548.         /// Current HP of Creature
  549.         /// </summary>
  550.         public int HP
  551.         {
  552.             private set { }
  553.             get
  554.             {
  555.                 return Stealth.Default.GetHP(ID);
  556.             }
  557.         }
  558.  
  559.         /// <summary>
  560.         /// Notoriety of Creature
  561.         /// 1: Innocent (Blue)
  562.         /// 2: Guild / Alliance (Green)
  563.         /// 3: Attackable But Not Criminal (Gray)
  564.         /// 4: Criminal (gray)
  565.         /// 5: Enemy (orange)
  566.         /// 6: Murderer (red)
  567.         /// </summary>
  568.         public byte Notoriety
  569.         {
  570.             private set { }
  571.             get
  572.             {
  573.                 return Stealth.Default.GetNotoriety(ID);
  574.             }
  575.         }
  576.  
  577.         public Creature(uint ID)
  578.             : base(ID)
  579.         {
  580.         }
  581.         public Creature(BaseThing thing)
  582.             : base(thing.ID)
  583.         {
  584.         }
  585.  
  586.     }
  587.     #endregion
  588.  
  589.     #region NPC
  590.     public class NPC : Creature
  591.     {
  592.         public uint RightHand
  593.         {
  594.             private set { }
  595.             get
  596.             {
  597.                 return Stealth.Default.ObjAtLayerEx(Stealth.GetRhandLayer(), ID);
  598.             }
  599.         }
  600.  
  601.         public uint LeftHand
  602.         {
  603.             private set { }
  604.             get
  605.             {
  606.                 return Stealth.Default.ObjAtLayerEx(Stealth.GetLhandLayer(), ID);
  607.             }
  608.         }
  609.  
  610.         public uint Shoes
  611.         {
  612.             private set { }
  613.             get
  614.             {
  615.                 return Stealth.Default.ObjAtLayerEx(Stealth.GetShoesLayer(), ID);
  616.             }
  617.         }
  618.  
  619.         public uint Pants
  620.         {
  621.             private set { }
  622.             get
  623.             {
  624.                 return Stealth.Default.ObjAtLayerEx(Stealth.GetPantsLayer(), ID);
  625.             }
  626.         }
  627.  
  628.         public uint Shirt
  629.         {
  630.             private set { }
  631.             get
  632.             {
  633.                 return Stealth.Default.ObjAtLayerEx(Stealth.GetShirtLayer(), ID);
  634.             }
  635.         }
  636.  
  637.         public uint Hat
  638.         {
  639.             private set { }
  640.             get
  641.             {
  642.                 return Stealth.Default.ObjAtLayerEx(Stealth.GetHatLayer(), ID);
  643.             }
  644.         }
  645.  
  646.         public uint Gloves
  647.         {
  648.             private set { }
  649.             get
  650.             {
  651.                 return Stealth.Default.ObjAtLayerEx(Stealth.GetGlovesLayer(), ID);
  652.             }
  653.         }
  654.  
  655.         public uint Ring
  656.         {
  657.             private set { }
  658.             get
  659.             {
  660.                 return Stealth.Default.ObjAtLayerEx(Stealth.GetRingLayer(), ID);
  661.             }
  662.         }
  663.  
  664.         public uint Talisman
  665.         {
  666.             private set { }
  667.             get
  668.             {
  669.                 return Stealth.Default.ObjAtLayerEx(Stealth.GetTalismanLayer(), ID);
  670.             }
  671.         }
  672.  
  673.         public uint Neck
  674.         {
  675.             private set { }
  676.             get
  677.             {
  678.                 return Stealth.Default.ObjAtLayerEx(Stealth.GetNeckLayer(), ID);
  679.             }
  680.         }
  681.  
  682.         public uint Hair
  683.         {
  684.             private set { }
  685.             get
  686.             {
  687.                 return Stealth.Default.ObjAtLayerEx(Stealth.GetHairLayer(), ID);
  688.             }
  689.         }
  690.  
  691.         public uint Waist
  692.         {
  693.             private set { }
  694.             get
  695.             {
  696.                 return Stealth.Default.ObjAtLayerEx(Stealth.GetWaistLayer(), ID);
  697.             }
  698.         }
  699.  
  700.         public uint Torso
  701.         {
  702.             private set { }
  703.             get
  704.             {
  705.                 return Stealth.Default.ObjAtLayerEx(Stealth.GetTorsoLayer(), ID);
  706.             }
  707.         }
  708.  
  709.         public uint Brace
  710.         {
  711.             private set { }
  712.             get
  713.             {
  714.                 return Stealth.Default.ObjAtLayerEx(Stealth.GetBraceLayer(), ID);
  715.             }
  716.         }
  717.  
  718.         public uint Beard
  719.         {
  720.             private set { }
  721.             get
  722.             {
  723.                 return Stealth.Default.ObjAtLayerEx(Stealth.GetBeardLayer(), ID);
  724.             }
  725.         }
  726.  
  727.         public uint TorsoH
  728.         {
  729.             private set { }
  730.             get
  731.             {
  732.                 return Stealth.Default.ObjAtLayerEx(Stealth.GetTorsoHLayer(), ID);
  733.             }
  734.         }
  735.  
  736.         public uint Ear
  737.         {
  738.             private set { }
  739.             get
  740.             {
  741.                 return Stealth.Default.ObjAtLayerEx(Stealth.GetEarLayer(), ID);
  742.             }
  743.         }
  744.  
  745.         public uint Arms
  746.         {
  747.             private set { }
  748.             get
  749.             {
  750.                 return Stealth.Default.ObjAtLayerEx(Stealth.GetArmsLayer(), ID);
  751.             }
  752.         }
  753.  
  754.         public uint Cloak
  755.         {
  756.             private set { }
  757.             get
  758.             {
  759.                 return Stealth.Default.ObjAtLayerEx(Stealth.GetCloakLayer(), ID);
  760.             }
  761.         }
  762.  
  763.         public Container Backpack
  764.         {
  765.             private set { }
  766.             get
  767.             {
  768.                 return new Container(Stealth.Default.ObjAtLayerEx(Stealth.GetBpackLayer(), ID));
  769.             }
  770.         }
  771.  
  772.         public uint Robe
  773.         {
  774.             private set { }
  775.             get
  776.             {
  777.                 return Stealth.Default.ObjAtLayerEx(Stealth.GetRobeLayer(), ID);
  778.             }
  779.         }
  780.  
  781.         public List<Item> Inventory
  782.         {
  783.             private set { }
  784.             get
  785.             {
  786.                 return this.Backpack.Inventory();
  787.             }
  788.         }
  789.  
  790.         public NPC(uint ID)
  791.             : base(ID)
  792.         {
  793.         }
  794.         public NPC(BaseThing thing)
  795.             : base(thing.ID)
  796.         {
  797.         }
  798.  
  799.     }
  800.     #endregion
  801.  
  802.     #region Self
  803.     public static class Self
  804.     {
  805.         private static ExtendedInfo extInfo;
  806.         public static uint ID { private set { } get { return Stealth.Default.GetSelfID(); } }
  807.  
  808.         public static int Mana { private set { } get { return Stealth.Default.GetSelfMana(); } }
  809.         public static int HP { private set { } get { return Stealth.Default.GetSelfLife(); } }
  810.         public static int Stamina { private set { } get { return Stealth.Default.GetSelfStam(); } }
  811.         public static int Weight { private set { } get { return Stealth.Default.GetSelfWeight(); } }
  812.  
  813.             public static int Life { private set { } get { return HP; } }
  814.             public static int Stam { private set { } get { return Stamina; } }
  815.  
  816.         public static int MaxMana { private set { } get { return Stealth.Default.GetSelfMaxMana(); } }
  817.         public static int MaxHP { private set { } get { return Stealth.Default.GetSelfMaxLife(); } }
  818.         public static int MaxStamina { private set { } get { return Stealth.Default.GetSelfMaxStam(); } }
  819.         public static int MaxWeight { private set { } get { return Stealth.Default.GetSelfMaxWeight(); } }
  820.        
  821.             public static int MaxLife { private set { } get { return MaxHP; } }
  822.             public static int MaxStam { private set { } get { return MaxStamina; } }
  823.  
  824.  
  825.         public static int X { private set { } get { return Stealth.Default.GetX(ID); } }
  826.         public static int Y { private set { } get { return Stealth.Default.GetY(ID); } }
  827.         public static sbyte Z { private set { } get { return Stealth.Default.GetZ(ID); } }
  828.  
  829.         public static string Direction
  830.         {
  831.             private set { }
  832.             get
  833.             {
  834.                 return Constants.MapDirection[Stealth.Default.GetDirection(ID)];
  835.             }
  836.         }
  837.         public static string Facing { private set { } get { return Direction; } }
  838.  
  839.         public static string DirectionTo(Item Obj)
  840.         {
  841.             return Constants.MapDirection[Stealth.Default.CalcDir(X, Y, Obj.X, Obj.Y)];
  842.         }
  843.  
  844.         public static string Name
  845.         {
  846.             private set { }
  847.             get
  848.             {
  849.                 return Stealth.Default.GetCharName();
  850.             }
  851.         }
  852.  
  853.         public static bool IsHidden
  854.         {
  855.             private set { }
  856.             get
  857.             {
  858.                 return Stealth.Default.GetHiddenStatus();
  859.             }
  860.         }
  861.  
  862.         public static Container Backpack
  863.         {
  864.             private set { }
  865.             get
  866.             {
  867.                 return new Container(Stealth.Default.GetBackpackID());
  868.             }
  869.         }
  870.  
  871.         public static byte World
  872.         {
  873.             private set { }
  874.             get
  875.             {
  876.                 return Stealth.Default.GetWorldNum();
  877.             }
  878.         }
  879.  
  880.         public static string Shard
  881.         {
  882.             private set { }
  883.             get
  884.             {
  885.                 return Stealth.Default.GetShardName();
  886.             }
  887.         }
  888.  
  889.         public static uint LastContainer
  890.         {
  891.             private set { }
  892.             get
  893.             {
  894.                 return Stealth.Default.GetLastContainer();
  895.             }
  896.         }
  897.  
  898.         public static void Cast(string SpellName, Item Object = null)
  899.         {
  900.             if (Object != null)
  901.                 Stealth.Default.CastSpellToObj(SpellName, Object.ID);
  902.             else
  903.                 Stealth.Default.CastSpell(SpellName);
  904.         }
  905.  
  906.         public static bool UseSkill(string Skill)
  907.         {
  908.             return Stealth.Default.UseSkill(Skill);
  909.         }
  910.  
  911.         public static void UsePrimary()
  912.         {
  913.             Stealth.Default.UsePrimaryAbility();
  914.         }
  915.         public static void UseSecondary()
  916.         {
  917.             Stealth.Default.UseSecondaryAbility();
  918.         }
  919.         public static string ActiveAbility
  920.         {
  921.             private set { }
  922.             get
  923.             {
  924.                 return Stealth.Default.GetAbility();
  925.             }
  926.         }
  927.  
  928.         public static bool WarMode
  929.         {
  930.             set
  931.             {
  932.                 Stealth.Default.SetWarMode(value);
  933.             }
  934.             get
  935.             {
  936.                 return Stealth.Default.GetWarModeStatus();
  937.             }
  938.         }
  939.  
  940.         public static Creature Target
  941.         {
  942.             set
  943.             {
  944.                 Stealth.Default.Attack(value.ID);
  945.             }
  946.             get
  947.             {
  948.                 uint ret = Stealth.Default.GetWarTarget();
  949.                 if (ret == 0)
  950.                     return null;
  951.                 return new Creature(Stealth.Default.GetWarTarget());
  952.             }
  953.         }
  954.  
  955.         static Self()
  956.         {
  957.             Properties.Refresh();
  958.         }
  959.  
  960.         public static class Properties
  961.         {
  962.             /// <summary>
  963.             /// Get updated properties
  964.             /// OSI Shards Only
  965.             /// </summary>
  966.             public static void Refresh()
  967.             {
  968.                 extInfo = Stealth.Default.GetExtInfo();
  969.             }
  970.  
  971.             /// <summary>
  972.             /// OSI Shards Only
  973.             /// </summary>
  974.             public static ushort DamageMin { get { return extInfo.DamageMin; } private set { } }
  975.             /// <summary>
  976.             /// OSI Shards Only
  977.             /// </summary>
  978.             public static ushort DamageMax { get { return extInfo.DamageMax; } private set { } }
  979.             /// <summary>
  980.             /// OSI Shards Only
  981.             /// </summary>
  982.             public static uint Tithing_Points { get { return extInfo.TithingPoints; } private set { } }
  983.             /// <summary>
  984.             /// OSI Shards Only
  985.             /// </summary>
  986.             public static ushort Hit_Chance_Incr { get { return extInfo.HitChanceIncr; } private set { } }
  987.             /// <summary>
  988.             /// OSI Shards Only
  989.             /// </summary>
  990.             public static ushort Swing_Speed_Incr { get { return extInfo.SwingSpeedIncr; } private set { } }
  991.             /// <summary>
  992.             /// OSI Shards Only
  993.             /// </summary>
  994.             public static ushort Damage_Chance_Incr { get { return extInfo.DamageChanceIncr; } private set { } }
  995.             /// <summary>
  996.             /// OSI Shards Only
  997.             /// </summary>
  998.             public static ushort Lower_Reagent_Cost { get { return extInfo.LowerReagentCost; } private set { } }
  999.             /// <summary>
  1000.             /// OSI Shards Only
  1001.             /// </summary>
  1002.             public static ushort HP_Regen { get { return extInfo.HPRegen; } private set { } }
  1003.             /// <summary>
  1004.             /// OSI Shards Only
  1005.             /// </summary>
  1006.             public static ushort Stam_Regen { get { return extInfo.StamRegen; } private set { } }
  1007.             /// <summary>
  1008.             /// OSI Shards Only
  1009.             /// </summary>
  1010.             public static ushort Mana_Regen { get { return extInfo.ManaRegen; } private set { } }
  1011.             /// <summary>
  1012.             /// OSI Shards Only
  1013.             /// </summary>
  1014.             public static ushort Reflect_Phys_Damage { get { return extInfo.ReflectPhysDamage; } private set { } }
  1015.             /// <summary>
  1016.             /// OSI Shards Only
  1017.             /// </summary>
  1018.             public static ushort Enhance_Potions { get { return extInfo.EnhancePotions; } private set { } }
  1019.             /// <summary>
  1020.             /// OSI Shards Only
  1021.             /// </summary>
  1022.             public static ushort Defense_Chance_Incr { get { return extInfo.DefenseChanceIncr; } private set { } }
  1023.             /// <summary>
  1024.             /// OSI Shards Only
  1025.             /// </summary>
  1026.             public static ushort Spell_Damage_Incr { get { return extInfo.SpellDamageIncr; } private set { } }
  1027.             /// <summary>
  1028.             /// OSI Shards Only
  1029.             /// </summary>
  1030.             public static ushort Faster_Cast_Recovery { get { return extInfo.FasterCastRecovery; } private set { } }
  1031.             /// <summary>
  1032.             /// OSI Shards Only
  1033.             /// </summary>
  1034.             public static ushort Faster_Casting { get { return extInfo.FasterCasting; } private set { } }
  1035.             /// <summary>
  1036.             /// OSI Shards Only
  1037.             /// </summary>
  1038.             public static ushort Lower_Mana_Cost { get { return extInfo.LowerManaCost; } private set { } }
  1039.             /// <summary>
  1040.             /// OSI Shards Only
  1041.             /// </summary>
  1042.             public static ushort Strength_Incr { get { return extInfo.StrengthIncr; } private set { } }
  1043.             /// <summary>
  1044.             /// OSI Shards Only
  1045.             /// </summary>
  1046.             public static ushort Dext_Incr { get { return extInfo.DextIncr; } private set { } }
  1047.             /// <summary>
  1048.             /// OSI Shards Only
  1049.             /// </summary>
  1050.             public static ushort Int_Incr { get { return extInfo.IntIncr; } private set { } }
  1051.             /// <summary>
  1052.             /// OSI Shards Only
  1053.             /// </summary>
  1054.             public static ushort HP_Incr { get { return extInfo.HPIncr; } private set { } }
  1055.             /// <summary>
  1056.             /// OSI Shards Only
  1057.             /// </summary>
  1058.             public static ushort Stam_Incr { get { return extInfo.StamIncr; } private set { } }
  1059.             /// <summary>
  1060.             /// OSI Shards Only
  1061.             /// </summary>
  1062.             public static ushort Mana_Incr { get { return extInfo.ManaIncr; } private set { } }
  1063.             /// <summary>
  1064.             /// OSI Shards Only
  1065.             /// </summary>
  1066.             public static ushort Max_HP_Incr { get { return extInfo.MaxHPIncr; } private set { } }
  1067.             /// <summary>
  1068.             /// OSI Shards Only
  1069.             /// </summary>
  1070.             public static ushort Max_Stam_Incr { get { return extInfo.MaxStamIncr; } private set { } }
  1071.             /// <summary>
  1072.             /// OSI Shards Only
  1073.             /// </summary>
  1074.             public static ushort Max_Mana_Increase { get { return extInfo.MaxManaIncrease; } private set { } }
  1075.  
  1076.             public static short Luck
  1077.             {
  1078.                 get
  1079.                 {
  1080.                     short luck = Convert.ToInt16(Stealth.Default.GetSelfLuck());
  1081.                     if (luck != 0)
  1082.                         return luck;
  1083.                     return extInfo.Luck;
  1084.                 }
  1085.                 private set { }
  1086.             }
  1087.  
  1088.             public static Byte Sex { private set { } get { return Stealth.Default.GetSelfSex(); } }
  1089.             public static String Title { private set { } get { return Stealth.Default.GetCharTitle(); } }
  1090.             public static uint Gold { private set { } get { return Stealth.Default.GetSelfGold(); } }
  1091.             public static ushort Weight { private set { } get { return Stealth.Default.GetSelfWeight(); } }
  1092.             public static ushort MaxWeight { private set { } get { return Stealth.Default.GetSelfMaxWeight(); } }
  1093.             public static Byte Race { private set { } get { return Stealth.Default.GetSelfRace(); } }
  1094.             public static Byte MaxPets { private set { } get { return Stealth.Default.GetSelfPetsMax(); } }
  1095.             public static Byte Pets { private set { } get { return Stealth.Default.GetSelfPetsCurrent(); } }
  1096.  
  1097.             public static ushort PhysicalResist { private set { } get { return Stealth.Default.GetSelfArmor(); } }
  1098.             public static ushort FireResist { private set { } get { return Stealth.Default.GetSelfFireResist(); } }
  1099.             public static ushort ColdResist { private set { } get { return Stealth.Default.GetSelfColdResist(); } }
  1100.             public static ushort PoisonResist { private set { } get { return Stealth.Default.GetSelfPoisonResist(); } }
  1101.             public static ushort EnergyResist { private set { } get { return Stealth.Default.GetSelfEnergyResist(); } }
  1102.         }
  1103.     }
  1104.     #endregion
  1105.  
  1106.     #region GumpClass
  1107.     public class GumpClass
  1108.     {
  1109.         private uint _gumpid, _gumptype;
  1110.         private int _gumpidx;
  1111.         private GumpInfo _gumpinfo;
  1112.  
  1113.         private GumpClass(uint Serial, uint GumpType)
  1114.         {
  1115.             _gumpid = Serial;
  1116.             _gumptype = GumpType;
  1117.             _gumpidx = GetIndexbySerial(Serial);
  1118.             _gumpinfo = Stealth.Default.GetGumpInfo(Convert.ToUInt16(_gumpidx));
  1119.         }
  1120.  
  1121.         public uint ID
  1122.         {
  1123.             private set { }
  1124.             get
  1125.             {
  1126.                 return _gumpid;
  1127.             }
  1128.         }
  1129.  
  1130.         public int Index
  1131.         {
  1132.             private set { }
  1133.             get
  1134.             {
  1135.                 return _gumpidx;
  1136.             }
  1137.         }
  1138.  
  1139.         public int Pages
  1140.         {
  1141.             private set { }
  1142.             get
  1143.             {
  1144.                 return _gumpinfo.Pages;
  1145.             }
  1146.         }
  1147.  
  1148.         public bool IsExists()
  1149.         {
  1150.             for (ushort i = 0; i < GumpCount; i++)
  1151.             {
  1152.                 if (Stealth.Default.GetGumpSerial(i) == _gumpid)
  1153.                     return true;
  1154.             }
  1155.             return false;
  1156.         }
  1157.  
  1158.         public List<string> Textlines()
  1159.         {
  1160.             return Stealth.Default.GetGumpTextLines((ushort)_gumpidx);
  1161.         }
  1162.  
  1163.  
  1164.         public List<ButtonTileArt> ButtonTileArts { get { return _gumpinfo.ButtonTileArts.ToList(); } private set { } }
  1165.         public List<CheckBox> CheckBoxes { get { return _gumpinfo.CheckBoxes.ToList(); } private set { } }
  1166.         public List<CheckerTrans> CheckerTrans { get { return _gumpinfo.CheckerTrans.ToList(); } private set { } }
  1167.         public List<CroppedText> CroppedText { get { return _gumpinfo.CroppedText.ToList(); } private set { } }
  1168.         public List<EndGroup> EndGroups { get { return _gumpinfo.EndGroups.ToList(); } private set { } }
  1169.         public List<Group> Groups { get { return _gumpinfo.Groups.ToList(); } private set { } }
  1170.         public List<GumpButton> GumpButtons { get { return _gumpinfo.GumpButtons.ToList(); } private set { } }
  1171.         public List<GumpPic> GumpPics { get { return _gumpinfo.GumpPics.ToList(); } private set { } }
  1172.         public List<GumpPicTiled> GumpPicTiled { get { return _gumpinfo.GumpPicTiled.ToList(); } private set { } }
  1173.         public List<GumpText> GumpText { get { return _gumpinfo.GumpText.ToList(); } private set { } }
  1174.         public List<HtmlGump> HtmlGump { get { return _gumpinfo.HtmlGump.ToList(); } private set { } }
  1175.         public List<ItemProperty> ItemProperties { get { return _gumpinfo.ItemProperties.ToList(); } private set { } }
  1176.         public List<RadioButton> RadioButtons { get { return _gumpinfo.RadioButtons.ToList(); } private set { } }
  1177.         public List<ResizePic> ResizePics { get { return _gumpinfo.ResizePics.ToList(); } private set { } }
  1178.         public List<TextEntry> TextEntries { get { return _gumpinfo.TextEntries.ToList(); } private set { } }
  1179.         public List<TextEntryLimited> TextEntriesLimited { get { return _gumpinfo.TextEntriesLimited.ToList(); } private set { } }
  1180.         public List<TilePicture> TilePicHues { get { return _gumpinfo.TilePicHue.ToList(); } private set { } }
  1181.         public List<TilePic> TilePics { get { return _gumpinfo.TilePics.ToList(); } private set { } }
  1182.         public List<Tooltip> Tooltips { get { return _gumpinfo.Tooltips.ToList(); } private set { } }
  1183.         public List<XmfHTMLGump> XmfHtmlGump { get { return _gumpinfo.XmfHtmlGump.ToList(); } private set { } }
  1184.         public List<XmfHTMLGumpColor> XmfHTMLGumpColor { get { return _gumpinfo.XmfHTMLGumpColor.ToList(); } private set { } }
  1185.         public List<XmfHTMLTok> XmfHTMLTok { get { return _gumpinfo.XmfHTMLTok.ToList(); } private set { } }
  1186.  
  1187.         #region Click Events
  1188.         public bool ClickButton(int ButtonID)
  1189.         {
  1190.             if (IsExists())
  1191.                 return Stealth.Default.NumGumpButton(Convert.ToUInt16(_gumpidx), ButtonID);
  1192.  
  1193.             return false;
  1194.         }
  1195.  
  1196.         public bool ToggleRadioButton(int RadioID, int Value)
  1197.         {
  1198.             if (IsExists())
  1199.                 return Stealth.Default.NumGumpRadiobutton(Convert.ToUInt16(_gumpidx), RadioID, Value);
  1200.  
  1201.             return false;
  1202.         }
  1203.  
  1204.         public bool ToggleCheckBoxButton(int CheckBoxID, int Value)
  1205.         {
  1206.             if (IsExists())
  1207.                 return Stealth.Default.NumGumpCheckBox(Convert.ToUInt16(_gumpidx), CheckBoxID, Value);
  1208.  
  1209.             return false;
  1210.         }
  1211.  
  1212.         public bool ChangeTextField(int TextFieldID, String Text)
  1213.         {
  1214.             if (IsExists())
  1215.                 return Stealth.Default.NumGumpTextEntry(Convert.ToUInt16(_gumpidx), TextFieldID, Text);
  1216.  
  1217.             return false;
  1218.         }
  1219.         #endregion
  1220.  
  1221.         #region Static Members
  1222.         public static GumpClass Create(ushort index)
  1223.         {
  1224.             uint Serial = Stealth.Default.GetGumpSerial(index);
  1225.             ushort Type = Convert.ToUInt16(Stealth.Default.GetGumpID(index));
  1226.  
  1227.             return new GumpClass(Serial, Type);
  1228.         }
  1229.  
  1230.         public static GumpClass LastGump()
  1231.         {
  1232.             uint index = GumpCount - 1;
  1233.  
  1234.             if (index >= 0)
  1235.             {
  1236.                 return GumpClass.Create((ushort)index);
  1237.             }
  1238.  
  1239.             return default(GumpClass);
  1240.         }
  1241.  
  1242.         public static uint GetGumpType(uint Serial)
  1243.         {
  1244.             int index = GetIndexbySerial(Serial);
  1245.             if (index > -1)
  1246.                 return Stealth.Default.GetGumpID(Convert.ToUInt16(index));
  1247.             return 0;
  1248.         }
  1249.  
  1250.         public static uint GetSerial(uint GumpType)
  1251.         {
  1252.             int index = GetIndexbyType(GumpType);
  1253.             if(index>-1)
  1254.                 return Stealth.Default.GetGumpSerial(Convert.ToUInt16(index));
  1255.             return 0;
  1256.         }
  1257.  
  1258.         public static int GetIndexbyType(uint GumpType)
  1259.         {
  1260.             for (ushort i = 0; i < GumpCount; i++)
  1261.             {
  1262.                 if (Stealth.Default.GetGumpID(i) == GumpType)
  1263.                     return i;
  1264.             }
  1265.             return -1;
  1266.         }
  1267.  
  1268.         public static int GetIndexbySerial(uint GumpSerial)
  1269.         {
  1270.             for (ushort i = 0; i < GumpCount; i++)
  1271.             {
  1272.                 if (Stealth.Default.GetGumpSerial(i) == GumpSerial)
  1273.                     return i;
  1274.             }
  1275.             return -1;
  1276.         }
  1277.  
  1278.         public static uint GumpCount
  1279.         {
  1280.             private set { }
  1281.             get
  1282.             {
  1283.                 return Stealth.Default.GetGumpsCount();
  1284.             }
  1285.         }
  1286.         #endregion
  1287.     }
  1288.     #endregion
  1289.  
  1290.     #region Context Menu
  1291.     public class ContextMenu
  1292.     {
  1293.         Creature _owner;
  1294.  
  1295.         public ContextMenu(uint Owner)
  1296.         {
  1297.             _owner = new Creature(Owner);
  1298.         }
  1299.  
  1300.         public bool Click(uint ClilocID)
  1301.         {
  1302.             if ((_owner.IsExists) && (_owner.Distance <= 3))
  1303.             {
  1304.                 Stealth.Default.ClearContextMenu();
  1305.                 Stealth.Default.RequestContextMenu(_owner.ID);
  1306.                 String Text = "";
  1307.                 if ((Text = Stealth.Default.GetContextMenu()).Trim() != "")
  1308.                 {
  1309.                     Text = Text.Replace("", "¶");
  1310.                     String[] E = Text.Split(new char[] { '¶' });
  1311.                     foreach (String a in E)
  1312.                     {
  1313.                         String[] b = a.Split(new char[] { '|' });
  1314.                         if (Convert.ToUInt32(b[1]) == ClilocID)
  1315.                         {
  1316.                             Stealth.Default.SetContextMenuHook(_owner.ID, Convert.ToByte(b));
  1317.                             Stealth.Default.RequestContextMenu(_owner.ID);
  1318.                             return true;
  1319.                         }
  1320.                     }
  1321.                 }
  1322.             }
  1323.             return false;
  1324.         }
  1325.     }
  1326.     #endregion
  1327.  
  1328.     #region BaseProperty
  1329.     public class BaseProperty
  1330.     {
  1331.         uint _ID;
  1332.         ClilocRec _clilocrec;
  1333.  
  1334.         public List<ClilocItemRec> Items { get { return _clilocrec.Items.ToList(); } }
  1335.  
  1336.         public BaseProperty(uint ID)
  1337.         {
  1338.             _ID = ID;
  1339.             Update();
  1340.         }
  1341.  
  1342.         private void Update()
  1343.         {
  1344.             _clilocrec = GetObject(_ID);
  1345.         }
  1346.  
  1347.         public List<string> GetParams(uint ClilocID)
  1348.         {
  1349.             Update();
  1350.             return GetParams(_clilocrec, ClilocID);
  1351.         }
  1352.  
  1353.         public String StringParameter(uint cliloc, int index)
  1354.         {
  1355.             Update();
  1356.             return StringParameter(_clilocrec,cliloc,index);
  1357.         }
  1358.  
  1359.         public int IntParameter(uint cliloc, int index)
  1360.         {
  1361.             Update();
  1362.             return IntParameter(_clilocrec, cliloc, index);
  1363.         }
  1364.  
  1365.         public Double FloatParameter(uint cliloc, int index)
  1366.         {
  1367.             Update();
  1368.             return FloatParameter(_clilocrec, cliloc, index);
  1369.         }
  1370.  
  1371.         public uint ClilocParameter(uint cliloc, int index)
  1372.         {
  1373.             Update();
  1374.             return ClilocParameter(_clilocrec, cliloc, index);
  1375.         }
  1376.  
  1377.         public bool ClilocExist(uint cliloc, bool checkparams = false)
  1378.         {
  1379.             Update();
  1380.             return ClilocExist(_clilocrec, cliloc, checkparams);
  1381.         }
  1382.  
  1383.         #region static Methods
  1384.  
  1385.         public static ClilocRec GetObject(uint ID)
  1386.         {
  1387.             return Stealth.Default.GetClilocRec(ID);
  1388.         }
  1389.  
  1390.         public static ClilocItemRec GetProperty(ClilocRec rec, uint cliloc)
  1391.         {
  1392.             foreach (ClilocItemRec item in rec.Items)
  1393.                 if (item.ClilocID == cliloc)
  1394.                     return item;
  1395.             return new ClilocItemRec();
  1396.         }
  1397.  
  1398.         public static List<string> GetParams(ClilocRec rec, uint ClilocID)
  1399.         {
  1400.             foreach (ClilocItemRec item in rec.Items)
  1401.                 if (item.ClilocID == ClilocID)
  1402.                     return item.Params;
  1403.             return new List<string>();
  1404.         }
  1405.  
  1406.         public static String StringParameter(ClilocRec rec, uint cliloc, int index)
  1407.         {
  1408.             try
  1409.             {
  1410.                 return GetParams(rec, cliloc)[index];
  1411.             }
  1412.             catch
  1413.             {
  1414.  
  1415.             }
  1416.             return "";
  1417.         }
  1418.  
  1419.         public static int IntParameter(ClilocRec rec, uint cliloc, int index)
  1420.         {
  1421.             try
  1422.             {
  1423.                 return Convert.ToInt32((Regex.Replace(StringParameter(rec, cliloc, index), @"[^0-9]", "").Trim()));
  1424.             }
  1425.             catch
  1426.             {
  1427.  
  1428.             }
  1429.             return 0;
  1430.         }
  1431.  
  1432.         public static Double FloatParameter(ClilocRec rec, uint cliloc, int index)
  1433.         {
  1434.             try
  1435.             {
  1436.                 return Convert.ToDouble((Regex.Replace(StringParameter(rec, cliloc, index), @"^\d+([\.\,]?\d+)?$", "").Trim()));
  1437.             }
  1438.             catch
  1439.             {
  1440.  
  1441.             }
  1442.             return 0.0;
  1443.         }
  1444.  
  1445.         public static uint ClilocParameter(ClilocRec rec, uint cliloc, int index)
  1446.         {
  1447.             try
  1448.             {
  1449.                 return Convert.ToUInt32((Regex.Replace(StringParameter(rec, cliloc, index), @"[^0-9]", "").Trim()));
  1450.             }
  1451.             catch
  1452.             {
  1453.  
  1454.             }
  1455.             return 0;
  1456.         }
  1457.  
  1458.         public static bool ClilocExist(ClilocRec rec, uint cliloc,bool checkparams = false)
  1459.         {
  1460.             foreach (ClilocItemRec item in rec.Items)
  1461.             {
  1462.                 if (item.ClilocID == cliloc)
  1463.                     return true;
  1464.                 if (checkparams)
  1465.                 {
  1466.                     foreach (String P in item.Params)
  1467.                     {
  1468.                         uint cli = 0;
  1469.                         try
  1470.                         {
  1471.                             cli = Convert.ToUInt32((Regex.Replace(P, @"[^0-9]", "").Trim()));
  1472.                         }
  1473.                         catch
  1474.                         {
  1475.                             cli = 0;
  1476.                         }
  1477.                         if (cli == cliloc)
  1478.                             return true;
  1479.                     }
  1480.                 }
  1481.             }
  1482.             return false;
  1483.         }
  1484.  
  1485.         #endregion  
  1486.     }
  1487.     #endregion
  1488. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement