public GameMessagePublicUpdatePropertyInt64(SequenceManager sequences, PropertyInt64 property, uint value)
     : base(GameMessageOpcode.PublicUpdatePropertyInt64, GameMessageGroup.UIQueue)
 {
     Writer.Write(sequences.GetNextSequence(SequenceType.PublicUpdatePropertyInt64));
     Writer.Write((uint)property);
     Writer.Write(value);
 }
Пример #2
0
 public static void SetProperty(this Biota biota, PropertyInt64 property, long value, ReaderWriterLockSlim rwLock)
 {
     rwLock.EnterUpgradeableReadLock();
     try
     {
         var result = biota.BiotaPropertiesInt64.FirstOrDefault(x => x.Type == (uint)property);
         if (result != null)
         {
             result.Value = value;
         }
         else
         {
             rwLock.EnterWriteLock();
             try
             {
                 var entity = new BiotaPropertiesInt64 {
                     ObjectId = biota.Id, Type = (ushort)property, Value = value, Object = biota
                 };
                 biota.BiotaPropertiesInt64.Add(entity);
             }
             finally
             {
                 rwLock.ExitWriteLock();
             }
         }
     }
     finally
     {
         rwLock.ExitUpgradeableReadLock();
     }
 }
Пример #3
0
 public void RemoveProperty(PropertyInt64 property)
 {
     if (Biota.TryRemoveProperty(property, BiotaDatabaseLock, biotaPropertyInt64s))
     {
         ChangesDetected = true;
     }
 }
 public GameMessagePrivateUpdatePropertyInt64(Session session, PropertyInt64 property, long value)
     : base(GameMessageOpcode.PrivateUpdatePropertyInt64, GameMessageGroup.UIQueue)
 {
     Writer.Write(session.Player.Sequences.GetNextSequence(Sequence.SequenceType.PrivateUpdatePropertyInt64));
     Writer.Write((uint)property);
     Writer.Write(value);
 }
Пример #5
0
        public SetInt64Stat(PropertyInt64 stat, long?amount = null)

            : base(EmoteType.SetInt64Stat)
        {
            Stat     = (int)stat;
            Amount64 = amount;
        }
Пример #6
0
 public static bool TryRemoveProperty(this Biota biota, PropertyInt64 property, out BiotaPropertiesInt64 entity, ReaderWriterLockSlim rwLock)
 {
     rwLock.EnterUpgradeableReadLock();
     try
     {
         entity = biota.BiotaPropertiesInt64.FirstOrDefault(x => x.Type == (uint)property);
         if (entity != null)
         {
             rwLock.EnterWriteLock();
             try
             {
                 biota.BiotaPropertiesInt64.Remove(entity);
                 entity.Object = null;
                 return(true);
             }
             finally
             {
                 rwLock.ExitWriteLock();
             }
         }
         return(false);
     }
     finally
     {
         rwLock.ExitUpgradeableReadLock();
     }
 }
 public GameMessagePrivateUpdatePropertyInt64(WorldObject worldObject, PropertyInt64 property, long value)
     : base(GameMessageOpcode.PrivateUpdatePropertyInt64, GameMessageGroup.UIQueue)
 {
     Writer.Write(worldObject.Sequences.GetNextSequence(Sequence.SequenceType.UpdatePropertyInt64, property));
     Writer.Write((uint)property);
     Writer.Write(value);
 }
Пример #8
0
 public GameMessagePrivateUpdatePropertyInt64(Session session, PropertyInt64 property, ulong value)
     : base(GameMessageOpcode.PrivateUpdatePropertyInt64, GameMessageGroup.Group09)
 {
     Writer.Write(session.UpdatePropertyInt64Sequence++);
     Writer.Write((uint)property);
     Writer.Write(value);
 }
Пример #9
0
 public void SetProperty(PropertyInt64 property, long value)
 {
     Biota.SetProperty(property, value, BiotaDatabaseLock, biotaPropertyInt64s, out var biotaChanged);
     if (biotaChanged)
     {
         ChangesDetected = true;
     }
 }
Пример #10
0
        public static void RemoveProperty(this Biota biota, PropertyInt64 property)
        {
            var result = biota.BiotaPropertiesInt64.FirstOrDefault(x => x.Type == (uint)property);

            if (result != null)
            {
                biota.BiotaPropertiesInt64.Remove(result);
                DatabaseManager.Shard.RemoveEntity(result, null);
            }
        }
Пример #11
0
        public InqInt64Stat(PropertyInt64 stat, int min, int max)

            : base(EmoteType.InqInt64Stat)
        {
            Init();

            Stat = (int)stat;
            Min  = min;
            Max  = max;
        }
