Ejemplo n.º 1
0
 public GameMessagePrivateUpdateDataID(WorldObject worldObject, PropertyDataId property, uint value)
     : base(GameMessageOpcode.PrivateUpdatePropertyDataID, GameMessageGroup.UIQueue)
 {
     Writer.Write(worldObject.Sequences.GetNextSequence(Sequence.SequenceType.UpdatePropertyDataID, property));
     Writer.Write((uint)property);
     Writer.Write(value);
 }
Ejemplo n.º 2
0
        public static string GetValueEnumName(this PropertyDataId property, uint value)
        {
            switch (property)
            {
            case PropertyDataId.ActivationAnimation:
            case PropertyDataId.InitMotion:
            case PropertyDataId.UseTargetAnimation:
            case PropertyDataId.UseTargetFailureAnimation:
            case PropertyDataId.UseTargetSuccessAnimation:
            case PropertyDataId.UseUserAnimation:
                return(System.Enum.GetName(typeof(MotionCommand), value));

            case PropertyDataId.PhysicsScript:
            case PropertyDataId.RestrictionEffect:
                return(System.Enum.GetName(typeof(PlayScript), value));

            case PropertyDataId.ActivationSound:
            case PropertyDataId.UseSound:
                return(System.Enum.GetName(typeof(Sound), value));

            case PropertyDataId.WieldedTreasureType:
            case PropertyDataId.DeathTreasureType:
                // todo
                break;

            case PropertyDataId.PCAPRecordedParentLocation:
                return(System.Enum.GetName(typeof(ParentLocation), value));
            }

            return(null);
        }
Ejemplo n.º 3
0
 public void RemoveProperty(PropertyDataId property)
 {
     if (Biota.TryRemoveProperty(property, BiotaDatabaseLock, biotaPropertyDataIds))
     {
         ChangesDetected = true;
     }
 }
 public GameMessagePrivateUpdateDataID(Session session, PropertyDataId property, uint value)
     : base(GameMessageOpcode.PrivateUpdatePropertyDataID, GameMessageGroup.Group09)
 {
     Writer.Write(session.Player.Sequences.GetNextSequence(Sequence.SequenceType.PrivateUpdatePropertyDataID));
     Writer.Write((uint)property);
     Writer.Write(value);
 }
Ejemplo n.º 5
0
 public static void SetProperty(this Biota biota, PropertyDataId property, uint value, ReaderWriterLockSlim rwLock)
 {
     rwLock.EnterUpgradeableReadLock();
     try
     {
         var result = biota.BiotaPropertiesDID.FirstOrDefault(x => x.Type == (uint)property);
         if (result != null)
         {
             result.Value = value;
         }
         else
         {
             rwLock.EnterWriteLock();
             try
             {
                 var entity = new BiotaPropertiesDID {
                     ObjectId = biota.Id, Type = (ushort)property, Value = value, Object = biota
                 };
                 biota.BiotaPropertiesDID.Add(entity);
             }
             finally
             {
                 rwLock.ExitWriteLock();
             }
         }
     }
     finally
     {
         rwLock.ExitUpgradeableReadLock();
     }
 }
Ejemplo n.º 6
0
 public static bool TryRemoveProperty(this Biota biota, PropertyDataId property, out BiotaPropertiesDID entity, ReaderWriterLockSlim rwLock)
 {
     rwLock.EnterUpgradeableReadLock();
     try
     {
         entity = biota.BiotaPropertiesDID.FirstOrDefault(x => x.Type == (uint)property);
         if (entity != null)
         {
             rwLock.EnterWriteLock();
             try
             {
                 biota.BiotaPropertiesDID.Remove(entity);
                 entity.Object = null;
                 return(true);
             }
             finally
             {
                 rwLock.ExitWriteLock();
             }
         }
         return(false);
     }
     finally
     {
         rwLock.ExitUpgradeableReadLock();
     }
 }
