public List<IItemAttributeCreator> Create(ItemTypeTable itemType) { var creatorList = new List<IItemAttributeCreator> {new DefaultAttributeCreator()}; //if (Item.IsWeapon(itemType)) creatorList.Add(new WeaponAttributeCreator()); //else if (Item.IsPotion(itemType)) creatorList.Add(new PotionAttributeCreator()); return creatorList; }
public static List<int> HierarchyToHashList(ItemTypeTable itemType) { List<int> result = new List<int>(); var types = HierarchyToList(itemType); foreach (var type in types) { result.Add(type.Hash); } return result; }
public static List<ItemTypeTable> HierarchyToList(ItemTypeTable itemType) { List<ItemTypeTable> result = new List<ItemTypeTable>(); var curType = itemType; if (curType != null) { result.Add(curType); while (curType.ParentType != -1) { curType = ItemTypes[curType.ParentType]; result.Add(curType); } } return result; }
public static bool IsDye(ItemTypeTable itemType) { return ItemGroup.IsSubType(itemType, "Dye"); }
public static bool IsJournalOrScroll(ItemTypeTable itemType) { return ItemGroup.IsSubType(itemType, "Scroll") || ItemGroup.IsSubType(itemType, "Book"); }
public static bool IsRuneOrJewel(ItemTypeTable itemType) { return ItemGroup.IsSubType(itemType, "Gem") || ItemGroup.IsSubType(itemType, "SpellRune"); }
public static bool IsAccessory(ItemTypeTable itemType) { return ItemGroup.IsSubType(itemType, "Jewelry"); }
public static bool IsGold(ItemTypeTable itemType) { return ItemGroup.IsSubType(itemType, "Gold"); }
public static bool IsBelt(ItemTypeTable itemType) { return ItemGroup.IsSubType(itemType, "Belt"); }
public static bool IsOffhand(ItemTypeTable itemType) { return ItemGroup.IsSubType(itemType, "Offhand"); }
public static bool Is2H(ItemTypeTable type) { return (type.Array[0] & 0x400) != 0; }
public static bool IsSubType(ItemTypeTable type, int rootTypeHash) { if (type == null) return false; if (type.Hash == rootTypeHash) return true; var curType = type; while (curType.ParentType != -1) { curType = ItemTypes[curType.ParentType]; if (curType.Hash == rootTypeHash) { return true; } } return false; }
public static bool IsSubType(ItemTypeTable type, string rootTypeName) { return IsSubType(type, StringHashHelper.HashItemName(rootTypeName)); }
public static bool IsWeapon(ItemTypeTable itemType) { return ItemGroup.IsSubType(itemType, "Weapon"); }
// generates a random item from given type category. // we can also set a difficulty mode parameter here, but it seems current db doesnt have nightmare or hell-mode items with valid snoId's /raist. public static Item GenerateRandom(Mooege.Core.GS.Actors.Actor player, ItemTypeTable type) { var itemDefinition = GetRandom(Items.Values .Where(def => ItemGroup .HierarchyToHashList(ItemGroup.FromHash(def.ItemType1)).Contains(type.Hash)).ToList()); return CreateItem(player, itemDefinition); }
public static bool IsArmor(ItemTypeTable itemType) { return ItemGroup.IsSubType(itemType, "Armor"); }
public static bool IsHealthGlobe(ItemTypeTable itemType) { return ItemGroup.IsSubType(itemType, "HealthGlyph"); }
public static bool Is2H(ItemTypeTable itemType) { return ItemGroup.Is2H(itemType); }
// generates a random item from given type category. // we can also set a difficulty mode parameter here, but it seems current db doesnt have nightmare or hell-mode items with valid snoId's /raist. public static Item GenerateRandom(Mooege.Core.GS.Actors.Actor player, ItemTypeTable type) { // TODO var itemDefinition = GetRandom(Items.Values.ToList()); return CreateItem(player, itemDefinition); }