/// <summary> /// not used in this game /// </summary> /// <param name="slot"></param> /// <returns></returns> public bool CanBeEquippedInSlot(EquipmentSlot slot) { if (slot == EquipmentSlot.Weapon) return true; return false; }
/// <summary> /// not used in this game /// </summary> /// <param name="slot"></param> /// <returns></returns> public bool CanBeEquippedInSlot(EquipmentSlot slot) { if (slot == EquipmentSlot.RightHand) return true; return false; }
/// <summary> /// When overridden in the derived class, notifies the owner of this object instance /// that an equipment slot has changed. /// </summary> /// <param name="slot">The slot that changed.</param> /// <param name="graphicIndex">The new graphic index of the slot.</param> protected override void SendSlotUpdate(EquipmentSlot slot, GrhIndex? graphicIndex) { using (var msg = ServerPacket.UpdateEquipmentSlot(slot, graphicIndex)) { User.Send(msg, ServerMessageType.GUIItems); } }
void CreateItemSlots(int row, int column, EquipmentSlot slot) { var loc = new Vector2(row, column); var pos = _itemSize * loc; new EquippedItemPB(this, pos, slot); }
public ISWeapon() { _minDamage = 0; _durability = 1; _maxDurability = 100; equipmentSlot = EquipmentSlot.Hands; }
public void Clone( ISWeapon weapon) { base.Clone(weapon); _durability = weapon.Durability; _maxDurability = weapon.MaxDurability; equipmentSlot = weapon.equipmentSlot; _prefab = weapon.Prefab; }
private void EquipItem(EquipmentSlot part, int uid) { if (!IsEmpty(part)) // Uh oh we are confused about something! But it's better to just do what the server says { UnEquipItem(part); } EquippedEntities.Add(part, Owner.EntityManager.GetEntity(uid)); }
public ISArmor() { _curArmor = 0; _maxArmor = 0; _durability = 1; _maxDurability = 1; equipmentSlot = EquipmentSlot.Chest; }
public ISArmor() { _curArmor = 0; _maxArmor = 100; _durability = 1; _maxDurability = 100; equipmentSlot = EquipmentSlot.Torso; }
public ISWeapon() { _minDamage = 0; _durability = 1; _maxDurability = 1; _prefab = null; equipmentSlot = EquipmentSlot.Weapon; }
void Start() { _equipment = GetComponent<Equipment>(); _camera = Camera.main.GetComponent<CameraController>(); rightHand = _equipment.First(slot => ((slot.region == EquipmentRegion.Hands) && slot.tags.Contains(EquipmentTag.Held, EquipmentTag.Right))); leftHand = _equipment.First(slot => ((slot.region == EquipmentRegion.Hands) && slot.tags.Contains(EquipmentTag.Held, EquipmentTag.Left))); }
// TODO: remove method public Item Get(EquipmentSlot slot) { Item result; if (TryGet(slot, out result)) { return result; } return null; }
public void Clone(ISArmor armor) { base.Clone(armor); _curArmor = armor._curArmor; _maxArmor = armor._maxArmor; _durability = armor.Durability; _maxDurability = armor.MaxDurability; equipmentSlot = armor.equipmentSlot; _prefab = armor.Prefab; }
public override void SetParameter(ComponentParameter parameter) { base.SetParameter(parameter); switch (parameter.MemberName) { case "wearloc": wearloc = (EquipmentSlot) Enum.Parse(typeof (EquipmentSlot), parameter.GetValue<string>()); break; } }
//CONSTRUCTORS public ChangeAttackTypeWindow(int left, int top, int width, int height, string title) : base(left, top, width, height, title) { _pc = null; slot1 = null; slot2 = null; selectedWeapon = 1; selectedDamageType1 = 1; selectedDamageType2 = 1; twoWeapons = false; hasTwoTypeDamage1 = false; hasTwoTypeDamage2 = false; }
/// <summary> /// Returns a default item that can be equipped to the given slot /// </summary> public ItemTemplate GetDefault(EquipmentSlot slot) { var template = m_defaultItemTemplates[(int)slot]; if (template == null) { Setup.EnsureItemsLoaded(); foreach (var temp in ItemMgr.Templates) { if (temp != null && temp.EquipmentSlots.Contains(slot)) { m_defaultItemTemplates[(int)slot] = template = temp; } } } Assert.IsNotNull(template); return template; }
private void SetCharacter() { //are we looking for player or npc? if (CharacterID == 0) { GameObject player = GameObject.Find("Player"); if (player != null) { Transform childPart = player.transform.FindChild(slotName); if (childPart != null) { equipmentSlot = childPart.GetComponent<EquipmentSlot>(); } } } //TODO (Jukki) NPC previews? Party members }
private void EquippedBy(int uid, EquipmentSlot wearloc) { Owner.SendMessage(this, ComponentMessageType.ItemEquipped); Owner.AddComponent(ComponentFamily.Mover, Owner.EntityManager.ComponentFactory.GetComponent("SlaveMoverComponent")); Owner.SendMessage(this, ComponentMessageType.SlaveAttach, uid); switch (wearloc) { case EquipmentSlot.Back: SendDrawDepth(DrawDepth.MobOverAccessoryLayer); break; case EquipmentSlot.Belt: SendDrawDepth(DrawDepth.MobUnderAccessoryLayer); break; case EquipmentSlot.Ears: SendDrawDepth(DrawDepth.MobUnderAccessoryLayer); break; case EquipmentSlot.Eyes: SendDrawDepth(DrawDepth.MobUnderAccessoryLayer); break; case EquipmentSlot.Feet: SendDrawDepth(DrawDepth.MobUnderClothingLayer); break; case EquipmentSlot.Hands: SendDrawDepth(DrawDepth.MobOverAccessoryLayer); break; case EquipmentSlot.Head: SendDrawDepth(DrawDepth.MobOverClothingLayer); break; case EquipmentSlot.Inner: SendDrawDepth(DrawDepth.MobUnderClothingLayer); break; case EquipmentSlot.Mask: SendDrawDepth(DrawDepth.MobUnderAccessoryLayer); break; case EquipmentSlot.Outer: SendDrawDepth(DrawDepth.MobOverClothingLayer); break; } }
void HandleHand(EquipmentSlot slot, bool down, bool interact) { if (slot.occupied) { var item = slot.item; if (down && interact && item.CanUnequip(slot)) { slot.Unequip(); item.OnDrop(); item.GetComponent<Rigidbody>().AddForce( (Vector3.up + _camera.transform.forward) * 200.0f); } } else if (down) { Item highlightedItem = null; var pos = slot.attachment.transform.position; var distance = pickupRange; var colliders = Physics.OverlapSphere(pos, pickupRange); foreach (var col in colliders) { var item = col.GetComponentInParent<Item>(); if ((item == null) || item.equipped || !item.CanEquip(slot)) continue; var dis = Vector3.Distance(pos, col.ClosestPointOnBounds(pos)); if (dis <= distance) { highlightedItem = item; distance = dis; } } if (highlightedItem != null) { highlightedItem.highlighted = true; if (interact) { highlightedItem.OnPickup(); slot.Equip(highlightedItem); } } } }
public EquipmentSlotUi(EquipmentSlot slot, IPlayerManager playerManager, IResourceManager resourceManager, IUserInterfaceManager userInterfaceManager) { _playerManager = playerManager; _resourceManager = resourceManager; _userInterfaceManager = userInterfaceManager; _color = Color.White; AssignedSlot = slot; _buttonSprite = _resourceManager.GetSprite("slot"); _textSprite = new TextSprite(slot + "UIElementSlot", slot.ToString(), _resourceManager.GetFont("CALIBRI")) { ShadowColor = Color.Black, ShadowOffset = new Vector2D(1, 1), Shadowed = true, Color = Color.White }; Update(0); }
public bool IsEquipped(Entity entity, EquipmentSlot slot) { return(EquippedEntities.ContainsKey(slot) && EquippedEntities[slot] == entity); }
public void Equip(Item item, EquipmentSlot slot) { slot.Item = item; ItemEquipped.Raise(); }
public Equipment GetEquipment(EquipmentSlot slot) { return(currentEquipment [(int)slot]); }
private double GetRating(IWowItem item, EquipmentSlot slot) { double rating = 0; if (item.Stats.TryGetValue("ITEM_MOD_CRIT_MELEE_RATING_SHORT", out string meleeCritString) && double.TryParse(meleeCritString, System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out double meleeCrit)) { rating += 2f * meleeCrit; } if (item.Stats.TryGetValue("ITEM_MOD_CRIT_RATING_SHORT", out string critString) && double.TryParse(critString, System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out double crit)) { rating += 2f * crit; } if (item.Stats.TryGetValue("ITEM_MOD_AGILITY_SHORT", out string agilityString) && double.TryParse(agilityString, System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out double agility)) { rating += 1f * agility; } if (item.Stats.TryGetValue("ITEM_MOD_ATTACK_POWER_SHORT", out string attackString) && double.TryParse(attackString, System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out double attack)) { rating += 0.25f * attack; } if (item.Stats.TryGetValue("ITEM_MOD_STRENGTH_SHORT", out string strengthString) && double.TryParse(strengthString, System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out double strength)) { rating += 0.5f * strength; } if (slot.Equals(EquipmentSlot.INVSLOT_OFFHAND) || slot.Equals(EquipmentSlot.INVSLOT_MAINHAND)) { // also 2nd weapons if (item.GetType() == typeof(WowWeapon) && ((WowWeapon)item).WeaponType.Equals(WeaponType.DAGGERS)) { if (item.Stats.TryGetValue("ITEM_MOD_DAMAGE_PER_SECOND_SHORT", out string dpsString) && double.TryParse(dpsString, System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out double dps)) { rating += 2f * dps; } } else { rating = 0; } } else if (!(slot.Equals(EquipmentSlot.INVSLOT_NECK) || slot.Equals(EquipmentSlot.INVSLOT_RING1) || slot.Equals(EquipmentSlot.INVSLOT_RING2) || slot.Equals(EquipmentSlot.INVSLOT_TRINKET1) || slot.Equals(EquipmentSlot.INVSLOT_TRINKET2))) { // armor stats if (item.Stats.TryGetValue("RESISTANCE0_NAME", out string armorString) && double.TryParse(armorString, System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out double armor)) { rating += 0.05f * armor; } if (item.Stats.TryGetValue("ITEM_MOD_DODGE_RATING_SHORT", out string dodgeString) && double.TryParse(dodgeString, System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out double dodge)) { rating += 0.5f * dodge; } } return(rating); }
private void ShowItem() { this.ResetInfoGroups(); if (this.ItemToShow_ != null) { Item I = this.ItemToShow_; // Common Fields this.picIcon.Image = I.GetIcon(); this.ttToolTip.SetToolTip(this.picIcon, I.GetFieldText("icon")); this.txtID.Text = I.GetFieldText("id"); this.txtResourceID.Text = I.GetFieldText("resource-id"); this.txtType.Text = I.GetFieldText("type"); this.txtStackSize.Text = I.GetFieldText("stack-size"); this.txtName.Text = I.GetFieldText("name"); this.txtDescription.Text = I.GetFieldText("description"); this.txtFlags.Text = I.GetFieldText("flags"); this.txtValidTargets.Text = I.GetFieldText("valid-targets"); // English Fields if (I.HasField("log-name-singular")) { this.txtSingular.Text = I.GetFieldText("log-name-singular"); this.txtPlural.Text = I.GetFieldText("log-name-plural"); this.ShowInfoGroup(this.grpLogStrings); } // Furniture Fields if (I.HasField("element")) { this.txtElement.Text = I.GetFieldText("element"); this.txtStorage.Text = I.GetFieldText("storage-slots"); this.ShowInfoGroup(this.grpFurnitureInfo); } // Usable Item Fields if (I.HasField("activation-time")) { this.txtActivationTime.Text = I.GetFieldText("activation-time"); this.ShowInfoGroup(this.grpUsableItemInfo); } // Equipment Fields if (I.HasField("level")) { this.txtLevel.Text = I.GetFieldText("level"); this.txtJobs.Text = I.GetFieldText("jobs"); this.txtSlots.Text = I.GetFieldText("slots"); this.txtRaces.Text = I.GetFieldText("races"); this.ShowInfoGroup(this.grpEquipmentInfo); } // Armor Fields if (I.HasField("shield-size") && I.HasField("slots")) { EquipmentSlot Slots = (EquipmentSlot)I.GetFieldValue("slots"); if ((Slots & EquipmentSlot.Sub) != 0) { this.txtShieldSize.Text = I.GetFieldText("shield-size"); this.ShowInfoGroup(this.grpShieldInfo); } } // Weapon Fields // FIXME: Pet Food should have an alternative group (with just Amount Healed) if (I.HasField("damage")) { this.txtDamage.Text = I.GetFieldText("damage"); this.txtDelay.Text = I.GetFieldText("delay"); this.txtDPS.Text = I.GetFieldText("dps"); this.txtSkill.Text = I.GetFieldText("skill"); this.txtJugSize.Text = I.GetFieldText("jug-size"); this.ShowInfoGroup(this.grpWeaponInfo); } // Puppet Item Fields if (I.HasField("puppet-slot")) { this.txtPuppetSlot.Text = I.GetFieldText("puppet-slot"); this.txtElementCharge.Text = I.GetFieldText("element-charge"); this.ShowInfoGroup(this.grpPuppetItemInfo); } // Enchantment Fields if (I.HasField("max-charges")) { byte MaxCharges = (byte)I.GetFieldValue("max-charges"); if (MaxCharges > 0) { this.txtMaxCharges.Text = I.GetFieldText("max-charges"); this.txtCastTime.Text = I.GetFieldText("casting-time"); this.txtEquipDelay.Text = I.GetFieldText("use-delay"); this.txtReuseTimer.Text = I.GetFieldText("reuse-delay"); this.ShowInfoGroup(this.grpEnchantmentInfo); } } } else { this.ttToolTip.SetToolTip(this.picIcon, null); this.picIcon.Image = null; this.txtID.Text = this.txtResourceID.Text = String.Empty; this.txtType.Text = this.txtStackSize.Text = String.Empty; this.txtName.Text = String.Empty; this.txtDescription.Text = String.Empty; this.txtFlags.Text = String.Empty; this.txtValidTargets.Text = String.Empty; } }
public void DisplayEquipmentSlot() { equipmentSlot = (EquipmentSlot)EditorGUILayout.EnumPopup("Equipment Slot", equipmentSlot); }
private void Initialize(Stats stats, EquipmentSlot[] slots) { Stats = stats; Slots.Value = slots; }
public Item this[EquipmentSlot slot] { get { return m_inventory.Items[(int)slot]; } }
public int GetMaxEquipment(EquipmentSlot slot) { return(maxEquipment[slot]); }
private static bool EquipmentSlot_FireBlackhole(On.RoR2.EquipmentSlot.orig_FireBlackhole orig, EquipmentSlot self) { var original = orig(self); if (original) { self.subcooldownTimer = cfgBlackholeCooldown; } return(original); }
private static bool EquipmentSlot_FireSaw(On.RoR2.EquipmentSlot.orig_FireSaw orig, EquipmentSlot self) { if (CanDeploy(self, PerPlayerDeployableType.Saw)) { self.subcooldownTimer = cfgSawCooldown; return(orig(self)); } return(false); }
private static bool EquipmentSlot_FireGateway(On.RoR2.EquipmentSlot.orig_FireGateway orig, EquipmentSlot self) { var original = orig(self); if (original) { self.subcooldownTimer = cfgGatewayCooldown; } return(original); }
private bool EquipmentSlot_PerformEquipmentAction(On.RoR2.EquipmentSlot.orig_PerformEquipmentAction orig, EquipmentSlot self, EquipmentDef equipmentDef) { var retv = orig(self, equipmentDef); if (self && self.characterBody) { var count = GetCount(self.characterBody); if (count <= 0) { return(retv); } var pts = self.characterBody.gameObject.GetComponent <PixieTubeStopwatch>(); if (!pts) { pts = self.characterBody.gameObject.AddComponent <PixieTubeStopwatch>(); } if (pts.CheckProcEquipment()) { for (var i = 0; i < count; i++) { SpawnWisp(self.characterBody.corePosition, self.characterBody.teamComponent ? self.characterBody.teamComponent.teamIndex : TeamIndex.None); } } } return(retv); }
public Equipment(string name, double power, double armor, EquipmentSlot equipmentSlot, int dropChance) : base(name, power, dropChance) { this.equipmentSlot = equipmentSlot; this.armor = armor; }
public EquipmentItem GetEquipmentAt(EquipmentSlot slot) { return(Equipment.GetValueOrDefault(slot)); }
/// <summary> /// Gets the item at the given InventorySlot (or null) /// </summary> public Item this[EquipmentSlot slot] { get { return m_Items[(int)slot]; } set { this[(int)slot] = value; } }
public bool SlotHk(Slot slot, EquipmentSlot slotName) { return(true); }
/// <summary> /// Tries to add a single new item with the given template to the given slot. /// Make sure the given targetSlot is valid before calling this method. /// </summary> public InventoryError TryAdd(ItemTemplate template, EquipmentSlot targetSlot) { var amount = 1; return TryAdd(template, ref amount, (int)targetSlot, true); }
public Item getItem(EquipmentSlot index) { return(items[(int)index]); }
public void UpdateEquipment() { Inventory inventory = _world.playerObj.GetComponent <InventoryController>().inventory; for (int i = 0; i < inventory.items.Count; i++) { bool haveSlot = false; for (int j = 0; j < equipmentSlots.Length; j++) { EquipmentSlot slot = equipmentSlots[j]; if (inventory.items[i].item.id == slot.GetId() && slot.GetCount() > 0) { haveSlot = true; slot.SetCount(inventory.items[i].count); if (inventory.activeIndex == i) { slot.Select(); } break; } } if (!haveSlot) { for (int j = 0; j < equipmentSlots.Length; j++) { EquipmentSlot slot = equipmentSlots[j]; if (slot.GetCount() == 0) { slot.SetId(inventory.items[i].item.id); slot.SetCount(inventory.items[i].count); if (inventory.activeIndex == i) { slot.Select(); } break; } } } } for (int i = 0; i < equipmentSlots.Length; i++) { EquipmentSlot slot = equipmentSlots[i]; bool resetSlot = true; for (int j = 0; j < inventory.items.Count; j++) { if (inventory.items[j].item.id == slot.GetId() && inventory.items[j].count > 0 && slot.GetCount() > 0) { resetSlot = false; break; } } if (resetSlot) { slot.SetCount(0); slot.Deselect(); } } }
// TODO: Add an index for EquipmentSlot? public GameEntity GetEquippedItem(EquipmentSlot slot, GameEntity actor, GameManager manager) => manager.EntityItemsToContainerRelationship[actor.Id].FirstOrDefault(item => item.Item.EquippedSlot == slot);
public bool IsEmpty(EquipmentSlot slot) { var isEmpty = true; if (slot.HasFlag(EquipmentSlot.Accessory1)) { isEmpty &= IsSlotEmpty(EquipmentSlot.Accessory1); } if (slot.HasFlag(EquipmentSlot.Accessory2)) { isEmpty &= IsSlotEmpty(EquipmentSlot.Accessory2); } if (slot.HasFlag(EquipmentSlot.Accessory3)) { isEmpty &= IsSlotEmpty(EquipmentSlot.Accessory3); } if (slot.HasFlag(EquipmentSlot.Armor)) { isEmpty &= IsSlotEmpty(EquipmentSlot.Armor); } if (slot.HasFlag(EquipmentSlot.Belt)) { isEmpty &= IsSlotEmpty(EquipmentSlot.Belt); } if (slot.HasFlag(EquipmentSlot.Boots)) { isEmpty &= IsSlotEmpty(EquipmentSlot.Boots); } if (slot.HasFlag(EquipmentSlot.Earring)) { isEmpty &= IsSlotEmpty(EquipmentSlot.Earring); } if (slot.HasFlag(EquipmentSlot.Greaves)) { isEmpty &= IsSlotEmpty(EquipmentSlot.Greaves); } if (slot.HasFlag(EquipmentSlot.Hat)) { isEmpty &= IsSlotEmpty(EquipmentSlot.Hat); } if (slot.HasFlag(EquipmentSlot.Helmet)) { isEmpty &= IsSlotEmpty(EquipmentSlot.Helmet); } if (slot.HasFlag(EquipmentSlot.LeftGauntlet)) { isEmpty &= IsSlotEmpty(EquipmentSlot.LeftGauntlet); } if (slot.HasFlag(EquipmentSlot.LeftRing)) { isEmpty &= IsSlotEmpty(EquipmentSlot.LeftRing); } if (slot.HasFlag(EquipmentSlot.Necklace)) { isEmpty &= IsSlotEmpty(EquipmentSlot.Necklace); } if (slot.HasFlag(EquipmentSlot.Overcoat)) { isEmpty &= IsSlotEmpty(EquipmentSlot.Overcoat); } if (slot.HasFlag(EquipmentSlot.RightGauntlet)) { isEmpty &= IsSlotEmpty(EquipmentSlot.RightGauntlet); } if (slot.HasFlag(EquipmentSlot.RightRing)) { isEmpty &= IsSlotEmpty(EquipmentSlot.RightRing); } if (slot.HasFlag(EquipmentSlot.Shield)) { isEmpty &= IsSlotEmpty(EquipmentSlot.Shield); } if (slot.HasFlag(EquipmentSlot.Weapon)) { isEmpty &= IsSlotEmpty(EquipmentSlot.Weapon); } return(isEmpty); }
public EquippableComponentState(EquipmentSlot wearLocation, int?holder) : base(ComponentFamily.Equippable) { WearLocation = wearLocation; Holder = holder; }
public InventoryItem GetSlot(EquipmentSlot slot) { return(equipment[(int)slot]); }
public void UnEquip(Item item, EquipmentSlot slot) { slot.Item = null; ItemUnEquipped.Raise(); }
public bool IsEquipped(string itemName, EquipmentSlot slot) { itemName = itemName.Trim(); var isEquipped = true; if (slot.HasFlag(EquipmentSlot.Accessory1)) { isEquipped &= string.Equals(itemName, GetSlot(EquipmentSlot.Accessory1).Name, StringComparison.OrdinalIgnoreCase); } if (slot.HasFlag(EquipmentSlot.Accessory2)) { isEquipped &= string.Equals(itemName, GetSlot(EquipmentSlot.Accessory2).Name, StringComparison.OrdinalIgnoreCase); } if (slot.HasFlag(EquipmentSlot.Accessory3)) { isEquipped &= string.Equals(itemName, GetSlot(EquipmentSlot.Accessory3).Name, StringComparison.OrdinalIgnoreCase); } if (slot.HasFlag(EquipmentSlot.Armor)) { isEquipped &= string.Equals(itemName, GetSlot(EquipmentSlot.Armor).Name, StringComparison.OrdinalIgnoreCase); } if (slot.HasFlag(EquipmentSlot.Belt)) { isEquipped &= string.Equals(itemName, GetSlot(EquipmentSlot.Belt).Name, StringComparison.OrdinalIgnoreCase); } if (slot.HasFlag(EquipmentSlot.Boots)) { isEquipped &= string.Equals(itemName, GetSlot(EquipmentSlot.Boots).Name, StringComparison.OrdinalIgnoreCase); } if (slot.HasFlag(EquipmentSlot.Earring)) { isEquipped &= string.Equals(itemName, GetSlot(EquipmentSlot.Earring).Name, StringComparison.OrdinalIgnoreCase); } if (slot.HasFlag(EquipmentSlot.Greaves)) { isEquipped &= string.Equals(itemName, GetSlot(EquipmentSlot.Greaves).Name, StringComparison.OrdinalIgnoreCase); } if (slot.HasFlag(EquipmentSlot.Hat)) { isEquipped &= string.Equals(itemName, GetSlot(EquipmentSlot.Hat).Name, StringComparison.OrdinalIgnoreCase); } if (slot.HasFlag(EquipmentSlot.Helmet)) { isEquipped &= string.Equals(itemName, GetSlot(EquipmentSlot.Helmet).Name, StringComparison.OrdinalIgnoreCase); } if (slot.HasFlag(EquipmentSlot.LeftGauntlet)) { isEquipped &= string.Equals(itemName, GetSlot(EquipmentSlot.LeftGauntlet).Name, StringComparison.OrdinalIgnoreCase); } if (slot.HasFlag(EquipmentSlot.LeftRing)) { isEquipped &= string.Equals(itemName, GetSlot(EquipmentSlot.LeftRing).Name, StringComparison.OrdinalIgnoreCase); } if (slot.HasFlag(EquipmentSlot.Necklace)) { isEquipped &= string.Equals(itemName, GetSlot(EquipmentSlot.Necklace).Name, StringComparison.OrdinalIgnoreCase); } if (slot.HasFlag(EquipmentSlot.Overcoat)) { isEquipped &= string.Equals(itemName, GetSlot(EquipmentSlot.Overcoat).Name, StringComparison.OrdinalIgnoreCase); } if (slot.HasFlag(EquipmentSlot.RightGauntlet)) { isEquipped &= string.Equals(itemName, GetSlot(EquipmentSlot.RightGauntlet).Name, StringComparison.OrdinalIgnoreCase); } if (slot.HasFlag(EquipmentSlot.RightRing)) { isEquipped &= string.Equals(itemName, GetSlot(EquipmentSlot.RightRing).Name, StringComparison.OrdinalIgnoreCase); } if (slot.HasFlag(EquipmentSlot.Shield)) { isEquipped &= string.Equals(itemName, GetSlot(EquipmentSlot.Shield).Name, StringComparison.OrdinalIgnoreCase); } if (slot.HasFlag(EquipmentSlot.Weapon)) { isEquipped &= string.Equals(itemName, GetSlot(EquipmentSlot.Weapon).Name, StringComparison.OrdinalIgnoreCase); } return(isEquipped); }
private static EquipmentSlot[][] GetEqByInv() { EquipmentSlot[][] equipmentSlotArray = new EquipmentSlot[(int)(1 + Utility.GetMaxEnum <InventorySlotType>())][]; equipmentSlotArray[18] = ItemMgr.AllBagSlots; equipmentSlotArray[4] = new EquipmentSlot[1] { EquipmentSlot.Shirt }; equipmentSlotArray[5] = new EquipmentSlot[1] { EquipmentSlot.Chest }; equipmentSlotArray[16] = new EquipmentSlot[1] { EquipmentSlot.Back }; equipmentSlotArray[8] = new EquipmentSlot[1] { EquipmentSlot.Boots }; equipmentSlotArray[11] = new EquipmentSlot[2] { EquipmentSlot.Finger1, EquipmentSlot.Finger2 }; equipmentSlotArray[10] = new EquipmentSlot[1] { EquipmentSlot.Gloves }; equipmentSlotArray[1] = new EquipmentSlot[1]; equipmentSlotArray[23] = new EquipmentSlot[1] { EquipmentSlot.OffHand }; equipmentSlotArray[7] = new EquipmentSlot[1] { EquipmentSlot.Pants }; equipmentSlotArray[2] = new EquipmentSlot[1] { EquipmentSlot.Neck }; equipmentSlotArray[27] = ItemMgr.AllBagSlots; equipmentSlotArray[15] = new EquipmentSlot[1] { EquipmentSlot.ExtraWeapon }; equipmentSlotArray[26] = new EquipmentSlot[1] { EquipmentSlot.ExtraWeapon }; equipmentSlotArray[28] = new EquipmentSlot[1] { EquipmentSlot.ExtraWeapon }; equipmentSlotArray[20] = new EquipmentSlot[1] { EquipmentSlot.Chest }; equipmentSlotArray[14] = new EquipmentSlot[1] { EquipmentSlot.OffHand }; equipmentSlotArray[3] = new EquipmentSlot[1] { EquipmentSlot.Shoulders }; equipmentSlotArray[19] = new EquipmentSlot[1] { EquipmentSlot.Tabard }; equipmentSlotArray[25] = new EquipmentSlot[1] { EquipmentSlot.ExtraWeapon }; equipmentSlotArray[12] = new EquipmentSlot[2] { EquipmentSlot.Trinket1, EquipmentSlot.Trinket2 }; equipmentSlotArray[17] = new EquipmentSlot[1] { EquipmentSlot.MainHand }; equipmentSlotArray[6] = new EquipmentSlot[1] { EquipmentSlot.Belt }; equipmentSlotArray[13] = new EquipmentSlot[2] { EquipmentSlot.MainHand, EquipmentSlot.OffHand }; equipmentSlotArray[21] = new EquipmentSlot[1] { EquipmentSlot.MainHand }; equipmentSlotArray[22] = new EquipmentSlot[1] { EquipmentSlot.OffHand }; equipmentSlotArray[9] = new EquipmentSlot[1] { EquipmentSlot.Wrist }; equipmentSlotArray[24] = (EquipmentSlot[])null; return(equipmentSlotArray); }
private void UnEquipItem(EquipmentSlot part) { EquippedEntities.Remove(part); }
public Clothing(EquipmentSlot slot) { _slot = slot; }
protected override bool PerformEquipmentAction(EquipmentSlot slot) { return(true); }
/// <summary> /// Create the piece of equipment /// </summary> /// <param name="name">Name of the equipment</param> /// <param name="stats">The stats added by the piece of equipment</param> /// <param name="slots">Slots the equipment takes up</param> public Equipment(string name, /*Stats stats,*/ EquipmentSlot[] slots) : base(name) { Initialize(new Stats(this/*, stats*/), slots); }
/// <summary> /// When overridden in the derived class, notifies the owner of this object instance /// that an equipment slot has changed. /// </summary> /// <param name="slot">The slot that changed.</param> /// <param name="graphicIndex">The new graphic index of the slot.</param> protected virtual void SendSlotUpdate(EquipmentSlot slot, GrhIndex?graphicIndex) { }
public ServerEquipmentUpdatePacket(Equipment equipment, EquipmentSlot slot) { Equipment = equipment; Slot = slot; }
static public bool IsAnythingEquipped(EquipmentSlot slot) => slot != null && slot.HasItemEquipped;
/// <summary> /// Checks if the given slot is occupied and -if so- puts the item from that slot into a free /// storage slot (within the backpack or any equipped bags). /// </summary> /// <returns>whether the given slot is now empty</returns> public bool EnsureEmpty(EquipmentSlot slot) { var item = this[slot]; if (item == null) { return true; } var newSlotId = FindFreeSlot(item, item.Amount); if (newSlotId.Slot == INVALID_SLOT) { // no space left return false; } SwapUnchecked(this, (int)slot, newSlotId.Container, newSlotId.Slot); return true; }
static public bool IsNotLeftHandUsedBy2H(EquipmentSlot slot) => !(slot.SlotType == EquipmentSlot.EquipmentSlotIDs.LeftHand && slot.EquippedItem.TwoHanded);
/// <summary> /// For all things that depend on info of all spells from first Init-round and other things /// </summary> internal void Init2() { if (inited) { return; } inited = true; IsChanneled = AttributesEx.HasAnyFlag(SpellAttributesEx.Channeled_1 | SpellAttributesEx.Channeled_2) || // don't use Enum.HasFlag! ChannelInterruptFlags > 0; IsPassive = (!IsChanneled && Attributes.HasFlag(SpellAttributes.Passive)) || // tracking spells are also passive HasEffectWith(effect => effect.AuraType == AuraType.TrackCreatures) || HasEffectWith(effect => effect.AuraType == AuraType.TrackResources) || HasEffectWith(effect => effect.AuraType == AuraType.TrackStealthed); foreach (var effect in Effects) { effect.Init2(); if (effect.IsHealEffect) { IsHealSpell = true; } if (effect.EffectType == SpellEffectType.NormalizedWeaponDamagePlus) { IsDualWieldAbility = true; } } InitAura(); if (IsChanneled) { if (Durations.Min == 0) { Durations.Min = Durations.Max = 1000; } foreach (var effect in Effects) { if (effect.IsPeriodic) { ChannelAmplitude = effect.Amplitude; break; } } } IsOnNextStrike = Attributes.HasAnyFlag(SpellAttributes.OnNextMelee | SpellAttributes.OnNextMelee_2); // don't use Enum.HasFlag! IsRangedAbility = !IsTriggeredSpell && (Attributes.HasAnyFlag(SpellAttributes.Ranged) || AttributesExC.HasFlag(SpellAttributesExC.ShootRangedWeapon)); IsStrikeSpell = HasEffectWith(effect => effect.IsStrikeEffect); IsWeaponAbility = IsRangedAbility || IsOnNextStrike || IsStrikeSpell; DamageIncreasedByAP = DamageIncreasedByAP || (PowerType == PowerType.Rage && SchoolMask == DamageSchoolMask.Physical); IsFinishingMove = AttributesEx.HasAnyFlag(SpellAttributesEx.FinishingMove) || HasEffectWith(effect => effect.PointsPerComboPoint > 0 && effect.EffectType != SpellEffectType.Dummy); TotemEffect = GetFirstEffectWith(effect => effect.HasTarget( ImplicitTargetType.TotemAir, ImplicitTargetType.TotemEarth, ImplicitTargetType.TotemFire, ImplicitTargetType.TotemWater)); // Required Item slot for weapon abilities if (RequiredItemClass == ItemClass.Armor && RequiredItemSubClassMask == ItemSubClassMask.Shield) { EquipmentSlot = EquipmentSlot.OffHand; } else { EquipmentSlot = (IsRangedAbility || AttributesExC.HasFlag(SpellAttributesExC.RequiresWand)) ? EquipmentSlot.ExtraWeapon : (AttributesExC.HasFlag(SpellAttributesExC.RequiresOffHandWeapon) ? EquipmentSlot.OffHand : (AttributesExC.HasFlag(SpellAttributesExC.RequiresMainHandWeapon) ? EquipmentSlot.MainHand : EquipmentSlot.End)); } HasIndividualCooldown = CooldownTime > 0 || (IsWeaponAbility && !IsOnNextStrike && EquipmentSlot != EquipmentSlot.End); //IsAoe = HasEffectWith((effect) => { // if (effect.ImplicitTargetA == ImplicitTargetType.) // effect.ImplicitTargetA = ImplicitTargetType.None; // if (effect.ImplicitTargetB == ImplicitTargetType.Unused_EnemiesInAreaChanneledWithExceptions) // effect.ImplicitTargetB = ImplicitTargetType.None; // return false; //}); var profEffect = GetEffect(SpellEffectType.SkillStep); if (profEffect != null) { TeachesApprenticeAbility = profEffect.BasePoints == 0; } IsProfession = !IsRangedAbility && Ability != null && Ability.Skill.Category == SkillCategory.Profession; IsEnhancer = SpellClassSet != 0 && !SpellClassMask.Contains(val => val != 0) && HasEffectWith(effect => effect.AffectMask.Contains(val => val != 0)); IsFishing = HasEffectWith(effect => effect.HasTarget(ImplicitTargetType.SelfFishing)); IsSkinning = HasEffectWith(effect => effect.EffectType == SpellEffectType.Skinning); IsTameEffect = HasEffectWith(effect => effect.EffectType == SpellEffectType.TameCreature); if (Id == 18425) { ToString(); } if (IsPreventionDebuff || Mechanic.IsNegative()) { HasHarmfulEffects = true; HasBeneficialEffects = false; HarmType = HarmType.Harmful; } else { HasHarmfulEffects = HasEffectWith(effect => effect.HarmType == HarmType.Harmful); HasBeneficialEffects = HasEffectWith(effect => effect.HarmType == HarmType.Beneficial); if (HasHarmfulEffects != HasBeneficialEffects && !HasEffectWith(effect => effect.HarmType == HarmType.Neutral)) { HarmType = HasHarmfulEffects ? HarmType.Harmful : HarmType.Beneficial; } else { HarmType = HarmType.Neutral; } } ReqDeadTarget = TargetFlags.HasAnyFlag(SpellTargetFlags.Corpse | SpellTargetFlags.PvPCorpse | SpellTargetFlags.UnitCorpse); CostsMana = PowerCost > 0 || PowerCostPercentage > 0; HasTargets = !HasEffectWith(effect => effect.HasTargets); CasterIsTarget = HasTargets && HasEffectWith(effect => effect.HasTarget(ImplicitTargetType.Self)); //HasSingleNotSelfTarget = IsAreaSpell = HasEffectWith(effect => effect.IsAreaEffect); IsDamageSpell = HasHarmfulEffects && !HasBeneficialEffects && HasEffectWith(effect => effect.EffectType == SpellEffectType.Attack || effect.EffectType == SpellEffectType.EnvironmentalDamage || effect.EffectType == SpellEffectType.InstantKill || effect.EffectType == SpellEffectType.SchoolDamage || effect.IsStrikeEffect); if (DamageMultipliers[0] <= 0) { DamageMultipliers[0] = 1; } IsHearthStoneSpell = HasEffectWith(effect => effect.HasTarget(ImplicitTargetType.HeartstoneLocation)); ForeachEffect(effect => { if (effect.EffectType == SpellEffectType.Skill) { SkillId = (SkillId)effect.MiscValue; } }); Schools = Utility.GetSetIndices<DamageSchool>((uint)SchoolMask); if (Schools.Length == 0) { Schools = new[] { DamageSchool.Physical }; } RequiresCasterOutOfCombat = !HasHarmfulEffects && CastDelay > 0 && (Attributes.HasFlag(SpellAttributes.CannotBeCastInCombat) || AttributesEx.HasFlag(SpellAttributesEx.RemainOutOfCombat) || AuraInterruptFlags.HasFlag(AuraInterruptFlags.OnStartAttack)); if (RequiresCasterOutOfCombat) { // We fail if being attacked (among others) InterruptFlags |= InterruptFlags.OnTakeDamage; } IsThrow = AttributesExC.HasFlag(SpellAttributesExC.ShootRangedWeapon) && Attributes.HasFlag(SpellAttributes.Ranged) && Ability != null && Ability.Skill.Id == SkillId.Thrown; HasModifierEffects = HasEffectWith(effect => effect.AuraType == AuraType.AddModifierFlat || effect.AuraType == AuraType.AddModifierPercent); ForeachEffect(effect => { for (var i = 0; i < 3; i++) { AllAffectingMasks[i] |= effect.AffectMask[i]; } }); if (Range.MaxDist == 0) { Range.MaxDist = 5; } if (RequiredToolIds == null) { RequiredToolIds = new uint[0]; } else { if (RequiredToolIds.Length > 0 && (RequiredToolIds[0] > 0 || RequiredToolIds[1] > 0)) { SpellHandler.SpellsRequiringTools.Add(this); } ArrayUtil.PruneVals(ref RequiredToolIds); } ArrayUtil.PruneVals(ref RequiredTotemCategories); ForeachEffect(effect => { if (effect.SpellEffectHandlerCreator != null) { EffectHandlerCount++; } }); //IsHealSpell = HasEffectWith((effect) => effect.IsHealEffect); }
public bool ValidSlot(EquipmentSlot e) { return(validSlots.Contains(e)); }
/// <summary> /// Initializes a new instance of the <see cref="CharacterEquippedTable"/> class. /// </summary> /// <param name="characterID">The initial value for the corresponding property.</param> /// <param name="itemID">The initial value for the corresponding property.</param> /// <param name="slot">The initial value for the corresponding property.</param> public CharacterEquippedTable(CharacterID @characterID, ItemID @itemID, EquipmentSlot @slot) { CharacterID = @characterID; ItemID = @itemID; Slot = @slot; }
public void AddSlot(EquipmentSlot slot) { validSlots.Add(slot); }