Ejemplo n.º 7
0
 public void SetProperty(PropertyDataId property, uint value)
 {
     Biota.SetProperty(property, value, BiotaDatabaseLock, biotaPropertyDataIds, out var biotaChanged);
     if (biotaChanged)
     {
         ChangesDetected = true;
     }
 }
Ejemplo n.º 8
0
        public static void RemoveProperty(this Biota biota, PropertyDataId property)
        {
            var result = biota.BiotaPropertiesDID.FirstOrDefault(x => x.Type == (uint)property);

            if (result != null)
            {
                biota.BiotaPropertiesDID.Remove(result);
                DatabaseManager.Shard.RemoveEntity(result, null);
            }
        }
Ejemplo n.º 9
0
 public static bool TryRemoveProperty(this Biota biota, PropertyDataId property, out BiotaPropertiesDID entity)
 {
     entity = biota.BiotaPropertiesDID.FirstOrDefault(x => x.Type == (uint)property);
     if (entity != null)
     {
         biota.BiotaPropertiesDID.Remove(entity);
         entity.Object = null;
         return(true);
     }
     return(false);
 }
Ejemplo n.º 10
0
 public static uint?GetProperty(this Biota biota, PropertyDataId property, ReaderWriterLockSlim rwLock)
 {
     rwLock.EnterReadLock();
     try
     {
         return(biota.BiotaPropertiesDID.FirstOrDefault(x => x.Type == (uint)property)?.Value);
     }
     finally
     {
         rwLock.ExitReadLock();
     }
 }
Ejemplo n.º 11
0
        public static void SetProperty(this Biota biota, PropertyDataId property, uint value)
        {
            var result = biota.BiotaPropertiesDID.FirstOrDefault(x => x.Type == (uint)property);

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

                biota.BiotaPropertiesDID.Add(entity);
            }
        }
        public static uint?GetProperty(this Weenie weenie, PropertyDataId property)
        {
            if (weenie.PropertiesDID == null)
            {
                return(null);
            }

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

            return(null);
        }
Ejemplo n.º 13
0
        public static void SetProperty(this Biota biota, PropertyDataId property, uint value)
        {
            var result = biota.BiotaPropertiesDID.FirstOrDefault(x => x.Type == (uint)property);

            if (result != null)
            {
                result.Value = value;
            }
            else
            {
                biota.BiotaPropertiesDID.Add(new BiotaPropertiesDID {
                    Type = (ushort)property, Value = value
                });
            }
        }
Ejemplo n.º 14
0
 public uint?GetProperty(PropertyDataId property)
 {
     BiotaDatabaseLock.EnterReadLock();
     try
     {
         if (biotaPropertyDataIds.TryGetValue(property, out var record))
         {
             return(record.Value);
         }
         return(null);
     }
     finally
     {
         BiotaDatabaseLock.ExitReadLock();
     }
 }
Ejemplo n.º 15
0
        public static void SetProperty(this Biota biota, PropertyDataId property, uint value, ReaderWriterLockSlim rwLock)
        {
            rwLock.EnterWriteLock();
            try
            {
                if (biota.PropertiesDID == null)
                {
                    biota.PropertiesDID = new Dictionary <PropertyDataId, uint>();
                }

                biota.PropertiesDID[property] = value;
            }
            finally
            {
                rwLock.ExitWriteLock();
            }
        }
