private void Set(UpdateFields field, UpdateValue value) { var index = (int)field; updateMask[index] = required[index] & !Equals(values[index], value); values[index] = value; }
protected internal void Set(UpdateFields field, ushort value0, ushort value1) { UpdateValue updateValue = values[(int)field]; updateValue.UInt16_0 = value0; updateValue.UInt16_1 = value1; Set(field, updateValue); }
public void update(string[] fieldNames, int val1, double val2, string con) { Table table = new Table(this.columnNames, this.columnTypes); Condition contemp = new Condition(table, con); List <Thread> threads = new List <Thread> { }; foreach (List <long> Id in this.cellIds) { UpdateFields uf = new UpdateFields(); uf.fildNames = fieldNames; uf.Value1 = val1; uf.Value2 = val2; uf.cellId = Id; uf.con = contemp; uf.typeList = this.columnTypes; Thread thread = new Thread(new ParameterizedThreadStart(UpdateField)); threads.Add(thread); thread.Start(uf); } foreach (Thread thr in threads) { thr.Join(); } }
/// <summary>Converts this object to an update statement.</summary> /// <param name="item"> The item.</param> /// <param name="excludeDefaults">true to exclude, false to include the defaults.</param> /// <returns>The given data converted to a string.</returns> public override string ToUpdateStatement(T item, bool excludeDefaults = false) { var setFields = new StringBuilder(); var dialectProvider = OrmLiteConfig.DialectProvider; foreach (var fieldDef in ModelDef.FieldDefinitions) { if (UpdateFields.Count > 0 && !UpdateFields.Contains(fieldDef.Name) || fieldDef.AutoIncrement) { continue; // added } var value = fieldDef.GetValue(item); if (excludeDefaults && (value == null || value.Equals(value.GetType().GetDefaultValue()))) { continue; //GetDefaultValue? } fieldDef.GetQuotedValue(item); if (setFields.Length > 0) { setFields.Append(","); } setFields.AppendFormat("{0} = {1}", dialectProvider.GetQuotedColumnName(fieldDef.FieldName), dialectProvider.GetQuotedValue(value, fieldDef.FieldType)); } return(string.Format("UPDATE {0} SET {1} {2}", dialectProvider.GetQuotedTableName(ModelDef), setFields, WhereExpression)); }
public static void SetVersion(ClientVersionBuild version) { if (Build == version) { return; } Build = version; _expansion = GetExpansion(version); Opcodes.InitializeOpcodeDictionary(); Handler.ResetHandlers(); UpdateFields.ResetUFDictionaries(); try { var asm = Assembly.Load($"WowPacketParserModule.{VersionDefiningBuild}"); Trace.WriteLine($"Loading module WowPacketParserModule.{VersionDefiningBuild}.dll"); Handler.LoadHandlers(asm, VersionDefiningBuild); Handler.LoadBattlenetHandlers(asm); // This is a huge hack to handle the abnormal situation that appeared with builds 6.0 and 6.1 having mostly the same packet structures if (!UpdateFields.LoadUFDictionaries(asm, version)) { UpdateFields.LoadUFDictionaries(asm, VersionDefiningBuild); } } catch (FileNotFoundException) { // No dll found, try to load the data in the executable itself UpdateFields.LoadUFDictionaries(Assembly.GetExecutingAssembly(), Build); } }
public override void LoadValuesFromUpdateFields() { Bytes0 = UpdateFields.GetValue <UnitField, uint?>(UnitField.UNIT_FIELD_BYTES_0); Bytes1 = UpdateFields.GetValue <UnitField, uint?>(UnitField.UNIT_FIELD_BYTES_1); Bytes2 = UpdateFields.GetValue <UnitField, uint?>(UnitField.UNIT_FIELD_BYTES_2); Size = UpdateFields.GetValue <ObjectField, float?>(ObjectField.OBJECT_FIELD_SCALE_X); MaxHealth = UpdateFields.GetValue <UnitField, uint?>(UnitField.UNIT_FIELD_MAXHEALTH); Level = UpdateFields.GetValue <UnitField, uint?>(UnitField.UNIT_FIELD_LEVEL); Faction = UpdateFields.GetValue <UnitField, uint?>(UnitField.UNIT_FIELD_FACTIONTEMPLATE); if (ClientVersion.AddedInVersion(ClientType.Legion)) { ScalingMinLevel = UpdateFields.GetValue <UnitField, uint?>(UnitField.UNIT_FIELD_SCALING_LEVEL_MIN); ScalingMaxLevel = UpdateFields.GetValue <UnitField, uint?>(UnitField.UNIT_FIELD_SCALING_LEVEL_MAX); if (ScalingMinLevel != null && ScalingMaxLevel != null) { CreatureTemplateScaling creatureTemplateScaling = new CreatureTemplateScaling(); creatureTemplateScaling.Entry = UpdateFields.GetValue <ObjectField, uint>(ObjectField.OBJECT_FIELD_ENTRY); creatureTemplateScaling.LevelScalingDelta = UpdateFields.GetValue <UnitField, uint>(UnitField.UNIT_FIELD_SCALING_LEVEL_DELTA); Storage.CreatureTemplateScalings.Add(creatureTemplateScaling); } EquipmentRaw = UpdateFields.GetArray <UnitField, uint>(UnitField.UNIT_VIRTUAL_ITEM_SLOT_ID, 6); } else { EquipmentRaw = UpdateFields.GetArray <UnitField, uint>(UnitField.UNIT_VIRTUAL_ITEM_SLOT_ID, 3); } UnitFlags = UpdateFields.GetEnum <UnitField, UnitFlags?>(UnitField.UNIT_FIELD_FLAGS); UnitFlags2 = UpdateFields.GetEnum <UnitField, UnitFlags2?>(UnitField.UNIT_FIELD_FLAGS_2); MeleeTime = UpdateFields.GetValue <UnitField, uint?>(UnitField.UNIT_FIELD_BASEATTACKTIME); RangedTime = UpdateFields.GetValue <UnitField, uint?>(UnitField.UNIT_FIELD_RANGEDATTACKTIME); Model = UpdateFields.GetValue <UnitField, uint?>(UnitField.UNIT_FIELD_DISPLAYID); Mount = UpdateFields.GetValue <UnitField, uint?>(UnitField.UNIT_FIELD_MOUNTDISPLAYID); if (ClientVersion.AddedInVersion(ClientType.WarlordsOfDraenor)) { DynamicFlagsWod = UpdateFields.GetEnum <ObjectField, UnitDynamicFlagsWOD?>(ObjectField.OBJECT_DYNAMIC_FLAGS); } else { DynamicFlags = UpdateFields.GetEnum <UnitField, UnitDynamicFlags?>(UnitField.UNIT_DYNAMIC_FLAGS); } NpcFlags = UpdateFields.GetEnum <UnitField, NPCFlags?>(UnitField.UNIT_NPC_FLAGS); EmoteState = UpdateFields.GetEnum <UnitField, EmoteType?>(UnitField.UNIT_NPC_EMOTESTATE); Resistances = UpdateFields.GetArray <UnitField, short>(UnitField.UNIT_FIELD_RESISTANCES, 7); ManaMod = UpdateFields.GetValue <UnitField, uint?>(UnitField.UNIT_FIELD_BASE_MANA); HealthMod = UpdateFields.GetValue <UnitField, uint?>(UnitField.UNIT_FIELD_BASE_HEALTH); BoundingRadius = UpdateFields.GetValue <UnitField, float?>(UnitField.UNIT_FIELD_BOUNDINGRADIUS); CombatReach = UpdateFields.GetValue <UnitField, float?>(UnitField.UNIT_FIELD_COMBATREACH); HoverHeight = UpdateFields.GetValue <UnitField, float?>(UnitField.UNIT_FIELD_HOVERHEIGHT); if (ClientVersion.AddedInVersion(ClientVersionBuild.V5_4_0_17359)) { PowerType = UpdateFields.GetEnum <UnitField, PowerType?>(UnitField.UNIT_FIELD_DISPLAY_POWER); InteractSpellID = UpdateFields.GetValue <UnitField, uint?>(UnitField.UNIT_FIELD_INTERACT_SPELLID); } ComputeBytes0(); ComputeEquipment(); }
private UpdateFields ReadValues(StreamHandler Reader) { var values = new UpdateFields(); byte blocksCount = Reader.ReadByte(); int[] updatemask = new int[blocksCount]; for (int i = 0; i < updatemask.Length; ++i) { updatemask[i] = Reader.ReadInt32(); } var mask = new BitArray(updatemask); for (uint i = 0; i < mask.Count; ++i) { if (mask[(int)i]) { values[i] = Reader.ReadUInt32(); } } return(values); }
public void LoadValuesFromUpdateFields() { Size = UpdateFields.GetValue <ObjectField, float?>(ObjectField.OBJECT_FIELD_SCALE_X); Bytes0 = UpdateFields.GetValue <UnitField, uint?>(UnitField.UNIT_FIELD_BYTES_0); MaxHealth = UpdateFields.GetValue <UnitField, uint?>(UnitField.UNIT_FIELD_MAXHEALTH); Level = UpdateFields.GetValue <UnitField, uint?>(UnitField.UNIT_FIELD_LEVEL); Faction = UpdateFields.GetValue <UnitField, uint?>(UnitField.UNIT_FIELD_FACTIONTEMPLATE); Equipment = UpdateFields.GetArray <UnitField, uint>(UnitField.UNIT_VIRTUAL_ITEM_SLOT_ID1, 3); UnitFlags = UpdateFields.GetEnum <UnitField, UnitFlags?>(UnitField.UNIT_FIELD_FLAGS); UnitFlags2 = UpdateFields.GetEnum <UnitField, UnitFlags2?>(UnitField.UNIT_FIELD_FLAGS_2); MeleeTime = UpdateFields.GetValue <UnitField, uint?>(UnitField.UNIT_FIELD_BASEATTACKTIME); RangedTime = UpdateFields.GetValue <UnitField, uint?>(UnitField.UNIT_FIELD_RANGEDATTACKTIME); Model = UpdateFields.GetValue <UnitField, uint?>(UnitField.UNIT_FIELD_DISPLAYID); Mount = UpdateFields.GetValue <UnitField, uint?>(UnitField.UNIT_FIELD_MOUNTDISPLAYID); Bytes1 = UpdateFields.GetValue <UnitField, uint?>(UnitField.UNIT_FIELD_BYTES_1); DynamicFlags = UpdateFields.GetEnum <UnitField, UnitDynamicFlags?>(UnitField.UNIT_DYNAMIC_FLAGS); NpcFlags = UpdateFields.GetEnum <UnitField, NPCFlags?>(UnitField.UNIT_NPC_FLAGS); EmoteState = UpdateFields.GetEnum <UnitField, EmoteType?>(UnitField.UNIT_NPC_EMOTESTATE); Resistances = UpdateFields.GetArray <UnitField, uint>(UnitField.UNIT_FIELD_RESISTANCES_ARMOR, 7); ManaMod = UpdateFields.GetValue <UnitField, uint?>(UnitField.UNIT_FIELD_BASE_MANA); HealthMod = UpdateFields.GetValue <UnitField, uint?>(UnitField.UNIT_FIELD_BASE_HEALTH); Bytes2 = UpdateFields.GetValue <UnitField, uint?>(UnitField.UNIT_FIELD_BYTES_2); BoundingRadius = UpdateFields.GetValue <UnitField, float?>(UnitField.UNIT_FIELD_BOUNDINGRADIUS); CombatReach = UpdateFields.GetValue <UnitField, float?>(UnitField.UNIT_FIELD_COMBATREACH); HoverHeight = UpdateFields.GetValue <UnitField, float?>(UnitField.UNIT_FIELD_HOVERHEIGHT); ComputeBytes0(); }
private void PrintValues(System.Text.StringBuilder builder, UpdateFields values, ObjectTypeId type) { foreach (var pair in values) { var uf = UpdateFields.GetUpdateField(pair.Key, type); if (uf.Type == UpdateFieldType.Long && uf.Id.ToString().EndsWith("_HIPART")) { continue; } builder.Append(" "); builder.Append(uf.Id); builder.Append(" = "); if (uf.Type == UpdateFieldType.Long && values.ContainsKey(pair.Key + 1)) { builder.Append(uf.Print(((ulong)values[pair.Key + 1] << 32) | (ulong)pair.Value)); } else { builder.Append(uf.Print(pair.Value)); } builder.AppendLine(); } }
public override void PrepareUpdateStatement(IDbCommand dbCmd, T item, bool excludeDefaults = false) { CopyParamsTo(dbCmd); var setFields = new StringBuilder(); foreach (var fieldDef in ModelDef.FieldDefinitions) { if (UpdateFields.Count > 0 && !UpdateFields.Contains(fieldDef.Name) || fieldDef.AutoIncrement) continue; // added var value = fieldDef.GetValue(item); if (excludeDefaults && (value == null || (!fieldDef.IsNullable && value.Equals(value.GetType().GetDefaultValue())))) continue; if (setFields.Length > 0) setFields.Append(", "); var param = DialectProvider.AddParam(dbCmd, value, fieldDef.ColumnType); setFields .Append(DialectProvider.GetQuotedColumnName(fieldDef.FieldName)) .Append("=") .Append(param.ParameterName); } if (setFields.Length == 0) throw new ArgumentException("No non-null or non-default values were provided for type: " + typeof(T).Name); dbCmd.CommandText = string.Format("UPDATE {0} SET {1} {2}", DialectProvider.GetQuotedTableName(ModelDef), setFields, WhereExpression); }
/// <summary> /// Grabs a value from a dictionary of UpdateFields /// </summary> /// <typeparam name="T">The type of UpdateField (ObjectField, UnitField, ...)</typeparam> /// <typeparam name="TK">The type of the value (int, uint or float and their nullable counterparts)</typeparam> /// <param name="dict">The dictionary</param> /// <param name="updateField">The update field we want</param> /// <returns></returns> public static TK GetValue <T, TK>(this Dictionary <int, UpdateField> dict, T updateField) { UpdateField uf; if (dict.TryGetValue(UpdateFields.GetUpdateField(updateField), out uf)) { var type = GetTypeCodeOfReturnValue <TK>(); switch (type) { case TypeCode.UInt32: return((TK)(object)uf.UInt32Value); case TypeCode.Int32: return((TK)(object)(int)uf.UInt32Value); case TypeCode.Single: return((TK)(object)uf.SingleValue); case TypeCode.Double: return((TK)(object)(double)uf.SingleValue); default: break; } } return(default(TK)); }
/// <summary> /// Grabs a value from a dictionary of UpdateFields /// </summary> /// <typeparam name="T">The type of UpdateField (ObjectField, UnitField, ...)</typeparam> /// <typeparam name="TK">The type of the value (int, uint or float and their nullable counterparts)</typeparam> /// <param name="dict">The dictionary</param> /// <param name="updateField">The update field we want</param> /// <returns></returns> public static TK GetValue <T, TK>(this Dictionary <int, UpdateField> dict, T updateField) { var isInt = false; var isUInt = false; var type = typeof(TK); switch (Type.GetTypeCode(type)) { case TypeCode.UInt32: isUInt = true; break; case TypeCode.Int32: isInt = true; break; case TypeCode.Single: case TypeCode.Double: break; default: { switch (Type.GetTypeCode(Nullable.GetUnderlyingType(type))) { case TypeCode.UInt32: isUInt = true; break; case TypeCode.Int32: isInt = true; break; case TypeCode.Single: case TypeCode.Double: break; default: return(default(TK)); } break; } } UpdateField uf; if (dict.TryGetValue(UpdateFields.GetUpdateField(updateField), out uf)) { if (isInt) { return((TK)(object)Convert.ToInt32(uf.UInt32Value)); } else if (isUInt) { return((TK)(object)uf.UInt32Value); } return((TK)(object)uf.SingleValue); } return(default(TK)); }
public static void SetVersion(ClientVersionBuild version) { if (Build == version) { return; } Build = version; _expansion = GetExpansion(version); Opcodes.InitializeOpcodeDictionary(); Handler.ResetHandlers(); UpdateFields.ResetUFDictionaries(); try { var asm = Assembly.LoadFrom(string.Format(AppDomain.CurrentDomain.BaseDirectory + "/" + "WowPacketParserModule.{0}.dll", VersionDefiningBuild)); Trace.WriteLine(string.Format("Loading module WowPacketParserModule.{0}.dll", VersionDefiningBuild)); Handler.LoadHandlers(asm, VersionDefiningBuild); UpdateFields.LoadUFDictionaries(asm, VersionDefiningBuild); } catch (FileNotFoundException) { // No dll found, try to load the data in the executable itself UpdateFields.LoadUFDictionaries(Assembly.GetExecutingAssembly(), Build); } }
private static bool GetTransportMap(WoWObject @object, out int mapId) { mapId = -1; WoWObject transport; if (!Storage.Objects.TryGetValue(@object.Movement.TransportGuid, out transport)) { return(false); } UpdateField entry; if (!transport.UpdateFields.TryGetValue(UpdateFields.GetUpdateField(ObjectField.OBJECT_FIELD_ENTRY), out entry)) { return(false); } if (SQLConnector.Enabled) { var transportTemplates = SQLDatabase.GetDict <uint, GameObjectTemplate>(new List <uint> { entry.UInt32Value }); if (transportTemplates.IsEmpty()) { return(false); } mapId = transportTemplates[entry.UInt32Value].Item1.Data[6]; } return(true); }
public override void LoadValuesFromUpdateFields() { spellId = UpdateFields.GetValue <AreaTriggerField, uint>(AreaTriggerField.AREATRIGGER_SPELLID); DecalPropertiesId = UpdateFields.GetValue <AreaTriggerField, uint>(AreaTriggerField.AREATRIGGER_DECAL_PROPERTIES_ID); TimeToTarget = UpdateFields.GetValue <AreaTriggerField, uint>(AreaTriggerField.AREATRIGGER_TIME_TO_TARGET); TimeToTargetScale = UpdateFields.GetValue <AreaTriggerField, uint>(AreaTriggerField.AREATRIGGER_TIME_TO_TARGET_SCALE); }
public override void LoadValuesFromUpdateFields() { spellId = UpdateFields.GetValue <AreaTriggerField, uint>(AreaTriggerField.AREATRIGGER_SPELLID); DecalPropertiesId = UpdateFields.GetValue <AreaTriggerField, uint>(AreaTriggerField.AREATRIGGER_DECAL_PROPERTIES_ID); TimeToTarget = UpdateFields.GetValue <AreaTriggerField, uint>(AreaTriggerField.AREATRIGGER_TIME_TO_TARGET); TimeToTargetScale = UpdateFields.GetValue <AreaTriggerField, uint>(AreaTriggerField.AREATRIGGER_TIME_TO_TARGET_SCALE); if (Settings.UseDBC) { for (uint idx = 0; idx < 32; idx++) { var tuple = Tuple.Create(spellId, idx); if (DBC.DBC.SpellEffectStores.ContainsKey(tuple)) { var effect = DBC.DBC.SpellEffectStores[tuple]; if (effect.Effect == (uint)SpellEffects.SPELL_EFFECT_CREATE_AREATRIGGER || effect.EffectAura == (uint)AuraTypeLegion.SPELL_AURA_AREA_TRIGGER) { // If we already had a SPELL_EFFECT_CREATE_AREATRIGGER, spell has multiple areatrigger, // so we can't deduce SpellMiscId, erase previous value & break if (SpellMiscId != null) { SpellMiscId = null; break; } SpellMiscId = (uint)effect.EffectMiscValue[0]; } } } } }
public float GetUpdateValueFloat(UpdateFields idx) { if ((ushort)idx >= updateValues.Count || !(updateValues[(ushort)idx] is float)) { return(0); } return((float)updateValues[(ushort)idx]); }
public uint GetUpdateValue(UpdateFields idx) { if ((ushort)idx >= updateValues.Count || !(updateValues[(ushort)idx] is uint)) { return(0); } return((uint)updateValues[(ushort)idx]); }
public uint GetValue(UpdateFields index) { if (!this.updateValues.ContainsKey((ushort)index)) { return(0); } return(this.updateValues[(ushort)index]); }
protected internal void Set(UpdateFields field, byte byte0, byte byte1, byte byte2, byte byte3) { UpdateValue updateValue = values[(int)field]; updateValue.Uint8_0 = byte0; updateValue.Uint8_1 = byte1; updateValue.Uint8_2 = byte2; updateValue.Uint8_3 = byte3; Set(field, updateValue); }
public bool IsTransport() { UpdateField uf; if (UpdateFields.TryGetValue(Enums.Version.UpdateFields.GetUpdateField(GameObjectField.GAMEOBJECT_BYTES_1), out uf)) { return((GameObjectType)((uf.UInt32Value & 0x0000FF00) >> 8) == GameObjectType.MOTransport); } return(false); }
public float?[] GetParentRotation() { if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_0_2_9056)) { return(UpdateFields.GetArray <GameObjectField, float?>(GameObjectField.GAMEOBJECT_PARENTROTATION, 4)); } else { return(null); } }
/// <summary> /// 生成更新语句 /// </summary> /// <param name="exceptColumn">不需要更新的列</param> /// <returns></returns> public override string BuildUpdate(List <string> exceptColumn) { if (exceptColumn?.Count == 0) { throw new MissingFieldException("except column should not be empty"); } var columns = UpdateFields.Where(f => !exceptColumn.Contains(f)).Select(f => $"`{f}` = @{f}").ToList(); return($@"UPDATE {TableName} SET { string.Join(" , ", columns) } WHERE `{mPrimaryKeyName}` = @{mPrimaryKeyName}"); }
public UpdateFields GetQuestSlot(uint quest) { for (UpdateFields c = UpdateFields.PLAYER_QUEST_LOG_1_1; c <= UpdateFields.PLAYER_QUEST_LOG_1_1 + 60; c += 3) { if (GetUpdateValue(c) == quest) { return(c); } } return(UpdateFields.OBJECT_FIELD_GUID); }
private static void SetVisibleItem(UpdateValuesDto dto, UpdateFields field, Item item) { if(item != null) { dto.Set(field, item.Entry); dto.Set(field + 1, (ushort)0, 0); } else { dto.Set(field, (uint)0); dto.Set(field + 1, (ushort)0, 0); } }
void Test(Character c, string[] argv) { if (argv.Length < 3) { Echo(c, "Error: .test flag value"); return; } UpdateFields n = (UpdateFields)int.Parse(argv[1]); uint v = (uint)int.Parse(argv[2]); c.SetUpdateValue(n, v); }
public static void HandleLootResponse(Packet packet) { var loot = new Loot(); var guid = packet.ReadGuid("GUID"); var lootType = packet.ReadEnum <LootType>("Loot Type", TypeCode.Byte); if (lootType == LootType.Unk0) { packet.ReadByte("Slot"); return; } loot.Gold = packet.ReadUInt32("Gold"); var count = packet.ReadByte("Drop Count"); if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_2_0_14333)) { packet.ReadByte("unk"); } loot.LootItems = new List <LootItem>(count); for (var i = 0; i < count; ++i) { var lootItem = new LootItem(); packet.ReadByte("Slot", i); lootItem.ItemId = (uint)packet.ReadEntryWithName <UInt32>(StoreNameType.Item, "Entry", i); lootItem.Count = packet.ReadUInt32("Count", i); packet.ReadUInt32("Display ID", i); packet.ReadInt32("Random Suffix", i); packet.ReadInt32("Random Property Id", i); packet.ReadEnum <LootSlotType>("Slot Type", TypeCode.Byte, i); loot.LootItems.Add(lootItem); } // Items do not have item id in its guid, we need to query the wowobject store go if (guid.GetObjectType() == ObjectType.Item) { WoWObject item; UpdateField itemEntry; if (Stuffing.Objects.TryGetValue(guid, out item)) { if (item.UpdateFields.TryGetValue(UpdateFields.GetUpdateField(ObjectField.OBJECT_FIELD_ENTRY), out itemEntry)) { Stuffing.Loots.TryAdd(new Tuple <uint, ObjectType>((uint)itemEntry.Int32Value, guid.GetObjectType()), loot); return; } } } Stuffing.Loots.TryAdd(new Tuple <uint, ObjectType>(guid.GetEntry(), guid.GetObjectType()), loot); }
public void SetUpdateValue(UpdateFields idx, ulong data, UpdateMask mask) { if (idx >= UpdateFields.PLAYER_END - 1) { return; } CheckUpdateSize(); updateValues[(ushort)idx] = (uint)data; updateValues[(ushort)idx + 1] = (uint)(data >> 32); mask.Set((ushort)idx, true); mask.Set((ushort)(idx + 1), true); }
private static void SetVisibleItem(UpdateValuesDto dto, UpdateFields field, Item item) { if (item != null) { dto.Set(field, item.Entry); dto.Set(field + 1, (ushort)0, 0); } else { dto.Set(field, (uint)0); dto.Set(field + 1, (ushort)0, 0); } }
public override bool IsTemporarySpawn() { // If our gameobject got the following update field set, // it's probably a temporary spawn UpdateField uf; if (UpdateFields.TryGetValue(Enums.Version.UpdateFields.GetUpdateField(GameObjectField.GAMEOBJECT_FIELD_CREATED_BY), out uf)) { return(uf.UInt32Value != 0); } return(false); }
public override void LoadValuesFromUpdateFields() { Bytes1 = BitConverter.ToUInt32(new byte[] { UnitData.StandState, UnitData.PetTalentPoints, UnitData.VisFlags, UnitData.AnimTier }, 0); Bytes2 = BitConverter.ToUInt32(new byte[] { UnitData.SheatheState, UnitData.PvpFlags, UnitData.PetFlags, UnitData.ShapeshiftForm }, 0); if (ClientVersion.AddedInVersion(ClientType.WarlordsOfDraenor)) { DynamicFlagsWod = (UnitDynamicFlagsWOD)ObjectData.DynamicFlags; } else { DynamicFlags = UpdateFields.GetEnum <UnitField, UnitDynamicFlags?>(UnitField.UNIT_DYNAMIC_FLAGS); } }
protected internal void Set(UpdateFields field, long value) { Set(field, (ulong)value); }
public static UpdateField GetUpdateField(OBJECT_TYPE_ID type, UpdateFields index) { int indx = (int)index; // index parameter must be checked first switch (type) { case OBJECT_TYPE_ID.TYPEID_ITEM: case OBJECT_TYPE_ID.TYPEID_CONTAINER: return item_uf[indx]; case OBJECT_TYPE_ID.TYPEID_UNIT: case OBJECT_TYPE_ID.TYPEID_PLAYER: return unit_uf[indx]; case OBJECT_TYPE_ID.TYPEID_GAMEOBJECT: return go_uf[indx]; case OBJECT_TYPE_ID.TYPEID_DYNAMICOBJECT: return do_uf[indx]; case OBJECT_TYPE_ID.TYPEID_CORPSE: return corpse_uf[indx]; default: return unit_uf[indx]; } }
protected internal void Set(UpdateFields field, uint value) { Set(field, new UpdateValue { UInt32 = value }); }
protected internal void Set(UpdateFields field, int value) { Set(field, (uint)value); }
protected internal void Set(UpdateFields field, ulong value) { Set(field, (uint)value); Set(field + 1, (uint)(value >> 32)); }
protected internal void Set(UpdateFields field, float value) { Set(field, new UpdateValue { Single = value }); }
protected internal void Set(UpdateFields field, short value0, short value1) { Set(field, (ushort)value0, (ushort)value1); }