public ItemData(NormalInventoryItem inventoryItem, BaseItemType baseItemType) { _inventoryItem = inventoryItem; var item = inventoryItem.Item; Path = item.Path; var baseComponent = item.GetComponent <Base>(); isElder = baseComponent.isElder; isShaper = baseComponent.isShaper; var mods = item.GetComponent <Mods>(); Rarity = mods?.ItemRarity ?? ItemRarity.Normal; BIdentified = mods?.Identified ?? true; ItemLevel = mods?.ItemLevel ?? 0; isFractured = mods?.HaveFractured ?? false; ItemMods = mods?.ItemMods; UniqueName = mods?.UniqueName; var quality = item.GetComponent <Quality>(); ItemQuality = quality?.ItemQuality ?? 0; ClassName = baseItemType.ClassName; BaseName = baseItemType.BaseName; MapTier = item.HasComponent <Map>() ? item.GetComponent <Map>().Tier : 0; clientRect = _inventoryItem.GetClientRect().Center; }
// Set oItem's base item type. This will not be visible until the // item is refreshed (e.g. drop and take the item, or logging out // and back in). public static void SetBaseItemType(uint oItem, BaseItemType baseitem) { Internal.NativeFunctions.nwnxSetFunction(PLUGIN_NAME, "SetBaseItemType"); Internal.NativeFunctions.nwnxPushInt(baseitem.InternalValue); Internal.NativeFunctions.nwnxPushObject(oItem); Internal.NativeFunctions.nwnxCallFunction(); }
private void AddItem(int x, int y, Entity item) { var rendertItem = item.GetComponent <RenderItem>(); var baseC = item.GetComponent <Base>(); var itemSizeX = baseC.ItemCellsSizeX; var itemSizeY = baseC.ItemCellsSizeY; bool stackable = false; string itemName = ""; int stackSize = 0; int maxStackSize = 0; var stack = item.GetComponent <Stack>(); if (stack != null && stack.Info != null) { stackable = true; BaseItemType bit = GameController.Files.BaseItemTypes.Translate(item.Path); itemName = bit.BaseName; stackSize = stack.Size; maxStackSize = stack.Info.MaxStackSize; } AddItemToCells(x, y, itemSizeX, itemSizeY, stackable, itemName, stackSize, maxStackSize, rendertItem.ResourcePath); }
public static void SetGreaterWeaponSpecializationFeat(BaseItemType baseItem, FeatType feat) { Internal.NativeFunctions.nwnxSetFunction(PLUGIN_NAME, "SetGreaterWeaponSpecializationFeat"); Internal.NativeFunctions.nwnxPushInt(feat.InternalValue); Internal.NativeFunctions.nwnxPushInt(baseItem.InternalValue); Internal.NativeFunctions.nwnxCallFunction(); }
private ItemUsefulProperties initItem(IEntity item) { BaseItemType bit = GameController.Files.BaseItemTypes.Translate(item.Path); if (bit == null) { return(null); } string name = bit.BaseName; CraftingBase craftingBase = new CraftingBase(); if (Settings.Crafting) { foreach (CraftingBase cb in craftingBases .Where(cb => cb.Name .Equals(name, StringComparison.InvariantCultureIgnoreCase) || new Regex(cb.Name) .Match(name).Success)) { craftingBase = cb; break; } } return(new ItemUsefulProperties(name, item, craftingBase)); }
/// <summary>inventory /// "Skill Gem" /// </summary> /// <returns></returns> private List <setData> getQualityType(string itemtype) { List <setData> res = new List <setData>(); var stashPanel = GameController.Game.IngameState.IngameUi.StashElement; if (!stashPanel.IsVisible) { return(null); } var visibleStash = stashPanel.VisibleStash; if (visibleStash == null) { return(null); } IList <NormalInventoryItem> inventoryItems = ingameUI.StashElement.VisibleStash.VisibleInventoryItems; foreach (NormalInventoryItem item in inventoryItems) { BaseItemType baseItemType = GameController.Files.BaseItemTypes.Translate(item.Item.Path); if (baseItemType.ClassName.Contains(itemtype)) { int Quality = item.Item.GetComponent <Quality>().ItemQuality; if (Quality > 0) { if (Quality <= Settings.MaxGemQuality) { res.Add(new QualityGem(item, Quality)); } } } } return(res); }
/// <summary> /// Check if nBaseItemType fits in oTarget's inventory. /// Note: Does not check inside any container items possessed by oTarget. /// * nBaseItemType: a BASE_ITEM_* constant. /// * oTarget: a valid creature, placeable or item. /// Returns: TRUE if the baseitem type fits, FALSE if not or on error. /// </summary> public static bool GetBaseItemFitsInInventory(BaseItemType baseItemType, uint target) { Internal.NativeFunctions.StackPushObject(target); Internal.NativeFunctions.StackPushInteger(baseItemType.InternalValue); Internal.NativeFunctions.CallBuiltIn(944); return(Internal.NativeFunctions.StackPopInteger() == 1); }
public ItemData(NormalInventoryItem inventoryItem, BaseItemType baseItemType) { InventoryItem = inventoryItem; var item = inventoryItem.Item; Path = item.Path; var baseComponent = item.GetComponent <Base>(); isElder = baseComponent.isElder; isShaper = baseComponent.isShaper; var mods = item.GetComponent <Mods>(); Rarity = mods?.ItemRarity ?? ItemRarity.Normal; BIdentified = mods?.Identified ?? true; ItemLevel = mods?.ItemLevel ?? 0; isFractured = mods?.HaveFractured ?? false; var quality = item.GetComponent <Quality>(); ItemQuality = quality?.ItemQuality ?? 0; ClassName = baseItemType.ClassName; BaseName = baseItemType.BaseName; MapTier = item.HasComponent <Map>() ? item.GetComponent <Map>().Tier : 0; clientRect = InventoryItem.GetClientRect().Center; var sockets = item.GetComponent <Sockets>(); if (sockets != null) { NumberOfSockets = sockets.NumberOfSockets; LargestLinkSize = sockets.LargestLinkSize; } }
private void LoadItemTypes() { foreach (var i in RecordAddresses()) { var key = M.ReadStringU(M.Read <long>(i)); var baseItemType = new BaseItemType { Metadata = key, ClassName = M.ReadStringU(M.Read <long>(i + 0x10, 0)), Width = M.Read <int>(i + 0x18), Height = M.Read <int>(i + 0x1C), BaseName = M.ReadStringU(M.Read <long>(i + 0x20)), DropLevel = M.Read <int>(i + 0x30), Tags = new string[M.Read <long>(i + 0xA8)] }; var ta = M.Read <long>(i + 0xB0); for (var k = 0; k < baseItemType.Tags.Length; k++) { var ii = ta + 0x8 + 0x10 * k; baseItemType.Tags[k] = M.ReadStringU(M.Read <long>(ii, 0), 255); } var tmpTags = key.Split('/'); string tmpKey; if (tmpTags.Length > 3) { baseItemType.MoreTagsFromPath = new string[tmpTags.Length - 3]; for (var k = 2; k < tmpTags.Length - 1; k++) { // This Regex and if condition change Item Path Category e.g. TwoHandWeapons // To tag strings type e.g. two_hand_weapon tmpKey = Regex.Replace(tmpTags[k], @"(?<!_)([A-Z])", "_$1").ToLower().Remove(0, 1); if (tmpKey[tmpKey.Length - 1] == 's') { tmpKey = tmpKey.Remove(tmpKey.Length - 1); } baseItemType.MoreTagsFromPath[k - 2] = tmpKey; } } else { baseItemType.MoreTagsFromPath = new string[1]; baseItemType.MoreTagsFromPath[0] = ""; } ContentsAddr.Add(i, baseItemType); if (!Contents.ContainsKey(key)) { Contents.Add(key, baseItemType); } } }
public PoeItem(string name, ItemRarity rarity, int itemLevel, BaseItemType baseType, int minPhysicalDamage, int maxPhysicalDamage, double attackSpeed, IEnumerable <IItemMod> affixes) : this(name, rarity, itemLevel, baseType, affixes) { Damage = new WeaponDamage(attackSpeed, minPhysicalDamage, maxPhysicalDamage); }
public static void SetEpicWeaponOverwhelmingCriticalFeat(BaseItemType baseItem, FeatType feat) { Internal.NativeFunctions.nwnxSetFunction(PLUGIN_NAME, "SetEpicWeaponOverwhelmingCriticalFeat"); Internal.NativeFunctions.nwnxPushInt(feat.InternalValue); Internal.NativeFunctions.nwnxPushInt(baseItem.InternalValue); Internal.NativeFunctions.nwnxCallFunction(); }
public ItemData(NormalInventoryItem inventoryItem, BaseItemType baseItemType) { _inventoryItem = inventoryItem; var item = inventoryItem.Item; Path = item.Path; var mods = item.GetComponent <Mods>(); Rarity = mods.ItemRarity; BIdentified = mods.Identified; ItemLevel = mods.ItemLevel; var quality = item.GetComponent <Quality>(); ItemQuality = quality.ItemQuality; ClassName = baseItemType.ClassName; BaseName = baseItemType.BaseName; if (item.HasComponent <PoeHUD.Poe.Components.Map>()) { MapTier = item.GetComponent <PoeHUD.Poe.Components.Map>().Tier; } else { MapTier = 0; } }
public static void SetWeaponFinesseSize(BaseItemType baseItem, CreatureSizeType nCreatureSize) { Internal.NativeFunctions.nwnxSetFunction(PLUGIN_NAME, "SetWeaponFinesseSize"); Internal.NativeFunctions.nwnxPushInt(nCreatureSize.InternalValue); Internal.NativeFunctions.nwnxPushInt(baseItem.InternalValue); Internal.NativeFunctions.nwnxCallFunction(); }
public void handleCurrency(EntityWrapper entityWrapper) { BaseItemType ItmBase = null; ItmBase = GameController.Files.BaseItemTypes.Translate(entityWrapper.GetComponent <WorldItem>().ItemEntity.Path); if (ItmBase == null || !(ItmBase.ClassName.Contains("Currency") || ItmBase.ClassName.Contains("Leaguestone") || ItmBase.ClassName.Contains("Fragment") || ItmBase.ClassName.Contains("MiscMapItem"))) { return; } var path = entityWrapper.GetComponent <WorldItem>().ItemEntity.Path; var resourcePath = entityWrapper.GetComponent <WorldItem>().ItemEntity.GetComponent <RenderItem>().ResourcePath; ItemInfo tmp = new ItemInfo() { count = 1, ResourcePath = resourcePath, }; if (items.ContainsKey(path)) { items[path].count++; } else { items.Add(path, tmp); } }
public static ItemInstance MakeNaturalWeapon(int wielderSize) { ItemMaterial itemMaterial = MaterialHandler.GetMaterial("Flesh"); BaseItemType baseItem = new BaseItemType("Weapon", "A claw, fist or psuedopod.", "A claw, fist or psuedopod.", "Natural Weapon", "Natural Weapon", "Hand1", wielderSize * 40.0f, itemMaterial, "Weapon", "Martial Arts", "strikes", null, 0, 0); return(new ItemInstance(baseItem, new Vector2Int(-1, -1), true)); }
/// <summary> /// Updates the detail of detailBlock, base on item being select with left click. /// </summary> /// <param name="itemIndex">Item index.</param> /// <param name="Quantiy">Quantiy.</param> /// <param name="itemtype">Itemtype.</param> public void UpdateDetail(int itemIndex, int Quantiy, BaseItemType itemtype) { BaseItem tempItem = ItemDatabase.Instance.GetItem(itemIndex, (int)itemtype); itemIcon.sprite = tempItem.Item_Sprite; descText.text = "Description : " + tempItem.Item_Description; infoText.text = "Type : " + tempItem.Base_Item_Type + "\nPrice : " + tempItem.Item_Price; }
private bool IsOnThisItem(string modText, BaseItemType baseItemType) { var isOnThisItem = modText.Contains(_affix.MatchText); // Some mods look the same in the tooltip but differ in terms of what base type they can appear on. // Most commonly local and global versions of the same mod on weapons and non-weapons. var isValidOnBaseType = _itemLexicon.IsValidOnBaseType(_affix, baseItemType); return(isOnThisItem && isValidOnBaseType); }
public BaseItem(int id, string name, string desc, Sprite spr, int price, BaseItemType _type, bool stack, int _weight) { itemID = id; itemName = name; itemDescription = desc; itemIcon = spr; type = _type; isStackable = stack; itemWeight = _weight; }
/// @brief Override the max attack distance of ranged weapons. /// @param nBaseItem The baseitem id. /// @param fMax The maximum attack distance. Default is 40.0f. /// @param fMaxPassive The maximum passive attack distance. Default is 20.0f. Seems to be used by the engine to determine a new nearby target when needed. /// @param fPreferred The preferred attack distance. See the PrefAttackDist column in baseitems.2da, default seems to be 30.0f for ranged weapons. /// @note fMaxPassive should probably be lower than fMax, half of fMax seems to be a good start. fPreferred should be at least ~0.5f lower than fMax. public static void SetMaxRangedAttackDistanceOverride(BaseItemType nBaseItem, float fMax, float fMaxPassive, float fPreferred) { Internal.NativeFunctions.nwnxSetFunction(PLUGIN_NAME, "SetMaxRangedAttackDistanceOverride"); Internal.NativeFunctions.nwnxPushFloat(fPreferred); Internal.NativeFunctions.nwnxPushFloat(fMaxPassive); Internal.NativeFunctions.nwnxPushFloat(fMax); Internal.NativeFunctions.nwnxPushInt(nBaseItem.InternalValue); Internal.NativeFunctions.nwnxCallFunction(); }
private bool TryComplexParse(string baseItemTypeText, out BaseItemType baseItemType) { // This is likely not going to be perfect. foreach (var map in _lookup.Where(map => map.Value.All(baseItemTypeText.Contains))) { baseItemType = map.Key; return(true); } baseItemType = BaseItemType.CrudeBow; return(false); }
public bool TryParse(int itemLevel, BaseItemType baseItemType, string modText, out IItemMod parsedMod) { if (IsOnThisItem(modText, baseItemType)) { var roll = GetAffixRoll(modText); parsedMod = new ItemMod(_affix, roll.Item1, roll.Item2, itemLevel); return(true); } parsedMod = null; return(false); }
public PoeItem(string name, ItemRarity rarity, int itemLevel, BaseItemType baseType, IEnumerable <IItemMod> affixes) { Name = name; Rarity = rarity; ItemLevel = itemLevel; BaseType = baseType; Damage = NoWeaponDamage; _mods = affixes.Cast <ItemMod>().ToList(); }
//Meant for making things like magic blasts that will never actually appear in the world. public static ItemInstance Make(int number, int faces, string actionString, string skill) { int division = 50; int size = number * division; float weight = (float)faces / number; ItemMaterial material = new ItemMaterial("", 1, 0, weight); BaseItemType tempItem = new BaseItemType("", "", "", "Temporary weapon", "Temporary weapon", "None", size, material, "Weapon", skill, actionString, null, 0, 0, 0); return(new ItemInstance(tempItem, new Vector2Int(-1, -1), true)); }
public void GetByID_OneItem_ReturnsBaseItemType() { // Arrange BaseItemType entity = new BaseItemType { ID = 1 }; // Act MessageHub.Instance.Publish(new OnCacheObjectSet <BaseItemType>(entity)); // Assert Assert.AreNotSame(entity, _cache.GetByID(1)); }
protected AbstractBasicItem( GameController gameController, NormalInventoryItem normalInventoryItem) { Random = new Random(); GameController = gameController; NormalInventoryItem = normalInventoryItem; Item = normalInventoryItem.Item; BaseItemType = GameController.Files.BaseItemTypes.Translate(normalInventoryItem.Item.Path); ItemBaseComponent = Item.GetComponent<Base>(); if (!Item.HasComponent<Mods>()) return; ItemModsComponent = Item.GetComponent<Mods>(); }
private void DebugItem(Entity itemEntity) { ItemDebugLines = new List <string>(); LogMessage(itemEntity.Path, 0); var components = itemEntity.GetComponents(); var game = GameController.Game; ItemDebugLines.Add("Path: " + itemEntity.Path); ItemDebugLines.Add("Address: " + itemEntity.Address.ToString("x")); BaseItemType BIT = GameController.Files.BaseItemTypes.Translate(itemEntity.Path); if (BIT != null) { ItemDebugLines.Add("===== BaseItemTypeInfo: ======"); DebugProperty(typeof(BaseItemType), BIT, 1); ItemDebugLines.Add("=============================="); } foreach (var component in components) { ItemDebugLines.Add(""); Type compType = null; if (!PoeHUDComponents.TryGetValue(component.Key, out compType)) { ItemDebugLines.Add($"<{component.Key}> (Not implemented in PoeHUD)"); ItemDebugLines.Add($"{DIVIDER}Address: {component.Value.ToString("x")}"); continue; } ItemDebugLines.Add($"<{component.Key}>:"); object instance = Activator.CreateInstance(compType); var addrProp = compType.GetProperty("Address", setPropFlags); addrProp.SetValue(instance, component.Value); var gameProp = compType.GetProperty("Game", setPropFlags); gameProp.SetValue(instance, game); var mamoryProp = compType.GetProperty("M", setPropFlags); mamoryProp.SetValue(instance, Memory); DebugProperty(compType, instance, 1); } var path = Path.Combine(PluginDirectory, "_ItemDebugInfo.txt"); File.WriteAllText(path, string.Join(Environment.NewLine, ItemDebugLines.ToArray()).Replace(DIVIDER, "\t")); }
public bool IsValidOnBaseType(IAffix affix, BaseItemType baseItemType) { var affixType = affix.GetType(); if (!AffixItemCategoryValidCombos.ContainsKey(affixType)) { // No list of valid combos, so affix is valid on all types. return(true); } // If the affix has valid combos then the item category must be listed there for this // affix to be valid on this type. return(AffixItemCategoryValidCombos[affixType].Contains(GetItemCategory(baseItemType))); }
protected AbstractBasicItem( GameController gameController, NormalInventoryItem normalInventoryItem) { Random = new Random(); GameController = gameController; NormalInventoryItem = normalInventoryItem; Item = normalInventoryItem.Item; BaseItemType = GameController.Files.BaseItemTypes.Translate(normalInventoryItem.Item.Path); ItemBaseComponent = Item.GetComponent <Base>(); if (Item.HasComponent <Mods>()) { ItemModsComponent = Item.GetComponent <Mods>(); Veiled = GetModByGroup("Veiled") > 0; ItemRarity = ItemModsComponent.ItemRarity; } }
public async Task <IActionResult> DeleteCategory(int?id) { if (id == null) { return(NotFound()); } BaseItemType category = await _unitOfWorkAsync.BaseItemTypes .GetById((int)id); if (category == null) { return(NotFound()); } return(View(category)); }
public ItemData(NormalInventoryItem inventoryItem, BaseItemType baseItemType) { _inventoryItem = inventoryItem; var item = inventoryItem.Item; Path = item.Path; var mods = item.GetComponent <Mods>(); Rarity = mods.ItemRarity; BIdentified = mods.Identified; ItemLevel = mods.ItemLevel; var quality = item.GetComponent <Quality>(); ItemQuality = quality.ItemQuality; ClassName = baseItemType.ClassName; BaseName = baseItemType.BaseName; }
public void setBaseItemType(BaseItemType i) { baseItemType = i; }