internal static void InitTools() { foreach (var spell in SpellsRequiringTools) { foreach (var id in spell.RequiredToolIds) { if (id > 0) { var templ = ItemMgr.Templates.Get(id); if (templ != null) { if (spell.RequiredTools == null) { spell.RequiredTools = new ItemTemplate[spell.RequiredToolIds.Length]; } ArrayUtil.Add(ref spell.RequiredTools, templ); } } } if (spell.RequiredTools != null) { ArrayUtil.Prune(ref spell.RequiredTools); } } }
/// <summary> /// Adds a new TestCharacter and adds it to this Pool. /// </summary> /// <returns></returns> public TestCharacter Create() { var chr = CreateChar(DefaultIsNew, DefaultArchetype); OnCreate(chr); ArrayUtil.Add(ref m_chars, chr); return(chr); }
public void add_should_create_array_with_item_when_given_null_array() { int[] array = null; ArrayUtil.Add(ref array, 1); specify(() => array[0] == 1); specify(() => array.Length == 1); }
public void add_should_add_item_to_end_of_array_when_given_existing_array() { var array = new[] { 1, 2, 3 }; ArrayUtil.Add(ref array, 4); specify(() => array[2] == 3); specify(() => array[3] == 4); specify(() => array.Length == 4); }
internal void AddImage(Image image) { if (_isClosed) { _clientConductor.LingerResource(image.ManagedResource()); } else { _images = ArrayUtil.Add(_images, image); } }
public override void OnInspectorGUI() { DrawDefaultInspector(); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Set")) { SetMatTexture(loader); } if (GUILayout.Button("Clear")) { ClearMatTexture(loader); } if (GUILayout.Button("Scan")) { EditorAssetUtil.ScanFolder("MaterialTexLoader_ScanFolder_" + loader.name, FileType.Material, files => { if (loader.materials == null) { loader.materials = new MaterialTexData[0]; } foreach (FileInfo f in files) { string path = EditorAssetUtil.GetProjectRelativePath(f.FullName); MaterialTexData data = new MaterialTexData(); data.material = AssetDatabase.LoadAssetAtPath <Material>(path); if (data.material != null) { if (data.material.HasProperty(MaterialTexLoader.TEX1)) { Texture tex1 = data.material.GetTexture(MaterialTexLoader.TEX1); if (tex1 != null) { data.tex1.SetPath(tex1); } } if (data.material.HasProperty(MaterialTexLoader.TEX2)) { Texture tex2 = data.material.GetTexture(MaterialTexLoader.TEX2); if (tex2 != null) { data.tex2.SetPath(tex2); } } ArrayUtil.Add(ref loader.materials, data); } } EditorUtil.SetDirty(loader); }); } EditorGUILayout.EndHorizontal(); }
public override void OnInspectorGUI() { drawer.Draw(); EditorGUILayout.BeginHorizontal(); EditorGUIUtil.ObjectField <Transform>(ref searchRoot, true); GUI.enabled = searchRoot != null; if (!Application.isPlaying && GUILayout.Button("Search")) { HashSet <GameObject> set = new HashSet <GameObject>(handler.buttons); foreach (UIButton b in searchRoot.GetComponentsInChildren <UIButton>()) { if (!set.Contains(b.gameObject)) { ArrayUtil.Add(ref handler.buttons, b.gameObject); } } InvalidateArray(); } EditorGUILayout.EndHorizontal(); GUI.enabled = true; }
public override void OnInspectorGUI() { if (toggleInspector.Draw()) { InvalidateArray(); } EditorGUILayout.BeginHorizontal(); EditorGUIUtil.ObjectField <Transform>(ref searchRoot, true); GUI.enabled = searchRoot != null; if (GUILayout.Button("Search")) { HashSet <GameObject> set = new HashSet <GameObject>(handler.toggleObj); foreach (UIToggle t in searchRoot.GetComponentsInChildren <UIToggle>()) { if (!set.Contains(t.gameObject)) { ArrayUtil.Add(ref handler.toggleObj, t.gameObject); } } InvalidateArray(); } GUI.enabled = true; EditorGUILayout.EndHorizontal(); }
public override void OnInspectorGUI() { EditorGUILayout.HelpBox("ShanghaiWindy 地面载具履带管理&制作系统(预览显示左侧履带)", MessageType.Info); vehicleTrackData = (VehicleTrackData)target; if (EditorTarget == null) { EditorTarget = EditorGUILayout.ObjectField("Target Edit Object/目标编辑对象", EditorTarget, typeof(GameObject), true) as GameObject; } if (TrackTransform == null) { if (GUILayout.Button("Load Suspension Data/读取悬挂信息")) { TrackTransform = EditorTarget.transform.GetChild(0).Find("VehicleDynamics/RightWheel").gameObject; ActiveEditorTracker.sharedTracker.isLocked = true; for (int i = 0; i < vehicleTrackData.AdvanceLeftBones.Length; i++) { GameObject NodeObject = GameObject.CreatePrimitive(PrimitiveType.Sphere); LastInstancePoint = NodeObject; NodeObject.transform.localScale = new Vector3(0.1f, 0.1f, 0.1f); NodeObject.name = "Node" + (Points.Count + 1).ToString(); NodeObject.transform.position = vehicleTrackData.AdvanceLeftBones[i]; Points.Add(NodeObject); } } } if (TrackTransform != null) { EditorGUILayout.HelpBox("Lock Inspector/视窗锁定", MessageType.Error); if (GUILayout.Button("Unlock Inspector/取消锁定")) { ActiveEditorTracker.sharedTracker.isLocked = false; if (tcPreview != null) { DestroyImmediate(tcPreview.gameObject); } } if (Selection.activeGameObject != null) { if (Selection.activeGameObject.name.Contains("Node")) { if (GUILayout.Button("Gravity Affected Node/节点重力")) { vehicleTrackData.SpringNode = ArrayUtil <int> .Add(ref vehicleTrackData.SpringNode, int.Parse(Selection.activeGameObject.name.Replace("Node", null))); } } } EditorGUILayout.HelpBox(string.Format("Suspension Count/负重轮数量:{0}", TrackTransform.transform.childCount.ToString()), MessageType.None); if (GUILayout.Button("Create Node/创建节点")) { Points.Add(CreatePoint()); } if (GUILayout.Button("Delete Node/删除节点")) { DeletePoint(); } if (GUILayout.Button("Save/保存设置")) { Save(); } if (GUILayout.Button("Turn on Material Instancing/实例材质")) { Material NewInstance = Instantiate(vehicleTrackData.TrackMesh.GetComponentInChildren <MeshRenderer>().sharedMaterial); if (!NewInstance.enableInstancing) { NewInstance.enableInstancing = true; } string VehicleName = EditorTarget.transform.GetChild(0).name; Directory.CreateDirectory(string.Format("Assets/Res/Vehicles/Ground/res/Tracks/{0}/", VehicleName)); string MaterialPath = string.Format("Assets/Res/Vehicles/Ground/res/Tracks/{0}/{0}_Track.mat", VehicleName); string ModelPath = string.Format("Assets/Res/Vehicles/Ground/res/Tracks/{0}/{0}_Track.prefab", VehicleName); AssetDatabase.CopyAsset(AssetDatabase.GetAssetPath(vehicleTrackData.TrackMesh.GetInstanceID()), ModelPath); GameObject NewInstanceTrackModel = (GameObject)AssetDatabase.LoadAssetAtPath(ModelPath, typeof(GameObject)); NewInstanceTrackModel.GetComponentInChildren <MeshRenderer>().sharedMaterial = NewInstance; vehicleTrackData.TrackMesh = NewInstanceTrackModel; AssetDatabase.CreateAsset(NewInstance, MaterialPath); } if (tcPreview == null) { if (GUILayout.Button("Preview Track/预览悬挂")) { Preview(); Save(); } } else { if (GUILayout.Button("Close Preview/取消预览")) { RemovePreview(); } if (GUILayout.Button("Update Preview/更新预览")) { RemovePreview(); Preview(); Save(); } } } base.OnInspectorGUI(); foreach (GameObject Point in Points) { EditorGUILayout.HelpBox(string.Format("ID/序号: {0} Position/坐标: {1}", Point.name, Point.transform.position.ToString()), MessageType.None); } if (GUI.changed) { EditorUtility.SetDirty(target); } }
internal void InitializeTemplate() { if (this.Names == null) { this.Names = new string[8]; } if (this.Descriptions == null) { this.Descriptions = new string[8]; } if (this.DefaultDescription == null) { this.DefaultDescription = ""; } if (string.IsNullOrEmpty(this.DefaultName) || this.Id == 0U) { return; } this.ItemId = (Asda2ItemId)this.Id; this.RequiredSkill = SkillHandler.Get(this.RequiredSkillId); this.Set = ItemMgr.GetSet(this.SetId); this.Lock = LockEntry.Entries.Get <LockEntry>(this.LockId); this.RequiredFaction = FactionMgr.Get(this.RequiredFactionId); this.RequiredProfession = SpellHandler.Get(this.RequiredProfessionId); this.SubClassMask = (ItemSubClassMask)(1 << (int)(this.SubClass & (ItemSubClass.WeaponDagger | ItemSubClass.WeaponThrown)) ); this.EquipmentSlots = ItemMgr.EquipmentSlotsByInvSlot.Get <EquipmentSlot[]>((uint)this.InventorySlotType); this.InventorySlotMask = (InventorySlotTypeMask)(1 << (int)(this.InventorySlotType & (InventorySlotType.WeaponRanged | InventorySlotType.Cloak))); this.IsAmmo = this.InventorySlotType == InventorySlotType.Ammo; this.IsKey = this.Class == ItemClass.Key; this.IsBag = this.InventorySlotType == InventorySlotType.Bag; this.IsContainer = this.Class == ItemClass.Container || this.Class == ItemClass.Quiver; this.IsStackable = this.MaxAmount > 1 && this.RandomSuffixId == 0U && this.RandomPropertiesId == 0U; this.IsTwoHandWeapon = this.InventorySlotType == InventorySlotType.TwoHandWeapon; this.SetIsWeapon(); if (this.ToolCategory != ToolCategory.None) { ItemMgr.FirstTotemsPerCat[(uint)this.ToolCategory] = this; } if (this.GemPropertiesId != 0U) { this.GemProperties = EnchantMgr.GetGemproperties(this.GemPropertiesId); if (this.GemProperties != null) { this.GemProperties.Enchantment.GemTemplate = this; } } if (this.Sockets == null) { this.Sockets = new SocketInfo[3]; } else if (((IEnumerable <SocketInfo>) this.Sockets).Contains <SocketInfo>( (Func <SocketInfo, bool>)(sock => sock.Color != SocketColor.None))) { this.HasSockets = true; } if (this.Damages == null) { this.Damages = DamageInfo.EmptyArray; } if (this.Resistances == null) { this.Resistances = new int[7]; } if (this.SocketBonusEnchantId != 0U) { this.SocketBonusEnchant = EnchantMgr.GetEnchantmentEntry(this.SocketBonusEnchantId); } switch (this.Class) { case ItemClass.Weapon: this.ItemProfession = ItemProfessions.WeaponSubClassProfessions.Get <SkillId>((uint)this.SubClass); break; case ItemClass.Armor: this.ItemProfession = ItemProfessions.ArmorSubClassProfessions.Get <SkillId>((uint)this.SubClass); break; } int sheathType = (int)this.SheathType; if (this.Spells != null) { ArrayUtil.Prune <ItemSpell>(ref this.Spells); for (int index = 0; index < 5; ++index) { this.Spells[index].Index = (uint)index; this.Spells[index].FinalizeAfterLoad(); } } else { this.Spells = ItemSpell.EmptyArray; } this.UseSpell = ((IEnumerable <ItemSpell>) this.Spells).Where <ItemSpell>( (Func <ItemSpell, bool>)(itemSpell => { if (itemSpell.Trigger == ItemSpellTrigger.Use) { return(itemSpell.Spell != null); } return(false); })).FirstOrDefault <ItemSpell>(); if (this.UseSpell != null) { this.UseSpell.Spell.RequiredTargetType = this.RequiredTargetType; this.UseSpell.Spell.RequiredTargetId = this.RequiredTargetId; } this.EquipSpells = ((IEnumerable <ItemSpell>) this.Spells).Where <ItemSpell>((Func <ItemSpell, bool>)(spell => { if (spell.Trigger == ItemSpellTrigger.Equip) { return(spell.Spell != null); } return(false); })).Select <ItemSpell, Spell>((Func <ItemSpell, Spell>)(itemSpell => itemSpell.Spell)).ToArray <Spell>(); this.SoulstoneSpell = ((IEnumerable <ItemSpell>) this.Spells).Where <ItemSpell>( (Func <ItemSpell, bool>)(spell => { if (spell.Trigger == ItemSpellTrigger.Soulstone) { return(spell.Spell != null); } return(false); })).Select <ItemSpell, Spell>((Func <ItemSpell, Spell>)(itemSpell => itemSpell.Spell)) .FirstOrDefault <Spell>(); this.HitSpells = ((IEnumerable <ItemSpell>) this.Spells).Where <ItemSpell>((Func <ItemSpell, bool>)(spell => { if (spell.Trigger == ItemSpellTrigger.ChanceOnHit) { return(spell.Spell != null); } return(false); })).Select <ItemSpell, Spell>((Func <ItemSpell, Spell>)(itemSpell => itemSpell.Spell)).ToArray <Spell>(); this.ConsumesAmount = (this.Class == ItemClass.Consumable || ((IEnumerable <ItemSpell>) this.Spells).Contains <ItemSpell>( (Func <ItemSpell, bool>)(spell => spell.Trigger == ItemSpellTrigger.Consume))) && (this.UseSpell == null || !this.UseSpell.HasCharges); this.IsHearthStone = this.UseSpell != null && this.UseSpell.Spell.IsHearthStoneSpell; this.IsInventory = this.InventorySlotType != InventorySlotType.None && this.InventorySlotType != InventorySlotType.Bag && this.InventorySlotType != InventorySlotType.Quiver && this.InventorySlotType != InventorySlotType.Relic; if (this.SetId != ItemSetId.None) { ItemSet itemSet = ItemMgr.Sets.Get <ItemSet>((uint)this.SetId); if (itemSet != null) { int num = (int)ArrayUtil.Add <ItemTemplate>(ref itemSet.Templates, this); } } if (this.Mods != null) { ArrayUtil.TruncVals <StatModifier>(ref this.Mods); } else { this.Mods = StatModifier.EmptyArray; } this.IsCharter = this.Flags.HasFlag((Enum)ItemFlags.Charter); this.RandomSuffixFactor = EnchantMgr.GetRandomSuffixFactor(this); if (this.IsCharter) { this.Creator = (Func <Item>)(() => (Item) new PetitionCharter()); } else if (this.IsContainer) { this.Creator = (Func <Item>)(() => (Item) new Container()); } else { this.Creator = (Func <Item>)(() => new Item()); } }
public static T[] Add <T>(this T[] source, T element) { return(ArrayUtil.Add(source, element)); }
internal void InitializeTemplate() { if (Names == null) { Names = new string[(int)ClientLocale.End]; } if (Descriptions == null) { Descriptions = new string[(int)ClientLocale.End]; } if (DefaultDescription == null) { DefaultDescription = ""; } if (string.IsNullOrEmpty(DefaultName) || Id == 0) { // something's off with these entries return; } ItemId = (ItemId)Id; //Faction = (FactionId)Faction; // faction, 3.2.2 RequiredSkill = SkillHandler.Get(RequiredSkillId); Set = ItemMgr.GetSet(SetId); Lock = LockEntry.Entries.Get(LockId); RequiredFaction = FactionMgr.Get(RequiredFactionId); RequiredProfession = SpellHandler.Get(RequiredProfessionId); SubClassMask = (ItemSubClassMask)(1 << (int)SubClass); EquipmentSlots = ItemMgr.EquipmentSlotsByInvSlot.Get((uint)InventorySlotType); InventorySlotMask = (InventorySlotTypeMask)(1 << (int)InventorySlotType); IsAmmo = InventorySlotType == InventorySlotType.Ammo; IsKey = Class == ItemClass.Key; IsBag = InventorySlotType == InventorySlotType.Bag; IsContainer = Class == ItemClass.Container || Class == ItemClass.Quiver; // enchantables can't be stacked IsStackable = MaxAmount > 1 && RandomSuffixId == 0 && RandomPropertiesId == 0; IsTwoHandWeapon = InventorySlotType == InventorySlotType.TwoHandWeapon; SetIsWeapon(); if (ToolCategory != 0) // && TotemCategory != TotemCategory.SkinningKnife) { ItemMgr.FirstTotemsPerCat[(uint)ToolCategory] = this; } if (GemPropertiesId != 0) { GemProperties = EnchantMgr.GetGemproperties(GemPropertiesId); if (GemProperties != null) { GemProperties.Enchantment.GemTemplate = this; } } if (Sockets == null) { Sockets = new SocketInfo[ItemConstants.MaxSocketCount]; } else if (Sockets.Contains(sock => sock.Color != 0)) { HasSockets = true; } if (Damages == null) { Damages = DamageInfo.EmptyArray; } if (Resistances == null) { Resistances = new int[(int)DamageSchool.Count]; } if (SocketBonusEnchantId != 0) { SocketBonusEnchant = EnchantMgr.GetEnchantmentEntry(SocketBonusEnchantId); } switch (Class) { case ItemClass.Weapon: ItemProfession = ItemProfessions.WeaponSubClassProfessions.Get((uint)SubClass); break; case ItemClass.Armor: ItemProfession = ItemProfessions.ArmorSubClassProfessions.Get((uint)SubClass); break; } if (SheathType == SheathType.Undetermined) { // TODO: Read sheath-id from Item.dbc } // spells if (Spells != null) { ArrayUtil.Prune(ref Spells); for (int i = 0; i < 5; i++) { Spells[i].Index = (uint)i; Spells[i].FinalizeAfterLoad(); } } else { Spells = ItemSpell.EmptyArray; } UseSpell = Spells.Where(itemSpell => itemSpell.Trigger == ItemSpellTrigger.Use && itemSpell.Spell != null).FirstOrDefault(); if (UseSpell != null) { UseSpell.Spell.RequiredTargetType = RequiredTargetType; UseSpell.Spell.RequiredTargetId = RequiredTargetId; } EquipSpells = Spells.Where(spell => spell.Trigger == ItemSpellTrigger.Equip && spell.Spell != null).Select(itemSpell => itemSpell.Spell).ToArray(); SoulstoneSpell = Spells.Where(spell => spell.Trigger == ItemSpellTrigger.Soulstone && spell.Spell != null).Select(itemSpell => itemSpell.Spell).FirstOrDefault(); HitSpells = Spells.Where(spell => spell.Trigger == ItemSpellTrigger.ChanceOnHit && spell.Spell != null).Select(itemSpell => itemSpell.Spell).ToArray(); if (UseSpell != null && (UseSpell.Id == SpellId.Learning || UseSpell.Id == SpellId.Learning_2)) { // Teaching TeachSpell = Spells.Where(spell => spell.Trigger == ItemSpellTrigger.Consume).FirstOrDefault(); } ConsumesAmount = (Class == ItemClass.Consumable || Spells.Contains(spell => spell.Trigger == ItemSpellTrigger.Consume)) && (UseSpell == null || !UseSpell.HasCharges); IsHearthStone = UseSpell != null && UseSpell.Spell.IsHearthStoneSpell; IsInventory = InventorySlotType != InventorySlotType.None && InventorySlotType != InventorySlotType.Bag && InventorySlotType != InventorySlotType.Quiver && InventorySlotType != InventorySlotType.Relic; // find set if (SetId != 0) { var set = ItemMgr.Sets.Get((uint)SetId); if (set != null) { ArrayUtil.Add(ref set.Templates, this); } } // truncate arrays if (Mods != null) { ArrayUtil.TruncVals(ref Mods); } else { Mods = StatModifier.EmptyArray; } IsCharter = Flags.HasFlag(ItemFlags.Charter); RandomSuffixFactor = EnchantMgr.GetRandomSuffixFactor(this); if (IsCharter) { Creator = () => new PetitionCharter(); } else if (IsContainer) { Creator = () => new Container(); } else { Creator = () => new Item(); } }
public void Add(T row) { T[] rows = GetArray(); ArrayUtil.Add(ref rows, row); Set(rows); }
internal void InitializeTemplate() { if (Names == null) { Names = new string[8]; } if (Descriptions == null) { Descriptions = new string[8]; } if (DefaultDescription == null) { DefaultDescription = ""; } if (string.IsNullOrEmpty(DefaultName) || Id == 0U) { return; } ItemId = (Asda2ItemId)Id; RequiredSkill = SkillHandler.Get(RequiredSkillId); Set = ItemMgr.GetSet(SetId); Lock = LockEntry.Entries.Get(LockId); RequiredFaction = FactionMgr.Get(RequiredFactionId); RequiredProfession = SpellHandler.Get(RequiredProfessionId); SubClassMask = (ItemSubClassMask)(1 << (int)(SubClass & (ItemSubClass.WeaponDagger | ItemSubClass.WeaponThrown)) ); EquipmentSlots = ItemMgr.EquipmentSlotsByInvSlot.Get((uint)InventorySlotType); InventorySlotMask = (InventorySlotTypeMask)(1 << (int)(InventorySlotType & (InventorySlotType.WeaponRanged | InventorySlotType.Cloak))); IsAmmo = InventorySlotType == InventorySlotType.Ammo; IsKey = Class == ItemClass.Key; IsBag = InventorySlotType == InventorySlotType.Bag; IsContainer = Class == ItemClass.Container || Class == ItemClass.Quiver; IsStackable = MaxAmount > 1 && RandomSuffixId == 0U && RandomPropertiesId == 0U; IsTwoHandWeapon = InventorySlotType == InventorySlotType.TwoHandWeapon; SetIsWeapon(); if (ToolCategory != ToolCategory.None) { ItemMgr.FirstTotemsPerCat[(uint)ToolCategory] = this; } if (GemPropertiesId != 0U) { GemProperties = EnchantMgr.GetGemproperties(GemPropertiesId); if (GemProperties != null) { GemProperties.Enchantment.GemTemplate = this; } } if (Sockets == null) { Sockets = new SocketInfo[3]; } else if (Sockets.Contains( sock => sock.Color != SocketColor.None)) { HasSockets = true; } if (Damages == null) { Damages = DamageInfo.EmptyArray; } if (Resistances == null) { Resistances = new int[7]; } if (SocketBonusEnchantId != 0U) { SocketBonusEnchant = EnchantMgr.GetEnchantmentEntry(SocketBonusEnchantId); } switch (Class) { case ItemClass.Weapon: ItemProfession = ItemProfessions.WeaponSubClassProfessions.Get((uint)SubClass); break; case ItemClass.Armor: ItemProfession = ItemProfessions.ArmorSubClassProfessions.Get((uint)SubClass); break; } int sheathType = (int)SheathType; if (Spells != null) { ArrayUtil.Prune(ref Spells); for (int index = 0; index < 5; ++index) { Spells[index].Index = (uint)index; Spells[index].FinalizeAfterLoad(); } } else { Spells = ItemSpell.EmptyArray; } UseSpell = Spells.Where( itemSpell => { if (itemSpell.Trigger == ItemSpellTrigger.Use) { return(itemSpell.Spell != null); } return(false); }).FirstOrDefault(); if (UseSpell != null) { UseSpell.Spell.RequiredTargetType = RequiredTargetType; UseSpell.Spell.RequiredTargetId = RequiredTargetId; } EquipSpells = Spells.Where(spell => { if (spell.Trigger == ItemSpellTrigger.Equip) { return(spell.Spell != null); } return(false); }).Select(itemSpell => itemSpell.Spell).ToArray(); SoulstoneSpell = Spells.Where( spell => { if (spell.Trigger == ItemSpellTrigger.Soulstone) { return(spell.Spell != null); } return(false); }).Select(itemSpell => itemSpell.Spell) .FirstOrDefault(); HitSpells = Spells.Where(spell => { if (spell.Trigger == ItemSpellTrigger.ChanceOnHit) { return(spell.Spell != null); } return(false); }).Select(itemSpell => itemSpell.Spell).ToArray(); ConsumesAmount = (Class == ItemClass.Consumable || Spells.Contains( spell => spell.Trigger == ItemSpellTrigger.Consume)) && (UseSpell == null || !UseSpell.HasCharges); IsHearthStone = UseSpell != null && UseSpell.Spell.IsHearthStoneSpell; IsInventory = InventorySlotType != InventorySlotType.None && InventorySlotType != InventorySlotType.Bag && InventorySlotType != InventorySlotType.Quiver && InventorySlotType != InventorySlotType.Relic; if (SetId != ItemSetId.None) { ItemSet itemSet = ItemMgr.Sets.Get((uint)SetId); if (itemSet != null) { int num = (int)ArrayUtil.Add(ref itemSet.Templates, this); } } if (Mods != null) { ArrayUtil.TruncVals(ref Mods); } else { Mods = StatModifier.EmptyArray; } IsCharter = Flags.HasFlag(ItemFlags.Charter); RandomSuffixFactor = EnchantMgr.GetRandomSuffixFactor(this); if (IsCharter) { Creator = () => (Item) new PetitionCharter(); } else if (IsContainer) { Creator = () => (Item) new Container(); } else { Creator = () => new Item(); } }