Ejemplo n.º 16
0
        public static string GetValueEnumName(this PropertyDataId property, uint value)
        {
            switch (property)
            {
            case PropertyDataId.ActivationAnimation:
            case PropertyDataId.InitMotion:
            case PropertyDataId.UseTargetAnimation:
            case PropertyDataId.UseTargetFailureAnimation:
            case PropertyDataId.UseTargetSuccessAnimation:
            case PropertyDataId.UseUserAnimation:
                return(System.Enum.GetName(typeof(MotionCommand), value));

            case PropertyDataId.PhysicsScript:
            case PropertyDataId.RestrictionEffect:
                return(System.Enum.GetName(typeof(PlayScript), value));

            case PropertyDataId.ActivationSound:
            case PropertyDataId.UseSound:
                return(System.Enum.GetName(typeof(Sound), value));

            case PropertyDataId.WieldedTreasureType:
            case PropertyDataId.DeathTreasureType:
                // todo
                break;

            case PropertyDataId.Spell:
            case PropertyDataId.DeathSpell:
            case PropertyDataId.ProcSpell:
            case PropertyDataId.RedSurgeSpell:
            case PropertyDataId.BlueSurgeSpell:
            case PropertyDataId.YellowSurgeSpell:
                return(System.Enum.GetName(typeof(SpellId), value));

            case PropertyDataId.ItemSkillLimit:
            case PropertyDataId.ItemSpecializedOnly:
                return(System.Enum.GetName(typeof(Skill), value));

            case PropertyDataId.PCAPRecordedParentLocation:
                return(System.Enum.GetName(typeof(ParentLocation), value));

            case PropertyDataId.PCAPRecordedDefaultScript:
                return(System.Enum.GetName(typeof(MotionCommand), value));
            }

            return(null);
        }
        public static bool TryRemoveProperty(this Biota biota, PropertyDataId property, ReaderWriterLockSlim rwLock)
        {
            if (biota.PropertiesDID == null)
            {
                return(false);
            }

            rwLock.EnterWriteLock();
            try
            {
                return(biota.PropertiesDID.Remove(property));
            }
            finally
            {
                rwLock.ExitWriteLock();
            }
        }
        public static uint?GetProperty(this Biota biota, PropertyDataId property, ReaderWriterLockSlim rwLock)
        {
            if (biota.PropertiesDID == null)
            {
                return(null);
            }

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

                return(null);
            }
            finally
            {
                rwLock.ExitReadLock();
            }
        }
        public static void SetProperty(this Biota biota, PropertyDataId property, uint value, ReaderWriterLockSlim rwLock, out bool changed)
        {
            rwLock.EnterWriteLock();
            try
            {
                if (biota.PropertiesDID == null)
                {
                    biota.PropertiesDID = new Dictionary <PropertyDataId, uint>();
                }

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

                if (changed)
                {
                    biota.PropertiesDID[property] = value;
                }
            }
            finally
            {
                rwLock.ExitWriteLock();
            }
        }
Ejemplo n.º 20
0
        public static bool IsHexData(this PropertyDataId property)
        {
            switch (property)
            {
            case PropertyDataId.AccountHouseId:
            case PropertyDataId.AlternateCurrency:
            case PropertyDataId.AugmentationCreateItem:
            case PropertyDataId.AugmentationEffect:
            case PropertyDataId.BlueSurgeSpell:
            case PropertyDataId.DeathSpell:
            case PropertyDataId.DeathTreasureType:
            case PropertyDataId.HouseId:
            case PropertyDataId.ItemSkillLimit:
            case PropertyDataId.ItemSpecializedOnly:
            case PropertyDataId.LastPortal:
            case PropertyDataId.LinkedPortalOne:
            case PropertyDataId.LinkedPortalTwo:
            case PropertyDataId.OlthoiDeathTreasureType:
            case PropertyDataId.OriginalPortal:
            case PropertyDataId.PhysicsScript:
            case PropertyDataId.ProcSpell:
            case PropertyDataId.RedSurgeSpell:
            case PropertyDataId.RestrictionEffect:
            case PropertyDataId.Spell:
            case PropertyDataId.SpellComponent:
            case PropertyDataId.UseCreateItem:
            case PropertyDataId.UseSound:
            case PropertyDataId.VendorsClassId:
            case PropertyDataId.WieldedTreasureType:
            case PropertyDataId.YellowSurgeSpell:

            case PropertyDataId x when x >= PropertyDataId.PCAPRecordedWeenieHeader:
                return(false);

            default:
                return(true);
            }
        }
Ejemplo n.º 21
0
 public static uint?GetProperty(this Weenie weenie, PropertyDataId property)
 {
     return(weenie.WeeniePropertiesDID.FirstOrDefault(x => x.Type == (uint)property)?.Value);
 }
