Ejemplo n.º 1
0
        public Unit(int index)
        {
            _Index = (ushort)index;

            _name          = string.Empty;
            _textID        = string.Empty;
            _unitType      = 0;
            _minimapRadius = -1;

            _DataLock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
            _DataLock.EnterWriteLock();

            _memoryLocation = 0;

            _Data = new byte[1];
            Update();

            _modelPtr = (uint)GameData.offsets.ReadStructMember(ORNames.Unit, ORNames.unit_model, _Data);
            _ID       = (uint)((ushort)GameData.offsets.ReadStructMember(ORNames.Unit, ORNames.times_used, _Data) + ((ushort)GameData.offsets.ReadStructMember(ORNames.Unit, ORNames.token, _Data) << 16));
            _DataLock.ExitWriteLock();
        }
Ejemplo n.º 2
0
        public WeaponData(MapData map, string id)
        {
            ID = id;
            DisplayEffectID = null;
            EffectID        = null;
            Range           = 5;
            Period          = 0.8332;
            Required        = (TargetFilter)0;
            Excluded        = (TargetFilter)0;

            if (map.ProcessedDataFiles.ContainsKey("WeaponData"))
            {
                foreach (DataFile dataFile in map.ProcessedDataFiles["WeaponData"])
                {
                    foreach (XElement element in dataFile.Data)
                    {
                        if (element.HasAttributes && element.Attribute("id") != null && element.Attribute("id").Value == id)                         //found
                        {
                            if (element.Element("Range") != null)
                            {
                                Range = float.Parse(element.Element("Range").Attribute("value").Value);
                            }
                            if (element.Element("DisplayEffect") != null)
                            {
                                EffectID = element.Element("DisplayEffect").Attribute("value").Value;
                            }
                            if (element.Element("Effect") != null)
                            {
                                EffectID = element.Element("Effect").Attribute("value").Value;
                            }
                            if (element.Element("TargetFilters") != null)
                            {
                                string[] tf  = element.Element("TargetFilters").Attribute("value").Value.Split(';');
                                string[] req = tf[0].Split(',');
                                foreach (string s in req)
                                {
                                    TargetFilter temp;
                                    if (Enum.TryParse <TargetFilter>(s, out temp))
                                    {
                                        Required |= temp;
                                    }
                                }
                                if (tf.Length > 1)
                                {
                                    string[] ex = tf[1].Split(',');
                                    foreach (string s in ex)
                                    {
                                        TargetFilter temp;
                                        if (Enum.TryParse <TargetFilter>(s, out temp))
                                        {
                                            Excluded |= temp;
                                        }
                                    }
                                }
                            }
                            break;
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
 public fixed32(fixed32 it)
 {
     _rawData = it._rawData;
 }