Пример #12
0
 public static bool TryRemoveProperty(this Biota biota, PropertyInt64 property, out BiotaPropertiesInt64 entity)
 {
     entity = biota.BiotaPropertiesInt64.FirstOrDefault(x => x.Type == (uint)property);
     if (entity != null)
     {
         biota.BiotaPropertiesInt64.Remove(entity);
         entity.Object = null;
         return(true);
     }
     return(false);
 }
Пример #13
0
 public static long?GetProperty(this Biota biota, PropertyInt64 property, ReaderWriterLockSlim rwLock)
 {
     rwLock.EnterReadLock();
     try
     {
         return(biota.BiotaPropertiesInt64.FirstOrDefault(x => x.Type == (uint)property)?.Value);
     }
     finally
     {
         rwLock.ExitReadLock();
     }
 }
Пример #14
0
        public static void SetProperty(this Biota biota, PropertyInt64 property, long value)
        {
            var result = biota.BiotaPropertiesInt64.FirstOrDefault(x => x.Type == (uint)property);

            if (result != null)
                result.Value = value;
            else
            {
                var entity = new BiotaPropertiesInt64 { ObjectId = biota.Id, Type = (ushort)property, Value = value, Object = biota };

                biota.BiotaPropertiesInt64.Add(entity);
            }
        }
        public static long?GetProperty(this Weenie weenie, PropertyInt64 property)
        {
            if (weenie.PropertiesInt64 == null)
            {
                return(null);
            }

            if (weenie.PropertiesInt64.TryGetValue(property, out var value))
            {
                return(value);
            }

            return(null);
        }
Пример #16
0
        public static void SetProperty(this Biota biota, PropertyInt64 property, long value)
        {
            var result = biota.BiotaPropertiesInt64.FirstOrDefault(x => x.Type == (uint)property);

            if (result != null)
            {
                result.Value = value;
            }
            else
            {
                biota.BiotaPropertiesInt64.Add(new BiotaPropertiesInt64 {
                    Type = (ushort)property, Value = value
                });
            }
        }
Пример #17
0
 public long?GetProperty(PropertyInt64 property)
 {
     BiotaDatabaseLock.EnterReadLock();
     try
     {
         if (biotaPropertyInt64s.TryGetValue(property, out var record))
         {
             return(record.Value);
         }
         return(null);
     }
     finally
     {
         BiotaDatabaseLock.ExitReadLock();
     }
 }
Пример #18
0
        public static void SetProperty(this Biota biota, PropertyInt64 property, long value, ReaderWriterLockSlim rwLock)
        {
            rwLock.EnterWriteLock();
            try
            {
                if (biota.PropertiesInt64 == null)
                {
                    biota.PropertiesInt64 = new Dictionary <PropertyInt64, long>();
                }

                biota.PropertiesInt64[property] = value;
            }
            finally
            {
                rwLock.ExitWriteLock();
            }
        }
        public static bool TryRemoveProperty(this Biota biota, PropertyInt64 property, ReaderWriterLockSlim rwLock)
        {
            if (biota.PropertiesInt64 == null)
            {
                return(false);
            }

            rwLock.EnterWriteLock();
            try
            {
                return(biota.PropertiesInt64.Remove(property));
            }
            finally
            {
                rwLock.ExitWriteLock();
            }
        }
        public static void SetProperty(this Biota biota, PropertyInt64 property, long value, ReaderWriterLockSlim rwLock, out bool changed)
        {
            rwLock.EnterWriteLock();
            try
            {
                if (biota.PropertiesInt64 == null)
                {
                    biota.PropertiesInt64 = new Dictionary <PropertyInt64, long>();
                }

                changed = (!biota.PropertiesInt64.TryGetValue(property, out var existing) || value != existing);

                if (changed)
                {
                    biota.PropertiesInt64[property] = value;
                }
            }
            finally
            {
                rwLock.ExitWriteLock();
            }
        }
        public static long?GetProperty(this Biota biota, PropertyInt64 property, ReaderWriterLockSlim rwLock)
        {
            if (biota.PropertiesInt64 == null)
            {
                return(null);
            }

            rwLock.EnterReadLock();
            try
            {
                if (biota.PropertiesInt64.TryGetValue(property, out var value))
                {
                    return(value);
                }

                return(null);
            }
            finally
            {
                rwLock.ExitReadLock();
            }
        }
Пример #22
0
 public byte[] GetNextSequence(SequenceType type, PropertyInt64 property)
 {
     return(GetSequence(type, (uint)property).NextBytes);
 }
Пример #23
0
 public static long? GetProperty(this Biota biota, PropertyInt64 property)
 {
     return biota.BiotaPropertiesInt64.FirstOrDefault(x => x.Type == (uint)property)?.Value;
 }
Пример #24
0
        public static string GetDescription(this PropertyInt64 prop)
        {
            var description = prop.GetAttributeOfType <DescriptionAttribute>();

            return(description?.Description ?? prop.ToString());
        }