Ejemplo n.º 22
0
 public uint?GetProperty(PropertyDataId propDID)
 {
     return(null);
 }
Ejemplo n.º 23
0
 public void SetProperty(PropertyDataId propDID, uint?value)
 {
 }
Ejemplo n.º 24
0
        protected string GetValueEnumName(PropertyDataId property, uint value)
        {
            switch (property)
            {
            case PropertyDataId.AlternateCurrency:
            case PropertyDataId.AugmentationCreateItem:
            case PropertyDataId.LastPortal:
            case PropertyDataId.LinkedPortalOne:
            case PropertyDataId.LinkedPortalTwo:
            case PropertyDataId.OriginalPortal:
            case PropertyDataId.UseCreateItem:
            case PropertyDataId.VendorsClassId:
            case PropertyDataId.PCAPPhysicsDIDDataTemplatedFrom:
                if (WeenieNames != null)
                {
                    WeenieNames.TryGetValue(value, out var propertyValueDescription);
                    return(propertyValueDescription);
                }
                break;

            case PropertyDataId.BlueSurgeSpell:
            case PropertyDataId.DeathSpell:
            case PropertyDataId.ProcSpell:
            case PropertyDataId.RedSurgeSpell:
            case PropertyDataId.Spell:
            case PropertyDataId.YellowSurgeSpell:
                if (SpellNames != null)
                {
                    SpellNames.TryGetValue(value, out var propertyValueDescription);
                    return(propertyValueDescription);
                }
                break;

            case PropertyDataId.WieldedTreasureType:
                string treasureW = "";
                if (TreasureWielded != null)
                {
                    if (TreasureWielded.ContainsKey(value))
                    {
                        foreach (var item in TreasureWielded[value])
                        {
                            treasureW += GetValueForTreasureDID(item);
                        }
                        return(treasureW);
                    }
                }
                else if (TreasureDeath != null)
                {
                    if (TreasureDeath.ContainsKey(value))
                    {
                        return($"Loot Tier: {TreasureDeath[value].Tier}");
                    }
                }
                break;

            case PropertyDataId.DeathTreasureType:
                string treasureD = "";
                if (TreasureDeath != null)
                {
                    if (TreasureDeath.ContainsKey(value))
                    {
                        return($"Loot Tier: {TreasureDeath[value].Tier}");
                    }
                }
                else if (TreasureWielded != null)
                {
                    if (TreasureWielded.ContainsKey(value))
                    {
                        foreach (var item in TreasureWielded[value])
                        {
                            treasureD += GetValueForTreasureDID(item);
                        }
                        return(treasureD);
                    }
                }
                break;

            case PropertyDataId.PCAPRecordedObjectDesc:
                return(((ObjectDescriptionFlag)value).ToString());

            case PropertyDataId.PCAPRecordedPhysicsDesc:
                return(((PhysicsDescriptionFlag)value).ToString());

            case PropertyDataId.PCAPRecordedWeenieHeader:
                return(((WeenieHeaderFlag)value).ToString());

            case PropertyDataId.PCAPRecordedWeenieHeader2:
                return(((WeenieHeaderFlag2)value).ToString());
            }

            return(property.GetValueEnumName(value));
        }
Ejemplo n.º 25
0
 public uint?GetProperty(PropertyDataId property)
 {
     return(Biota.GetProperty(property, BiotaDatabaseLock));
 }
Ejemplo n.º 26
0
        public static string GetDescription(this PropertyDataId prop)
        {
            var description = prop.GetAttributeOfType <DescriptionAttribute>();

            return(description?.Description ?? prop.ToString());
        }
Ejemplo n.º 27
0
 public static uint? GetProperty(this Biota biota, PropertyDataId property)
 {
     return biota.BiotaPropertiesDID.FirstOrDefault(x => x.Type == (uint)property)?.Value;
 }
Ejemplo n.º 28
0
 public byte[] GetNextSequence(SequenceType type, PropertyDataId property)
 {
     return(GetSequence(type, (uint)property).NextBytes);
 }