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); }
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); }
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); }
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(); } }
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(); } }
public void SetProperty(PropertyDataId property, uint value) { Biota.SetProperty(property, value, BiotaDatabaseLock, biotaPropertyDataIds, out var biotaChanged); if (biotaChanged) { ChangesDetected = true; } }
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); } }
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); }
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(); } }
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); }
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 }); } }
public uint?GetProperty(PropertyDataId property) { BiotaDatabaseLock.EnterReadLock(); try { if (biotaPropertyDataIds.TryGetValue(property, out var record)) { return(record.Value); } return(null); } finally { BiotaDatabaseLock.ExitReadLock(); } }
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(); } }
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(); } }
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); } }
public static uint?GetProperty(this Weenie weenie, PropertyDataId property) { return(weenie.WeeniePropertiesDID.FirstOrDefault(x => x.Type == (uint)property)?.Value); }
public uint?GetProperty(PropertyDataId propDID) { return(null); }
public void SetProperty(PropertyDataId propDID, uint?value) { }
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)); }
public uint?GetProperty(PropertyDataId property) { return(Biota.GetProperty(property, BiotaDatabaseLock)); }
public static string GetDescription(this PropertyDataId prop) { var description = prop.GetAttributeOfType <DescriptionAttribute>(); return(description?.Description ?? prop.ToString()); }
public static uint? GetProperty(this Biota biota, PropertyDataId property) { return biota.BiotaPropertiesDID.FirstOrDefault(x => x.Type == (uint)property)?.Value; }
public byte[] GetNextSequence(SequenceType type, PropertyDataId property) { return(GetSequence(type, (uint)property).NextBytes); }