Пример #25
0
        public void loadProperties(ArkArchive archive, GameObject next, long propertiesBlockOffset, int?nextGameObjectPropertiesOffset = null)
        {
            var offset     = propertiesBlockOffset + _propertiesOffset;
            var nextOffset = nextGameObjectPropertiesOffset != null ? propertiesBlockOffset + nextGameObjectPropertiesOffset.Value : (next != null) ? propertiesBlockOffset + next._propertiesOffset : archive.Size - 1;

            archive.Position = offset;


            properties.Clear();
            try
            {
                var property = PropertyRegistry.readProperty(archive, null);

                while (property != null)
                {
                    if (property != ExcludedProperty.Instance)
                    {
                        properties.Add(_arkNameCache.Create(property.Name.Token, property.Index), property);
                    }


                    property = PropertyRegistry.readProperty(archive, archive.ExclusivePropertyNameTree);
                }
            }
            catch (UnreadablePropertyException)
            {
                // Stop reading and ignore possible extra data for now, needs a new field in ExtraDataHandler
                return;
            }
            finally
            {
                //these are in order of most common to least common to keep lookups at a minimum
                if (Properties.ContainsKey(_ownerName) || Properties.ContainsKey(_bHasResetDecayTime) || ClassName.Name == "CherufeNest_C")
                {
                    if (ClassName.Token.StartsWith("DeathItemCache_"))
                    {
                        _isFlags |= GameObjectIs.IsDeathItemCache;
                        goto SkipRest;
                    }

                    _isFlags |= GameObjectIs.IsStructure;
                    goto SkipRest;
                }

                if (Properties.ContainsKey(_dinoId1))
                {
                    _isFlags |= GameObjectIs.IsCreature;
                }
                int tamingTeamID    = 0;
                int targetingTeamId = 0;

                if (IsCreature)
                {
                    if (Properties.ContainsKey(_tamingTeamID))
                    {
                        PropertyInt32 tamingTeam = (PropertyInt32)Properties[_tamingTeamID];
                        tamingTeamID = tamingTeam.Value.GetValueOrDefault(0);
                    }

                    if (Properties.ContainsKey(_targetTeamID))
                    {
                        PropertyInt32 targetingTeam = (PropertyInt32)Properties[_targetTeamID];
                        targetingTeamId = targetingTeam.Value.GetValueOrDefault(0);
                    }


                    if (targetingTeamId > 1000000000)
                    {
                        if ((tamingTeamID > 0 && tamingTeamID < 1000000000) & !Properties.ContainsKey(_imprinterName))
                        {
                        }
                        else
                        {
                            _isFlags |= GameObjectIs.IsTamedCreature;
                        }
                    }
                }

                if (IsCreature && !IsTamedCreature)
                {
                    _isFlags |= GameObjectIs.IsWildCreature;
                }
                if (IsTamedCreature && (ClassName.Equals(_raft_bp_c) || ClassName.Equals(_motorraft_bp_c)))
                {
                    _isFlags |= GameObjectIs.IsRaftCreature;
                }

                if (Properties.ContainsKey(_currentStatusValues))
                {
                    _isFlags |= GameObjectIs.IsStatusComponent;
                }
                if (IsStatusComponent && ClassName.Token.StartsWith("DinoCharacterStatusComponent_"))
                {
                    _isFlags |= GameObjectIs.IsDinoStatusComponent;
                }
                if (IsStatusComponent && !IsDinoStatusComponent && ClassName.Token.StartsWith("PlayerCharacterStatusComponent_"))
                {
                    _isFlags |= GameObjectIs.IsPlayerCharacterStatusComponent;
                }


                if (ClassName.Token.StartsWith("DroppedItemGeneric_") & !ClassName.Name.Contains("NoPhysics"))
                {
                    if (Properties.ContainsKey(_droppedByPlayerId))
                    {
                        PropertyInt64 selectedPlayerId = (PropertyInt64)Properties[_droppedByPlayerId];

                        if (selectedPlayerId.Value != 0)
                        {
                            _isFlags |= GameObjectIs.IsDroppedItem;
                        }
                    }
                }

                if (IsItem)
                {
                    goto SkipRest;
                }

                if (IsCreature)
                {
                    goto SkipRest;
                }

                if (IsStatusComponent)
                {
                    goto SkipRest;
                }

                if (Properties.ContainsKey(_bInitializedMe))
                {
                    _isFlags |= GameObjectIs.IsInventory;
                }
                if (IsInventory && ClassName.Token.StartsWith("PrimalInventoryBP_"))
                {
                    _isFlags |= GameObjectIs.IsStructureInventory;
                }
                if (IsInventory && !IsStructureInventory && ClassName.Token.StartsWith("DinoTamedInventoryComponent_"))
                {
                    _isFlags |= GameObjectIs.IsTamedCreatureInventory;
                }
                if (IsInventory && !(IsStructureInventory || IsTamedCreatureInventory) && ClassName.Token.StartsWith("PrimalInventoryComponent"))
                {
                    _isFlags |= GameObjectIs.IsPlayerCharacterInventory;
                }
                if (IsInventory && !(IsStructureInventory || IsTamedCreatureInventory || IsPlayerCharacterInventory) && ClassName.Token.StartsWith("DinoWildInventoryComponent_"))
                {
                    _isFlags |= GameObjectIs.IsWildCreatureInventory;
                }

                if (IsInventory)
                {
                    goto SkipRest;
                }

                if (ClassName.Equals(_structurePaintingComponent))
                {
                    _isFlags |= GameObjectIs.IsStructurePaintingComponent;

                    goto SkipRest;
                }

                if (ClassName.Equals(_droppedItem))
                {
                    _isFlags |= GameObjectIs.IsDroppedItem;

                    goto SkipRest;
                }

                if (ClassName.Equals(_male) || ClassName.Equals(_female))
                {
                    _isFlags |= GameObjectIs.IsPlayerCharacter;

                    goto SkipRest;
                }

                _isFlags |= GameObjectIs.IsSomethingElse;


                //IsStructure = (Properties.ContainsKey(_ownerName) || Properties.ContainsKey(_bHasResetDecayTime));
                //if (IsStructure) goto SkipRest;

                //IsCreature = Properties.ContainsKey(_dinoId1);
                //IsTamedCreature = IsCreature && (Properties.ContainsKey(_tamerString) || Properties.ContainsKey(_tamingTeamID));
                //IsWildCreature = IsCreature && !IsTamedCreature;
                //IsRaftCreature = IsTamedCreature && ClassName.Equals(_raft_bp_c);
                //if (IsCreature) goto SkipRest;

                //IsStatusComponent = Properties.ContainsKey(_currentStatusValues);
                //IsDinoStatusComponent = IsStatusComponent && ClassName.Token.StartsWith("DinoCharacterStatusComponent_");
                //IsPlayerCharacterStatusComponent = IsStatusComponent && !IsDinoStatusComponent && ClassName.Token.StartsWith("PlayerCharacterStatusComponent_");
                //if (IsStatusComponent) goto SkipRest;

                //IsInventory = Properties.ContainsKey(_bInitializedMe);
                //IsStructureInventory = IsInventory && ClassName.Token.StartsWith("PrimalInventoryBP_");
                //IsTamedCreatureInventory = IsInventory && !IsStructureInventory && ClassName.Token.StartsWith("DinoTamedInventoryComponent_");
                //IsPlayerCharacterInventory = IsInventory && !(IsStructureInventory || IsTamedCreatureInventory) && ClassName.Token.StartsWith("PrimalInventoryComponent");
                //IsWildCreatureInventory = IsInventory && !(IsStructureInventory || IsTamedCreatureInventory || IsPlayerCharacterInventory) && ClassName.Token.StartsWith("DinoWildInventoryComponent_");
                //if (IsInventory) goto SkipRest;

                //IsStructurePaintingComponent = ClassName.Equals(_structurePaintingComponent);
                //if (IsStructurePaintingComponent) goto SkipRest;

                //IsDroppedItem = ClassName.Equals(_droppedItem);
                //if (IsDroppedItem) goto SkipRest;

                //IsPlayerCharacter = ClassName.Equals(_male) || ClassName.Equals(_female);
                //if (IsPlayerCharacter) goto SkipRest;

                //IsSomethingElse = true;

                SkipRest :;
            }

            var distance = nextOffset - archive.Position;

            if (distance > 0)
            {
                ExtraData = ExtraDataRegistry.getExtraData(this, archive, distance);
            }
            else
            {
                ExtraData = null;
            }
        }
Пример #26
0
 public long?GetProperty(PropertyInt64 property)
 {
     return(Biota.GetProperty(property, BiotaDatabaseLock));
 }
Пример #27
0
 public static PersistedPropertyAttribute GetPersistedPropertyAttribute(this PropertyInt64 val)
 {
     return(Enum.EnumHelper.GetAttributeOfType <PersistedPropertyAttribute>(val));
 }
Пример #28
0
 public void SetPropertyInt64(PropertyInt64 property, ulong value)
 {
     Debug.Assert(property < PropertyInt64.Count, "Invalid Property.");
     propertiesInt64[property] = value;
 }
Пример #29
0
 public static long?GetProperty(this Weenie weenie, PropertyInt64 property)
 {
     return(weenie.WeeniePropertiesInt64.FirstOrDefault(x => x.Type == (uint)property)?.Value);
 }
Пример #30
0
 public GameEventPrivateUpdatePropertyInt64(Session session, PropertyInt64 property, ulong value)
     : base(session)
 {
     this.property = property;
     this.value    = value;
 }